/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 51452dcb2fd0 */ 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 { CollectionPinnableCategories, CollectionPinnableCategories$inboundSchema, CollectionPinnableCategories$outboundSchema, } from "./collectionpinnablecategories.js"; import { CollectionPinnableTargets, CollectionPinnableTargets$inboundSchema, CollectionPinnableTargets$outboundSchema, } from "./collectionpinnabletargets.js"; export type CollectionPinTarget = { /** * Categories a Collection can be pinned to. */ category: CollectionPinnableCategories; /** * Optional. If category supports values, then the additional value for the category e.g. department name for DEPARTMENT_RESOURCE, team name/id for TEAM_RESOURCE and so on. */ value?: string | undefined; /** * What targets can a Collection be pinned to. */ target?: CollectionPinnableTargets | undefined; }; /** @internal */ export const CollectionPinTarget$inboundSchema: z.ZodType< CollectionPinTarget, z.ZodTypeDef, unknown > = z.object({ category: CollectionPinnableCategories$inboundSchema, value: z.string().optional(), target: CollectionPinnableTargets$inboundSchema.optional(), }); /** @internal */ export type CollectionPinTarget$Outbound = { category: string; value?: string | undefined; target?: string | undefined; }; /** @internal */ export const CollectionPinTarget$outboundSchema: z.ZodType< CollectionPinTarget$Outbound, z.ZodTypeDef, CollectionPinTarget > = z.object({ category: CollectionPinnableCategories$outboundSchema, value: z.string().optional(), target: CollectionPinnableTargets$outboundSchema.optional(), }); export function collectionPinTargetToJSON( collectionPinTarget: CollectionPinTarget, ): string { return JSON.stringify( CollectionPinTarget$outboundSchema.parse(collectionPinTarget), ); } export function collectionPinTargetFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CollectionPinTarget$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CollectionPinTarget' from JSON`, ); }