/* * 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 { lazySchema as lazySchema$, safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type Collection = { /** * A unique identifier for an object. */ id: string; /** * The collections's parent ID */ parentId?: string | null | undefined; /** * The collections's type */ type?: string | null | undefined; /** * Name of the collection */ name?: string | null | undefined; /** * Description of the collection */ description?: string | null | undefined; /** * When custom mappings are configured on the resource, the result is included here. */ customMappings?: { [k: string]: any } | null | undefined; /** * The date and time when the object was last updated. */ updatedAt?: Date | null | undefined; /** * The date and time when the object was created. */ createdAt?: Date | null | undefined; }; /** @internal */ export const Collection$inboundSchema: z.ZodType< Collection, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ id: types.string(), parent_id: z.nullable(types.string()).optional(), type: z.nullable(types.string()).optional(), name: z.nullable(types.string()).optional(), description: z.nullable(types.string()).optional(), custom_mappings: z.nullable(z.record(z.any())).optional(), updated_at: z.nullable(types.date()).optional(), created_at: z.nullable(types.date()).optional(), }).transform((v) => { return remap$(v, { "parent_id": "parentId", "custom_mappings": "customMappings", "updated_at": "updatedAt", "created_at": "createdAt", }); }) ); export function collectionFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Collection$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Collection' from JSON`, ); }