typings/lib2/messagev2/action/action.js

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DisplayType = exports.ActionStyle = exports.Action = void 0;
const internal_1 = require("../internal");
/**
 * Represents an action.
 * @extends ChannelCustomizable
 */
class Action extends internal_1.ChannelCustomizable {
    /**
     * Creates an instance of Action.
     * @param {string} label - The label of the action.
     */
    constructor(label) {
        super();
        this.label = label;
    }
    /**
     * Deserialize nested object properties into corresponding class instances
     */
    deserializeNestedProperties() {
        super.deserializeNestedProperties();
        if (this.voice) {
            this.voice = internal_1.MessageUtil.deserializeVoice(this.voice);
        }
    }
    /**
     * Gets the ID of the action.
     * @returns {string} The ID of the action.
     */
    getId() {
        return this.id;
    }
    /**
     * Sets the ID of the action.
     * @param {string} id - The ID to set.
     */
    setId(id) {
        this.id = id;
        return this;
    }
    /**
     * Gets the label of the action.
     * @returns {string} The label of the action.
     */
    getLabel() {
        return this.label;
    }
    /**
     * Sets the label of the action.
     * @param {string} label - The label to set.
     * @returns The current instance of the Action class.
     */
    setLabel(label) {
        this.label = label;
        return this;
    }
    /**
     * Gets the voice settings associated with the action.
     * @returns {Voice} The voice settings associated with the action.
     */
    getVoice() {
        return this.voice;
    }
    /**
     * Sets the voice settings associated with the action.
     * @param {Voice} voice - The voice to set.
     * @returns The current instance of the Action class.
     */
    setVoice(voice) {
        this.voice = voice;
        return this;
    }
    /**
     * Gets the image URL of the action.
     * @returns {string} The image URL of the action.
     */
    getImageUrl() {
        return this.imageUrl;
    }
    /**
     * Sets the image URL of the action.
     * @param {string} imageUrl - The image URL to set.
     * @returns The current instance of the Action class.
     */
    setImageUrl(imageUrl) {
        this.imageUrl = imageUrl;
        return this;
    }
    /**
     * Gets the style of the action.
     * @returns {string} The style of the action.
     */
    getStyle() {
        return this.style;
    }
    /**
     * Sets the style of the action.
     * @param {string} style - The style to set.
     * @returns The current instance of the Action class.
     */
    setStyle(style) {
        this.style = style;
        return this;
    }
    /**
     * Gets the style of the action.
     * @returns {DisplayType} The display type of the action.
     */
    getDisplayType() {
        return this.displayType;
    }
    /**
     * Sets the display type of the action.
     * @param {DisplayType} displayType - The display type to set.
     * @returns The current instance of the Action class.
     */
    setDisplayType(displayType) {
        this.displayType = displayType;
        return this;
    }
}
exports.Action = Action;
/**
 * Represents the style of an action.
 */
var ActionStyle;
(function (ActionStyle) {
    ActionStyle["primary"] = "primary";
    ActionStyle["danger"] = "danger";
})(ActionStyle = exports.ActionStyle || (exports.ActionStyle = {}));
/**
 * Represents the display type of an action.
 */
var DisplayType;
(function (DisplayType) {
    DisplayType["button"] = "button";
    DisplayType["link"] = "link";
    DisplayType["icon"] = "icon";
})(DisplayType = exports.DisplayType || (exports.DisplayType = {}));