/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: d0faf3206877 */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { PropertyDefinition, PropertyDefinition$inboundSchema, PropertyDefinition$Outbound, PropertyDefinition$outboundSchema, } from "./propertydefinition.js"; import { PropertyGroup, PropertyGroup$inboundSchema, PropertyGroup$Outbound, PropertyGroup$outboundSchema, } from "./propertygroup.js"; /** * The document category of this object type. */ export const DocCategory = { Uncategorized: "UNCATEGORIZED", Tickets: "TICKETS", Crm: "CRM", PublishedContent: "PUBLISHED_CONTENT", CollaborativeContent: "COLLABORATIVE_CONTENT", QuestionAnswer: "QUESTION_ANSWER", Messaging: "MESSAGING", CodeRepository: "CODE_REPOSITORY", ChangeManagement: "CHANGE_MANAGEMENT", People: "PEOPLE", Email: "EMAIL", Sso: "SSO", Ats: "ATS", KnowledgeHub: "KNOWLEDGE_HUB", ExternalShortcut: "EXTERNAL_SHORTCUT", Entity: "ENTITY", Calendar: "CALENDAR", Agents: "AGENTS", } as const; /** * The document category of this object type. */ export type DocCategory = OpenEnum; /** * The definition for an `DocumentMetadata.objectType` within a datasource. */ export type ObjectDefinition = { /** * Unique identifier for this `DocumentMetadata.objectType`. If omitted, this definition is used as a default for all unmatched `DocumentMetadata.objectType`s in this datasource. */ name?: string | undefined; /** * The user-friendly name of the object for display. */ displayLabel?: string | undefined; /** * The document category of this object type. */ docCategory?: DocCategory | undefined; propertyDefinitions?: Array | undefined; /** * A list of `PropertyGroup`s belonging to this object type, which will group properties to be displayed together in the UI. */ propertyGroups?: Array | undefined; /** * Whether or not the object is summarizable */ summarizable?: boolean | undefined; }; /** @internal */ export const DocCategory$inboundSchema: z.ZodType< DocCategory, z.ZodTypeDef, unknown > = openEnums.inboundSchema(DocCategory); /** @internal */ export const DocCategory$outboundSchema: z.ZodType< string, z.ZodTypeDef, DocCategory > = openEnums.outboundSchema(DocCategory); /** @internal */ export const ObjectDefinition$inboundSchema: z.ZodType< ObjectDefinition, z.ZodTypeDef, unknown > = z.object({ name: z.string().optional(), displayLabel: z.string().optional(), docCategory: DocCategory$inboundSchema.optional(), propertyDefinitions: z.array(PropertyDefinition$inboundSchema).optional(), propertyGroups: z.array(PropertyGroup$inboundSchema).optional(), summarizable: z.boolean().optional(), }); /** @internal */ export type ObjectDefinition$Outbound = { name?: string | undefined; displayLabel?: string | undefined; docCategory?: string | undefined; propertyDefinitions?: Array | undefined; propertyGroups?: Array | undefined; summarizable?: boolean | undefined; }; /** @internal */ export const ObjectDefinition$outboundSchema: z.ZodType< ObjectDefinition$Outbound, z.ZodTypeDef, ObjectDefinition > = z.object({ name: z.string().optional(), displayLabel: z.string().optional(), docCategory: DocCategory$outboundSchema.optional(), propertyDefinitions: z.array(PropertyDefinition$outboundSchema).optional(), propertyGroups: z.array(PropertyGroup$outboundSchema).optional(), summarizable: z.boolean().optional(), }); export function objectDefinitionToJSON( objectDefinition: ObjectDefinition, ): string { return JSON.stringify( ObjectDefinition$outboundSchema.parse(objectDefinition), ); } export function objectDefinitionFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ObjectDefinition$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ObjectDefinition' from JSON`, ); }