export type CreateApiV1ContractorsContractorUuidTerminationArgs = {'X-Gusto-API-Version'?: '2026-06-15' | undefined, contractor_uuid: string, body: {end_date: string}}; export type CreateApiV1ContractorsContractorUuidTerminationOptions = {baseUrl?: string | undefined, CompanyAccessAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Schedule a contractor termination * * POST /v1/contractors/{contractor_uuid}/termination */ export const createApiV1ContractorsContractorUuidTermination = async (args: CreateApiV1ContractorsContractorUuidTerminationArgs, options?: CreateApiV1ContractorsContractorUuidTerminationOptions) => { const {baseUrl = "https://api.gusto-demo.com", fetch: fetchFn = fetch, CompanyAccessAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['X-Gusto-API-Version'] != null) headers.set("X-Gusto-API-Version", String(args['X-Gusto-API-Version'])) if (CompanyAccessAuth !== undefined) headers.set('authorization', `Bearer ${CompanyAccessAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/contractors/${encodeURIComponent(String(args.contractor_uuid))}/termination${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 };