// ╔═══════╗╔═══════╗╔════╗╔═╗╔════╗╔═╗╔═══════╗╔═══════╗╔═══════╗╔═══════╗╔═══════╗╔════╗╔═╗ ╔═══════╗╔═╗ ╔═══════╗╔═══════╗╔═══════╗╔═══════╗╔═══════╗ ╔═══════╗╔═══════╗ // ║ ╔═════╝║ ╔═══╗ ║║ ╔╗ ║║ ║║ ╔╗ ║║ ║║ ╔═════╝║ ╔═════╝╚══╗ ╔══╝╚══╗ ╔══╝║ ╔═══╗ ║║ ╔╗ ║║ ║ ║ ╔═════╝║ ║ ║ ╔═══╗ ║║ ╔═════╝║ ╔═════╝║ ╔═════╝║ ╔═════╝ ╚══╗ ╔══╝║ ╔═════╝ // ║ ║ ║ ║ ║ ║║ ║║ ║║ ║║ ║║ ║║ ║║ ╚═════╗║ ║ ║ ║ ║ ║ ║ ║ ║ ║║ ║║ ║║ ║╔═══════╗║ ║ ║ ║ ║ ╚═══╝ ║║ ╚═════╗║ ╚═════╗║ ╚═════╗║ ╚═════╗ ║ ║ ║ ╚═════╗ // ║ ║ ║ ║ ║ ║║ ║║ ║║ ║║ ║║ ║║ ║║ ╔═════╝║ ║ ║ ║ ║ ║ ║ ║ ║ ║║ ║║ ║║ ║╚═══════╝║ ║ ║ ║ ║ ╔═══╗ ║╚═════╗ ║╚═════╗ ║║ ╔═════╝╚═════╗ ║ ║ ║ ╚═════╗ ║ // ║ ╚═════╗║ ╚═══╝ ║║ ║║ ╚╝ ║║ ║║ ╚╝ ║║ ╚═════╗║ ╚═════╗ ║ ║ ╔══╝ ╚══╗║ ╚═══╝ ║║ ║║ ╚╝ ║ ║ ╚═════╗║ ╚═════╗║ ║ ║ ║╔═════╝ ║╔═════╝ ║║ ╚═════╗╔═════╝ ║╔═╗ ║ ║ ╔═════╝ ║ // ╚═══════╝╚═══════╝╚═╝╚════╝╚═╝╚════╝╚═══════╝╚═══════╝ ╚═╝ ╚═══════╝╚═══════╝╚═╝╚════╝ ╚═══════╝╚═══════╝╚═╝ ╚═╝╚═══════╝╚═══════╝╚═══════╝╚═══════╝╚═╝ ╚═╝ ╚═══════╝ // ╔═══════╗╔═══════╗╔═══════╗╔═══════╗╔═══════╗╔═══════╗╔═══════╗ // ╚══╗ ╔══╝║ ╔╗ ╔╗ ║║ ╔═══╗ ║║ ╔═══╗ ║║ ╔═══╗ ║╚══╗ ╔══╝║ ╔═════╝ // ║ ║ ║ ║║ ║║ ║║ ╚═══╝ ║║ ║ ║ ║║ ╚═══╝ ║ ║ ║ ║ ╚═════╗ // ║ ║ ║ ║║ ║║ ║║ ╔═════╝║ ║ ║ ║║ ╔═╗ ╔═╝ ║ ║ ╚═════╗ ║ // ╔══╝ ╚══╗║ ║║ ║║ ║║ ║ ║ ╚═══╝ ║║ ║ ║ ╚═╗ ║ ║ ╔═════╝ ║ // ╚═══════╝╚═╝╚═╝╚═╝╚═╝ ╚═══════╝╚═╝ ╚═══╝ ╚═╝ ╚═══════╝ import * as messageEngine from '../../message-engine/message-engine.js'; // ╔═══════╗╔═══════╗╔═══════╗╔═╗ ╔═══════╗╔═══════╗╔═══════╗ // ╚╗ ╔══╗ ║║ ╔═════╝║ ╔═════╝║ ║ ║ ╔═══╗ ║║ ╔═══╗ ║║ ╔═════╝ // ║ ║ ║ ║║ ╚═════╗║ ║ ║ ║ ║ ╚═══╝ ║║ ╚═══╝ ║║ ╚═════╗ // ║ ║ ║ ║║ ╔═════╝║ ║ ║ ║ ║ ╔═══╗ ║║ ╔═╗ ╔═╝║ ╔═════╝ // ╔╝ ╚══╝ ║║ ╚═════╗║ ╚═════╗║ ╚═════╗║ ║ ║ ║║ ║ ║ ╚═╗║ ╚═════╗ // ╚═══════╝╚═══════╝╚═══════╝╚═══════╝╚═╝ ╚═╝╚═╝ ╚═══╝╚═══════╝ type SendTemplateMessageParameters = Omit // ╔═══════╗╔═╗ ╔═══════╗╔═══════╗╔═══════╗ // ║ ╔═════╝║ ║ ║ ╔═══╗ ║║ ╔═════╝║ ╔═════╝ // ║ ║ ║ ║ ║ ╚═══╝ ║║ ╚═════╗║ ╚═════╗ // ║ ║ ║ ║ ║ ╔═══╗ ║╚═════╗ ║╚═════╗ ║ // ║ ╚═════╗║ ╚═════╗║ ║ ║ ║╔═════╝ ║╔═════╝ ║ // ╚═══════╝╚═══════╝╚═╝ ╚═╝╚═══════╝╚═══════╝ export class Connection { // ╔═══════╗╔═══════╗╔════╗╔═╗╔═══════╗╔═══════╗╔═══════╗╔═╗ ╔═╗╔═══════╗╔═══════╗╔═══════╗╔═══════╗ // ║ ╔═════╝║ ╔═══╗ ║║ ╔╗ ║║ ║║ ╔═════╝╚══╗ ╔══╝║ ╔═══╗ ║║ ║ ║ ║║ ╔═════╝╚══╗ ╔══╝║ ╔═══╗ ║║ ╔═══╗ ║ // ║ ║ ║ ║ ║ ║║ ║║ ║║ ║║ ╚═════╗ ║ ║ ║ ╚═══╝ ║║ ║ ║ ║║ ║ ║ ║ ║ ║ ║ ║║ ╚═══╝ ║ // ║ ║ ║ ║ ║ ║║ ║║ ║║ ║╚═════╗ ║ ║ ║ ║ ╔═╗ ╔═╝║ ║ ║ ║║ ║ ║ ║ ║ ║ ║ ║║ ╔═╗ ╔═╝ // ║ ╚═════╗║ ╚═══╝ ║║ ║║ ╚╝ ║╔═════╝ ║ ║ ║ ║ ║ ║ ╚═╗║ ╚═══╝ ║║ ╚═════╗ ║ ║ ║ ╚═══╝ ║║ ║ ║ ╚═╗ // ╚═══════╝╚═══════╝╚═╝╚════╝╚═══════╝ ╚═╝ ╚═╝ ╚═══╝╚═══════╝╚═══════╝ ╚═╝ ╚═══════╝╚═╝ ╚═══╝ private readonly _apiKey: string; private readonly _domainName: string; private readonly _regionName: string; constructor(apiKey: string, regionName: string, domainName: string) { this._apiKey = apiKey; this._regionName = regionName; this._domainName = domainName; } // ╔═══════╗╔═══════╗╔════╗╔═╗╔═══════╗ // ║ ╔═════╝║ ╔═════╝║ ╔╗ ║║ ║╚╗ ╔══╗ ║ // ║ ╚═════╗║ ╚═════╗║ ║║ ║║ ║ ║ ║ ║ ║ // ╚═════╗ ║║ ╔═════╝║ ║║ ║║ ║ ║ ║ ║ ║ // ╔═════╝ ║║ ╚═════╗║ ║║ ╚╝ ║╔╝ ╚══╝ ║ // ╚═══════╝╚═══════╝╚═╝╚════╝╚═══════╝ async sendTemplateMessage(parameters: SendTemplateMessageParameters) { return await messageEngine.sendTemplateMessage({ apiKey: this.getApiKey(), region: this.getRegionName(), domain: this.getDomainName(), ...parameters, }); } // ╔═══════╗╔═══════╗╔═══════╗ ╔═╗ ╔═╗ ╔═══════╗╔═╗ ╔═╗ // ║ ╔═══╗ ║║ ╔═══╗ ║╚══╗ ╔══╝ ║ ║ ║ ║ ║ ╔═════╝║ ║ ║ ║ // ║ ╚═══╝ ║║ ╚═══╝ ║ ║ ║ ╔═══════╗║ ╚═╝ ╚═╗║ ╚═════╗║ ╚═══╝ ║ // ║ ╔═══╗ ║║ ╔═════╝ ║ ║ ╚═══════╝║ ╔═══╗ ║║ ╔═════╝╚═════╗ ║ // ║ ║ ║ ║║ ║ ╔══╝ ╚══╗ ║ ║ ║ ║║ ╚═════╗╔═════╝ ║ // ╚═╝ ╚═╝╚═╝ ╚═══════╝ ╚═╝ ╚═╝╚═══════╝╚═══════╝ getApiKey() { return this._apiKey; } // ╔═══════╗╔═══════╗╔═══════╗╔═══════╗╔═══════╗╔════╗╔═╗ // ║ ╔═══╗ ║║ ╔═════╝║ ╔═════╝╚══╗ ╔══╝║ ╔═══╗ ║║ ╔╗ ║║ ║ // ║ ╚═══╝ ║║ ╚═════╗║ ║ ╔═══╗ ║ ║ ║ ║ ║ ║║ ║║ ║║ ║ // ║ ╔═╗ ╔═╝║ ╔═════╝║ ║ ╚═╗ ║ ║ ║ ║ ║ ║ ║║ ║║ ║║ ║ // ║ ║ ║ ╚═╗║ ╚═════╗║ ╚═══╝ ║╔══╝ ╚══╗║ ╚═══╝ ║║ ║║ ╚╝ ║ // ╚═╝ ╚═══╝╚═══════╝╚═══════╝╚═══════╝╚═══════╝╚═╝╚════╝ getRegionName() { return this._regionName; } // ╔═══════╗╔═══════╗╔═══════╗╔═══════╗╔═══════╗╔════╗╔═╗ // ╚╗ ╔══╗ ║║ ╔═══╗ ║║ ╔╗ ╔╗ ║║ ╔═══╗ ║╚══╗ ╔══╝║ ╔╗ ║║ ║ // ║ ║ ║ ║║ ║ ║ ║║ ║║ ║║ ║║ ╚═══╝ ║ ║ ║ ║ ║║ ║║ ║ // ║ ║ ║ ║║ ║ ║ ║║ ║║ ║║ ║║ ╔═══╗ ║ ║ ║ ║ ║║ ║║ ║ // ╔╝ ╚══╝ ║║ ╚═══╝ ║║ ║║ ║║ ║║ ║ ║ ║╔══╝ ╚══╗║ ║║ ╚╝ ║ // ╚═══════╝╚═══════╝╚═╝╚═╝╚═╝╚═╝ ╚═╝╚═══════╝╚═╝╚════╝ getDomainName() { return this._domainName; } }