import type { Booking } from '@entities' import type { FilterType, HttpClient, IncludeType } from '@services' import { endpointMaker } from '@services' import type { ApiError, Response } from '@types' export type BookingInput = { houseId: string paginate?: { per: string; page: string } included: IncludeType filters: FilterType } const getBookings = (http: HttpClient) => { return { query: ( input: BookingInput, ): Promise< Response< Booking<{ serialized: true; withRelationships: true }>[], Included, ApiError > > => { const query = endpointMaker({ includes: input.included, filter: input.filters, pagination: input.paginate, }) return http.get(`v3/user/houses/${input.houseId}/bookings${query}`) }, } } export default getBookings