export type CreateApiPurchasesActionsAssignCustomerArgs = {'Accept-Language'?: string | undefined, body: {store_id: string, external_purchase_id: string, card_number?: string | undefined, customer_id?: string | undefined}}; export type CreateApiPurchasesActionsAssignCustomerOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Assign customer * * POST /purchases/actions/assign-customer * * Also accepts auth: basicAuth */ export const createApiPurchasesActionsAssignCustomer = async (args: CreateApiPurchasesActionsAssignCustomerArgs, options?: CreateApiPurchasesActionsAssignCustomerOptions) => { const {baseUrl = "https://sandbox.crmcarecloud.com/webservice/rest-api/enterprise-interface/v1.0", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['Accept-Language'] != null) headers.set("Accept-Language", String(args['Accept-Language'])) if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/purchases/actions/assign-customer${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 };