typings/lib2/messagev2/messagePayload/attachmentMessage.js

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AttachmentType = exports.Attachment = exports.AttachmentMessage = void 0;
const internal_1 = require("../internal");
/**
 * Represents an attachment message.
 */
class AttachmentMessage extends internal_1.NonRawMessage {
    /**
     * Constructs an AttachmentMessage object with the specified attachment.
     * @param {Attachment} attachment The attachment of the message (required).
     */
    constructor(attachment) {
        super();
        this.type = 'attachment';
        this.attachment = attachment;
    }
    /**
     * Deserialize nested object properties into corresponding class instances
     */
    deserializeNestedProperties() {
        super.deserializeNestedProperties();
        this.attachment = internal_1.MessageUtil.deserializeAttachment(this.attachment);
    }
    /**
     * Gets the attachment of the message.
     * @returns {Attachment} The attachment of the message.
     */
    getAttachment() {
        return this.attachment;
    }
    /**
     * Sets the attachment of the message.
     * @param {Attachment} attachment The attachment of the message.
     * @returns This AttachmentMessage instance.
     */
    setAttachment(attachment) {
        this.attachment = attachment;
        return this;
    }
}
exports.AttachmentMessage = AttachmentMessage;
/**
 * Represents an attachment.
 */
class Attachment {
    /**
     * Constructs an Attachment object with the specified type and URL.
     * @param type The type of the attachment (required).
     * @param url The URL of the attachment (required).
     */
    constructor(type, url) {
        this.type = type;
        this.url = url;
    }
    /**
     * Gets the type of the attachment.
     * @returns The type of the attachment.
     */
    getType() {
        return this.type;
    }
    /**
     * Sets the type of the attachment.
     * @param type The type of the attachment.
     * @returns This Attachment instance.
     */
    setType(type) {
        this.type = type;
        return this;
    }
    /**
     * Gets the URL of the attachment.
     * @returns The URL of the attachment.
     */
    getUrl() {
        return this.url;
    }
    /**
     * Sets the URL of the attachment.
     * @param url The URL of the attachment.
     * @returns This Attachment instance.
     */
    setUrl(url) {
        this.url = url;
        return this;
    }
    /**
     * Gets the title of the attachment.
     * @returns The title of the attachment.
     */
    getTitle() {
        return this.title;
    }
    /**
     * Sets the title of the attachment.
     * @param title The title of the attachment.
     * @returns This Attachment instance.
     */
    setTitle(title) {
        this.title = title;
        return this;
    }
}
exports.Attachment = Attachment;
/**
 * Represents the type of an attachment.
 */
var AttachmentType;
(function (AttachmentType) {
    AttachmentType["file"] = "file";
    AttachmentType["video"] = "video";
    AttachmentType["audio"] = "audio";
    AttachmentType["image"] = "image";
})(AttachmentType = exports.AttachmentType || (exports.AttachmentType = {}));