export type CreateApiApiV1CustomersCustomerIdContactPersonArgs = {customerId: string, body: {type?: ('company' | 'mr' | 'mrs' | 'other' | null) | undefined, name: string, title?: (string | null) | undefined, birthday?: (string | null) | undefined, birthdayShowInCalendar?: (boolean | null) | undefined, sendBirthdayCard?: (boolean | null) | undefined, marketingBan?: (boolean | null) | undefined, department?: (string | null) | undefined, subDepartment?: (string | null) | undefined, position?: (string | null) | undefined, language?: (string | null) | undefined, address?: ({street?: (string | null) | undefined, additionalStreet?: (string | null) | undefined, zip?: (string | null) | undefined, city?: (string | null) | undefined, state?: (string | null) | undefined, country?: (string | null) | undefined}) | undefined, contact?: ({phone?: (string | null) | undefined, fax?: (string | null) | undefined, mobile?: (string | null) | undefined, salutation?: (string | null) | undefined, email?: (string | null) | undefined}) | undefined, groups?: Array | undefined, comment?: (string | null) | undefined, others?: (string | null) | undefined}}; export type CreateApiApiV1CustomersCustomerIdContactPersonOptions = {baseUrl?: string | undefined, BearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create contact person * * POST /api/v1/customers/{customerId}/contactPerson */ export const createApiApiV1CustomersCustomerIdContactPerson = async (args: CreateApiApiV1CustomersCustomerIdContactPersonArgs, options?: CreateApiApiV1CustomersCustomerIdContactPersonOptions) => { 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") headers.set('accept', "text/html") if (BearerAuth !== undefined) headers.set('authorization', `Bearer ${BearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/customers/${encodeURIComponent(String(args.customerId))}/contactPerson${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", 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() };