/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 9ced5127d17b */ 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 { ChatMessage, ChatMessage$inboundSchema } from "./chatmessage.js"; import { IconConfig, IconConfig$inboundSchema } from "./iconconfig.js"; import { ObjectPermissions, ObjectPermissions$inboundSchema, } from "./objectpermissions.js"; import { Person, Person$inboundSchema } from "./person.js"; import { UserRoleSpecification, UserRoleSpecification$inboundSchema, } from "./userrolespecification.js"; /** * A historical representation of a series of chat messages a user had with Glean Assistant. */ export type Chat = { /** * 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; permissions?: ObjectPermissions | undefined; /** * The chat messages within a Chat. */ messages?: Array | undefined; /** * A list of roles for this Chat. */ roles?: Array | undefined; }; /** @internal */ export const Chat$inboundSchema: z.ZodType = z .object({ id: z.string().optional(), createTime: z.number().int().optional(), createdBy: Person$inboundSchema.optional(), updateTime: z.number().int().optional(), name: z.string().optional(), applicationId: z.string().optional(), applicationName: z.string().optional(), icon: IconConfig$inboundSchema.optional(), permissions: ObjectPermissions$inboundSchema.optional(), messages: z.array(ChatMessage$inboundSchema).optional(), roles: z.array(UserRoleSpecification$inboundSchema).optional(), }); export function chatFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Chat$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Chat' from JSON`, ); }