/* * 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 { Result as SafeParseResult } from "../../types/fp.js"; import * as components from "../components/index.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type GetJobRequest = { id: string; /** * Optional external end-user identifier forwarded by the API gateway. */ xOnBehalfOf?: string | undefined; }; export type GetJobResponse = | components.ComputeJob | components.ComputeErrorEnvelope; /** @internal */ export const GetJobRequest$inboundSchema: z.ZodType< GetJobRequest, z.ZodTypeDef, unknown > = z.object({ id: z.string(), "X-On-Behalf-Of": z.string().optional(), }).transform((v) => { return remap$(v, { "X-On-Behalf-Of": "xOnBehalfOf", }); }); /** @internal */ export type GetJobRequest$Outbound = { id: string; "X-On-Behalf-Of"?: string | undefined; }; /** @internal */ export const GetJobRequest$outboundSchema: z.ZodType< GetJobRequest$Outbound, z.ZodTypeDef, GetJobRequest > = z.object({ id: z.string(), xOnBehalfOf: z.string().optional(), }).transform((v) => { return remap$(v, { xOnBehalfOf: "X-On-Behalf-Of", }); }); export function getJobRequestToJSON(getJobRequest: GetJobRequest): string { return JSON.stringify(GetJobRequest$outboundSchema.parse(getJobRequest)); } export function getJobRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetJobRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetJobRequest' from JSON`, ); } /** @internal */ export const GetJobResponse$inboundSchema: z.ZodType< GetJobResponse, z.ZodTypeDef, unknown > = z.union([ components.ComputeJob$inboundSchema, components.ComputeErrorEnvelope$inboundSchema, ]); /** @internal */ export type GetJobResponse$Outbound = | components.ComputeJob$Outbound | components.ComputeErrorEnvelope$Outbound; /** @internal */ export const GetJobResponse$outboundSchema: z.ZodType< GetJobResponse$Outbound, z.ZodTypeDef, GetJobResponse > = z.union([ components.ComputeJob$outboundSchema, components.ComputeErrorEnvelope$outboundSchema, ]); export function getJobResponseToJSON(getJobResponse: GetJobResponse): string { return JSON.stringify(GetJobResponse$outboundSchema.parse(getJobResponse)); } export function getJobResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetJobResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetJobResponse' from JSON`, ); }