/* * 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 { Currency, Currency$inboundSchema, Currency$outboundSchema, } from "./currency.js"; import { CustomField, CustomField$inboundSchema, CustomField$Outbound, CustomField$outboundSchema, } from "./customfield.js"; import { Department, Department$inboundSchema } from "./department.js"; import { DepartmentInput, DepartmentInput$Outbound, DepartmentInput$outboundSchema, } from "./departmentinput.js"; import { JobStatus, JobStatus$inboundSchema, JobStatus$outboundSchema, } from "./jobstatus.js"; /** * The visibility of the job */ export const Visibility = { Draft: "draft", Public: "public", Internal: "internal", } as const; /** * The visibility of the job */ export type Visibility = OpenEnum; export const EmploymentTerms = { FullTime: "full-time", PartTime: "part-time", Internship: "internship", Contractor: "contractor", Employee: "employee", Freelance: "freelance", Temp: "temp", Seasonal: "seasonal", Volunteer: "volunteer", Other: "other", } as const; export type EmploymentTerms = OpenEnum; /** * Details of the branch for which the job is created. */ export type Branch = { /** * A unique identifier for an object. */ id?: string | undefined; /** * Name of the branch. */ name?: string | undefined; }; export type Blocks = { title?: string | undefined; content?: string | null | undefined; }; export type Salary = { /** * Minimum salary payable for the job role. */ min?: number | undefined; /** * Maximum salary payable for the job role. */ max?: number | undefined; /** * Indicates the associated currency for an amount of money. Values correspond to [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217). */ currency?: Currency | null | undefined; interval?: string | null | undefined; }; export const JobType = { JobPortal: "job_portal", JobDescription: "job_description", } as const; export type JobType = OpenEnum; export type JobLinks = { type?: JobType | undefined; url?: string | undefined; }; export type Job = { /** * A unique identifier for an object. */ id?: string | undefined; slug?: string | null | undefined; /** * The job title of the person. */ title?: string | null | undefined; /** * Sequence in relation to other jobs. */ sequence?: number | undefined; /** * The visibility of the job */ visibility?: Visibility | undefined; /** * The status of the job. */ status?: JobStatus | undefined; /** * The code of the job. */ code?: string | undefined; /** * language code according to ISO 639-1. For the United States - EN */ language?: string | null | undefined; employmentTerms?: EmploymentTerms | null | undefined; /** * Level of experience required for the job role. */ experience?: string | undefined; /** * Specifies the location for the job posting. */ location?: string | null | undefined; /** * Specifies whether the posting is for a remote job. */ remote?: boolean | null | undefined; /** * A job's Requisition ID (Req ID) allows your organization to identify and track a job based on alphanumeric naming conventions unique to your company's internal processes. */ requisitionId?: string | undefined; department?: Department | undefined; /** * Details of the branch for which the job is created. */ branch?: Branch | undefined; /** * The recruiter is generally someone who is tasked to help the hiring manager find and screen qualified applicant */ recruiters?: Array | null | undefined; hiringManagers?: Array | undefined; followers?: Array | null | undefined; /** * A description of the object. */ description?: string | null | undefined; /** * The job description in HTML format */ descriptionHtml?: string | null | undefined; blocks?: Array | undefined; closing?: string | null | undefined; /** * The closing section of the job description in HTML format */ closingHtml?: string | null | undefined; closingDate?: Date | null | undefined; salary?: Salary | undefined; /** * URL of the job description * * @deprecated field: This field is deprecated and may be removed in a future version.. */ url?: string | null | undefined; /** * URL of the job portal * * @deprecated field: This field is deprecated and may be removed in a future version.. */ jobPortalUrl?: string | null | undefined; /** * @deprecated field: This field is deprecated and may be removed in a future version.. */ recordUrl?: string | null | undefined; links?: Array | undefined; confidential?: boolean | undefined; /** * Specifies whether an employee of the organization can apply for the job. */ availableToEmployees?: boolean | undefined; tags?: Array | null | undefined; addresses?: Array
| undefined; customFields?: Array | undefined; /** * Flag to indicate if the object is deleted. */ deleted?: boolean | null | undefined; ownerId?: string | null | undefined; publishedAt?: Date | null | undefined; /** * When custom mappings are configured on the resource, the result is included here. */ customMappings?: { [k: string]: any } | 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; }; /** * Details of the branch for which the job is created. */ export type JobBranch = { /** * Name of the branch. */ name?: string | undefined; }; export type JobInput = { slug?: string | null | undefined; /** * The job title of the person. */ title?: string | null | undefined; /** * Sequence in relation to other jobs. */ sequence?: number | undefined; /** * The visibility of the job */ visibility?: Visibility | undefined; /** * The status of the job. */ status?: JobStatus | undefined; /** * The code of the job. */ code?: string | undefined; /** * language code according to ISO 639-1. For the United States - EN */ language?: string | null | undefined; employmentTerms?: EmploymentTerms | null | undefined; /** * Level of experience required for the job role. */ experience?: string | undefined; /** * Specifies the location for the job posting. */ location?: string | null | undefined; /** * Specifies whether the posting is for a remote job. */ remote?: boolean | null | undefined; /** * A job's Requisition ID (Req ID) allows your organization to identify and track a job based on alphanumeric naming conventions unique to your company's internal processes. */ requisitionId?: string | undefined; department?: DepartmentInput | undefined; /** * Details of the branch for which the job is created. */ branch?: JobBranch | undefined; /** * The recruiter is generally someone who is tasked to help the hiring manager find and screen qualified applicant */ recruiters?: Array | null | undefined; hiringManagers?: Array | undefined; followers?: Array | null | undefined; /** * A description of the object. */ description?: string | null | undefined; /** * The job description in HTML format */ descriptionHtml?: string | null | undefined; blocks?: Array | undefined; closing?: string | null | undefined; /** * The closing section of the job description in HTML format */ closingHtml?: string | null | undefined; closingDate?: Date | null | undefined; salary?: Salary | undefined; /** * URL of the job description * * @deprecated field: This field is deprecated and may be removed in a future version.. */ url?: string | null | undefined; /** * URL of the job portal * * @deprecated field: This field is deprecated and may be removed in a future version.. */ jobPortalUrl?: string | null | undefined; /** * @deprecated field: This field is deprecated and may be removed in a future version.. */ recordUrl?: string | null | undefined; links?: Array | undefined; confidential?: boolean | undefined; /** * Specifies whether an employee of the organization can apply for the job. */ availableToEmployees?: boolean | undefined; tags?: Array | null | undefined; addresses?: Array
| undefined; customFields?: Array | undefined; /** * Flag to indicate if the object is deleted. */ deleted?: boolean | null | undefined; ownerId?: string | null | undefined; }; /** @internal */ export const Visibility$inboundSchema: z.ZodType< Visibility, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => openEnums.inboundSchema(Visibility)); /** @internal */ export const Visibility$outboundSchema: z.ZodType< string, z.ZodTypeDef, Visibility > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(Visibility)); /** @internal */ export const EmploymentTerms$inboundSchema: z.ZodType< EmploymentTerms, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => openEnums.inboundSchema(EmploymentTerms)); /** @internal */ export const EmploymentTerms$outboundSchema: z.ZodType< string, z.ZodTypeDef, EmploymentTerms > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(EmploymentTerms) ); /** @internal */ export const Branch$inboundSchema: z.ZodType = /* @__PURE__ */ lazySchema$(() => z.object({ id: types.optional(types.string()), name: types.optional(types.string()), }) ); export function branchFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Branch$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Branch' from JSON`, ); } /** @internal */ export const Blocks$inboundSchema: z.ZodType = /* @__PURE__ */ lazySchema$(() => z.object({ title: types.optional(types.string()), content: z.nullable(types.string()).optional(), }) ); /** @internal */ export type Blocks$Outbound = { title?: string | undefined; content?: string | null | undefined; }; /** @internal */ export const Blocks$outboundSchema: z.ZodType< Blocks$Outbound, z.ZodTypeDef, Blocks > = /* @__PURE__ */ lazySchema$(() => z.object({ title: z.string().optional(), content: z.nullable(z.string()).optional(), }) ); export function blocksToJSON(blocks: Blocks): string { return JSON.stringify(Blocks$outboundSchema.parse(blocks)); } export function blocksFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Blocks$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Blocks' from JSON`, ); } /** @internal */ export const Salary$inboundSchema: z.ZodType = /* @__PURE__ */ lazySchema$(() => z.object({ min: types.optional(types.number()), max: types.optional(types.number()), currency: z.nullable(Currency$inboundSchema).optional(), interval: z.nullable(types.string()).optional(), }) ); /** @internal */ export type Salary$Outbound = { min?: number | undefined; max?: number | undefined; currency?: string | null | undefined; interval?: string | null | undefined; }; /** @internal */ export const Salary$outboundSchema: z.ZodType< Salary$Outbound, z.ZodTypeDef, Salary > = /* @__PURE__ */ lazySchema$(() => z.object({ min: z.number().int().optional(), max: z.number().int().optional(), currency: z.nullable(Currency$outboundSchema).optional(), interval: z.nullable(z.string()).optional(), }) ); export function salaryToJSON(salary: Salary): string { return JSON.stringify(Salary$outboundSchema.parse(salary)); } export function salaryFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Salary$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Salary' from JSON`, ); } /** @internal */ export const JobType$inboundSchema: z.ZodType = /* @__PURE__ */ lazySchema$(() => openEnums.inboundSchema(JobType)); /** @internal */ export const JobType$outboundSchema: z.ZodType = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(JobType)); /** @internal */ export const JobLinks$inboundSchema: z.ZodType< JobLinks, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ type: types.optional(JobType$inboundSchema), url: types.optional(types.string()), }) ); /** @internal */ export type JobLinks$Outbound = { type?: string | undefined; url?: string | undefined; }; /** @internal */ export const JobLinks$outboundSchema: z.ZodType< JobLinks$Outbound, z.ZodTypeDef, JobLinks > = /* @__PURE__ */ lazySchema$(() => z.object({ type: JobType$outboundSchema.optional(), url: z.string().optional(), }) ); export function jobLinksToJSON(jobLinks: JobLinks): string { return JSON.stringify(JobLinks$outboundSchema.parse(jobLinks)); } export function jobLinksFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => JobLinks$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'JobLinks' from JSON`, ); } /** @internal */ export const Job$inboundSchema: z.ZodType = /* @__PURE__ */ lazySchema$(() => z.object({ id: types.optional(types.string()), slug: z.nullable(types.string()).optional(), title: z.nullable(types.string()).optional(), sequence: types.optional(types.number()), visibility: types.optional(Visibility$inboundSchema), status: types.optional(JobStatus$inboundSchema), code: types.optional(types.string()), language: z.nullable(types.string()).optional(), employment_terms: z.nullable(EmploymentTerms$inboundSchema).optional(), experience: types.optional(types.string()), location: z.nullable(types.string()).optional(), remote: z.nullable(types.boolean()).optional(), requisition_id: types.optional(types.string()), department: types.optional(Department$inboundSchema), branch: types.optional(z.lazy(() => Branch$inboundSchema)), recruiters: z.nullable(z.array(types.string())).optional(), hiring_managers: types.optional(z.array(types.string())), followers: z.nullable(z.array(types.string())).optional(), description: z.nullable(types.string()).optional(), description_html: z.nullable(types.string()).optional(), blocks: types.optional(z.array(z.lazy(() => Blocks$inboundSchema))), closing: z.nullable(types.string()).optional(), closing_html: z.nullable(types.string()).optional(), closing_date: z.nullable(types.date()).optional(), salary: types.optional(z.lazy(() => Salary$inboundSchema)), url: z.nullable(types.string()).optional(), job_portal_url: z.nullable(types.string()).optional(), record_url: z.nullable(types.string()).optional(), links: types.optional(z.array(z.lazy(() => JobLinks$inboundSchema))), confidential: types.optional(types.boolean()), available_to_employees: types.optional(types.boolean()), tags: z.nullable(z.array(types.string())).optional(), addresses: types.optional(z.array(Address$inboundSchema)), custom_fields: types.optional(z.array(CustomField$inboundSchema)), deleted: z.nullable(types.boolean()).optional(), owner_id: z.nullable(types.string()).optional(), published_at: z.nullable(types.date()).optional(), custom_mappings: z.nullable(z.record(z.any())).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(), }).transform((v) => { return remap$(v, { "employment_terms": "employmentTerms", "requisition_id": "requisitionId", "hiring_managers": "hiringManagers", "description_html": "descriptionHtml", "closing_html": "closingHtml", "closing_date": "closingDate", "job_portal_url": "jobPortalUrl", "record_url": "recordUrl", "available_to_employees": "availableToEmployees", "custom_fields": "customFields", "owner_id": "ownerId", "published_at": "publishedAt", "custom_mappings": "customMappings", "updated_by": "updatedBy", "created_by": "createdBy", "updated_at": "updatedAt", "created_at": "createdAt", }); }) ); export function jobFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Job$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Job' from JSON`, ); } /** @internal */ export type JobBranch$Outbound = { name?: string | undefined; }; /** @internal */ export const JobBranch$outboundSchema: z.ZodType< JobBranch$Outbound, z.ZodTypeDef, JobBranch > = /* @__PURE__ */ lazySchema$(() => z.object({ name: z.string().optional(), }) ); export function jobBranchToJSON(jobBranch: JobBranch): string { return JSON.stringify(JobBranch$outboundSchema.parse(jobBranch)); } /** @internal */ export type JobInput$Outbound = { slug?: string | null | undefined; title?: string | null | undefined; sequence?: number | undefined; visibility?: string | undefined; status?: string | undefined; code?: string | undefined; language?: string | null | undefined; employment_terms?: string | null | undefined; experience?: string | undefined; location?: string | null | undefined; remote?: boolean | null | undefined; requisition_id?: string | undefined; department?: DepartmentInput$Outbound | undefined; branch?: JobBranch$Outbound | undefined; recruiters?: Array | null | undefined; hiring_managers?: Array | undefined; followers?: Array | null | undefined; description?: string | null | undefined; description_html?: string | null | undefined; blocks?: Array | undefined; closing?: string | null | undefined; closing_html?: string | null | undefined; closing_date?: string | null | undefined; salary?: Salary$Outbound | undefined; url?: string | null | undefined; job_portal_url?: string | null | undefined; record_url?: string | null | undefined; links?: Array | undefined; confidential?: boolean | undefined; available_to_employees?: boolean | undefined; tags?: Array | null | undefined; addresses?: Array | undefined; custom_fields?: Array | undefined; deleted?: boolean | null | undefined; owner_id?: string | null | undefined; }; /** @internal */ export const JobInput$outboundSchema: z.ZodType< JobInput$Outbound, z.ZodTypeDef, JobInput > = /* @__PURE__ */ lazySchema$(() => z.object({ slug: z.nullable(z.string()).optional(), title: z.nullable(z.string()).optional(), sequence: z.number().int().optional(), visibility: Visibility$outboundSchema.optional(), status: JobStatus$outboundSchema.optional(), code: z.string().optional(), language: z.nullable(z.string()).optional(), employmentTerms: z.nullable(EmploymentTerms$outboundSchema).optional(), experience: z.string().optional(), location: z.nullable(z.string()).optional(), remote: z.nullable(z.boolean()).optional(), requisitionId: z.string().optional(), department: DepartmentInput$outboundSchema.optional(), branch: z.lazy(() => JobBranch$outboundSchema).optional(), recruiters: z.nullable(z.array(z.string())).optional(), hiringManagers: z.array(z.string()).optional(), followers: z.nullable(z.array(z.string())).optional(), description: z.nullable(z.string()).optional(), descriptionHtml: z.nullable(z.string()).optional(), blocks: z.array(z.lazy(() => Blocks$outboundSchema)).optional(), closing: z.nullable(z.string()).optional(), closingHtml: z.nullable(z.string()).optional(), closingDate: z.nullable( z.date().transform(v => v.toISOString().slice(0, "YYYY-MM-DD".length)), ).optional(), salary: z.lazy(() => Salary$outboundSchema).optional(), url: z.nullable(z.string()).optional(), jobPortalUrl: z.nullable(z.string()).optional(), recordUrl: z.nullable(z.string()).optional(), links: z.array(z.lazy(() => JobLinks$outboundSchema)).optional(), confidential: z.boolean().optional(), availableToEmployees: z.boolean().optional(), tags: z.nullable(z.array(z.string())).optional(), addresses: z.array(Address$outboundSchema).optional(), customFields: z.array(CustomField$outboundSchema).optional(), deleted: z.nullable(z.boolean()).optional(), ownerId: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { employmentTerms: "employment_terms", requisitionId: "requisition_id", hiringManagers: "hiring_managers", descriptionHtml: "description_html", closingHtml: "closing_html", closingDate: "closing_date", jobPortalUrl: "job_portal_url", recordUrl: "record_url", availableToEmployees: "available_to_employees", customFields: "custom_fields", ownerId: "owner_id", }); }) ); export function jobInputToJSON(jobInput: JobInput): string { return JSON.stringify(JobInput$outboundSchema.parse(jobInput)); }