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 UpdateWorkExperienceDto = {companyId: string, title: string, description: string | null, startDate: DateISO | null, endDate: DateISO | null, location: CreateLocationDto | null}; export type UpdateApiCandidatesWorkExperiencesWorkExperienceIdArgs = {workExperienceId: string, body: UpdateWorkExperienceDto}; export type UpdateApiCandidatesWorkExperiencesWorkExperienceIdOptions = {baseUrl: string, xApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update work experience * * PUT /candidates/work-experiences/{workExperienceId} */ export const updateApiCandidatesWorkExperiencesWorkExperienceId = async (args: UpdateApiCandidatesWorkExperiencesWorkExperienceIdArgs, options: UpdateApiCandidatesWorkExperiencesWorkExperienceIdOptions) => { 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/work-experiences/${encodeURIComponent(String(args.workExperienceId))}${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 };