/* * 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 { 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 { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { CenseyeTarget, CenseyeTarget$inboundSchema } from "./censeyetarget.js"; /** * Current state of the job. */ export const State = { Started: "started", Completed: "completed", Failed: "failed", Unknown: "unknown", } as const; /** * Current state of the job. */ export type State = OpenEnum; export type CenseyeJob = { /** * The point-in-time the asset data was evaluated at. */ atTime?: Date | undefined; /** * When the job was created. */ createTime?: Date | undefined; /** * When the job and results will be deleted. */ deleteTime?: Date | undefined; /** * Error message if the job failed. */ error?: string | undefined; /** * Unique identifier of the job. */ jobId: string; /** * Total number of result field-value pairs. */ resultCount?: number | undefined; /** * Current state of the job. */ state: State; target: CenseyeTarget; /** * When the job was last updated. */ updateTime?: Date | undefined; }; /** @internal */ export const State$inboundSchema: z.ZodType = openEnums.inboundSchema(State); /** @internal */ export const CenseyeJob$inboundSchema: z.ZodType< CenseyeJob, z.ZodTypeDef, unknown > = z.object({ at_time: z.string().datetime({ offset: true }).transform(v => new Date(v)) .optional(), create_time: z.string().datetime({ offset: true }).transform(v => new Date(v)) .optional(), delete_time: z.string().datetime({ offset: true }).transform(v => new Date(v)) .optional(), error: z.string().optional(), job_id: z.string(), result_count: z.number().int().optional(), state: State$inboundSchema, target: CenseyeTarget$inboundSchema, update_time: z.string().datetime({ offset: true }).transform(v => new Date(v)) .optional(), }).transform((v) => { return remap$(v, { "at_time": "atTime", "create_time": "createTime", "delete_time": "deleteTime", "job_id": "jobId", "result_count": "resultCount", "update_time": "updateTime", }); }); export function censeyeJobFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CenseyeJob$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CenseyeJob' from JSON`, ); }