export type CreateJobItem = {operation: 'CREATE' | 'UPDATE' | 'DELETE', company_tax_id: string, email?: string | undefined, full_name?: string | undefined, employee_id?: string | undefined, national_id?: string | undefined, payroll_id?: string | undefined, employee_segment?: string | undefined, department?: string | undefined, office_zip_code?: string | undefined, cost_center?: string | undefined, mobile_number?: string | undefined, discount_subset_id?: string | undefined, eligible_to_payroll?: boolean | undefined, custom_fields?: {[key: string]: unknown} | undefined}; export type CreateApiV1EligibilityJobsJobIdItemsArgs = {'job-id': string, body: Array}; export type CreateApiV1EligibilityJobsJobIdItemsOptions = {baseUrl?: string | undefined, OAuth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Add items to a job * * POST /v1/eligibility/jobs/{job-id}/items */ export const createApiV1EligibilityJobsJobIdItems = async (args: CreateApiV1EligibilityJobsJobIdItemsArgs, options?: CreateApiV1EligibilityJobsJobIdItemsOptions) => { const {baseUrl = "https://api.clients.wellhub.com", fetch: fetchFn = fetch, OAuth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (OAuth2 !== undefined) headers.set('authorization', `Bearer ${OAuth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/eligibility/jobs/${encodeURIComponent(String(args['job-id']))}/items${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 };