/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 3b87493ed5f6 */ 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 { IconConfig, IconConfig$inboundSchema, IconConfig$Outbound, IconConfig$outboundSchema, } from "./iconconfig.js"; import { Person, Person$inboundSchema, Person$Outbound, Person$outboundSchema, } from "./person.js"; /** * Metadata of a Chat a user had with Glean Assistant. This contains no actual conversational content. */ export type ChatMetadata = { /** * The opaque id of the Chat. */ id?: string | undefined; /** * Server Unix timestamp of the creation time (in seconds since epoch UTC). */ createTime?: number | undefined; createdBy?: Person | undefined; /** * Server Unix timestamp of the update time (in seconds since epoch UTC). */ updateTime?: number | undefined; /** * The name of the Chat. */ name?: string | undefined; /** * The ID of the AI App that this Chat is associated to. */ applicationId?: string | undefined; /** * The display name of the AI App that this Chat is associated to. */ applicationName?: string | undefined; /** * Defines how to render an icon */ icon?: IconConfig | undefined; }; /** @internal */ export const ChatMetadata$inboundSchema: z.ZodType< ChatMetadata, z.ZodTypeDef, unknown > = z.object({ id: z.string().optional(), createTime: z.number().int().optional(), createdBy: z.lazy(() => Person$inboundSchema).optional(), updateTime: z.number().int().optional(), name: z.string().optional(), applicationId: z.string().optional(), applicationName: z.string().optional(), icon: IconConfig$inboundSchema.optional(), }); /** @internal */ export type ChatMetadata$Outbound = { id?: string | undefined; createTime?: number | undefined; createdBy?: Person$Outbound | undefined; updateTime?: number | undefined; name?: string | undefined; applicationId?: string | undefined; applicationName?: string | undefined; icon?: IconConfig$Outbound | undefined; }; /** @internal */ export const ChatMetadata$outboundSchema: z.ZodType< ChatMetadata$Outbound, z.ZodTypeDef, ChatMetadata > = z.object({ id: z.string().optional(), createTime: z.number().int().optional(), createdBy: z.lazy(() => Person$outboundSchema).optional(), updateTime: z.number().int().optional(), name: z.string().optional(), applicationId: z.string().optional(), applicationName: z.string().optional(), icon: IconConfig$outboundSchema.optional(), }); export function chatMetadataToJSON(chatMetadata: ChatMetadata): string { return JSON.stringify(ChatMetadata$outboundSchema.parse(chatMetadata)); } export function chatMetadataFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ChatMetadata$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ChatMetadata' from JSON`, ); }