/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: b740da1d317a */ 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 { Document, Document$inboundSchema } from "./document.js"; import { OperatorMetadata, OperatorMetadata$inboundSchema, } from "./operatormetadata.js"; import { Quicklink, Quicklink$inboundSchema } from "./quicklink.js"; import { StructuredResult, StructuredResult$inboundSchema, } from "./structuredresult.js"; import { TextRange, TextRange$inboundSchema } from "./textrange.js"; export const AutocompleteResultResultType = { AdditionalDocument: "ADDITIONAL_DOCUMENT", App: "APP", BrowserHistory: "BROWSER_HISTORY", Datasource: "DATASOURCE", Document: "DOCUMENT", Entity: "ENTITY", Golink: "GOLINK", History: "HISTORY", ChatHistory: "CHAT_HISTORY", NewChat: "NEW_CHAT", Operator: "OPERATOR", OperatorValue: "OPERATOR_VALUE", Quicklink: "QUICKLINK", Suggestion: "SUGGESTION", } as const; export type AutocompleteResultResultType = OpenEnum< typeof AutocompleteResultResultType >; export type AutocompleteResult = { result: string; /** * A list of all possible keywords for given result. */ keywords?: Array | undefined; resultType?: AutocompleteResultResultType | undefined; /** * Higher indicates a more confident match. */ score?: number | undefined; operatorMetadata?: OperatorMetadata | undefined; /** * An action for a specific datasource that will show up in autocomplete and app card, e.g. "Create new issue" for jira. */ quicklink?: Quicklink | undefined; document?: Document | undefined; url?: string | undefined; /** * A single object that can support any object in the work graph. Only a single object will be populated. */ structuredResult?: StructuredResult | undefined; /** * A token to be passed in /feedback events associated with this autocomplete result. */ trackingToken?: string | undefined; /** * Subsections of the result string to which some special formatting should be applied (eg. bold) */ ranges?: Array | undefined; }; /** @internal */ export const AutocompleteResultResultType$inboundSchema: z.ZodType< AutocompleteResultResultType, z.ZodTypeDef, unknown > = openEnums.inboundSchema(AutocompleteResultResultType); /** @internal */ export const AutocompleteResult$inboundSchema: z.ZodType< AutocompleteResult, z.ZodTypeDef, unknown > = z.object({ result: z.string(), keywords: z.array(z.string()).optional(), resultType: AutocompleteResultResultType$inboundSchema.optional(), score: z.number().optional(), operatorMetadata: OperatorMetadata$inboundSchema.optional(), quicklink: Quicklink$inboundSchema.optional(), document: Document$inboundSchema.optional(), url: z.string().optional(), structuredResult: StructuredResult$inboundSchema.optional(), trackingToken: z.string().optional(), ranges: z.array(TextRange$inboundSchema).optional(), }); export function autocompleteResultFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AutocompleteResult$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AutocompleteResult' from JSON`, ); }