/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 95c0545f8afe */ 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"; /** * The type of custom property - this governs the search and faceting behavior. Note that MULTIPICKLIST is not yet supported. */ export const PropertyType = { Text: "TEXT", Date: "DATE", Int: "INT", Userid: "USERID", Picklist: "PICKLIST", Textlist: "TEXTLIST", Multipicklist: "MULTIPICKLIST", } as const; /** * The type of custom property - this governs the search and faceting behavior. Note that MULTIPICKLIST is not yet supported. */ export type PropertyType = OpenEnum; export const UiOptions = { None: "NONE", SearchResult: "SEARCH_RESULT", DocHovercard: "DOC_HOVERCARD", } as const; export type UiOptions = OpenEnum; export type PropertyDefinition = { /** * The name of the property in the `DocumentMetadata` (e.g. 'createTime', 'updateTime', 'author', 'container'). In the future, this will support custom properties too. */ name?: string | undefined; /** * The user friendly label for the property. */ displayLabel?: string | undefined; /** * The user friendly label for the property that will be used if a plural context. */ displayLabelPlural?: string | undefined; /** * The type of custom property - this governs the search and faceting behavior. Note that MULTIPICKLIST is not yet supported. */ propertyType?: PropertyType | undefined; uiOptions?: UiOptions | undefined; /** * If true then the property will not show up as a facet in the UI. */ hideUiFacet?: boolean | undefined; /** * Will be used to set the order of facets in the UI, if present. If set for one facet, must be set for all non-hidden UI facets. Must take on an integer value from 1 (shown at the top) to N (shown last), where N is the number of non-hidden UI facets. These facets will be ordered below the built-in "Type" and "Tag" operators. */ uiFacetOrder?: number | undefined; /** * If true then the property will not be indexed for retrieval and ranking. */ skipIndexing?: boolean | undefined; /** * The unique identifier of the `PropertyGroup` to which this property belongs. */ group?: string | undefined; }; /** @internal */ export const PropertyType$inboundSchema: z.ZodType< PropertyType, z.ZodTypeDef, unknown > = openEnums.inboundSchema(PropertyType); /** @internal */ export const PropertyType$outboundSchema: z.ZodType< string, z.ZodTypeDef, PropertyType > = openEnums.outboundSchema(PropertyType); /** @internal */ export const UiOptions$inboundSchema: z.ZodType< UiOptions, z.ZodTypeDef, unknown > = openEnums.inboundSchema(UiOptions); /** @internal */ export const UiOptions$outboundSchema: z.ZodType< string, z.ZodTypeDef, UiOptions > = openEnums.outboundSchema(UiOptions); /** @internal */ export const PropertyDefinition$inboundSchema: z.ZodType< PropertyDefinition, z.ZodTypeDef, unknown > = z.object({ name: z.string().optional(), displayLabel: z.string().optional(), displayLabelPlural: z.string().optional(), propertyType: PropertyType$inboundSchema.optional(), uiOptions: UiOptions$inboundSchema.optional(), hideUiFacet: z.boolean().optional(), uiFacetOrder: z.number().int().optional(), skipIndexing: z.boolean().optional(), group: z.string().optional(), }); /** @internal */ export type PropertyDefinition$Outbound = { name?: string | undefined; displayLabel?: string | undefined; displayLabelPlural?: string | undefined; propertyType?: string | undefined; uiOptions?: string | undefined; hideUiFacet?: boolean | undefined; uiFacetOrder?: number | undefined; skipIndexing?: boolean | undefined; group?: string | undefined; }; /** @internal */ export const PropertyDefinition$outboundSchema: z.ZodType< PropertyDefinition$Outbound, z.ZodTypeDef, PropertyDefinition > = z.object({ name: z.string().optional(), displayLabel: z.string().optional(), displayLabelPlural: z.string().optional(), propertyType: PropertyType$outboundSchema.optional(), uiOptions: UiOptions$outboundSchema.optional(), hideUiFacet: z.boolean().optional(), uiFacetOrder: z.number().int().optional(), skipIndexing: z.boolean().optional(), group: z.string().optional(), }); export function propertyDefinitionToJSON( propertyDefinition: PropertyDefinition, ): string { return JSON.stringify( PropertyDefinition$outboundSchema.parse(propertyDefinition), ); } export function propertyDefinitionFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PropertyDefinition$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PropertyDefinition' from JSON`, ); }