UNPKG

@mindkey/recruiting-api-client

Version:

The MindKey API Client allows easy access to your MindKey Recruiting data.

1 lines 40.6 kB
{"version":3,"sources":["projects/api-client/src/helpers/get-base-path.ts","projects/api-client/src/helpers/get-user-language-header.ts","projects/api-client/src/errors/http.error.ts","projects/api-client/src/helpers/send-request.ts","projects/api-client/src/helpers/get-content-type-header.ts","projects/api-client/src/clients/job-agent.client.ts","projects/api-client/src/clients/lookup.client.ts","projects/api-client/src/models/application-form.model.ts","projects/api-client/src/models/vacancy-details-configuration.model.ts","projects/api-client/src/models/vacancy-list.model.ts","projects/api-client/src/models/vacancy-list-configuration.model.ts","projects/api-client/src/helpers/assign-filters.ts","projects/api-client/src/clients/vacancy.client.ts"],"sourcesContent":["export function getBasePath(baseUrl: string, customerId: string): string {\n return `${baseUrl}/${encodeURIComponent(customerId)}`;\n}\n","export function getUserLanguageHeader(language: string): { 'X-MindKey-User-Language': string } {\n return { 'X-MindKey-User-Language': language };\n}\n","/**\n * @public\n */\nexport class HttpError extends Error {\n constructor(\n readonly response: Response,\n message: string,\n ) {\n super(message);\n }\n\n get status(): number {\n return this.response.status;\n }\n}\n","import { HttpError } from '../errors';\n\nexport interface HttpBackend {\n get<T>(url: string, headers: Record<string, string>): Promise<T>;\n\n post<T>(url: string, body: unknown, headers: Record<string, string>): Promise<T>;\n\n put<T>(url: string, body: unknown, headers: Record<string, string>): Promise<T>;\n\n delete<T>(url: string, body: unknown, headers: Record<string, string>): Promise<T>;\n\n sendRequest<T>(url: string, method: string, headers: Record<string, string>, body?: unknown): Promise<T>;\n}\n\nexport const fetchBackend: HttpBackend = {\n async get<T>(url: string, headers: Record<string, string>): Promise<T> {\n return await fetchBackend.sendRequest(url, 'GET', headers);\n },\n async post<T>(url: string, body: unknown, headers: Record<string, string>): Promise<T> {\n return await fetchBackend.sendRequest(url, 'POST', headers, body);\n },\n async put<T>(url: string, body: unknown, headers: Record<string, string>): Promise<T> {\n return await fetchBackend.sendRequest(url, 'GET', headers, body);\n },\n async delete<T>(url: string, body: unknown, headers: Record<string, string>): Promise<T> {\n return await fetchBackend.sendRequest(url, 'GET', headers, body);\n },\n async sendRequest<T>(url: string, method: string, headers: Record<string, string>, body?: unknown): Promise<T> {\n const response = await fetch(url, { method, headers, body: convertToBodyInit(body) });\n let text = '';\n\n if (!response.ok) {\n try {\n text = await response.text();\n } catch {\n text = `Http failure response for ${url}: ${response.status} ${response.statusText}`;\n }\n throw new HttpError(response, text);\n } else {\n text = await response.text();\n }\n\n if (!text) {\n text = '{}';\n }\n\n return JSON.parse(text) as T;\n },\n};\n\nexport function convertToBodyInit(body?: unknown): BodyInit | undefined {\n if (!body) {\n return undefined;\n }\n\n if (\n (typeof Blob !== 'undefined' && body instanceof Blob) ||\n (typeof ArrayBuffer !== 'undefined' && body instanceof ArrayBuffer) ||\n (typeof FormData !== 'undefined' && body instanceof FormData) ||\n (typeof URLSearchParams !== 'undefined' && body instanceof URLSearchParams)\n ) {\n return body;\n }\n\n // Convert the object to JSON\n return JSON.stringify(body);\n}\n","interface ContentType {\n 'Content-Type': string;\n}\n\nexport function getJsonContentTypeHeader(): ContentType {\n return { 'Content-Type': 'application/json' };\n}\n","import type { JobAgent, JobAgentConfiguration, JobAgentType, JobAgentUpdate } from '../models';\nimport { fetchBackend, getBasePath, getUserLanguageHeader, HttpBackend } from '../helpers';\nimport { getJsonContentTypeHeader } from '../helpers/get-content-type-header';\n\n/**\n * API client to make requests to the Job Agent API.\n *\n * @public\n */\nexport class JobAgentClient {\n constructor(\n private readonly basePath: string,\n private readonly backend: HttpBackend = fetchBackend,\n ) {}\n\n /**\n * Returns the site settings for Job Agents.\n * @param customerId - Your customer id.\n * @param language - The language to request.\n */\n getJobAgentConfiguration(customerId: string, language: string): Promise<JobAgentConfiguration> {\n return this.backend.get(`${this.getBaseUrl(customerId)}/configuration`, {\n ...getUserLanguageHeader(language),\n });\n }\n\n /**\n * Returns the settings for a specific Job Agent type.\n * @param customerId - Your customer id.\n * @param language - The language to request.\n * @param type - The id of a Job Agent type.\n */\n getJobAgentType(customerId: string, language: string, type: string): Promise<JobAgentType> {\n return this.backend.get(`${this.getBaseUrl(customerId)}/types/${encodeURIComponent(type)}`, {\n ...getUserLanguageHeader(language),\n });\n }\n\n /**\n * Returns a specific Job Agent.\n * @param customerId - Your customer id.\n * @param language - The language to request.\n * @param jobAgentId - The id of the Job Agent.\n * @param code - The code of the Job Agent.\n * @param type - The type of the Job Agent.\n */\n getJobAgent(customerId: string, language: string, jobAgentId: string, code: string, type: string): Promise<JobAgent> {\n return this.backend.post(\n `${this.getBaseUrl(customerId)}/${type}`,\n {\n jobAgentId,\n code,\n },\n {\n ...this.getDefaultPostHeaders(language),\n },\n );\n }\n\n /**\n * Creates a new Job Agent.\n * @param customerId - Your customer id.\n * @param language - The language to request.\n * @param jobAgent - The Job Agent to create.\n * @param type - The type of the Job Agent.\n */\n createJobAgent(customerId: string, language: string, jobAgent: JobAgent, type: string): Promise<void> {\n return this.backend.post(`${this.getBaseUrl(customerId)}/create/${type}`, jobAgent, {\n ...this.getDefaultPostHeaders(language),\n });\n }\n\n /**\n * Updates an existing Job Agent.\n * @param customerId - Your customer id.\n * @param language - The language to request.\n * @param jobAgent - The Job Agent to change.\n * @param type - The type of the Job Agent.\n */\n updateJobAgent(customerId: string, language: string, jobAgent: JobAgentUpdate, type: string): Promise<void> {\n return this.backend.put(`${this.getBaseUrl(customerId)}/${type}`, jobAgent, {\n ...this.getDefaultPostHeaders(language),\n });\n }\n\n /**\n * Deletes an existing Job Agent.\n * @param customerId - Your customer id.\n * @param language - The language to request.\n * @param jobAgentId - The id of the Job Agent.\n * @param code - The code of the Job Agent.\n * @param type - The type of the Job Agent.\n */\n deleteJobAgent(customerId: string, language: string, jobAgentId: string, code: string, type: string): Promise<void> {\n return this.backend.delete(\n `${this.getBaseUrl(customerId)}/${type}`,\n {\n code,\n jobAgentId,\n },\n {\n ...this.getDefaultPostHeaders(language),\n },\n );\n }\n\n /**\n * Tries to email the user allowing them to activate/modify/delete their Job Agent.\n * This API always returns success, even if the email was not found in the system to prevent checking if emails are in the system or not.\n * @param customerId - Your customer id.\n * @param language - The language to request.\n * @param email - The email that should be in the system to try to resent the recent Job Agent information to.\n * @param type - The type of the Job Agent.\n */\n resendEmail(customerId: string, language: string, email: string, type: string): Promise<void> {\n return this.backend.post(`${this.getBaseUrl(customerId)}/resend-email/${type}`, email, {\n ...this.getDefaultPostHeaders(language),\n });\n }\n\n /**\n * Activates an existing Job Agent.\n * @param customerId - Your customer id.\n * @param language - The language to request.\n * @param code - The code of the Job Agent.\n * @param type - The type of the Job Agent.\n */\n activate(customerId: string, language: string, code: string, type: string): Promise<void> {\n return this.backend.post(`${this.getBaseUrl(customerId)}/activate/${type}`, code, {\n ...this.getDefaultPostHeaders(language),\n });\n }\n\n private getBaseUrl(customerId: string): string {\n return `${getBasePath(this.basePath, customerId)}/job-agents`;\n }\n\n private getDefaultPostHeaders(language: string): Record<string, string> {\n return { ...getUserLanguageHeader(language), ...getJsonContentTypeHeader() };\n }\n}\n","import type { Lookups } from '../models';\nimport { fetchBackend, getBasePath, getUserLanguageHeader, HttpBackend } from '../helpers';\n\n/**\n * API client to make requests to the Lookup API.\n *\n * @public\n */\nexport class LookupClient {\n constructor(\n private readonly baseUrl: string,\n private readonly backend: HttpBackend = fetchBackend,\n ) {}\n\n /**\n * Gets all the lookups.\n * @param customerId - Your customer id.\n * @param language - The language to request.\n */\n getLookups(customerId: string, language: string): Promise<Lookups> {\n return this.backend.get(`${getBasePath(this.baseUrl, customerId)}/candidates/lookup`, {\n ...getUserLanguageHeader(language),\n });\n }\n}\n","import { HasDescription } from './description.model';\n\n/**\n * @public\n */\nexport enum AttachmentType {\n Other = 'Other',\n Application = 'Application',\n Resume = 'Resume',\n}\n\n/**\n * @public\n */\nexport interface Attachment extends HasDescription {\n documentTypeId: string;\n mandatory: boolean;\n attachmentType: AttachmentType;\n}\n\n/**\n * @public\n */\nexport interface ApplicationFormType {\n /**\n * Flag indicating whether to display the image.\n */\n showImage: boolean;\n\n /**\n * Represents a flag indicating whether to show regions.\n */\n showRegions: boolean;\n\n /**\n * Indicates whether to show locations or not.\n */\n showLocations: boolean;\n\n /**\n * Indicates whether to display fields of work.\n */\n showFieldsOfWork: boolean;\n\n /**\n * Indicates whether to display elements or not.\n */\n showElements: boolean;\n\n /**\n * Flag indicating whether to show the \"Allow Save Disclaimer\" message.\n */\n showAllowSaveDisclaimer: boolean;\n\n /**\n * Indicates whether to show previously applied changes or not.\n */\n showPreviouslyApplied: boolean;\n\n /**\n * Flags whether or not to display media.\n */\n showMedia: boolean;\n\n /**\n * Indicates whether the birth date should be shown or not.\n */\n showBirthDate: boolean;\n\n /**\n * Represents a variable that determines whether to show the gender.\n */\n showGender: boolean;\n\n /**\n * Represents a variable indicating whether to display the home phone number.\n */\n showHomePhone: boolean;\n\n /**\n * Indicates whether to display the mobile phone on the interface.\n */\n showMobilePhone: boolean;\n\n /**\n * Indicates whether to show the country information or not.\n */\n showCountry: boolean;\n\n /**\n * Indicates whether to display the state/province of a location.\n */\n showStateProvince: boolean;\n\n /**\n * Represents a variable indicating whether to show the address.\n */\n showAddress: boolean;\n\n /**\n * Represents a variable showAddress2 which indicates whether to display\n * the Address Line 2 in an address block.\n */\n showAddress2: boolean;\n\n /**\n * Determines whether to show the nationality of a person.\n */\n showNationality: boolean;\n\n /**\n * Represents the marital status of an individual.\n */\n showMaritalStatus: boolean;\n\n /**\n * Indicates whether to display the salutation or not.\n */\n showSalutation: boolean;\n\n /**\n * Represents whether gender is mandatory or not.\n */\n genderMandatory: boolean;\n\n /**\n * Indicates whether the birth date is mandatory or not.\n */\n birthDateMandatory: boolean;\n\n /**\n * Flag to indicate if a mobile phone is mandatory.\n */\n mobilePhoneMandatory: boolean;\n\n /**\n * Flag to indicate whether the home phone number is mandatory.\n */\n homePhoneMandatory: boolean;\n\n /**\n * Represents whether the address is mandatory or not.\n */\n addressMandatory: boolean;\n\n /**\n * Represents whether the media is mandatory or not.\n */\n mediaMandatory: boolean;\n\n /**\n * Represents the document type ID of an invalid image document.\n */\n invalidImageDocumentTypeId: string;\n\n /**\n * Represents the unique identifier for the application note document type.\n */\n applicationNoteDocumentTypeId: string;\n\n /**\n * The reference to the default advertisement.\n */\n defaultAdvertisementReference: string;\n\n /**\n * Represents whether a note should be displayed or not.\n */\n showNote: boolean;\n\n /**\n * Flag indicating whether saving a disclaimer is mandatory.\n */\n allowSaveDisclaimerMandatory: boolean;\n\n /**\n * Indicates whether the email should be repeated or not.\n */\n repeatEmail: boolean;\n\n /**\n * The `allowSaveDisclaimer` variable stores the disclaimer text that is used to determine whether saving is allowed or not.\n */\n allowSaveDisclaimer: string;\n\n /**\n * Represents the confirmation page for a website.\n */\n confirmationPage: string;\n\n /**\n * Represents information about an attachment.\n */\n attachmentInfo: string;\n\n /**\n * The unique identifier for a candidate mailing template.\n */\n candidateMailingTemplateId: string;\n\n /**\n * Represents an array of {@link Attachment}.\n */\n attachments: Attachment[];\n\n /**\n * Indicates whether sign-in with LinkedIn is enabled.\n */\n enableSignInWithLinkedIn: boolean;\n\n /**\n * Indicates whether Jobindex QuickApply is enabled.\n */\n enableJobindexQuickApply: boolean;\n}\n\n/**\n * @internal\n */\nexport interface ApplicationFormSettings {\n enablePicturePreview?: boolean;\n showColonInFieldNames?: boolean;\n}\n","/**\n * @public\n */\nexport enum DataPlacement {\n Show = 'Show',\n Hide = 'Hide',\n Sidebar = 'Sidebar',\n}\n\n/**\n * @public\n */\nexport interface VacancyDetailsConfiguration {\n /**\n * Specifies if the start date is shown and where.\n */\n showStartDate?: DataPlacement;\n\n /**\n * Specifies if the end date is shown and where.\n */\n showEndDate?: DataPlacement;\n\n /**\n * Specifies if the vacancy type is shown and where.\n */\n showVacancyType?: DataPlacement;\n\n /**\n * Specifies if the contact person name is shown and where.\n */\n showContactPersonName?: DataPlacement;\n\n /**\n * Specifies if the contact person work phone is shown and where.\n */\n showContactPersonWorkPhone?: DataPlacement;\n\n /**\n * Specifies if the contact person mobile phone is shown and where.\n */\n showContactPersonMobilePhone?: DataPlacement;\n\n /**\n * Specifies if the contact person email is shown and where.\n */\n showContactPersonEmail?: DataPlacement;\n\n /**\n * Specifies if the position start date is shown and where.\n */\n showPositionStartDate?: DataPlacement;\n\n /**\n * Specifies if the employment category name is shown and where.\n */\n showEmploymentCategoryName?: DataPlacement;\n\n /**\n * Specifies if the organization name is shown and where.\n */\n showOrganizationName?: DataPlacement;\n\n /**\n * Specifies if the locations are shown and where.\n */\n showLocations?: DataPlacement;\n\n /**\n * Specifies if the regions are shown and where.\n */\n showRegions?: DataPlacement;\n\n /**\n * Specifies if the teaser is shown and where.\n */\n showTeaser?: DataPlacement;\n\n /**\n * Specifies if the company name is shown and where.\n */\n showCompanyName?: DataPlacement;\n\n /**\n * Specifies if the company address is shown and where.\n */\n showCompanyAddress?: DataPlacement;\n\n /**\n * Whether to display dates in a long date format.\n * If false, will use the short date format.\n */\n showLongDate?: boolean;\n\n /**\n * Indicates whether to include the advertisement text.\n *\n * The text also includes base64 encoded images leading to increased response times.\n */\n includeAdvertisementText?: boolean;\n\n /**\n * Indicates whether to show the banner image or not.\n */\n showImage?: boolean;\n}\n","/**\n * @public\n */\nexport enum AccessType {\n All = 'All',\n External = 'External',\n Internal = 'Internal',\n}\n\nexport enum UnsolicitedType {\n Hide = 'Hide',\n Only = 'Only',\n Bottom = 'Bottom',\n Top = 'Top',\n}\n\n/**\n * @public\n */\nexport interface VacancyListFilters {\n /**\n * Represents a date in the format of \"YYYY-MM-DD\".\n */\n perDate?: string;\n\n /**\n * Filters for a specific vacancy type.\n */\n vacancyTypeId?: string;\n\n /**\n * Filters for a specific region.\n */\n regionName?: string;\n\n /**\n * Filters for a specific location.\n */\n locationId?: string;\n\n /**\n * Filters for a specific area.\n */\n vacancyAreaName?: string;\n\n /**\n * Filters for a specific media id.\n */\n mediaId?: string;\n\n /**\n * Filters for unsolicited vacancies, also defines the placement in the list in case of the Vacancy List web component usage.\n */\n unsolicited?: UnsolicitedType;\n\n /**\n * Filters for a specific {@link AccessType}\n */\n access?: AccessType;\n}\n","/**\n * @public\n */\nexport enum SortFieldType {\n Description = 'Description',\n StartDate = 'StartDate',\n EndDate = 'EndDate',\n Priority = 'Priority',\n}\n\n/**\n * @public\n */\nexport interface VacancyListConfiguration {\n /**\n * Indicates whether to include the advertisement text.\n *\n * The text also includes base64 encoded images leading to increased response times.\n */\n includeAdvertisementText?: boolean;\n\n /**\n * Indicates whether the start date of a show should be displayed.\n */\n showStartDate?: boolean;\n\n /**\n * Represents whether to show the end date or not.\n */\n showEndDate?: boolean;\n\n /**\n * Determines whether the long date should be shown or not.\n */\n showLongDate?: boolean;\n\n /**\n * Indicates whether to show the teaser text or not.\n */\n showTeaserText?: boolean;\n\n /**\n * Determines whether to show locations or not.\n */\n showLocations?: boolean;\n\n /**\n * Specifies whether to show regions.\n */\n showRegions?: boolean;\n\n /**\n * Specifies whether to show areas or not.\n */\n showAreas?: boolean;\n\n /**\n * Specifies whether to show fields of work or not.\n */\n showFieldsOfWork?: boolean;\n\n /**\n * Specified the field used for sorting.\n */\n sortField?: SortFieldType;\n\n /**\n * Indicates whether the sorting should be in descending order.\n */\n sortDescending?: boolean;\n\n /**\n * Indicates whether to show filters or not.\n */\n showFilters?: boolean;\n\n /**\n * Indicates whether to display the apply link.\n */\n showApplyLink?: boolean;\n\n /**\n * Indicates whether to display the search.\n */\n showSearch?: boolean;\n}\n\n/**\n * Configuration that only can be done via HTML attributes.\n * @public\n */\nexport interface VacancyListLocalConfiguration {\n showAreasFilter: boolean;\n showVacancyTypesFilter: boolean;\n showLocationsFilter: boolean;\n showRegionsFilter: boolean;\n showFieldsOfWorkFilter: boolean;\n showEmptyMessage: boolean;\n\n /**\n * Indicates whether to display the list image.\n */\n showImages?: boolean;\n\n /**\n * If no list image is set on a vacancy it will try to show the banner image instead.\n * @see {showImages} must be true in order to make this work.\n */\n useBannerImageFallback?: boolean;\n}\n","const setFilter = <T extends object>(searchParams: URLSearchParams, propertyName: keyof T, filters?: T): void => {\n const value = filters ? filters[propertyName] : undefined;\n\n if (value === undefined) {\n return;\n }\n\n const propertyNameAsString = String(propertyName);\n\n switch (typeof value) {\n case 'boolean':\n searchParams.set(propertyNameAsString, value ? 'true' : 'false');\n break;\n\n case 'string':\n searchParams.set(propertyNameAsString, value);\n break;\n\n default:\n throw new Error(`${typeof value} is not implemented yet.`);\n }\n};\n\nexport const assignFilters = <T extends object>(searchParams: URLSearchParams, filters?: T): void => {\n if (!filters) {\n return;\n }\n\n for (const key of Object.keys(filters)) {\n setFilter(searchParams, key as keyof T, filters);\n }\n};\n","import type {\n ApplicationFormType,\n CandidateResult,\n CandidateUpload,\n VacancyDetails,\n VacancyDetailsConfiguration,\n VacancyDetailsFilters,\n VacancyListConfiguration,\n VacancyListFilters,\n} from '../models';\nimport { AccessType, SimpleVacancyDetails } from '../models';\nimport { fetchBackend, getBasePath, getUserLanguageHeader, HttpBackend } from '../helpers';\nimport { assignFilters } from '../helpers/assign-filters';\n\n/**\n * API client to make requests to the Vacancy API.\n *\n * @public\n */\nexport class VacancyClient {\n constructor(\n private readonly baseUrl: string,\n private readonly backend: HttpBackend = fetchBackend,\n ) {}\n\n /**\n * Returns the setup for a Vacancy.\n * @param customerId - Your customer id.\n * @param language - The language to request.\n * @param applicationFormType - The application form type to request.\n */\n getApplicationFormType(customerId: string, language: string, applicationFormType = 'Standard'): Promise<ApplicationFormType> {\n return this.backend.get(`${this.getApplicationFormTypePath(customerId)}/${encodeURIComponent(applicationFormType)}`, {\n ...getUserLanguageHeader(language),\n });\n }\n\n /**\n * Returns the site settings for Vacancy List.\n * @param customerId - Your customer id.\n * @param language - The language to request.\n */\n getVacancyListConfiguration(customerId: string, language: string): Promise<VacancyListConfiguration> {\n return this.backend.get(this.getVacancyListConfigurationPath(customerId), {\n ...getUserLanguageHeader(language),\n });\n }\n\n /**\n * Returns a detailed list of vacancies.\n *\n * The result of this API should be cached and reused.\n *\n * @param customerId - Your customer id.\n * @param language - The language to request.\n * @param filtersAndConfiguration - Filters and configuration to apply to the request.\n */\n async getVacancyList(\n customerId: string,\n language: string,\n filtersAndConfiguration?: VacancyListFilters & VacancyListConfiguration,\n ): Promise<VacancyDetails[]> {\n const url = new URL(this.getVacancyListPath(customerId));\n\n assignFilters(url.searchParams, this.setDefaultFilter(filtersAndConfiguration));\n\n const result = await this.backend.get<VacancyDetails[]>(url.toString(), {\n ...getUserLanguageHeader(language),\n });\n\n return result.map(item => this.prepareVacancyDetailsModel(item));\n }\n\n /**\n * Returns a less detailed list of vacancies.\n * @param customerId - Your customer id.\n * @param language - The language to request.\n * @param filtersAndConfiguration - Filters and configuration to apply to the request.\n */\n async getSimpleVacancyList(\n customerId: string,\n language: string,\n filtersAndConfiguration?: VacancyListFilters & VacancyListConfiguration,\n ): Promise<SimpleVacancyDetails[]> {\n const url = new URL(this.getSimpleVacancyListPath(customerId));\n\n assignFilters(url.searchParams, this.setDefaultFilter(filtersAndConfiguration));\n\n const result = await this.backend.get<SimpleVacancyDetails[]>(url.toString(), {\n ...getUserLanguageHeader(language),\n });\n\n return result.map(item => this.prepareSimpleVacancyDetailsModel(item));\n }\n\n /**\n * Returns the site settings for Vacancy.\n * @param customerId - Your customer id.\n * @param language - The language to request.\n */\n getVacancyDetailsConfiguration(customerId: string, language: string): Promise<VacancyDetailsConfiguration> {\n return this.backend.get(this.getVacancyDetailsConfigurationPath(customerId), {\n ...getUserLanguageHeader(language),\n });\n }\n\n /**\n * Returns a single vacancy.\n * @param customerId - Your customer id.\n * @param language - The language to request.\n * @param id - The id of the vacancy.\n * @param filters - The filters to apply to the request.\n */\n async getVacancyDetails(customerId: string, id: string, language: string, filters?: VacancyDetailsFilters): Promise<VacancyDetails> {\n const url = new URL(`${this.getBasePath(customerId)}/${encodeURIComponent(id)}`);\n\n assignFilters(url.searchParams, filters);\n\n const result = await this.backend.get<VacancyDetails>(url.toString(), {\n ...getUserLanguageHeader(language),\n });\n\n return this.prepareVacancyDetailsModel(result);\n }\n\n /**\n * Creates a new candidate for a vacancy.\n * @param customerId - Your customer id.\n * @param language - The language to request.\n * @param candidate - The candidate to add to the vacancy.\n * @param attachments - Attachments to upload.\n * @param image - Candidate image.\n */\n createCandidate(customerId: string, language: string, candidate: CandidateUpload, attachments: File[], image?: File): Promise<CandidateResult> {\n const formData = new FormData();\n attachments.forEach(attachment => formData.append('attachments', attachment));\n if (image) {\n formData.set('image', image);\n }\n\n formData.set('candidate', JSON.stringify(candidate));\n\n return this.backend.post(`${this.getCandidatePath(customerId)}`, formData, {\n ...getUserLanguageHeader(language),\n });\n }\n\n private prepareVacancyDetailsModel(model: VacancyDetails): VacancyDetails {\n return this.assignEmptyArraysOnNullOrUndefinedListFieldsForVacancyDetailsModel(this.mapDeprecatedVacancyDetailsFields(model));\n }\n\n private prepareSimpleVacancyDetailsModel(model: SimpleVacancyDetails): SimpleVacancyDetails {\n return this.assignEmptyArraysOnNullOrUndefinedListFieldsForSimpleVacancyDetailsModel(model);\n }\n\n private mapDeprecatedVacancyDetailsFields(model: VacancyDetails): VacancyDetails {\n // noinspection JSDeprecatedSymbols\n return {\n ...model,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n contactEmployeeWorkPhoneNumber: model.contactEmployeeWorkPhoneNumber ?? model.contactEmployeWorkPhoneNumber,\n };\n }\n\n private assignEmptyArraysOnNullOrUndefinedListFieldsForSimpleVacancyDetailsModel(model: SimpleVacancyDetails): SimpleVacancyDetails {\n return {\n ...model,\n areas: model.areas ?? [],\n fieldsOfWork: model.fieldsOfWork ?? [],\n locations: model.locations ?? [],\n regions: model.regions ?? [],\n };\n }\n\n private assignEmptyArraysOnNullOrUndefinedListFieldsForVacancyDetailsModel(model: VacancyDetails): VacancyDetails {\n return {\n ...model,\n ...this.assignEmptyArraysOnNullOrUndefinedListFieldsForSimpleVacancyDetailsModel(model),\n medias: model.medias ?? [],\n vacancyElements: model.vacancyElements ?? [],\n };\n }\n\n private setDefaultFilter<T extends VacancyListFilters>(input: T | undefined): T {\n return { ...input, access: input?.access ?? AccessType.External } as T;\n }\n\n private getBasePath(customerId: string): string {\n return `${getBasePath(this.baseUrl, customerId)}/vacancies`;\n }\n\n private getApplicationFormTypePath(customerId: string): string {\n return `${getBasePath(this.baseUrl, customerId)}/candidates/types`;\n }\n\n private getCandidatePath(customerId: string): string {\n return `${getBasePath(this.baseUrl, customerId)}/candidates`;\n }\n\n private getVacancyListPath(customerId: string): string {\n return `${this.getBasePath(customerId)}/detailed`;\n }\n\n private getSimpleVacancyListPath(customerId: string): string {\n return `${this.getBasePath(customerId)}/simple`;\n }\n\n private getConfigurationPath(customerId: string): string {\n return `${this.getBasePath(customerId)}/configuration`;\n }\n\n private getVacancyListConfigurationPath(customerId: string): string {\n return `${this.getConfigurationPath(customerId)}/list`;\n }\n\n private getVacancyDetailsConfigurationPath(customerId: string): string {\n return `${this.getConfigurationPath(customerId)}/details`;\n }\n}\n"],"mappings":"0aAAM,SAAUA,EAAYC,EAAiBC,EAAkB,CAC3D,MAAO,GAAGD,CAAO,IAAIE,mBAAmBD,CAAU,CAAC,EACvD,CCFM,SAAUE,EAAsBC,EAAgB,CAClD,MAAO,CAAE,0BAA2BA,CAAQ,CAChD,CCCM,IAAOC,EAAP,cAAyBC,KAAK,CAChCC,YACaC,EACTC,EAAe,CAEf,MAAMA,CAAO,EAHJ,KAAAD,SAAAA,CAIb,CAEA,IAAIE,QAAM,CACN,OAAO,KAAKF,SAASE,MACzB,GCCG,IAAMC,EAA4B,CACrC,MAAMC,IAAOC,EAAaC,EAA+B,CACrD,OAAO,MAAMH,EAAaI,YAAYF,EAAK,MAAOC,CAAO,CAC7D,EACA,MAAME,KAAQH,EAAaI,EAAeH,EAA+B,CACrE,OAAO,MAAMH,EAAaI,YAAYF,EAAK,OAAQC,EAASG,CAAI,CACpE,EACA,MAAMC,IAAOL,EAAaI,EAAeH,EAA+B,CACpE,OAAO,MAAMH,EAAaI,YAAYF,EAAK,MAAOC,EAASG,CAAI,CACnE,EACA,MAAME,OAAUN,EAAaI,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,GAAG,KAAK+D,qBAAqB/D,CAAU,CAAC,OACnD,CAEQ0B,mCAAmC1B,EAAkB,CACzD,MAAO,GAAG,KAAK+D,qBAAqB/D,CAAU,CAAC,UACnD","names":["getBasePath","baseUrl","customerId","encodeURIComponent","getUserLanguageHeader","language","HttpError","Error","constructor","response","message","status","fetchBackend","get","url","headers","sendRequest","post","body","put","delete","method","response","fetch","convertToBodyInit","text","ok","status","statusText","HttpError","JSON","parse","Blob","ArrayBuffer","FormData","URLSearchParams","stringify","getJsonContentTypeHeader","JobAgentClient","constructor","basePath","backend","fetchBackend","getJobAgentConfiguration","customerId","language","get","getBaseUrl","__spreadValues","getUserLanguageHeader","getJobAgentType","type","encodeURIComponent","getJobAgent","jobAgentId","code","post","getDefaultPostHeaders","createJobAgent","jobAgent","updateJobAgent","put","deleteJobAgent","delete","resendEmail","email","activate","getBasePath","getJsonContentTypeHeader","LookupClient","constructor","baseUrl","backend","fetchBackend","getLookups","customerId","language","get","getBasePath","__spreadValues","getUserLanguageHeader","AttachmentType","DataPlacement","AccessType","UnsolicitedType","SortFieldType","setFilter","searchParams","propertyName","filters","value","undefined","propertyNameAsString","String","set","Error","assignFilters","key","Object","keys","VacancyClient","constructor","baseUrl","backend","fetchBackend","getApplicationFormType","customerId","language","applicationFormType","get","getApplicationFormTypePath","encodeURIComponent","__spreadValues","getUserLanguageHeader","getVacancyListConfiguration","getVacancyListConfigurationPath","getVacancyList","filtersAndConfiguration","url","URL","getVacancyListPath","assignFilters","searchParams","setDefaultFilter","toString","map","item","prepareVacancyDetailsModel","getSimpleVacancyList","getSimpleVacancyListPath","prepareSimpleVacancyDetailsModel","getVacancyDetailsConfiguration","getVacancyDetailsConfigurationPath","getVacancyDetails","id","filters","getBasePath","result","createCandidate","candidate","attachments","image","formData","FormData","forEach","attachment","append","set","JSON","stringify","post","getCandidatePath","model","assignEmptyArraysOnNullOrUndefinedListFieldsForVacancyDetailsModel","mapDeprecatedVacancyDetailsFields","assignEmptyArraysOnNullOrUndefinedListFieldsForSimpleVacancyDetailsModel","__spreadProps","contactEmployeeWorkPhoneNumber","contactEmployeWorkPhoneNumber","areas","fieldsOfWork","locations","regions","medias","vacancyElements","input","access","AccessType","External","getConfigurationPath"],"file":"dist/api-client/api-client.mjs"}