export type BulkCreateCandidateEnrichmentTypeDto = {value: 'EMAIL', purpose?: ('personal' | 'work') | undefined} | {value: 'PHONE'} | {value: 'LINKEDIN'} | {value: 'PROFILE'}; export type BulkCreateCandidateEnrichmentsCandidateIdsDto = {include: Array}; export type BulkCreateCandidateEnrichmentsSelectDto = {candidateIds: BulkCreateCandidateEnrichmentsCandidateIdsDto}; export type BulkCreateCandidateEnrichmentsDto = {type: BulkCreateCandidateEnrichmentTypeDto, select: BulkCreateCandidateEnrichmentsSelectDto}; export type CreateApiEnrichmentsBulkArgs = {body: BulkCreateCandidateEnrichmentsDto}; export type CreateApiEnrichmentsBulkOptions = {baseUrl: string, xApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create enrichments * * POST /enrichments/_bulk */ export const createApiEnrichmentsBulk = async (args: CreateApiEnrichmentsBulkArgs, options: CreateApiEnrichmentsBulkOptions) => { 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(/\/+$/, '')}/enrichments/_bulk${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 };