export type PatchApiExternalPayrollsPayrollArgs = {payroll: string, body: {company?: string | undefined, period_start?: string | undefined, period_end?: string | undefined, payday?: string | undefined, pay_frequency?: string | undefined, correction?: string | undefined, items?: (Array<{employee?: string | undefined, earnings?: (Array<{amount?: string | undefined, hours?: string | undefined, type?: string | undefined, workplace?: string | undefined, earning_code?: string | undefined}>) | undefined, reimbursements?: Array<{amount: string}> | undefined, taxes?: (Array<{tax: string, amount: string, taxable_wages?: string | undefined, gross_taxable_wages?: string | undefined}>) | undefined, benefits?: (Array<{id?: string | undefined, benefit?: string | undefined, description?: string | undefined, employee_contribution_amount?: string | undefined, company_contribution_amount?: string | undefined}>) | undefined, post_tax_deductions?: (Array<{id?: string | undefined, amount?: string | undefined, description?: string | undefined}>) | undefined}>) | undefined, contractor_payments?: (Array<{amount?: string | undefined, reimbursement_amount?: string | undefined, contractor?: string | undefined}>) | undefined, metadata?: unknown | undefined}}; export type PatchApiExternalPayrollsPayrollOptions = {baseUrl?: string | undefined, sec0?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update an external payroll * * PATCH /external_payrolls/{payroll} */ export const patchApiExternalPayrollsPayroll = async (args: PatchApiExternalPayrollsPayrollArgs, options?: PatchApiExternalPayrollsPayrollOptions) => { const {baseUrl = "https://sandbox.checkhq.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(/\/+$/, '')}/external_payrolls/${encodeURIComponent(String(args.payroll))}${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 };