export type PatchApiApiV2CustomersIdArgs = {id: string, body: {customerType?: ('person' | 'company' | null) | undefined, firstname?: (string | null) | undefined, lastname?: (string | null) | undefined, name?: (string | null) | undefined, title?: (string | null) | undefined, birthdate?: (string | null) | undefined, number?: (string | null) | undefined, deviatingCustomerNumber?: (string | null) | undefined, salutation?: ('mr' | 'mrs' | 'company' | 'other' | null) | undefined, salutationPhrase?: (string | null) | undefined, department?: (string | null) | undefined, subDepartment?: (string | null) | undefined, contactDetails?: ({phone?: (string | null) | undefined, mobile?: (string | null) | undefined, fax?: (string | null) | undefined, email?: (string | null) | undefined, website?: (string | null) | undefined, additionalData?: (Array<{label: string, value: string | null} | null>) | undefined}) | undefined, accountManager?: ({id: string} | null) | undefined, salesManager?: ({id: string} | null) | undefined, isLead?: boolean | undefined, contactPerson?: (string | null) | undefined, groups?: (Array | null) | undefined, customFields?: (Array<{id: number, value: string | null}>) | undefined, financials?: ({tax?: ({taxation?: ('domestic' | 'eu-delivery' | 'export' | 'free') | undefined, taxDisplay?: ('automatically' | 'always-net' | 'always-gross') | undefined, useDeliveryThreshold?: boolean | undefined, taxNumber?: (string | null) | undefined, vatId?: (string | null) | undefined}) | undefined, paymentTerms?: ({fixedPaymentTerms?: boolean | undefined, paymentTargetDays?: (number | null) | undefined, paymentTargetDiscount?: number | undefined, paymentTargetDiscountDays?: (number | null) | undefined}) | undefined, paymentMethod?: ({id: string} | null) | undefined, subscriptionPaymentMethod?: ('invoice' | 'direct-debit' | null) | undefined, customsInformation?: (string | null) | undefined, creditLimit?: number | undefined, defaultCurrency?: string | undefined}) | undefined, primaryBankAccount?: ({bankName?: string | undefined, owner?: (string | null) | undefined, iban?: (string | null) | undefined, bic?: (string | null) | undefined, sepa?: ({companySepa?: boolean | undefined, mandateReference?: (string | null) | undefined, mandateReferenceChange?: boolean | undefined, mandateReferenceDate?: (string | null) | undefined, usage?: ('recurring' | 'single') | undefined, initial?: boolean | undefined, remark?: (string | null) | undefined}) | undefined}) | undefined, documentDelivery?: ({autoCreateDocuments?: ('both' | 'delivery_note' | 'invoice') | undefined, invoiceAlwaysPaper?: boolean | undefined, amountInvoicePrints?: (number | null) | undefined, preferFax?: boolean | undefined}) | undefined, language?: (string | null) | undefined, mainProject?: {id: string} | undefined, commission?: number | undefined, identifier?: (string | null) | undefined, logfile?: string | undefined, lat?: (number | null) | undefined, lng?: (number | null) | undefined, fromShop?: {id: string} | undefined, marketing?: ({marketingBan?: boolean | undefined, showBirthdayInCalendar?: boolean | undefined, birthdayCard?: boolean | undefined, ageApproval?: boolean | undefined}) | undefined, shipping?: ({freeShipping?: boolean | undefined, trackingMailBan?: boolean | undefined, deliveryBan?: boolean | undefined, freeShippingFrom?: number | undefined, deliveryBanReason?: (string | null) | undefined, deliveryBanDate?: (string | null) | undefined, shippingMethod?: ({id: string} | null) | undefined}) | undefined}}; export type PatchApiApiV2CustomersIdOptions = {baseUrl?: string | undefined, BearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update customer * * PATCH /api/v2/customers/{id} */ export const patchApiApiV2CustomersId = async (args: PatchApiApiV2CustomersIdArgs, options?: PatchApiApiV2CustomersIdOptions) => { const {baseUrl = "https://xentral.xentral.biz", fetch: fetchFn = fetch, BearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (BearerAuth !== undefined) headers.set('authorization', `Bearer ${BearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v2/customers/${encodeURIComponent(String(args.id))}${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 };