export type ExternalFilePayload = {fileName?: string | undefined, base64Data?: string | undefined}; export type PublicApplicationPayload = {jobOpportunityId: number, lastName: string, firstName: string, phoneNumber: string, emailAddress: string, resume: ExternalFilePayload | null, additionalFiles: Array, comments?: Array | undefined, consentToGoInTalentPool?: boolean | undefined}; export type CreateApiRecruitmentApiPublicApplicationsArgs = {body: PublicApplicationPayload}; export type CreateApiRecruitmentApiPublicApplicationsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create a new application for a job opportunity * * POST /recruitment/api/public/applications */ export const createApiRecruitmentApiPublicApplications = async (args: CreateApiRecruitmentApiPublicApplicationsArgs, options?: CreateApiRecruitmentApiPublicApplicationsOptions) => { const {baseUrl = "https://example.ilucca.net", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/recruitment/api/public/applications${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 };