/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { lazySchema as lazySchema$, safeParse } from "../../lib/schemas.js"; import * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Address, Address$inboundSchema, Address$Outbound, Address$outboundSchema, } from "./address.js"; import { CustomField, CustomField$inboundSchema, CustomField$Outbound, CustomField$outboundSchema, } from "./customfield.js"; import { Email, Email$inboundSchema, Email$Outbound, Email$outboundSchema, } from "./email.js"; import { PassThroughBody, PassThroughBody$inboundSchema, PassThroughBody$Outbound, PassThroughBody$outboundSchema, } from "./passthroughbody.js"; import { PhoneNumber, PhoneNumber$inboundSchema, PhoneNumber$Outbound, PhoneNumber$outboundSchema, } from "./phonenumber.js"; /** * The gender represents the gender identity of a person. */ export const ApplicantGender = { Male: "male", Female: "female", Unisex: "unisex", Other: "other", NotSpecified: "not_specified", } as const; /** * The gender represents the gender identity of a person. */ export type ApplicantGender = OpenEnum; /** * The type of website */ export const ApplicantType = { Primary: "primary", Secondary: "secondary", Work: "work", Personal: "personal", Other: "other", } as const; /** * The type of website */ export type ApplicantType = OpenEnum; export type Websites = { /** * Unique identifier for the website */ id?: string | null | undefined; /** * The website URL */ url: string; /** * The type of website */ type?: ApplicantType | null | undefined; }; export type SocialLinks = { /** * Unique identifier of the social link */ id?: string | null | undefined; /** * URL of the social link, e.g. https://www.twitter.com/apideck */ url: string; /** * Type of the social link, e.g. twitter */ type?: string | null | undefined; }; export type Applicant = { /** * A unique identifier for an object. */ id?: string | undefined; /** * The name of an applicant. */ name?: string | undefined; /** * A formal salutation for the person. For example, 'Mr', 'Mrs' */ salutation?: string | null | undefined; /** * The first name of the person. */ firstName?: string | null | undefined; /** * The last name of the person. */ lastName?: string | null | undefined; /** * Middle name of the person. */ middleName?: string | null | undefined; /** * The initials of the person, usually derived from their first, middle, and last names. */ initials?: string | null | undefined; /** * The date of birth of the person. */ birthday?: Date | null | undefined; /** * The gender represents the gender identity of a person. */ gender?: ApplicantGender | null | undefined; /** * A unique identifier assigned by the government. This field is considered sensitive information and may be subject to special security and privacy restrictions. */ socialSecurityNumber?: string | null | undefined; type?: string | undefined; coverLetter?: string | undefined; jobUrl?: string | null | undefined; /** * The URL of the photo of a person. */ photoUrl?: string | null | undefined; /** * Typically a list of previous companies where the contact has worked or schools that the contact has attended */ headline?: string | undefined; /** * The job title of the person. */ title?: string | null | undefined; emails?: Array | undefined; customFields?: Array | undefined; phoneNumbers?: Array | undefined; addresses?: Array
| undefined; websites?: Array | undefined; socialLinks?: Array | undefined; stageId?: string | undefined; recruiterId?: string | undefined; coordinatorId?: string | undefined; applicationIds?: Array | null | undefined; /** * Deprecated: Use application_ids instead. Array of application IDs associated with the applicant. * * @deprecated field: Deprecated. Use application_ids instead.. */ applications?: Array | null | undefined; followers?: Array | null | undefined; sources?: Array | null | undefined; sourceId?: string | undefined; confidential?: boolean | undefined; anonymized?: boolean | undefined; tags?: Array | null | undefined; archived?: boolean | null | undefined; lastInteractionAt?: Date | null | undefined; ownerId?: string | null | undefined; sourcedBy?: string | null | undefined; cvUrl?: string | undefined; recordUrl?: string | null | undefined; rejectedAt?: Date | null | undefined; /** * When custom mappings are configured on the resource, the result is included here. */ customMappings?: { [k: string]: any } | null | undefined; /** * Flag to indicate if the object is deleted. */ deleted?: boolean | null | undefined; /** * The user who deleted the object. */ deletedBy?: string | null | undefined; /** * The time at which the object was deleted. */ deletedAt?: Date | null | undefined; /** * The user who last updated the object. */ updatedBy?: string | null | undefined; /** * The user who created the object. */ createdBy?: string | null | undefined; /** * The date and time when the object was last updated. */ updatedAt?: Date | null | undefined; /** * The date and time when the object was created. */ createdAt?: Date | null | undefined; /** * The pass_through property allows passing service-specific, custom data or structured modifications in request body when creating or updating resources. */ passThrough?: Array | undefined; }; export type ApplicantInput = { /** * The name of an applicant. */ name?: string | undefined; /** * A formal salutation for the person. For example, 'Mr', 'Mrs' */ salutation?: string | null | undefined; /** * The first name of the person. */ firstName?: string | null | undefined; /** * The last name of the person. */ lastName?: string | null | undefined; /** * Middle name of the person. */ middleName?: string | null | undefined; /** * The initials of the person, usually derived from their first, middle, and last names. */ initials?: string | null | undefined; /** * The date of birth of the person. */ birthday?: Date | null | undefined; /** * The gender represents the gender identity of a person. */ gender?: ApplicantGender | null | undefined; /** * A unique identifier assigned by the government. This field is considered sensitive information and may be subject to special security and privacy restrictions. */ socialSecurityNumber?: string | null | undefined; type?: string | undefined; coverLetter?: string | undefined; /** * The URL of the photo of a person. */ photoUrl?: string | null | undefined; /** * Typically a list of previous companies where the contact has worked or schools that the contact has attended */ headline?: string | undefined; /** * The job title of the person. */ title?: string | null | undefined; emails?: Array | undefined; customFields?: Array | undefined; phoneNumbers?: Array | undefined; addresses?: Array
| undefined; websites?: Array | undefined; socialLinks?: Array | undefined; stageId?: string | undefined; recruiterId?: string | undefined; coordinatorId?: string | undefined; applicationIds?: Array | null | undefined; /** * Deprecated: Use application_ids instead. Array of application IDs associated with the applicant. * * @deprecated field: Deprecated. Use application_ids instead.. */ applications?: Array | null | undefined; followers?: Array | null | undefined; sources?: Array | null | undefined; confidential?: boolean | undefined; anonymized?: boolean | undefined; tags?: Array | null | undefined; archived?: boolean | null | undefined; ownerId?: string | null | undefined; recordUrl?: string | null | undefined; /** * Flag to indicate if the object is deleted. */ deleted?: boolean | null | undefined; /** * The pass_through property allows passing service-specific, custom data or structured modifications in request body when creating or updating resources. */ passThrough?: Array | undefined; }; /** @internal */ export const ApplicantGender$inboundSchema: z.ZodType< ApplicantGender, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => openEnums.inboundSchema(ApplicantGender)); /** @internal */ export const ApplicantGender$outboundSchema: z.ZodType< string, z.ZodTypeDef, ApplicantGender > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(ApplicantGender) ); /** @internal */ export const ApplicantType$inboundSchema: z.ZodType< ApplicantType, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => openEnums.inboundSchema(ApplicantType)); /** @internal */ export const ApplicantType$outboundSchema: z.ZodType< string, z.ZodTypeDef, ApplicantType > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(ApplicantType)); /** @internal */ export const Websites$inboundSchema: z.ZodType< Websites, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ id: z.nullable(types.string()).optional(), url: types.string(), type: z.nullable(ApplicantType$inboundSchema).optional(), }) ); /** @internal */ export type Websites$Outbound = { id?: string | null | undefined; url: string; type?: string | null | undefined; }; /** @internal */ export const Websites$outboundSchema: z.ZodType< Websites$Outbound, z.ZodTypeDef, Websites > = /* @__PURE__ */ lazySchema$(() => z.object({ id: z.nullable(z.string()).optional(), url: z.string(), type: z.nullable(ApplicantType$outboundSchema).optional(), }) ); export function websitesToJSON(websites: Websites): string { return JSON.stringify(Websites$outboundSchema.parse(websites)); } export function websitesFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Websites$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Websites' from JSON`, ); } /** @internal */ export const SocialLinks$inboundSchema: z.ZodType< SocialLinks, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ id: z.nullable(types.string()).optional(), url: types.string(), type: z.nullable(types.string()).optional(), }) ); /** @internal */ export type SocialLinks$Outbound = { id?: string | null | undefined; url: string; type?: string | null | undefined; }; /** @internal */ export const SocialLinks$outboundSchema: z.ZodType< SocialLinks$Outbound, z.ZodTypeDef, SocialLinks > = /* @__PURE__ */ lazySchema$(() => z.object({ id: z.nullable(z.string()).optional(), url: z.string(), type: z.nullable(z.string()).optional(), }) ); export function socialLinksToJSON(socialLinks: SocialLinks): string { return JSON.stringify(SocialLinks$outboundSchema.parse(socialLinks)); } export function socialLinksFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => SocialLinks$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SocialLinks' from JSON`, ); } /** @internal */ export const Applicant$inboundSchema: z.ZodType< Applicant, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ id: types.optional(types.string()), name: types.optional(types.string()), salutation: z.nullable(types.string()).optional(), first_name: z.nullable(types.string()).optional(), last_name: z.nullable(types.string()).optional(), middle_name: z.nullable(types.string()).optional(), initials: z.nullable(types.string()).optional(), birthday: z.nullable(types.date()).optional(), gender: z.nullable(ApplicantGender$inboundSchema).optional(), social_security_number: z.nullable(types.string()).optional(), type: types.optional(types.string()), cover_letter: types.optional(types.string()), job_url: z.nullable(types.string()).optional(), photo_url: z.nullable(types.string()).optional(), headline: types.optional(types.string()), title: z.nullable(types.string()).optional(), emails: types.optional(z.array(Email$inboundSchema)), custom_fields: types.optional(z.array(CustomField$inboundSchema)), phone_numbers: types.optional(z.array(PhoneNumber$inboundSchema)), addresses: types.optional(z.array(Address$inboundSchema)), websites: types.optional(z.array(z.lazy(() => Websites$inboundSchema))), social_links: types.optional( z.array(z.lazy(() => SocialLinks$inboundSchema)), ), stage_id: types.optional(types.string()), recruiter_id: types.optional(types.string()), coordinator_id: types.optional(types.string()), application_ids: z.nullable(z.array(types.string())).optional(), applications: z.nullable(z.array(types.string())).optional(), followers: z.nullable(z.array(types.string())).optional(), sources: z.nullable(z.array(types.string())).optional(), source_id: types.optional(types.string()), confidential: types.optional(types.boolean()), anonymized: types.optional(types.boolean()), tags: z.nullable(z.array(types.string())).optional(), archived: z.nullable(types.boolean()).optional(), last_interaction_at: z.nullable(types.date()).optional(), owner_id: z.nullable(types.string()).optional(), sourced_by: z.nullable(types.string()).optional(), cv_url: types.optional(types.string()), record_url: z.nullable(types.string()).optional(), rejected_at: z.nullable(types.date()).optional(), custom_mappings: z.nullable(z.record(z.any())).optional(), deleted: z.nullable(types.boolean()).optional(), deleted_by: z.nullable(types.string()).optional(), deleted_at: z.nullable(types.date()).optional(), updated_by: z.nullable(types.string()).optional(), created_by: z.nullable(types.string()).optional(), updated_at: z.nullable(types.date()).optional(), created_at: z.nullable(types.date()).optional(), pass_through: types.optional(z.array(PassThroughBody$inboundSchema)), }).transform((v) => { return remap$(v, { "first_name": "firstName", "last_name": "lastName", "middle_name": "middleName", "social_security_number": "socialSecurityNumber", "cover_letter": "coverLetter", "job_url": "jobUrl", "photo_url": "photoUrl", "custom_fields": "customFields", "phone_numbers": "phoneNumbers", "social_links": "socialLinks", "stage_id": "stageId", "recruiter_id": "recruiterId", "coordinator_id": "coordinatorId", "application_ids": "applicationIds", "source_id": "sourceId", "last_interaction_at": "lastInteractionAt", "owner_id": "ownerId", "sourced_by": "sourcedBy", "cv_url": "cvUrl", "record_url": "recordUrl", "rejected_at": "rejectedAt", "custom_mappings": "customMappings", "deleted_by": "deletedBy", "deleted_at": "deletedAt", "updated_by": "updatedBy", "created_by": "createdBy", "updated_at": "updatedAt", "created_at": "createdAt", "pass_through": "passThrough", }); }) ); export function applicantFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Applicant$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Applicant' from JSON`, ); } /** @internal */ export type ApplicantInput$Outbound = { name?: string | undefined; salutation?: string | null | undefined; first_name?: string | null | undefined; last_name?: string | null | undefined; middle_name?: string | null | undefined; initials?: string | null | undefined; birthday?: string | null | undefined; gender?: string | null | undefined; social_security_number?: string | null | undefined; type?: string | undefined; cover_letter?: string | undefined; photo_url?: string | null | undefined; headline?: string | undefined; title?: string | null | undefined; emails?: Array | undefined; custom_fields?: Array | undefined; phone_numbers?: Array | undefined; addresses?: Array | undefined; websites?: Array | undefined; social_links?: Array | undefined; stage_id?: string | undefined; recruiter_id?: string | undefined; coordinator_id?: string | undefined; application_ids?: Array | null | undefined; applications?: Array | null | undefined; followers?: Array | null | undefined; sources?: Array | null | undefined; confidential?: boolean | undefined; anonymized?: boolean | undefined; tags?: Array | null | undefined; archived?: boolean | null | undefined; owner_id?: string | null | undefined; record_url?: string | null | undefined; deleted?: boolean | null | undefined; pass_through?: Array | undefined; }; /** @internal */ export const ApplicantInput$outboundSchema: z.ZodType< ApplicantInput$Outbound, z.ZodTypeDef, ApplicantInput > = /* @__PURE__ */ lazySchema$(() => z.object({ name: z.string().optional(), salutation: z.nullable(z.string()).optional(), firstName: z.nullable(z.string()).optional(), lastName: z.nullable(z.string()).optional(), middleName: z.nullable(z.string()).optional(), initials: z.nullable(z.string()).optional(), birthday: z.nullable( z.date().transform(v => v.toISOString().slice(0, "YYYY-MM-DD".length)), ).optional(), gender: z.nullable(ApplicantGender$outboundSchema).optional(), socialSecurityNumber: z.nullable(z.string()).optional(), type: z.string().optional(), coverLetter: z.string().optional(), photoUrl: z.nullable(z.string()).optional(), headline: z.string().optional(), title: z.nullable(z.string()).optional(), emails: z.array(Email$outboundSchema).optional(), customFields: z.array(CustomField$outboundSchema).optional(), phoneNumbers: z.array(PhoneNumber$outboundSchema).optional(), addresses: z.array(Address$outboundSchema).optional(), websites: z.array(z.lazy(() => Websites$outboundSchema)).optional(), socialLinks: z.array(z.lazy(() => SocialLinks$outboundSchema)).optional(), stageId: z.string().optional(), recruiterId: z.string().optional(), coordinatorId: z.string().optional(), applicationIds: z.nullable(z.array(z.string())).optional(), applications: z.nullable(z.array(z.string())).optional(), followers: z.nullable(z.array(z.string())).optional(), sources: z.nullable(z.array(z.string())).optional(), confidential: z.boolean().optional(), anonymized: z.boolean().optional(), tags: z.nullable(z.array(z.string())).optional(), archived: z.nullable(z.boolean()).optional(), ownerId: z.nullable(z.string()).optional(), recordUrl: z.nullable(z.string()).optional(), deleted: z.nullable(z.boolean()).optional(), passThrough: z.array(PassThroughBody$outboundSchema).optional(), }).transform((v) => { return remap$(v, { firstName: "first_name", lastName: "last_name", middleName: "middle_name", socialSecurityNumber: "social_security_number", coverLetter: "cover_letter", photoUrl: "photo_url", customFields: "custom_fields", phoneNumbers: "phone_numbers", socialLinks: "social_links", stageId: "stage_id", recruiterId: "recruiter_id", coordinatorId: "coordinator_id", applicationIds: "application_ids", ownerId: "owner_id", recordUrl: "record_url", passThrough: "pass_through", }); }) ); export function applicantInputToJSON(applicantInput: ApplicantInput): string { return JSON.stringify(ApplicantInput$outboundSchema.parse(applicantInput)); }