export type CreateApiV1AppointmentsIdSendEmailArgs = {id: number, body: {email?: string | undefined, type: 'appointment_confirmation' | 'appointment_request' | 'appointment_approved' | 'appointment_rejected'}}; export type CreateApiV1AppointmentsIdSendEmailOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Send a confirmation email * * POST /v1/appointments/{id}/send_email */ export const createApiV1AppointmentsIdSendEmail = async (args: CreateApiV1AppointmentsIdSendEmailArgs, options?: CreateApiV1AppointmentsIdSendEmailOptions) => { 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/${encodeURIComponent(String(args.id))}/send_email${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 };