export type CreateApiCandidatesIdWorkHistoryArgs = {id: number, body: {title: string, employer: {linked?: boolean | undefined, name?: string | undefined, location?: ({city?: string | undefined, state?: string | undefined}) | undefined}, supervisor?: ({linked?: boolean | undefined, name?: string | undefined, phone?: string | undefined}) | undefined, is_verified?: boolean | undefined, is_current?: string | undefined, start_date?: string | undefined, end_date?: string | undefined, reason_for_leaving?: string | undefined}}; export type CreateApiCandidatesIdWorkHistoryOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create a candidate work history item * * POST /candidates/{id}/work_history */ export const createApiCandidatesIdWorkHistory = async (args: CreateApiCandidatesIdWorkHistoryArgs, options?: CreateApiCandidatesIdWorkHistoryOptions) => { const {baseUrl = "https://api.catsone.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/candidates/${encodeURIComponent(String(args.id))}/work_history${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 };