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