export type CreateApiV1AppointmentsRecurSlotsArgs = {body: {provider: number, services: Array, date?: string | undefined, dates?: Array | undefined, frequency?: ('daily' | 'weekly' | 'monthly') | undefined, count?: number | undefined}}; export type CreateApiV1AppointmentsRecurSlotsOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Find available slots * * POST /v1/appointments/recur_slots */ export const createApiV1AppointmentsRecurSlots = async (args: CreateApiV1AppointmentsRecurSlotsArgs, options?: CreateApiV1AppointmentsRecurSlotsOptions) => { const {baseUrl = "https://developer.yezza.com", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (ApiKeyAuth !== undefined) headers.set("X-Api-Key", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/v1/appointments/recur_slots${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };