export type PatchApiApiCustomersArgs = {body: {data?: ({attributes?: ({business_name?: string | undefined, cashed_vat?: boolean | undefined, contact_name?: string | undefined, country_iso_alpha_2?: string | undefined, email?: string | undefined, internal_observations?: string | undefined, is_tax_exempt?: boolean | undefined, mobile_number?: string | undefined, not_final_customer?: boolean | undefined, observations?: string | undefined, phone_number?: string | undefined, tax_country_region?: string | undefined, tax_registration_number?: string | undefined, website?: string | undefined}) | undefined, id?: string | undefined, type?: string | undefined}) | undefined}}; export type PatchApiApiCustomersOptions = {baseUrl: string, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Atualizar dados do cliente * * PATCH /api/customers */ export const patchApiApiCustomers = async (args: PatchApiApiCustomersArgs, options: PatchApiApiCustomersOptions) => { const {baseUrl, fetch: fetchFn = fetch, oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "text/plain") if (oauth2 !== undefined) headers.set('authorization', `Bearer ${oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/customers${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 res.text() };