/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; 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 { CustomMappings, CustomMappings$inboundSchema, CustomMappings$Outbound, CustomMappings$outboundSchema, } from "./custommappings.js"; export type CollectionTag = { /** * A unique identifier for an object. */ id: string | null; /** * The name of the tag. */ name?: string | null | undefined; /** * When custom mappings are configured on the resource, the result is included here. */ customMappings?: CustomMappings | null | undefined; }; /** @internal */ export const CollectionTag$inboundSchema: z.ZodType< CollectionTag, z.ZodTypeDef, unknown > = z.object({ id: z.nullable(z.string()), name: z.nullable(z.string()).optional(), custom_mappings: z.nullable(CustomMappings$inboundSchema).optional(), }).transform((v) => { return remap$(v, { "custom_mappings": "customMappings", }); }); /** @internal */ export type CollectionTag$Outbound = { id: string | null; name?: string | null | undefined; custom_mappings?: CustomMappings$Outbound | null | undefined; }; /** @internal */ export const CollectionTag$outboundSchema: z.ZodType< CollectionTag$Outbound, z.ZodTypeDef, CollectionTag > = z.object({ id: z.nullable(z.string()), name: z.nullable(z.string()).optional(), customMappings: z.nullable(CustomMappings$outboundSchema).optional(), }).transform((v) => { return remap$(v, { customMappings: "custom_mappings", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace CollectionTag$ { /** @deprecated use `CollectionTag$inboundSchema` instead. */ export const inboundSchema = CollectionTag$inboundSchema; /** @deprecated use `CollectionTag$outboundSchema` instead. */ export const outboundSchema = CollectionTag$outboundSchema; /** @deprecated use `CollectionTag$Outbound` instead. */ export type Outbound = CollectionTag$Outbound; } export function collectionTagToJSON(collectionTag: CollectionTag): string { return JSON.stringify(CollectionTag$outboundSchema.parse(collectionTag)); } export function collectionTagFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CollectionTag$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CollectionTag' from JSON`, ); }