/* * 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 { Item, Item$inboundSchema, Item$Outbound, Item$outboundSchema, } from "./item.js"; /** * Paginated list object containing input items for a response with cursor-based pagination metadata. */ export type InputItemListObject = { /** * The object type, always 'list' for paginated list responses. */ object: "list"; /** * Array of input items (messages, prompts, instructions) that were provided when creating the response. Each item contains its type, content, role, and metadata. */ data: Array; /** * The ID of the first item in the current page. Used as a reference point for pagination. */ firstId?: string | undefined; /** * The ID of the last item in the current page. Used as a cursor for fetching the next page. */ lastId?: string | undefined; /** * Indicates whether there are more items available beyond the current page. True if additional pages exist, false otherwise. */ hasMore: boolean; }; /** @internal */ export const InputItemListObject$inboundSchema: z.ZodType< InputItemListObject, z.ZodTypeDef, unknown > = z.object({ object: z.literal("list"), data: z.array(Item$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 InputItemListObject$Outbound = { object: "list"; data: Array; first_id?: string | undefined; last_id?: string | undefined; has_more: boolean; }; /** @internal */ export const InputItemListObject$outboundSchema: z.ZodType< InputItemListObject$Outbound, z.ZodTypeDef, InputItemListObject > = z.object({ object: z.literal("list"), data: z.array(Item$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 inputItemListObjectToJSON( inputItemListObject: InputItemListObject, ): string { return JSON.stringify( InputItemListObject$outboundSchema.parse(inputItemListObject), ); } export function inputItemListObjectFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => InputItemListObject$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InputItemListObject' from JSON`, ); }