/* * 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 ListJobsRequest = { state?: components.ComputeResourceState | undefined; cursor?: string | undefined; limit?: number | undefined; /** * Optional external end-user identifier forwarded by the API gateway. */ xOnBehalfOf?: string | undefined; }; export type ListJobsResponse = | components.ComputeJobList | components.ComputeErrorEnvelope; /** @internal */ export const ListJobsRequest$inboundSchema: z.ZodType< ListJobsRequest, z.ZodTypeDef, unknown > = z.object({ state: components.ComputeResourceState$inboundSchema.optional(), cursor: z.string().optional(), limit: z.number().int().default(50), "X-On-Behalf-Of": z.string().optional(), }).transform((v) => { return remap$(v, { "X-On-Behalf-Of": "xOnBehalfOf", }); }); /** @internal */ export type ListJobsRequest$Outbound = { state?: string | undefined; cursor?: string | undefined; limit: number; "X-On-Behalf-Of"?: string | undefined; }; /** @internal */ export const ListJobsRequest$outboundSchema: z.ZodType< ListJobsRequest$Outbound, z.ZodTypeDef, ListJobsRequest > = z.object({ state: components.ComputeResourceState$outboundSchema.optional(), cursor: z.string().optional(), limit: z.number().int().default(50), xOnBehalfOf: z.string().optional(), }).transform((v) => { return remap$(v, { xOnBehalfOf: "X-On-Behalf-Of", }); }); export function listJobsRequestToJSON( listJobsRequest: ListJobsRequest, ): string { return JSON.stringify(ListJobsRequest$outboundSchema.parse(listJobsRequest)); } export function listJobsRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListJobsRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListJobsRequest' from JSON`, ); } /** @internal */ export const ListJobsResponse$inboundSchema: z.ZodType< ListJobsResponse, z.ZodTypeDef, unknown > = z.union([ components.ComputeJobList$inboundSchema, components.ComputeErrorEnvelope$inboundSchema, ]); /** @internal */ export type ListJobsResponse$Outbound = | components.ComputeJobList$Outbound | components.ComputeErrorEnvelope$Outbound; /** @internal */ export const ListJobsResponse$outboundSchema: z.ZodType< ListJobsResponse$Outbound, z.ZodTypeDef, ListJobsResponse > = z.union([ components.ComputeJobList$outboundSchema, components.ComputeErrorEnvelope$outboundSchema, ]); export function listJobsResponseToJSON( listJobsResponse: ListJobsResponse, ): string { return JSON.stringify( ListJobsResponse$outboundSchema.parse(listJobsResponse), ); } export function listJobsResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListJobsResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListJobsResponse' from JSON`, ); }