UNPKG

@topoos/push

Version:

SDK para el servicio de envío de notificaciones mediante Firebase Cloud Messaging, desarrollado en NodeJS.

118 lines (96 loc) 5.53 kB
"use strict"; 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 _SubscribeToTopic = _interopRequireDefault(require("../org.wso2.client.model.PUSH/SubscribeToTopic")); var _SubscribeToTopicResponse = _interopRequireDefault(require("../org.wso2.client.model.PUSH/SubscribeToTopicResponse")); 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; } /** * Topic service. * @module org.wso2.client.api.PUSH/TopicApi * @version 1.0.0 */ var TopicApi = /*#__PURE__*/function () { /** * Constructs a new TopicApi. * @alias module:org.wso2.client.api.PUSH/TopicApi * @class * @param {module:ApiClient} [apiClient] Optional API client implementation to use, * default to {@link module:ApiClient#instance} if unspecified. */ function TopicApi(apiClient) { _classCallCheck(this, TopicApi); this.apiClient = apiClient || _ApiClient["default"].instance; } /** * Callback function to receive the result of the subscribeToTopic operation. * @callback module:org.wso2.client.api.PUSH/TopicApi~subscribeToTopicCallback * @param {String} error Error message, if any. * @param {module:org.wso2.client.model.PUSH/SubscribeToTopicResponse} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Suscribir dispositivos a un topic * Suscribe un conjunto de dispositivos, identificados por su token de registro, a un topic, identificado por nombre * @param {module:org.wso2.client.model.PUSH/SubscribeToTopic} subscribeToTopic * @param {module:org.wso2.client.api.PUSH/TopicApi~subscribeToTopicCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:org.wso2.client.model.PUSH/SubscribeToTopicResponse} */ _createClass(TopicApi, [{ key: "subscribeToTopic", value: function subscribeToTopic(_subscribeToTopic, callback) { var postBody = _subscribeToTopic; // verify the required parameter 'subscribeToTopic' is set if (_subscribeToTopic === undefined || _subscribeToTopic === null) { throw new _Error["default"]("Missing the required parameter 'subscribeToTopic' when calling subscribeToTopic"); } var pathParams = {}; var queryParams = {}; var headerParams = {}; var formParams = {}; var authNames = ['default']; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = _SubscribeToTopicResponse["default"]; return this.apiClient.callApi('/topic', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback); } /** * Callback function to receive the result of the unsubscribeFromTopic operation. * @callback module:org.wso2.client.api.PUSH/TopicApi~unsubscribeFromTopicCallback * @param {String} error Error message, if any. * @param {module:org.wso2.client.model.PUSH/SubscribeToTopicResponse} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Desuscribir dispositivos a un topic * Desuscribe un conjunto de dispositivos, identificados por su token de registro, a un topic, identificado por nombre * @param {module:org.wso2.client.model.PUSH/SubscribeToTopic} subscribeToTopic * @param {module:org.wso2.client.api.PUSH/TopicApi~unsubscribeFromTopicCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:org.wso2.client.model.PUSH/SubscribeToTopicResponse} */ }, { key: "unsubscribeFromTopic", value: function unsubscribeFromTopic(subscribeToTopic, callback) { var postBody = subscribeToTopic; // verify the required parameter 'subscribeToTopic' is set if (subscribeToTopic === undefined || subscribeToTopic === null) { throw new _Error["default"]("Missing the required parameter 'subscribeToTopic' when calling unsubscribeFromTopic"); } var pathParams = {}; var queryParams = {}; var headerParams = {}; var formParams = {}; var authNames = ['default']; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = _SubscribeToTopicResponse["default"]; return this.apiClient.callApi('/topic', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback); } }]); return TopicApi; }(); exports["default"] = TopicApi;