export type Address = {address1?: string | undefined, address2?: string | undefined, address3?: string | undefined, address4?: string | undefined, address5?: string | undefined, address6?: string | undefined, address7?: string | undefined, zip?: string | undefined, city?: string | undefined, country_code?: string | undefined}; export type CustomAgreements = {agreement_id: string, agreement_value: 0 | 1 | 2}; export type Agreement = {agreement_gtc?: (0 | 1 | 2) | undefined, agreement_profiling?: (0 | 1 | 2) | undefined, agreement_marketing_communication?: (0 | 1 | 2) | undefined, custom_agreements?: Array | undefined}; export type Consents = {consent_id: string, consent_value: 0 | 1 | 2, last_change?: string | undefined}; export type PersonalInformation = {salutation?: string | undefined, gender?: (1 | 2 | 3 | 4 | 5 | null) | undefined, first_name?: string | undefined, last_name?: string | undefined, pre_nominals?: string | undefined, post_nominals?: string | undefined, birthdate?: string | undefined, email?: string | undefined, phone?: string | undefined, language_id: string, store_id?: string | undefined, photo_url?: string | undefined, address?: Address | undefined, agreement?: Agreement | undefined, consents?: Array | undefined}; export type Customer = {customer_id?: string | undefined, personal_information: PersonalInformation, doi_email?: string | undefined, doi_phone?: string | undefined, last_change?: string | undefined, state?: (0 | 1 | 2) | undefined}; export type SocialNetworkCredentials = {social_network_id: string, social_network_token: string}; export type PropertyRecord = {property_record_id?: string | undefined, property_id: string, property_name?: string | undefined, property_value?: (string | number | number | boolean | Array | Record) | undefined, last_change?: string | undefined}; export type UpdateApiCustomersCustomerIdArgs = {'Accept-Language'?: string | undefined, customer_id: string, body: {customer: Customer, password?: string | undefined, social_network_credentials?: SocialNetworkCredentials | undefined, property_records?: Array | undefined}}; export type UpdateApiCustomersCustomerIdOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update a customer * * PUT /customers/{customer_id} * * Also accepts auth: basicAuth */ export const updateApiCustomersCustomerId = async (args: UpdateApiCustomersCustomerIdArgs, options?: UpdateApiCustomersCustomerIdOptions) => { 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(/\/+$/, '')}/customers/${encodeURIComponent(String(args.customer_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 };