export type PatchApiContractorsArgs = {body: {companyID: string, contractor: {contractorID: string, first_name?: string | undefined, last_name?: string | undefined, dob?: string | undefined, business_name?: string | undefined, ssn?: string | undefined, email?: string | undefined, address?: string | undefined, address_line2?: string | undefined, city?: string | undefined, state?: string | undefined, zip?: string | undefined, start_date?: string | undefined}}}; export type PatchApiContractorsOptions = {baseUrl?: string | undefined, sec0?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update Contractor Information * * PATCH /contractors */ export const patchApiContractors = async (args: PatchApiContractorsArgs, options?: PatchApiContractorsOptions) => { const {baseUrl = "https://api.zeal.com", fetch: fetchFn = fetch, sec0} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (sec0 !== undefined) headers.set("Authorization", sec0) const url = `${baseUrl.replace(/\/+$/, '')}/contractors${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 };