/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 5a491394d5db */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { CollectionPinMetadata, CollectionPinMetadata$inboundSchema, CollectionPinMetadata$Outbound, CollectionPinMetadata$outboundSchema, } from "./collectionpinmetadata.js"; import { CollectionPinTarget, CollectionPinTarget$inboundSchema, CollectionPinTarget$Outbound, CollectionPinTarget$outboundSchema, } from "./collectionpintarget.js"; export type CollectionPinnedMetadata = { /** * List of targets this Collection is pinned to. */ existingPins?: Array | undefined; /** * List of targets this Collection can be pinned to, excluding the targets this Collection is already pinned to. We also include Collection ID already is pinned to each eligible target, which will be 0 if the target has no pinned Collection. */ eligiblePins?: Array | undefined; }; /** @internal */ export const CollectionPinnedMetadata$inboundSchema: z.ZodType< CollectionPinnedMetadata, z.ZodTypeDef, unknown > = z.object({ existingPins: z.array(CollectionPinTarget$inboundSchema).optional(), eligiblePins: z.array(CollectionPinMetadata$inboundSchema).optional(), }); /** @internal */ export type CollectionPinnedMetadata$Outbound = { existingPins?: Array | undefined; eligiblePins?: Array | undefined; }; /** @internal */ export const CollectionPinnedMetadata$outboundSchema: z.ZodType< CollectionPinnedMetadata$Outbound, z.ZodTypeDef, CollectionPinnedMetadata > = z.object({ existingPins: z.array(CollectionPinTarget$outboundSchema).optional(), eligiblePins: z.array(CollectionPinMetadata$outboundSchema).optional(), }); export function collectionPinnedMetadataToJSON( collectionPinnedMetadata: CollectionPinnedMetadata, ): string { return JSON.stringify( CollectionPinnedMetadata$outboundSchema.parse(collectionPinnedMetadata), ); } export function collectionPinnedMetadataFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CollectionPinnedMetadata$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CollectionPinnedMetadata' from JSON`, ); }