### Install Bookwhen PHP SDK with Composer Source: https://github.com/inshore/bookwhen/blob/develop/README.md Install the Bookwhen PHP API SDK using Composer. Ensure you have PHP 8.3 or later. ```bash $ composer require inshore/bookwhen ``` -------------------------------- ### Fetch All Attachments Source: https://github.com/inshore/bookwhen/blob/develop/README.md Fetch all attachments accessible by the API token. This method corresponds to the GET /attachments endpoint. ```php // Fetch attachments accessible by the API token. $attachments = $bookwhen->attachments(); ``` -------------------------------- ### Run PHPUnit Tests Source: https://github.com/inshore/bookwhen/blob/develop/README.md Execute automated tests for the package using Composer and PHPUnit. Ensure you have PHPUnit installed via Composer. ```bash $ composer phpunit ``` -------------------------------- ### Get Specific Location by ID Source: https://github.com/inshore/bookwhen/blob/develop/README.md Retrieve a specific location using its ID. ```php // Returns the location for the provided location ID. $location = $bookwhen->location('ev-smij-20200530100000'); ``` -------------------------------- ### Fetch All Class Passes Source: https://github.com/inshore/bookwhen/blob/develop/README.md Fetch all class passes accessible by the API token. This method corresponds to the GET /class_passes endpoint. ```php // Fetch class passes accessible by the API token. $classPasses = $bookwhen->classPasses(); ``` -------------------------------- ### Get All Events Source: https://github.com/inshore/bookwhen/blob/develop/README.md Fetch all events accessible by the API token. This method can be filtered by various parameters like calendar, entry, location, tag, title, detail, from, to, and compact. ```php // Returns the event for the provided event ID. $event = $bookwhen->events(); ``` ```php // Returns the event for the provided event ID. $event = $bookwhen->events(title: ['Title to filter by']); ``` ```php // Fetch events accessible by the API token. $events = $bookwhen->events(); ``` ```php // Fetch events accessible by the API token. $events = $bookwhen->events(includeLocation: true, includeTickets: true); ``` -------------------------------- ### Get All Locations Source: https://github.com/inshore/bookwhen/blob/develop/README.md Fetch all locations accessible by the API token. This method can be filtered by address text or additional information. ```php // Fetch events accessible by the API token. $locations = $bookwhen->locations(); // Returns the location for the provided location ID. ``` ```php // Fetch events accessible by the API token. $locations = $bookwhen->locations(addressText: 'Remote')); // Returns the location for the provided location ID. ``` -------------------------------- ### Get Locations Source: https://github.com/inshore/bookwhen/blob/develop/README.md Fetches a list of locations accessible by the API token. Supports filtering by address text and additional information. ```APIDOC ## GET /locations ### Description Fetches a list of locations accessible by the API token. Supports filtering. ### Method GET ### Endpoint /locations ### Parameters #### Query Parameters - **addressText** (string) - Restrict to locations containing the address text filter. - **additionalInfo** (string) - Filter by the text contained in the additional info. ### Request Example ```php $locations = $bookwhen->locations(); $locations = $bookwhen->locations(addressText: 'Remote'); ``` ### Response #### Success Response (200) - (object) - Location details ``` -------------------------------- ### Get Location by ID Source: https://github.com/inshore/bookwhen/blob/develop/README.md Retrieves a specific location using its unique ID. ```APIDOC ## GET /locations/{location_id} ### Description Retrieves a specific location using its unique ID. ### Method GET ### Endpoint /locations/{location_id} ### Parameters #### Path Parameters - **location_id** (string) - The unique identifier of the location. ### Request Example ```php $location = $bookwhen->location('ev-smij-20200530100000'); ``` ### Response #### Success Response (200) - (object) - Location details ``` -------------------------------- ### Get Specific Event by ID Source: https://github.com/inshore/bookwhen/blob/develop/README.md Retrieve a specific event using its ID. You can include related data such as location and tickets by setting the corresponding include parameters to true. ```php // Returns the event for the provided event ID. $event = $bookwhen->event('ev-smij-20200530100000'); ``` ```php // Returns the event for the provided event ID. $event = $bookwhen->event(eventId: 'ev-smij-20200530100000', includeLocation: true, includeTickets: true); ``` -------------------------------- ### Fetch Single Class Pass by ID Source: https://github.com/inshore/bookwhen/blob/develop/README.md Retrieve a specific class pass using its unique ID. This corresponds to the GET /class_passes/{class_pass_id} endpoint. ```php // Returns the class pass for the provided class pass ID. $classPass = $bookwhen->classPass('ev-smij-20200530100000'); ``` -------------------------------- ### Fetch Single Attachment by ID Source: https://github.com/inshore/bookwhen/blob/develop/README.md Retrieve a specific attachment using its unique ID. This corresponds to the GET /attachments/{attachment_id} endpoint. ```php // Returns the attachment for the provided attachment ID. $attachment = $bookwhen->attachment('ev-smij-20200530100000' ); ``` -------------------------------- ### Get Events Source: https://github.com/inshore/bookwhen/blob/develop/README.md Fetches a list of events accessible by the API token. Supports filtering by calendar, entry, location, tag, title, detail, date range, and compact view. Can also include related data like attachments, location, and tickets. ```APIDOC ## GET /events ### Description Fetches a list of events accessible by the API token. Supports filtering by various criteria and including related data. ### Method GET ### Endpoint /events ### Parameters #### Query Parameters - **calendar** (string) - Restrict to events on the given calendars (schedule pages). - **entry** (string) - Restrict to given entries. - **location** (array) - Array of location slugs to include. - **tag** (array) - Array of tag words to include. - **title** (array) - Array of entry titles to search for. - **detail** (array) - Array of entry details to search for. - **from** (string) - Inclusive time to fetch events from in format YYYYMMDD or YYYYMMDDHHMISS. Defaults to today. - **to** (string) - Non-inclusive time to fetch events until in format YYYYMMDD or YYYYMMDDHHMISS. - **compact** (boolean) - Combine events in a course into a single virtual event. - **includeAttachments** (boolean) - Include event attachments. - **includeLocation** (boolean) - Include event location. - **includeTickets** (boolean) - Include event tickets. - **includeTickets.class_passes** (boolean) - Include class passes for tickets. - **includeTickets.events** (boolean) - Include events for tickets. ### Request Example ```php $events = $bookwhen->events(includeLocation: true, includeTickets: true); $events = $bookwhen->events(title: ['Title to filter by']); ``` ### Response #### Success Response (200) - (object) - Event details ``` -------------------------------- ### Get Event by ID Source: https://github.com/inshore/bookwhen/blob/develop/README.md Retrieves a specific event using its unique ID. Can include related data such as attachments, location, and tickets. ```APIDOC ## GET /events/{event_id} ### Description Retrieves a specific event using its unique ID. Can optionally include related data. ### Method GET ### Endpoint /events/{event_id} ### Parameters #### Path Parameters - **event_id** (string) - The unique identifier of the event. #### Query Parameters - **includeAttachments** (boolean) - Include event attachments. - **includeLocation** (boolean) - Include event location. - **includeTickets** (boolean) - Include event tickets. - **includeTickets.class_passes** (boolean) - Include class passes for tickets. - **includeTickets.events** (boolean) - Include events for tickets. ### Request Example ```php $event = $bookwhen->event('ev-smij-20200530100000'); $event = $bookwhen->event(eventId: 'ev-smij-20200530100000', includeLocation: true, includeTickets: true); ``` ### Response #### Success Response (200) - (object) - Event details ``` -------------------------------- ### Initialize Bookwhen SDK Source: https://github.com/inshore/bookwhen/blob/develop/README.md Initialize the Bookwhen SDK. Ensure your Bookwhen API key is exposed as the INSHORE_BOOKWHEN_API_KEY environment variable. ```php $bookwhen = new Bookwhen(); ``` -------------------------------- ### Enable Debug Logging in Bookwhen Client Source: https://github.com/inshore/bookwhen/blob/develop/README.md Instantiate the Bookwhen client with debug logging enabled by passing the 'debug' level. This provides detailed debugging information. ```php $bookwhen = new Bookwhen()->debug('Debug'); ``` -------------------------------- ### Instantiating Location with Named Arguments Source: https://github.com/inshore/bookwhen/blob/develop/CHANGELOG.md When instantiating the `Location` class directly, use named arguments for compatibility due to a changed parameter order. This ensures required parameters come first, followed by optional ones. ```php new Location(id: $id, addressText: $addr, additionalInfo: $info, ...) ``` -------------------------------- ### Fetch Attachments with Filters Source: https://github.com/inshore/bookwhen/blob/develop/README.md Fetch attachments accessible by the API token, applying filters for title, file name, or file type. Multiple filters can be combined. ```php // Fetch attachments accessible by the API token. $attachments = $bookwhen->attachments(fileName: 'CV')); $attachments = $bookwhen->attachments(fileType: 'pdf')); $attachments = $bookwhen->attachments(title: 'Title to filter by')); $attachments = $bookwhen->attachments(fileName: 'CV', fileType: 'pdf', title: 'Title to filter by')); ``` -------------------------------- ### Retrieve a Single Ticket with Included Data Source: https://github.com/inshore/bookwhen/blob/develop/README.md Fetch a specific ticket and include associated data like events and attachments by setting the relevant `include` parameters to `true`. This provides a more complete view of the ticket's context. ```php // Retrieve a single ticket. $client->ticket('ti-sboe-20200320100000-tk1m', includeEventsAttachments: true); ``` -------------------------------- ### Fetch Tickets with Included Data Source: https://github.com/inshore/bookwhen/blob/develop/README.md To include related data such as attachments or event details when fetching tickets, pass `true` for the desired include parameters. This is useful when you need more comprehensive ticket information in a single request. ```php // Fetch tickets for the given event. $eventId = 'ev-smij-20200530100000'; $client->tickets($eventId, includeAttachments: true); ``` -------------------------------- ### Fetch Class Passes with Filters Source: https://github.com/inshore/bookwhen/blob/develop/README.md Fetch class passes accessible by the API token, applying filters for title, details, usage type, cost, usage allowance, or days restriction. Comparison operators can be used for numeric filters. ```php // Fetch class passes accessible by the API token. $classPasses = $bookwhen->classPasses(); $classPasses = $bookwhen->classPasses(title: 'Title to filter by')); ``` -------------------------------- ### Attachments Source: https://github.com/inshore/bookwhen/blob/develop/README.md Fetches attachments accessible by the API token. Supports filtering by title, file name, and file type. ```APIDOC ## Attachments ### Description Fetches attachments accessible by the API token. Supports filtering by title, file name, and file type. ### Method GET ### Endpoint /attachments ### Parameters #### Query Parameters - **title** (string) - Optional - Filter on the file title text. - **fileName** (string) - Optional - Filter on the file name. - **fileType** (string) - Optional - Filter on the file type. ### Request Example ```php $attachments = $bookwhen->attachments(fileName: 'CV', fileType: 'pdf', title: 'Title to filter by'); ``` ### Response #### Success Response (200) - **attachments** (array) - A list of attachment objects. ``` -------------------------------- ### Fetch All Tickets for an Event Source: https://github.com/inshore/bookwhen/blob/develop/README.md Use this method to retrieve all tickets associated with a specific event. By default, related data like attachments and event details are not included. ```php // Fetch tickets for the given event. $eventId = 'ev-smij-20200530100000'; $client->tickets($eventId); ``` -------------------------------- ### Class Passes Source: https://github.com/inshore/bookwhen/blob/develop/README.md Fetches class passes accessible by the API token. Supports filtering by title, details, usage type, cost, usage allowance, and days restriction. ```APIDOC ## Class Passes ### Description Fetches class passes accessible by the API token. Supports filtering by title, details, usage type, cost, usage allowance, and days restriction. ### Method GET ### Endpoint /class_passes ### Parameters #### Query Parameters - **title** (string) - Optional - Filter on the title text of the pass. - **detail** (string) - Optional - Filter on the details text. - **usageType** (string) - Optional - Filter on the type of the pass: personal or any. - **cost** (object) - Optional - Filter on the cost with an exact value or use a comparison operator (gt, gte, lt, lte, eq). - **usageAllowance** (object) - Optional - Filter on pass usage allowance. Accepts comparison operators. - **useRestrictedForDays** (object) - Optional - Filter on pass days restriction. Accepts comparison operators. ### Request Example ```php $classPasses = $bookwhen->classPasses(title: 'Title to filter by'); ``` ### Response #### Success Response (200) - **classPasses** (array) - A list of class pass objects. ``` -------------------------------- ### Fetch tickets for an event Source: https://github.com/inshore/bookwhen/blob/develop/README.md Retrieves a list of tickets associated with a specific event. You can optionally include related data such as attachments, event details, and location information by passing true for the desired include parameters. ```APIDOC ## GET /tickets ### Description Fetches tickets for a given event. Supports including related data like attachments, events, and location. ### Method GET ### Endpoint /tickets ### Parameters #### Query Parameters - **eventId** (string) - Required - The ID of the event to fetch tickets for. - **includeAttachments** (boolean) - Optional - Whether to include attachments. - **includeLocation** (boolean) - Optional - Whether to include location data. - **includeTickets.class_passes** (boolean) - Optional - Whether to include class pass information for tickets. - **includeTickets.events** (boolean) - Optional - Whether to include event details for tickets. ### Request Example ```php // Fetch tickets for the given event. $eventId = 'ev-smij-20200530100000'; $client->tickets($eventId, includeAttachments: true); ``` ### Response #### Success Response (200) - **tickets** (array) - A list of ticket objects. - **attachments** (array) - Included attachments if requested. - **location** (object) - Included location data if requested. - **class_passes** (array) - Included class pass information if requested. - **events** (object) - Included event details if requested. #### Response Example ```json { "tickets": [ { "id": "ti-sboe-20200320100000-tk1m", "eventId": "ev-smij-20200530100000" } ], "attachments": [], "location": {}, "class_passes": [], "events": {} } ``` ``` -------------------------------- ### Retrieve a single ticket Source: https://github.com/inshore/bookwhen/blob/develop/README.md Retrieves details for a specific ticket using its ID. Similar to fetching multiple tickets, you can include related data by setting the appropriate include parameters to true. ```APIDOC ## GET /tickets/{ticket_id} ### Description Retrieves a single ticket by its ID. Supports including related data like attachments and events. ### Method GET ### Endpoint /tickets/{ticket_id} ### Parameters #### Path Parameters - **ticket_id** (string) - Required - The ID of the ticket to retrieve. #### Query Parameters - **includeEventsAttachments** (boolean) - Optional - Whether to include attachments and event details. ### Request Example ```php // Retrieve a single ticket. $ticketId = 'ti-sboe-20200320100000-tk1m'; $client->ticket($ticketId, includeEventsAttachments: true); ``` ### Response #### Success Response (200) - **ticket** (object) - The ticket object. - **attachments** (array) - Included attachments if requested. - **events** (object) - Included event details if requested. #### Response Example ```json { "ticket": { "id": "ti-sboe-20200320100000-tk1m", "eventId": "ev-smij-20200530100000" }, "attachments": [], "events": {} } ``` ``` -------------------------------- ### Attachment by ID Source: https://github.com/inshore/bookwhen/blob/develop/README.md Retrieves a specific attachment using its unique ID. ```APIDOC ## Attachment by ID ### Description Retrieves a specific attachment using its unique ID. ### Method GET ### Endpoint /attachments/{attachment_id} ### Parameters #### Path Parameters - **attachment_id** (string) - Required - The ID of the attachment to retrieve. ### Request Example ```php $attachment = $bookwhen->attachment('ev-smij-20200530100000'); ``` ### Response #### Success Response (200) - **attachment** (object) - The attachment object. ``` -------------------------------- ### Class Pass by ID Source: https://github.com/inshore/bookwhen/blob/develop/README.md Retrieves a specific class pass using its unique ID. ```APIDOC ## Class Pass by ID ### Description Retrieves a specific class pass using its unique ID. ### Method GET ### Endpoint /class_passes/{class_pass_id} ### Parameters #### Path Parameters - **class_pass_id** (string) - Required - The ID of the class pass to retrieve. ### Request Example ```php $classPass = $bookwhen->classPass('ev-smij-20200530100000'); ``` ### Response #### Success Response (200) - **classPass** (object) - The class pass object. ``` -------------------------------- ### Retrieve a Single Ticket Source: https://github.com/inshore/bookwhen/blob/develop/README.md This method retrieves details for a specific ticket using its unique ID. Similar to fetching multiple tickets, related data is not included by default. ```php // Retrieve a single ticket. $ticketId = 'ti-sboe-20200320100000-tk1m'; $client->ticket($ticketId); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.