/* * 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 { ResponseObject, ResponseObject$inboundSchema, ResponseObject$Outbound, ResponseObject$outboundSchema, } from "./responseobject.js"; /** * Paginated list object containing responses with cursor-based pagination metadata. */ export type ResponseListObject = { /** * The object type, always 'list' for paginated list responses. */ object: "list"; /** * Array of response objects. Each response contains its status, model, input/output, tool usage logs, metadata, and completion information. */ data: Array; /** * The ID of the first response in the current page. Used as a reference point for pagination. */ firstId?: string | undefined; /** * The ID of the last response in the current page. Used as a cursor for fetching the next page. */ lastId?: string | undefined; /** * Indicates whether there are more responses available beyond the current page. True if additional pages exist, false otherwise. */ hasMore: boolean; }; /** @internal */ export const ResponseListObject$inboundSchema: z.ZodType< ResponseListObject, z.ZodTypeDef, unknown > = z.object({ object: z.literal("list"), data: z.array(ResponseObject$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 ResponseListObject$Outbound = { object: "list"; data: Array; first_id?: string | undefined; last_id?: string | undefined; has_more: boolean; }; /** @internal */ export const ResponseListObject$outboundSchema: z.ZodType< ResponseListObject$Outbound, z.ZodTypeDef, ResponseListObject > = z.object({ object: z.literal("list"), data: z.array(ResponseObject$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 responseListObjectToJSON( responseListObject: ResponseListObject, ): string { return JSON.stringify( ResponseListObject$outboundSchema.parse(responseListObject), ); } export function responseListObjectFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ResponseListObject$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseListObject' from JSON`, ); }