/* * 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 { MemoryEntry, MemoryEntry$inboundSchema, MemoryEntry$Outbound, MemoryEntry$outboundSchema, } from "./memoryentry.js"; export type MemoryEntryList = { object: "list"; data: Array; firstId: string | null; lastId: string | null; hasMore: boolean; }; /** @internal */ export const MemoryEntryList$inboundSchema: z.ZodType< MemoryEntryList, z.ZodTypeDef, unknown > = z.object({ object: z.literal("list"), data: z.array(MemoryEntry$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 MemoryEntryList$Outbound = { object: "list"; data: Array; first_id: string | null; last_id: string | null; has_more: boolean; }; /** @internal */ export const MemoryEntryList$outboundSchema: z.ZodType< MemoryEntryList$Outbound, z.ZodTypeDef, MemoryEntryList > = z.object({ object: z.literal("list"), data: z.array(MemoryEntry$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 memoryEntryListToJSON( memoryEntryList: MemoryEntryList, ): string { return JSON.stringify(MemoryEntryList$outboundSchema.parse(memoryEntryList)); } export function memoryEntryListFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => MemoryEntryList$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'MemoryEntryList' from JSON`, ); }