export type CreateApiApiBusinessBusinessIdBranchBranchIdClientClientIdCheckinArgs = {businessId: string, branchId: string, clientId: string, date?: string | undefined}; export type CreateApiApiBusinessBusinessIdBranchBranchIdClientClientIdCheckinOptions = {baseUrl?: string | undefined, basicAuth?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Check in appointments * * POST /api/business/{businessId}/branch/{branchId}/client/{clientId}/checkin */ export const createApiApiBusinessBusinessIdBranchBranchIdClientClientIdCheckin = async (args: CreateApiApiBusinessBusinessIdBranchBranchIdClientClientIdCheckinArgs, options?: CreateApiApiBusinessBusinessIdBranchBranchIdClientClientIdCheckinOptions) => { 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() if (args.date != null) query.append("date", String(args.date)) 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))}/client/${encodeURIComponent(String(args.clientId))}/checkin${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };