import { ConversationState } from '../conversation'; import { MessageType } from './message_type'; export interface TextMessage { id?: number; type: MessageType.TEXT; text: string; icon: string | null; } export interface CommandMessage { id?: number; type: MessageType.COMMAND; command: string; json?: any; } export interface MediaMessage { id?: number; type: MessageType.PICTURE | MessageType.AUDIO | MessageType.VIDEO; url: string; alt?: string; icon: string | null; } export interface RDL { displayTitle: string; displayText?: string; webCallback: string; callback?: string; pictureUrl?: string; } export interface RDLMessage { id?: number; type: MessageType.RDL; rdl: RDL; icon: string | null; } export interface SoundEffectMessage { id?: number; type: MessageType.SOUND_EFFECT; name: string; exclusive: boolean; icon: string | null; } export interface ChoiceMessage { id?: number; type: MessageType.CHOICE; idx: number; title: string; } export interface LinkMessage { id?: number; type: MessageType.LINK; url: string; title: string; /** * Conversation state associated with this link message. * * This is added to link messages to enable transparent * transfer of conversations across registration and * configuration flows. */ state: ConversationState; } export interface ButtonMessage { id?: number; type: MessageType.BUTTON; json: string; title: string; } export interface NewProgramMessage { id?: number; type: MessageType.NEW_PROGRAM; uniqueId: string; name: string; code: string; results: Array>; errors: string[]; icon: string | null; } /** * A message (chat bubble) from either the user or the agent. * * Objects of this type are included in the conversation history. * * They correspond to protocol messages sent from the server to * the client when the server replays the history, or when a * new message is added to the history. */ export declare type Message = TextMessage | CommandMessage | MediaMessage | RDLMessage | SoundEffectMessage | ChoiceMessage | LinkMessage | ButtonMessage | NewProgramMessage;