import { ApiResponse , RequestOptions } from '../core' ; import { CancelBookingRequest , cancelBookingRequestSchema , } from '../models/cancelBookingRequest' ; import { CancelBookingResponse , cancelBookingResponseSchema , } from '../models/cancelBookingResponse' ; import { CreateBookingRequest , createBookingRequestSchema , } from '../models/createBookingRequest' ; import { CreateBookingResponse , createBookingResponseSchema , } from '../models/createBookingResponse' ; import { ListBookingsResponse , listBookingsResponseSchema , } from '../models/listBookingsResponse' ; import { ListTeamMemberBookingProfilesResponse , listTeamMemberBookingProfilesResponseSchema , } from '../models/listTeamMemberBookingProfilesResponse' ; import { RetrieveBookingResponse , retrieveBookingResponseSchema , } from '../models/retrieveBookingResponse' ; import { RetrieveBusinessBookingProfileResponse , retrieveBusinessBookingProfileResponseSchema , } from '../models/retrieveBusinessBookingProfileResponse' ; import { RetrieveTeamMemberBookingProfileResponse , retrieveTeamMemberBookingProfileResponseSchema , } from '../models/retrieveTeamMemberBookingProfileResponse' ; import { SearchAvailabilityRequest , searchAvailabilityRequestSchema , } from '../models/searchAvailabilityRequest' ; import { SearchAvailabilityResponse , searchAvailabilityResponseSchema , } from '../models/searchAvailabilityResponse' ; import { UpdateBookingRequest , updateBookingRequestSchema , } from '../models/updateBookingRequest' ; import { UpdateBookingResponse , updateBookingResponseSchema , } from '../models/updateBookingResponse' ; import { boolean , number , optional , string } from '../schema' ; import { BaseApi } from './baseApi' ; export class BookingsApi extends BaseApi { param limit param cursor param teamMemberId param locationId param startAtMin param startAtMax return async listBookings ( limit ? , cursor ? , teamMemberId ? , locationId ? , startAtMin ? , startAtMax ? , requestOptions ? ) { const req = this . createRequest ( 'GET' , '/v2/bookings' ) ; const mapped = req . prepareArgs ( { limit : [ limit , optional ( number ( ) ) ] , cursor : [ cursor , optional ( string ( ) ) ] , teamMemberId : [ teamMemberId , optional ( string ( ) ) ] , locationId : [ locationId , optional ( string ( ) ) ] , startAtMin : [ startAtMin , optional ( string ( ) ) ] , startAtMax : [ startAtMax , optional ( string ( ) ) ] , } ) ; req . query ( 'limit' , mapped . limit ) ; req . query ( 'cursor' , mapped . cursor ) ; req . query ( 'team_member_id' , mapped . teamMemberId ) ; req . query ( 'location_id' , mapped . locationId ) ; req . query ( 'start_at_min' , mapped . startAtMin ) ; req . query ( 'start_at_max' , mapped . startAtMax ) ; return req . callAsJson ( listBookingsResponseSchema , requestOptions ) ; } param body return async createBooking ( body , requestOptions ? ) { const req = this . createRequest ( 'POST' , '/v2/bookings' ) ; const mapped = req . prepareArgs ( { body : [ body , createBookingRequestSchema ] , } ) ; req . header ( 'Content-Type' , 'application/json' ) ; req . json ( mapped . body ) ; return req . callAsJson ( createBookingResponseSchema , requestOptions ) ; } param body return async searchAvailability ( body , requestOptions ? ) { const req = this . createRequest ( 'POST' , '/v2/bookings/availability/search' ) ; const mapped = req . prepareArgs ( { body : [ body , searchAvailabilityRequestSchema ] , } ) ; req . header ( 'Content-Type' , 'application/json' ) ; req . json ( mapped . body ) ; return req . callAsJson ( searchAvailabilityResponseSchema , requestOptions ) ; } return async retrieveBusinessBookingProfile ( requestOptions ? ) { const req = this . createRequest ( 'GET' , '/v2/bookings/business-booking-profile' ) ; return req . callAsJson ( retrieveBusinessBookingProfileResponseSchema , requestOptions ) ; } param bookableOnly param limit param cursor param locationId return async listTeamMemberBookingProfiles ( bookableOnly ? , limit ? , cursor ? , locationId ? , requestOptions ? ) { const req = this . createRequest ( 'GET' , '/v2/bookings/team-member-booking-profiles' ) ; const mapped = req . prepareArgs ( { bookableOnly : [ bookableOnly , optional ( boolean ( ) ) ] , limit : [ limit , optional ( number ( ) ) ] , cursor : [ cursor , optional ( string ( ) ) ] , locationId : [ locationId , optional ( string ( ) ) ] , } ) ; req . query ( 'bookable_only' , mapped . bookableOnly ) ; req . query ( 'limit' , mapped . limit ) ; req . query ( 'cursor' , mapped . cursor ) ; req . query ( 'location_id' , mapped . locationId ) ; return req . callAsJson ( listTeamMemberBookingProfilesResponseSchema , requestOptions ) ; } param teamMemberId return async retrieveTeamMemberBookingProfile ( teamMemberId , requestOptions ? ) { const req = this . createRequest ( 'GET' ) ; const mapped = req . prepareArgs ( { teamMemberId : [ teamMemberId , string ( ) ] } ) ; req . appendTemplatePath `/v2/bookings/team-member-booking-profiles/${ mapped . teamMemberId }` ; return req . callAsJson ( retrieveTeamMemberBookingProfileResponseSchema , requestOptions ) ; } param bookingId return async retrieveBooking ( bookingId , requestOptions ? ) { const req = this . createRequest ( 'GET' ) ; const mapped = req . prepareArgs ( { bookingId : [ bookingId , string ( ) ] } ) ; req . appendTemplatePath `/v2/bookings/${ mapped . bookingId }` ; return req . callAsJson ( retrieveBookingResponseSchema , requestOptions ) ; } param bookingId param body return async updateBooking ( bookingId , body , requestOptions ? ) { const req = this . createRequest ( 'PUT' ) ; const mapped = req . prepareArgs ( { bookingId : [ bookingId , string ( ) ] , body : [ body , updateBookingRequestSchema ] , } ) ; req . header ( 'Content-Type' , 'application/json' ) ; req . json ( mapped . body ) ; req . appendTemplatePath `/v2/bookings/${ mapped . bookingId }` ; return req . callAsJson ( updateBookingResponseSchema , requestOptions ) ; } param bookingId param body return async cancelBooking ( bookingId , body , requestOptions ? ) { const req = this . createRequest ( 'POST' ) ; const mapped = req . prepareArgs ( { bookingId : [ bookingId , string ( ) ] , body : [ body , cancelBookingRequestSchema ] , } ) ; req . header ( 'Content-Type' , 'application/json' ) ; req . json ( mapped . body ) ; req . appendTemplatePath `/v2/bookings/${ mapped . bookingId }/cancel` ; return req . callAsJson ( cancelBookingResponseSchema , requestOptions ) ; } }