export type CreateApiEmployeesArgs = {body: {first_name?: string | undefined, middle_name?: string | undefined, last_name: string, email?: string | undefined, dob?: string | undefined, residence?: ({line1: string, line2?: string | undefined, city: string, state: string, postal_code: string, country?: string | undefined}) | undefined, company: string, start_date?: string | undefined, termination_date?: string | undefined, default_net_pay_split?: string | undefined, workplaces: Array, primary_workplace?: string | undefined, ssn?: string | undefined, payment_method_preference?: string | undefined, active?: boolean | undefined, w2_electronic_consent_provided?: boolean | undefined, metadata?: unknown | undefined}}; export type CreateApiEmployeesOptions = {baseUrl?: string | undefined, sec0?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create an employee * * POST /employees */ export const createApiEmployees = async (args: CreateApiEmployeesArgs, options?: CreateApiEmployeesOptions) => { 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(/\/+$/, '')}/employees${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 (await res.json()) as unknown };