/* * 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 ListJobEventsRequest = { id: string; cursor?: string | undefined; limit?: number | undefined; /** * asc pages oldest-first (default); desc pages newest-first. A cursor is only valid within a traversal that keeps the same order. */ order?: components.ComputeOrder | undefined; /** * Optional external end-user identifier forwarded by the API gateway. */ xOnBehalfOf?: string | undefined; }; export type ListJobEventsResponse = | components.ComputeEventList | components.ComputeErrorEnvelope; /** @internal */ export const ListJobEventsRequest$inboundSchema: z.ZodType< ListJobEventsRequest, z.ZodTypeDef, unknown > = z.object({ id: z.string(), cursor: z.string().optional(), limit: z.number().int().default(50), order: components.ComputeOrder$inboundSchema.default("asc"), "X-On-Behalf-Of": z.string().optional(), }).transform((v) => { return remap$(v, { "X-On-Behalf-Of": "xOnBehalfOf", }); }); /** @internal */ export type ListJobEventsRequest$Outbound = { id: string; cursor?: string | undefined; limit: number; order: string; "X-On-Behalf-Of"?: string | undefined; }; /** @internal */ export const ListJobEventsRequest$outboundSchema: z.ZodType< ListJobEventsRequest$Outbound, z.ZodTypeDef, ListJobEventsRequest > = z.object({ id: z.string(), cursor: z.string().optional(), limit: z.number().int().default(50), order: components.ComputeOrder$outboundSchema.default("asc"), xOnBehalfOf: z.string().optional(), }).transform((v) => { return remap$(v, { xOnBehalfOf: "X-On-Behalf-Of", }); }); export function listJobEventsRequestToJSON( listJobEventsRequest: ListJobEventsRequest, ): string { return JSON.stringify( ListJobEventsRequest$outboundSchema.parse(listJobEventsRequest), ); } export function listJobEventsRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListJobEventsRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListJobEventsRequest' from JSON`, ); } /** @internal */ export const ListJobEventsResponse$inboundSchema: z.ZodType< ListJobEventsResponse, z.ZodTypeDef, unknown > = z.union([ components.ComputeEventList$inboundSchema, components.ComputeErrorEnvelope$inboundSchema, ]); /** @internal */ export type ListJobEventsResponse$Outbound = | components.ComputeEventList$Outbound | components.ComputeErrorEnvelope$Outbound; /** @internal */ export const ListJobEventsResponse$outboundSchema: z.ZodType< ListJobEventsResponse$Outbound, z.ZodTypeDef, ListJobEventsResponse > = z.union([ components.ComputeEventList$outboundSchema, components.ComputeErrorEnvelope$outboundSchema, ]); export function listJobEventsResponseToJSON( listJobEventsResponse: ListJobEventsResponse, ): string { return JSON.stringify( ListJobEventsResponse$outboundSchema.parse(listJobEventsResponse), ); } export function listJobEventsResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListJobEventsResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListJobEventsResponse' from JSON`, ); }