import {z} from 'zod' export type PostConnectCreateLinkRequestBody = {end_user_email: string, end_user_organization_name: string, end_user_origin_id?: (string | null) | undefined, remote_environment?: (string | null) | undefined, integration_category?: ('HRIS' | 'ATS' | 'ASSESSMENT' | 'LMS') | undefined, integration_tool?: ('workday' | 'successfactors' | 'smartrecruiters' | 'factorial' | 'oraclerecruiting' | 'lever' | 'icims' | 'cornerstonetalentlink' | 'recruitee' | 'recruiterflow' | 'atlas' | 'greenhouse' | 'greenhousev3' | 'greenhousejobboard' | 'teamtailor' | 'teamtailorjobboards' | 'ashby' | 'talentsoft' | 'talentsoftcustomer' | 'concludis' | 'perbilityhelix' | 'talention' | 'piloga' | 'onlyfy' | 'personio' | 'ukgpro' | 'ukgready' | 'adpworkforcenow' | 'taleo' | 'rexx' | 'afas' | 'bamboohr' | 'bullhorn4salesforce' | 'bullhorn' | 'bullhornlogin' | 'workable' | 'jobvite' | 'fountain' | 'softgarden' | 'softgardenpartner' | 'pinpoint' | 'welcometothejungle' | 'dvinci' | 'dvinciadmin' | 'join' | 'sagehr' | 'traffit' | 'erecruiter' | 'abacusumantis' | 'umantis' | 'jobylon' | 'taleez' | 'hrworks' | 'otys' | 'zohorecruit' | 'ceipal' | 'eploy' | 'jobdiva' | 'careerplug' | 'perview' | 'eightfold' | 'paylocity' | 'paycor' | 'avature' | 'apploi' | 'phenom' | 'paradox' | 'heyrecruit' | 'recruhr' | 'recruitcrm' | 'jazzhr' | 'bite' | 'brassring' | 'homerun' | 'mysolution' | 'carerix' | 'carerixgraphql' | 'hroffice' | 'talentclue' | 'inrecruiting' | 'jobadder' | 'jobadderjobboard' | 'ubeeo' | 'connexys' | 'hr4you' | 'cornerstoneondemand' | 'zvooverecruit' | 'odoo' | 'comeet' | 'compleetpitcher' | 'compleetpersy' | 'compleet' | 'gem' | 'laura' | 'covetorest' | 'coveto' | 'mercury' | 'crelate' | 'manatal' | 'avionte' | 'mhmhr' | 'asymbl' | 'breezyhr' | 'flatchr' | 'dayforce' | 'digitalrecruiters' | 'applicantstack' | 'reachmee' | 'talentadore' | 'sandbox' | 'guidecom' | 'spott' | 'stardex' | 'logicmelon' | 'loxo' | 'kula' | 'trackerrms' | 'databites' | 'pageup' | 'talent360' | 'emplypeople' | 'hibob' | 'workdaycustomreport' | 'workdaycustomreportsftp' | 'ukgprowfm' | 'adpdecidium' | 'adplink' | 'payfitcustomer' | 'payfitpartner' | 'payfit' | 'employmenthero' | 'fourth' | 'kenjo' | 'heavenhr' | 'cezannehr' | 'entraid' | 'azuread' | 'googleworkspace' | 'nmbrs' | 'deel' | 'remotecom' | 'iriscascade' | 'okta' | 'sagepeople' | 'humaans' | 'eurecia' | 'oraclehcm' | 'officient' | 'sesamehr' | 'charliehr' | 'abacus' | 'zohopeople' | 'gusto' | 'breathehr' | 'catalystone' | 'mirus' | 'alexishr' | 'simployer' | 'peple' | 'youserve' | 'hansalog' | 'lattice' | 'latticetalent' | 'hoorayhr' | 'trinet' | 'trinetpeo' | 'namely' | 'paycom' | 'insperity' | 'paychex' | 'rippling' | 'sapling' | 'peoplehr' | 'lucca' | 'zelt' | 'planday' | 'boondmanager' | 'haileyhr' | 'silae' | 'skello' | 'oysterhr' | 'kiwihr' | 'square' | 'leapsome' | 'loket' | 'workforcecom' | 'peoplefirst' | 'sdworx' | 'itrent' | 'absenceio' | 'a3innuvanomina' | 'scim' | 'datevlauds' | 'datevhr' | 'datev' | 'datevlug' | 'sympa' | 'youforce' | 'nibelis' | 'peoplexd' | 'zellis' | 'veda' | 'sftp' | 'sftpfetch' | '360learning' | 'talentlms' | 'docebo' | 'coursera' | 'udemy' | 'linkedinlearning' | 'moodle' | null) | undefined, language?: ('en' | 'de' | 'fr' | 'it' | 'es' | null) | undefined, scope_config_id?: (string | null) | undefined, enable_filtering?: boolean | undefined, enable_field_mapping?: boolean | undefined, enable_static_ips?: boolean | undefined, link_type?: ('EMBEDDED' | 'MAGIC_LINK') | undefined}; export type CreateApiConnectCreateLinkArgs = {body: PostConnectCreateLinkRequestBody}; export type CreateApiConnectCreateLinkOptions = {baseUrl?: string | undefined, ApiKey?: string | undefined, fetch?: typeof fetch | undefined}; export const postConnectCreateLinkPositiveResponse = z.object({status: z.literal("success"), data: z.object({link: z.string(), static_ips: z.array(z.string()).optional()})}); export const validateResponse = async ( schema: { readonly '~standard': { readonly validate: (value: unknown) => ({ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }) | Promise<{ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }> } }, value: unknown ): Promise => { const result = await schema['~standard'].validate(value) if (result.issues !== undefined) { const detail = result.issues .map(({ message, path }) => path?.length ? `${path.map((segment) => String(typeof segment === 'object' ? segment.key : segment)).join('.')}: ${message}` : message ) .join('; ') throw new Error(`Response does not match the schema: ${detail}`, { cause: { issues: result.issues } }) } return result.value }; /** * Create connection link * * POST /connect/create-link */ export const createApiConnectCreateLink = async (args: CreateApiConnectCreateLinkArgs, options?: CreateApiConnectCreateLinkOptions) => { const {baseUrl = "https://api.kombo.dev/v1", fetch: fetchFn = fetch, ApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (ApiKey !== undefined) headers.set('authorization', `Bearer ${ApiKey}`) const url = `${baseUrl.replace(/\/+$/, '')}/connect/create-link${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 validateResponse(postConnectCreateLinkPositiveResponse, await res.json()) };