/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { CustomMappings, CustomMappings$inboundSchema, CustomMappings$Outbound, CustomMappings$outboundSchema, } from "./custommappings.js"; import { PassThroughBody, PassThroughBody$inboundSchema, PassThroughBody$Outbound, PassThroughBody$outboundSchema, } from "./passthroughbody.js"; export const ApplicationStatus = { Open: "open", Rejected: "rejected", Hired: "hired", Converted: "converted", Other: "other", } as const; export type ApplicationStatus = ClosedEnum; export type Stage = { /** * Stage the candidate should be in. If omitted, the default stage for this job will be used. */ id?: string | null | undefined; name?: string | null | undefined; }; export type Application = { /** * A unique identifier for an object. */ id?: string | undefined; applicantId: string | null; jobId: string | null; status?: ApplicationStatus | null | undefined; stage?: Stage | undefined; /** * When custom mappings are configured on the resource, the result is included here. */ customMappings?: CustomMappings | 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 ApplicationInput = { applicantId: string | null; jobId: string | null; status?: ApplicationStatus | null | undefined; stage?: Stage | 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 ApplicationStatus$inboundSchema: z.ZodNativeEnum< typeof ApplicationStatus > = z.nativeEnum(ApplicationStatus); /** @internal */ export const ApplicationStatus$outboundSchema: z.ZodNativeEnum< typeof ApplicationStatus > = ApplicationStatus$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace ApplicationStatus$ { /** @deprecated use `ApplicationStatus$inboundSchema` instead. */ export const inboundSchema = ApplicationStatus$inboundSchema; /** @deprecated use `ApplicationStatus$outboundSchema` instead. */ export const outboundSchema = ApplicationStatus$outboundSchema; } /** @internal */ export const Stage$inboundSchema: z.ZodType = z .object({ id: z.nullable(z.string()).optional(), name: z.nullable(z.string()).optional(), }); /** @internal */ export type Stage$Outbound = { id?: string | null | undefined; name?: string | null | undefined; }; /** @internal */ export const Stage$outboundSchema: z.ZodType< Stage$Outbound, z.ZodTypeDef, Stage > = z.object({ id: z.nullable(z.string()).optional(), name: z.nullable(z.string()).optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace Stage$ { /** @deprecated use `Stage$inboundSchema` instead. */ export const inboundSchema = Stage$inboundSchema; /** @deprecated use `Stage$outboundSchema` instead. */ export const outboundSchema = Stage$outboundSchema; /** @deprecated use `Stage$Outbound` instead. */ export type Outbound = Stage$Outbound; } export function stageToJSON(stage: Stage): string { return JSON.stringify(Stage$outboundSchema.parse(stage)); } export function stageFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Stage$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Stage' from JSON`, ); } /** @internal */ export const Application$inboundSchema: z.ZodType< Application, z.ZodTypeDef, unknown > = z.object({ id: z.string().optional(), applicant_id: z.nullable(z.string()), job_id: z.nullable(z.string()), status: z.nullable(ApplicationStatus$inboundSchema).optional(), stage: z.lazy(() => Stage$inboundSchema).optional(), custom_mappings: z.nullable(CustomMappings$inboundSchema).optional(), updated_by: z.nullable(z.string()).optional(), created_by: z.nullable(z.string()).optional(), updated_at: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), created_at: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), pass_through: z.array(PassThroughBody$inboundSchema).optional(), }).transform((v) => { return remap$(v, { "applicant_id": "applicantId", "job_id": "jobId", "custom_mappings": "customMappings", "updated_by": "updatedBy", "created_by": "createdBy", "updated_at": "updatedAt", "created_at": "createdAt", "pass_through": "passThrough", }); }); /** @internal */ export type Application$Outbound = { id?: string | undefined; applicant_id: string | null; job_id: string | null; status?: string | null | undefined; stage?: Stage$Outbound | undefined; custom_mappings?: CustomMappings$Outbound | null | undefined; updated_by?: string | null | undefined; created_by?: string | null | undefined; updated_at?: string | null | undefined; created_at?: string | null | undefined; pass_through?: Array | undefined; }; /** @internal */ export const Application$outboundSchema: z.ZodType< Application$Outbound, z.ZodTypeDef, Application > = z.object({ id: z.string().optional(), applicantId: z.nullable(z.string()), jobId: z.nullable(z.string()), status: z.nullable(ApplicationStatus$outboundSchema).optional(), stage: z.lazy(() => Stage$outboundSchema).optional(), customMappings: z.nullable(CustomMappings$outboundSchema).optional(), updatedBy: z.nullable(z.string()).optional(), createdBy: z.nullable(z.string()).optional(), updatedAt: z.nullable(z.date().transform(v => v.toISOString())).optional(), createdAt: z.nullable(z.date().transform(v => v.toISOString())).optional(), passThrough: z.array(PassThroughBody$outboundSchema).optional(), }).transform((v) => { return remap$(v, { applicantId: "applicant_id", jobId: "job_id", customMappings: "custom_mappings", updatedBy: "updated_by", createdBy: "created_by", updatedAt: "updated_at", createdAt: "created_at", passThrough: "pass_through", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace Application$ { /** @deprecated use `Application$inboundSchema` instead. */ export const inboundSchema = Application$inboundSchema; /** @deprecated use `Application$outboundSchema` instead. */ export const outboundSchema = Application$outboundSchema; /** @deprecated use `Application$Outbound` instead. */ export type Outbound = Application$Outbound; } export function applicationToJSON(application: Application): string { return JSON.stringify(Application$outboundSchema.parse(application)); } export function applicationFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Application$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Application' from JSON`, ); } /** @internal */ export const ApplicationInput$inboundSchema: z.ZodType< ApplicationInput, z.ZodTypeDef, unknown > = z.object({ applicant_id: z.nullable(z.string()), job_id: z.nullable(z.string()), status: z.nullable(ApplicationStatus$inboundSchema).optional(), stage: z.lazy(() => Stage$inboundSchema).optional(), pass_through: z.array(PassThroughBody$inboundSchema).optional(), }).transform((v) => { return remap$(v, { "applicant_id": "applicantId", "job_id": "jobId", "pass_through": "passThrough", }); }); /** @internal */ export type ApplicationInput$Outbound = { applicant_id: string | null; job_id: string | null; status?: string | null | undefined; stage?: Stage$Outbound | undefined; pass_through?: Array | undefined; }; /** @internal */ export const ApplicationInput$outboundSchema: z.ZodType< ApplicationInput$Outbound, z.ZodTypeDef, ApplicationInput > = z.object({ applicantId: z.nullable(z.string()), jobId: z.nullable(z.string()), status: z.nullable(ApplicationStatus$outboundSchema).optional(), stage: z.lazy(() => Stage$outboundSchema).optional(), passThrough: z.array(PassThroughBody$outboundSchema).optional(), }).transform((v) => { return remap$(v, { applicantId: "applicant_id", jobId: "job_id", passThrough: "pass_through", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace ApplicationInput$ { /** @deprecated use `ApplicationInput$inboundSchema` instead. */ export const inboundSchema = ApplicationInput$inboundSchema; /** @deprecated use `ApplicationInput$outboundSchema` instead. */ export const outboundSchema = ApplicationInput$outboundSchema; /** @deprecated use `ApplicationInput$Outbound` instead. */ export type Outbound = ApplicationInput$Outbound; } export function applicationInputToJSON( applicationInput: ApplicationInput, ): string { return JSON.stringify( ApplicationInput$outboundSchema.parse(applicationInput), ); } export function applicationInputFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ApplicationInput$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ApplicationInput' from JSON`, ); }