typings/lib2/messagev2/messagePayload/textStreamMessage.js

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.StreamState = exports.TextStreamMessage = void 0;
const textMessage_1 = require("./textMessage");
/**
 * Represents a text stream message.
 * @extends TextMessage
 */
class TextStreamMessage extends textMessage_1.TextMessage {
    /**
     * Create a new TextStreamMessage object.
     * @param {string} text - The latest text chunk of the stream
     * @param {string} aggregateText - Aggregate text that has been streamed so far
     * @param {string} streamId - Unique identifier of the text stream
     * @param {StreamState} streamState - the state of the stream: start, running or end
     */
    constructor(text, aggregateText, streamId, streamState) {
        super(text);
        this.aggregateText = aggregateText;
        this.streamId = streamId;
        this.streamState = streamState;
        this.type = 'textStream';
        this.aggregateText = aggregateText;
        this.streamId = streamId;
        this.streamState = streamState;
    }
    /**
     * Get the aggregate text content of the message.
     * @returns {string} The aggregate message text.
     */
    getAggregateText() {
        return this.aggregateText;
    }
    /**
     * Set the aggregate text content of the message.
     * @param {string} aggregateText - The text to set.
     * @returns {TextStreamMessage} The current instance of the TextStreamMessage class.
     */
    setAggregateText(aggregateText) {
        this.aggregateText = aggregateText;
        return this;
    }
    /**
     * Get the ID of the text stream
     * @returns {string} The stream ID
     */
    getStreamId() {
        return this.streamId;
    }
    /**
     * Get the state of the text stream
     * @returns {StreamState} The stream state
     */
    getStreamState() {
        return this.streamState;
    }
}
exports.TextStreamMessage = TextStreamMessage;
/**
 * Represents the state of the text stream
 */
var StreamState;
(function (StreamState) {
    StreamState["start"] = "start";
    StreamState["running"] = "running";
    StreamState["end"] = "end";
})(StreamState = exports.StreamState || (exports.StreamState = {}));