/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: a40ad4c092f7 */ import * as z from "zod/v3"; import { ClosedEnum } from "../../types/enums.js"; /** * Type of the id in the incoming request. */ export const IdType = { ChannelName: "CHANNEL_NAME", ThreadId: "THREAD_ID", ConversationId: "CONVERSATION_ID", } as const; /** * Type of the id in the incoming request. */ export type IdType = ClosedEnum; /** * The direction of the results asked with respect to the reference timestamp. Missing field defaults to OLDER. Only applicable when using a message_id. */ export const Direction = { Older: "OLDER", Newer: "NEWER", } as const; /** * The direction of the results asked with respect to the reference timestamp. Missing field defaults to OLDER. Only applicable when using a message_id. */ export type Direction = ClosedEnum; /** * The type of the data source. */ export const Datasource = { Slack: "SLACK", Slackentgrid: "SLACKENTGRID", Microsoftteams: "MICROSOFTTEAMS", Gchat: "GCHAT", Facebookworkplace: "FACEBOOKWORKPLACE", } as const; /** * The type of the data source. */ export type Datasource = ClosedEnum; export type MessagesRequest = { /** * Type of the id in the incoming request. */ idType: IdType; /** * ID corresponding to the requested idType. Note that channel and threads are represented by the underlying datasource's ID and conversations are represented by their document's ID. */ id: string; /** * Id for the for the workspace in case of multiple workspaces. */ workspaceId?: string | undefined; /** * The direction of the results asked with respect to the reference timestamp. Missing field defaults to OLDER. Only applicable when using a message_id. */ direction?: Direction | undefined; /** * Timestamp in millis of the reference message. Only applicable when using a message_id. */ timestampMillis?: number | undefined; /** * Whether to include root message in response. */ includeRootMessage?: boolean | undefined; /** * The type of the data source. */ datasource: Datasource; /** * The datasource instance display name from which the document was extracted. This is used for appinstance facet filter for datasources that support multiple instances. */ datasourceInstanceDisplayName?: string | undefined; }; /** @internal */ export const IdType$outboundSchema: z.ZodNativeEnum = z .nativeEnum(IdType); /** @internal */ export const Direction$outboundSchema: z.ZodNativeEnum = z .nativeEnum(Direction); /** @internal */ export const Datasource$outboundSchema: z.ZodNativeEnum = z .nativeEnum(Datasource); /** @internal */ export type MessagesRequest$Outbound = { idType: string; id: string; workspaceId?: string | undefined; direction?: string | undefined; timestampMillis?: number | undefined; includeRootMessage?: boolean | undefined; datasource: string; datasourceInstanceDisplayName?: string | undefined; }; /** @internal */ export const MessagesRequest$outboundSchema: z.ZodType< MessagesRequest$Outbound, z.ZodTypeDef, MessagesRequest > = z.object({ idType: IdType$outboundSchema, id: z.string(), workspaceId: z.string().optional(), direction: Direction$outboundSchema.optional(), timestampMillis: z.number().int().optional(), includeRootMessage: z.boolean().optional(), datasource: Datasource$outboundSchema, datasourceInstanceDisplayName: z.string().optional(), }); export function messagesRequestToJSON( messagesRequest: MessagesRequest, ): string { return JSON.stringify(MessagesRequest$outboundSchema.parse(messagesRequest)); }