export type AddressDetailsV1 = {street: string, houseNumber: string, houseNumberAddition?: string | undefined, zipCode: string, city: string, country: string}; export type WorkerUpdateRequestV1 = {workerId?: string | undefined, address: AddressDetailsV1, mobileNumber?: string | undefined, emailAddress?: string | undefined, iban: string}; export type CreateApiPublicOnboardingV1UpdateWorkerArgs = {body: WorkerUpdateRequestV1}; export type CreateApiPublicOnboardingV1UpdateWorkerOptions = {baseUrl?: string | undefined, oauth2ClientCredentials?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update the info of a worker * * POST /public/onboarding/v1/update-worker */ export const createApiPublicOnboardingV1UpdateWorker = async (args: CreateApiPublicOnboardingV1UpdateWorkerArgs, options?: CreateApiPublicOnboardingV1UpdateWorkerOptions) => { const {baseUrl = "https://api.maqqie.app", fetch: fetchFn = fetch, oauth2ClientCredentials} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (oauth2ClientCredentials !== undefined) headers.set('authorization', `Bearer ${oauth2ClientCredentials}`) const url = `${baseUrl.replace(/\/+$/, '')}/public/onboarding/v1/update-worker${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 undefined };