"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CmClient = void 0;
const api_1 = __importDefault(require("api"));
class CmClient {
    constructor({ productToken }) {
        this.sendSms = async ({ from, to, message, reference, }) => {
            return await this._client.messages_SendMessage({
                messages: {
                    authentication: { productToken: this._productToken },
                    msg: [
                        {
                            from,
                            body: {
                                type: 'auto',
                                content: message,
                            },
                            reference,
                            to: [
                                {
                                    number: to,
                                },
                            ],
                            allowedChannels: ['SMS'],
                            minimumNumberOfMessageParts: 1,
                            maximumNumberOfMessageParts: 8,
                        },
                    ],
                },
            });
        };
        this._productToken = productToken;
        this._client = (0, api_1.default)('@messaging/v1.1#1f38u2plibh3cmv');
    }
}
exports.CmClient = CmClient;
//# sourceMappingURL=client.js.map