export type CustomerUpdateObject = {id?: number | undefined, external_code?: (string | null) | undefined, person_name: string, contact_person?: (string | null) | undefined, nickname?: (string | null) | undefined, birthday?: (string | null) | undefined, email?: string | undefined, email_cc?: string | undefined, address: string, address_complement?: (string | null) | undefined, address_number?: string | undefined, neighborhood: string, zipcode: string, state?: string | undefined, city_name: string, phone_number?: (string | null) | undefined, mobile_local_code?: (string | null) | undefined, mobile_number?: (string | null) | undefined, ignore_email?: (boolean | null) | undefined, ignore_sms?: (boolean | null) | undefined, ignore_whatsapp?: (boolean | null) | undefined, notes?: (string | null) | undefined, tags?: (Array | null) | undefined, tag_list?: (string | null) | undefined, custom_data?: (Record | null) | undefined, created_via_api?: (boolean | null) | undefined, created_at?: (string | null) | undefined, updated_at?: (string | null) | undefined}; export type UpdateApiV1CustomersIdArgs = {id: string, 'User-Agent'?: string | undefined, body: CustomerUpdateObject}; export type UpdateApiV1CustomersIdOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Atualizar Cliente * * PUT /v1/customers/{id} */ export const updateApiV1CustomersId = async (args: UpdateApiV1CustomersIdArgs, options?: UpdateApiV1CustomersIdOptions) => { const {baseUrl = "https://api-sandbox.kobana.com.br", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['User-Agent'] != null) headers.set("User-Agent", String(args['User-Agent'])) if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/customers/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 };