/* * 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 { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { AgentRun, AgentRun$inboundSchema, AgentRun$Outbound, AgentRun$outboundSchema, } from "./agentrun.js"; export const AgentRunListObject = { List: "list", } as const; export type AgentRunListObject = ClosedEnum; export type AgentRunList = { object: AgentRunListObject; data: Array; firstId: string | null; lastId: string | null; hasMore: boolean; }; /** @internal */ export const AgentRunListObject$inboundSchema: z.ZodNativeEnum< typeof AgentRunListObject > = z.nativeEnum(AgentRunListObject); /** @internal */ export const AgentRunListObject$outboundSchema: z.ZodNativeEnum< typeof AgentRunListObject > = AgentRunListObject$inboundSchema; /** @internal */ export const AgentRunList$inboundSchema: z.ZodType< AgentRunList, z.ZodTypeDef, unknown > = z.object({ object: AgentRunListObject$inboundSchema, data: z.array(AgentRun$inboundSchema), first_id: z.nullable(z.string()), last_id: z.nullable(z.string()), has_more: z.boolean(), }).transform((v) => { return remap$(v, { "first_id": "firstId", "last_id": "lastId", "has_more": "hasMore", }); }); /** @internal */ export type AgentRunList$Outbound = { object: string; data: Array; first_id: string | null; last_id: string | null; has_more: boolean; }; /** @internal */ export const AgentRunList$outboundSchema: z.ZodType< AgentRunList$Outbound, z.ZodTypeDef, AgentRunList > = z.object({ object: AgentRunListObject$outboundSchema, data: z.array(AgentRun$outboundSchema), firstId: z.nullable(z.string()), lastId: z.nullable(z.string()), hasMore: z.boolean(), }).transform((v) => { return remap$(v, { firstId: "first_id", lastId: "last_id", hasMore: "has_more", }); }); export function agentRunListToJSON(agentRunList: AgentRunList): string { return JSON.stringify(AgentRunList$outboundSchema.parse(agentRunList)); } export function agentRunListFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AgentRunList$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AgentRunList' from JSON`, ); }