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