export type PatchApiCandidatesIdAvatarArgs = {id: string, body: BodyInit}; export type PatchApiCandidatesIdAvatarOptions = {baseUrl: string, xApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update candidate avatar * * PATCH /candidates/{id}/avatar */ export const patchApiCandidatesIdAvatar = async (args: PatchApiCandidatesIdAvatarArgs, options: PatchApiCandidatesIdAvatarOptions) => { const {baseUrl, fetch: fetchFn = fetch, xApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (xApiKey !== undefined) headers.set("x-api-key", xApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/candidates/${encodeURIComponent(String(args.id))}/avatar${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", headers, body: args.body}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };