UNPKG

mongodb-stitch

Version:

[![Join the chat at https://gitter.im/mongodb/stitch](https://badges.gitter.im/mongodb/stitch.svg)](https://gitter.im/mongodb/stitch?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

54 lines (43 loc) 1.96 kB
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _util = require('../../util'); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * Create a new TwilioService instance (not meant to be instantiated directly, * use `.service('twilio', '<service-name>')` on a {@link StitchClient} instance). * * @class * @return {TwilioService} a TwilioService instance. */ var TwilioService = function () { function TwilioService(stitchClient, serviceName) { _classCallCheck(this, TwilioService); this.client = stitchClient; this.serviceName = serviceName; } /** * Send a text message to a number * * @method * @param {String} from number to send from * @param {String} to number to send to * @param {String} body SMS body content * @return {Promise} which resolves to 'null' when message is sent successfully, * or is rejected when there is an error */ _createClass(TwilioService, [{ key: 'send', value: function send(from, to, body) { return (0, _util.serviceResponse)(this, { action: 'send', args: { from: from, to: to, body: body } }); } }]); return TwilioService; }(); exports.default = TwilioService; module.exports = exports['default'];