/* * 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 ListJobLogsRequest = { id: string; source?: components.ComputeLogSource | undefined; 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 ListJobLogsResponse = | components.ComputeLogList | components.ComputeErrorEnvelope; /** @internal */ export const ListJobLogsRequest$inboundSchema: z.ZodType< ListJobLogsRequest, z.ZodTypeDef, unknown > = z.object({ id: z.string(), source: components.ComputeLogSource$inboundSchema.optional(), 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 ListJobLogsRequest$Outbound = { id: string; source?: string | undefined; cursor?: string | undefined; limit: number; order: string; "X-On-Behalf-Of"?: string | undefined; }; /** @internal */ export const ListJobLogsRequest$outboundSchema: z.ZodType< ListJobLogsRequest$Outbound, z.ZodTypeDef, ListJobLogsRequest > = z.object({ id: z.string(), source: components.ComputeLogSource$outboundSchema.optional(), 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 listJobLogsRequestToJSON( listJobLogsRequest: ListJobLogsRequest, ): string { return JSON.stringify( ListJobLogsRequest$outboundSchema.parse(listJobLogsRequest), ); } export function listJobLogsRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListJobLogsRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListJobLogsRequest' from JSON`, ); } /** @internal */ export const ListJobLogsResponse$inboundSchema: z.ZodType< ListJobLogsResponse, z.ZodTypeDef, unknown > = z.union([ components.ComputeLogList$inboundSchema, components.ComputeErrorEnvelope$inboundSchema, ]); /** @internal */ export type ListJobLogsResponse$Outbound = | components.ComputeLogList$Outbound | components.ComputeErrorEnvelope$Outbound; /** @internal */ export const ListJobLogsResponse$outboundSchema: z.ZodType< ListJobLogsResponse$Outbound, z.ZodTypeDef, ListJobLogsResponse > = z.union([ components.ComputeLogList$outboundSchema, components.ComputeErrorEnvelope$outboundSchema, ]); export function listJobLogsResponseToJSON( listJobLogsResponse: ListJobLogsResponse, ): string { return JSON.stringify( ListJobLogsResponse$outboundSchema.parse(listJobLogsResponse), ); } export function listJobLogsResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListJobLogsResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListJobLogsResponse' from JSON`, ); }