export type DateISO = string; export type LocationType = 'primary_home' | 'secondary_home' | 'primary_work' | 'headquarters' | 'regional_office'; export type CreateLocationDto = {street1: string | null, street2: string | null, postalCode: string | null, city: string | null, region: string | null, state: string | null, country: string | null, latitude?: (number | null) | undefined, longitude?: (number | null) | undefined, type: LocationType | null}; export type ReplaceCandidateWorkExperienceDto = {companyId: string, title: string, description: string | null, startDate: DateISO | null, endDate: DateISO | null, location: CreateLocationDto | null, id: string} | {companyId: string, title: string, description: string | null, startDate: DateISO | null, endDate: DateISO | null, location: CreateLocationDto | null}; export type ReplaceCandidateWorkExperiencesDto = {items: Array}; export type UpdateApiCandidatesIdWorkExperiencesArgs = {id: string, body: ReplaceCandidateWorkExperiencesDto}; export type UpdateApiCandidatesIdWorkExperiencesOptions = {baseUrl: string, xApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Replace work experiences * * PUT /candidates/{id}/work-experiences */ export const updateApiCandidatesIdWorkExperiences = async (args: UpdateApiCandidatesIdWorkExperiencesArgs, options: UpdateApiCandidatesIdWorkExperiencesOptions) => { const {baseUrl, fetch: fetchFn = fetch, xApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (xApiKey !== undefined) headers.set("x-api-key", xApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/candidates/${encodeURIComponent(String(args.id))}/work-experiences${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 };