/* * 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 { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { BatchObject, BatchObject$inboundSchema, BatchObject$Outbound, BatchObject$outboundSchema, } from "./batchobject.js"; export type ListBatchesResponse = { object: "list"; data: Array; firstId?: string | undefined; lastId?: string | undefined; hasMore: boolean; }; /** @internal */ export const ListBatchesResponse$inboundSchema: z.ZodType< ListBatchesResponse, z.ZodTypeDef, unknown > = z.object({ object: z.literal("list"), data: z.array(BatchObject$inboundSchema), first_id: z.string().optional(), last_id: z.string().optional(), has_more: z.boolean(), }).transform((v) => { return remap$(v, { "first_id": "firstId", "last_id": "lastId", "has_more": "hasMore", }); }); /** @internal */ export type ListBatchesResponse$Outbound = { object: "list"; data: Array; first_id?: string | undefined; last_id?: string | undefined; has_more: boolean; }; /** @internal */ export const ListBatchesResponse$outboundSchema: z.ZodType< ListBatchesResponse$Outbound, z.ZodTypeDef, ListBatchesResponse > = z.object({ object: z.literal("list"), data: z.array(BatchObject$outboundSchema), firstId: z.string().optional(), lastId: z.string().optional(), hasMore: z.boolean(), }).transform((v) => { return remap$(v, { firstId: "first_id", lastId: "last_id", hasMore: "has_more", }); }); export function listBatchesResponseToJSON( listBatchesResponse: ListBatchesResponse, ): string { return JSON.stringify( ListBatchesResponse$outboundSchema.parse(listBatchesResponse), ); } export function listBatchesResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListBatchesResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListBatchesResponse' from JSON`, ); }