/* * 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 { ConversationObject, ConversationObject$inboundSchema, ConversationObject$Outbound, ConversationObject$outboundSchema, } from "./conversationobject.js"; export type ConversationListObject = { object: "list"; /** * Array of conversations */ data: Array; /** * Whether there are more conversations */ hasMore: boolean; /** * ID of the last conversation in the current page */ lastId?: string | undefined; }; /** @internal */ export const ConversationListObject$inboundSchema: z.ZodType< ConversationListObject, z.ZodTypeDef, unknown > = z.object({ object: z.literal("list"), data: z.array(ConversationObject$inboundSchema), has_more: z.boolean(), last_id: z.string().optional(), }).transform((v) => { return remap$(v, { "has_more": "hasMore", "last_id": "lastId", }); }); /** @internal */ export type ConversationListObject$Outbound = { object: "list"; data: Array; has_more: boolean; last_id?: string | undefined; }; /** @internal */ export const ConversationListObject$outboundSchema: z.ZodType< ConversationListObject$Outbound, z.ZodTypeDef, ConversationListObject > = z.object({ object: z.literal("list"), data: z.array(ConversationObject$outboundSchema), hasMore: z.boolean(), lastId: z.string().optional(), }).transform((v) => { return remap$(v, { hasMore: "has_more", lastId: "last_id", }); }); export function conversationListObjectToJSON( conversationListObject: ConversationListObject, ): string { return JSON.stringify( ConversationListObject$outboundSchema.parse(conversationListObject), ); } export function conversationListObjectFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ConversationListObject$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ConversationListObject' from JSON`, ); }