export type QPilotCoreModelsDtoRequestsSwitchCustomerRequest = {oldCustomerId: number, newCustomerId: number}; export type PatchApiSitesSiteIdScheduledOrdersScheduledOrderIdSwitchCustomerArgs = {siteId: number, scheduledOrderId: number, body: QPilotCoreModelsDtoRequestsSwitchCustomerRequest}; export type PatchApiSitesSiteIdScheduledOrdersScheduledOrderIdSwitchCustomerOptions = {baseUrl?: string | undefined, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Switch Customer in Scheduled Order * * PATCH /Sites/{siteId}/ScheduledOrders/{scheduledOrderId}/SwitchCustomer */ export const patchApiSitesSiteIdScheduledOrdersScheduledOrderIdSwitchCustomer = async (args: PatchApiSitesSiteIdScheduledOrdersScheduledOrderIdSwitchCustomerArgs, options?: PatchApiSitesSiteIdScheduledOrdersScheduledOrderIdSwitchCustomerOptions) => { const {baseUrl = "https://api.qpilot.cloud", fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (Bearer !== undefined) headers.set("Authorization", Bearer) const url = `${baseUrl.replace(/\/+$/, '')}/Sites/${encodeURIComponent(String(args.siteId))}/ScheduledOrders/${encodeURIComponent(String(args.scheduledOrderId))}/SwitchCustomer${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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 };