1. get all bookings - useBookings
The useBookings hook returns an array of bookings that belong to the user whose access token is passed to <CalProvider>. You can filter bookings by status, event type id, attendee email etc. - see this class for filters you can pass to the hook.
Below code snippet shows how to use the useBookings hook to fetch bookings for a specific user using take, skip and status filters:
2. get specific booking - useBooking
The useBooking hook returns detailed information about a single booking. Simply provide the booking’s unique identifier (bookingUid) as a parameter to fetch its associated data.
Below code snippet shows how to use the useBooking hook to fetch a specific booking for a user.
3. cancel booking - useCancelBooking
The useCancelBooking hook allows you to cancel a booking. This hook returns a mutation function that handles the cancellation process. To cancel a booking, you’ll need to provide at least the booking’s unique identifier (uid). While the uid is the only mandatory parameter, you can enhance the cancellation process by including optional parameters such as cancellationReason to specify why the booking is being canceled, and allRemainingBookings to specify whether to cancel all future recurring bookings.
Below code snippet shows how to use the useCancelBooking hook to cancel a booking for a user.
4. get all bookings of a user as an organization admin - useOrganizationUserBookings
The useBookings hooks returns bookings of user associated with the access token passed to the <CalProvider>, but this hook
allows organization admins to fetch bookings of any organization member.
The access token passed to the <CalProvider> must belong
to a managed user who is an organization admin. That means you have to create a managed user and then add an accepted membership with an admin or owner role by making a request to the organizations memberships endpoint. Example body:
5. get all organization bookings as an organization admin - useOrganizationBookings
The useBookings hooks returns bookings of user associated with the access token passed to the <CalProvider>, but this hook
allows organization admins to fetch bookings of the whole organization.
The access token passed to the <CalProvider> must belong
to a managed user who is an organization admin. That means you have to create a managed user and then add an accepted membership with an admin or owner role by making a request to the organizations memberships endpoint. Example body:
Previous: Troubleshooter
Debug availability issues
Next: Event Types Hooks
Hooks for event types