/* * 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 ListServiceLogsRequest = { 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 ListServiceLogsResponse = | components.ComputeLogList | components.ComputeErrorEnvelope; /** @internal */ export const ListServiceLogsRequest$inboundSchema: z.ZodType< ListServiceLogsRequest, 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 ListServiceLogsRequest$Outbound = { id: string; source?: string | undefined; cursor?: string | undefined; limit: number; order: string; "X-On-Behalf-Of"?: string | undefined; }; /** @internal */ export const ListServiceLogsRequest$outboundSchema: z.ZodType< ListServiceLogsRequest$Outbound, z.ZodTypeDef, ListServiceLogsRequest > = 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 listServiceLogsRequestToJSON( listServiceLogsRequest: ListServiceLogsRequest, ): string { return JSON.stringify( ListServiceLogsRequest$outboundSchema.parse(listServiceLogsRequest), ); } export function listServiceLogsRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListServiceLogsRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListServiceLogsRequest' from JSON`, ); } /** @internal */ export const ListServiceLogsResponse$inboundSchema: z.ZodType< ListServiceLogsResponse, z.ZodTypeDef, unknown > = z.union([ components.ComputeLogList$inboundSchema, components.ComputeErrorEnvelope$inboundSchema, ]); /** @internal */ export type ListServiceLogsResponse$Outbound = | components.ComputeLogList$Outbound | components.ComputeErrorEnvelope$Outbound; /** @internal */ export const ListServiceLogsResponse$outboundSchema: z.ZodType< ListServiceLogsResponse$Outbound, z.ZodTypeDef, ListServiceLogsResponse > = z.union([ components.ComputeLogList$outboundSchema, components.ComputeErrorEnvelope$outboundSchema, ]); export function listServiceLogsResponseToJSON( listServiceLogsResponse: ListServiceLogsResponse, ): string { return JSON.stringify( ListServiceLogsResponse$outboundSchema.parse(listServiceLogsResponse), ); } export function listServiceLogsResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListServiceLogsResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListServiceLogsResponse' from JSON`, ); }