export type CreateApiRecruitingCandidatesCandidateIdAttachmentArgs = {candidateId: string, body: BodyInit}; export type CreateApiRecruitingCandidatesCandidateIdAttachmentOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Add an attachment to a candidate * * POST /recruiting/candidates/{candidateId}/attachment */ export const createApiRecruitingCandidatesCandidateIdAttachment = async (args: CreateApiRecruitingCandidatesCandidateIdAttachmentArgs, options?: CreateApiRecruitingCandidatesCandidateIdAttachmentOptions) => { const {baseUrl = "https://sandbox-api.kenjo.io/api/v1", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() const url = `${baseUrl.replace(/\/+$/, '')}/recruiting/candidates/${encodeURIComponent(String(args.candidateId))}/attachment${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", 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 };