/* * 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 { Agent, Agent$inboundSchema, Agent$Outbound, Agent$outboundSchema, } from "./agent.js"; export const AgentListObject = { List: "list", } as const; export type AgentListObject = ClosedEnum; export type AgentList = { object: AgentListObject; data: Array; firstId: string | null; lastId: string | null; hasMore: boolean; }; /** @internal */ export const AgentListObject$inboundSchema: z.ZodNativeEnum< typeof AgentListObject > = z.nativeEnum(AgentListObject); /** @internal */ export const AgentListObject$outboundSchema: z.ZodNativeEnum< typeof AgentListObject > = AgentListObject$inboundSchema; /** @internal */ export const AgentList$inboundSchema: z.ZodType< AgentList, z.ZodTypeDef, unknown > = z.object({ object: AgentListObject$inboundSchema, data: z.array(Agent$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 AgentList$Outbound = { object: string; data: Array; first_id: string | null; last_id: string | null; has_more: boolean; }; /** @internal */ export const AgentList$outboundSchema: z.ZodType< AgentList$Outbound, z.ZodTypeDef, AgentList > = z.object({ object: AgentListObject$outboundSchema, data: z.array(Agent$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 agentListToJSON(agentList: AgentList): string { return JSON.stringify(AgentList$outboundSchema.parse(agentList)); } export function agentListFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AgentList$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AgentList' from JSON`, ); }