typings/lib2/messagev2/action/postbackAction.js

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PostbackAction = void 0;
const internal_1 = require("../internal");
/**
 * Represents a postback action.
 * @extends Action
 */
class PostbackAction extends internal_1.Action {
    /**
     * Creates an instance of PostbackAction.
     * @param label - The label of the postback action.
     * @param postback - The postback associated with the action.
     */
    constructor(label, postback) {
        super(label);
        this.type = 'postback';
        this.postback = postback;
    }
    /**
     * Gets the postback associated with the action.
     * @returns The postback associated with the action.
     */
    getPostback() {
        return this.postback;
    }
    /**
     * Sets the postback associated with the action.
     * @param postback - The postback to set.
     * @returns The current instance of the PostbackAction class.
     */
    setPostback(postback) {
        this.postback = postback;
        return this;
    }
    /**
     * Gets the keywords.
     * @returns The keywords.
     */
    getKeywords() {
        return this.keywords;
    }
    /**
     * Sets the keywords.
     * @param keywords - The keywords to set.
     * @returns The current instance of the PostbackAction class.
     */
    setKeywords(keywords) {
        this.keywords = keywords;
        return this;
    }
    /**
     * Adds a keyword.
     * @param keyword - The keyword to add.
     * @returns The current instance of the PostbackAction class.
     */
    addKeyword(keyword) {
        if (!this.keywords) {
            this.keywords = [];
        }
        this.keywords.push(keyword);
        return this;
    }
    /**
     * Gets the skipAutoNumber flag.
     * @returns The skipAutoNumber flag.
     */
    getSkipAutoNumber() {
        return this.skipAutoNumber;
    }
    /**
     * Sets the skipAutoNumber flag.
     * @param skipAutoNumber - The skipAutoNumber flag to set.
     * @returns The current instance of the PostbackAction class.
     */
    setSkipAutoNumber(skipAutoNumber) {
        this.skipAutoNumber = skipAutoNumber;
        return this;
    }
}
exports.PostbackAction = PostbackAction;