export type AppendNoteRequest = {note: string}; export type CreateApiApiBusinessBusinessIdBranchBranchIdBookingBookingIdAppendnoteArgs = {businessId: string, branchId: string, bookingId: string, body: AppendNoteRequest}; export type CreateApiApiBusinessBusinessIdBranchBranchIdBookingBookingIdAppendnoteOptions = {baseUrl?: string | undefined, basicAuth?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Create a note for the booking * * POST /api/business/{businessId}/branch/{branchId}/booking/{bookingId}/appendnote */ export const createApiApiBusinessBusinessIdBranchBranchIdBookingBookingIdAppendnote = async (args: CreateApiApiBusinessBusinessIdBranchBranchIdBookingBookingIdAppendnoteArgs, options?: CreateApiApiBusinessBusinessIdBranchBranchIdBookingBookingIdAppendnoteOptions) => { const {baseUrl = "http://api-gateway-eu.phorest.com/third-party-api-server", fetch: fetchFn = fetch, basicAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (basicAuth !== undefined) headers.set('authorization', `Basic ${btoa(`${basicAuth.username}:${basicAuth.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/business/${encodeURIComponent(String(args.businessId))}/branch/${encodeURIComponent(String(args.branchId))}/booking/${encodeURIComponent(String(args.bookingId))}/appendnote${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 };