@topoos/push
Version:
SDK para el servicio de envío de notificaciones mediante Firebase Cloud Messaging, desarrollado en NodeJS.
79 lines (63 loc) • 3.38 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _ApiClient = _interopRequireDefault(require("../ApiClient"));
var _Error = _interopRequireDefault(require("../org.wso2.client.model.PUSH/Error"));
var _PostNotificationResult = _interopRequireDefault(require("../org.wso2.client.model.PUSH/PostNotificationResult"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
//import UNKNOWN_BASE_TYPE from '../org.wso2.client.model.PUSH/UNKNOWN_BASE_TYPE';
/**
* Notificacion service.
* @module org.wso2.client.api.PUSH/NotificacionApi
* @version 1.0.0
*/
var NotificacionApi = /*#__PURE__*/function () {
/**
* Constructs a new NotificacionApi.
* @alias module:org.wso2.client.api.PUSH/NotificacionApi
* @class
* @param {module:ApiClient} [apiClient] Optional API client implementation to use,
* default to {@link module:ApiClient#instance} if unspecified.
*/
function NotificacionApi(apiClient) {
_classCallCheck(this, NotificacionApi);
this.apiClient = apiClient || _ApiClient["default"].instance;
}
/**
* Callback function to receive the result of the sendNotification operation.
* @callback module:org.wso2.client.api.PUSH/NotificacionApi~sendNotificationCallback
* @param {String} error Error message, if any.
* @param {module:org.wso2.client.model.PUSH/PostNotificationResult} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* Enviar notificación
* Envía una notificación a topic, usuario, dispositivo o condición
* @param {Object} opts Optional parameters
* @param {module:org.wso2.client.api.PUSH/NotificacionApi~sendNotificationCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:org.wso2.client.model.PUSH/PostNotificationResult}
*/
_createClass(NotificacionApi, [{
key: "sendNotification",
value: function sendNotification(opts, callback) {
opts = opts || {};
var postBody = opts;
var pathParams = {};
var queryParams = {};
var headerParams = {};
var formParams = {};
var authNames = ['default'];
var contentTypes = ['application/json'];
var accepts = ['application/json'];
var returnType = _PostNotificationResult["default"];
return this.apiClient.callApi('/notification', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
}
}]);
return NotificacionApi;
}();
exports["default"] = NotificacionApi;