export type JTLDataContractsKeysKundeKey = string; export type JTLDataContractsKeysAnsprechpartnerKey = string; export type JTLWawiRestContractsModelsV1CustomerUpdateCustomerContact = {department?: string | undefined, honorific?: string | undefined, firstName?: string | undefined, lastName?: string | undefined, phoneNumber?: string | undefined, mobilePhoneNumber?: string | undefined, emailAddress?: string | undefined, fax?: string | undefined}; export type PatchApiV2CustomersCustomerIdContactsCustomerContactIdArgs = {'x-tenant-id': string, customerId: JTLDataContractsKeysKundeKey, customerContactId: JTLDataContractsKeysAnsprechpartnerKey, 'x-runas'?: string | undefined, 'x-companyid'?: string | undefined, body: JTLWawiRestContractsModelsV1CustomerUpdateCustomerContact}; export type PatchApiV2CustomersCustomerIdContactsCustomerContactIdOptions = {baseUrl?: string | undefined, oauth2AuthorizationCode?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update Customer Contact * * PATCH /v2/customers/{customerId}/contacts/{customerContactId} * * Also accepts auth: oauth2-client-credentials */ export const patchApiV2CustomersCustomerIdContactsCustomerContactId = async (args: PatchApiV2CustomersCustomerIdContactsCustomerContactIdArgs, options?: PatchApiV2CustomersCustomerIdContactsCustomerContactIdOptions) => { const {baseUrl = "https://scx-sbx.api.jtl-software.com", fetch: fetchFn = fetch, oauth2AuthorizationCode} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (args['x-tenant-id'] != null) headers.set("x-tenant-id", String(args['x-tenant-id'])) if (args['x-runas'] != null) headers.set("x-runas", String(args['x-runas'])) if (args['x-companyid'] != null) headers.set("x-companyid", String(args['x-companyid'])) if (oauth2AuthorizationCode !== undefined) headers.set('authorization', `Bearer ${oauth2AuthorizationCode}`) const url = `${baseUrl.replace(/\/+$/, '')}/v2/customers/${encodeURIComponent(String(args.customerId))}/contacts/${encodeURIComponent(String(args.customerContactId))}${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 (await res.json()) as unknown };