UNPKG

@topoos/push

Version:

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

130 lines (105 loc) 5.79 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var _ApiClient = _interopRequireDefault(require("../ApiClient")); var _AddDeviceToGroup = _interopRequireDefault(require("../org.wso2.client.model.PUSH/AddDeviceToGroup")); var _Error = _interopRequireDefault(require("../org.wso2.client.model.PUSH/Error")); 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; } /** * Usuario service. * @module org.wso2.client.api.PUSH/UsuarioApi * @version 1.0.0 */ var UsuarioApi = /*#__PURE__*/function () { /** * Constructs a new UsuarioApi. * @alias module:org.wso2.client.api.PUSH/UsuarioApi * @class * @param {module:ApiClient} [apiClient] Optional API client implementation to use, * default to {@link module:ApiClient#instance} if unspecified. */ function UsuarioApi(apiClient) { _classCallCheck(this, UsuarioApi); this.apiClient = apiClient || _ApiClient["default"].instance; } /** * Callback function to receive the result of the addDevicesToUser operation. * @callback module:org.wso2.client.api.PUSH/UsuarioApi~addDevicesToUserCallback * @param {String} error Error message, if any. * @param data This operation does not return a value. * @param {String} response The complete HTTP response. */ /** * Añadir dispositivos asignados al usuario * Crea un usuario con un grupo de dispositivos asignados, o los añade al grupo si el usuario ya tenía uno creado * @param {String} userId Identificador del usuario * @param {module:org.wso2.client.model.PUSH/AddDeviceToGroup} addDeviceToGroup * @param {module:org.wso2.client.api.PUSH/UsuarioApi~addDevicesToUserCallback} callback The callback function, accepting three arguments: error, data, response */ _createClass(UsuarioApi, [{ key: "addDevicesToUser", value: function addDevicesToUser(userId, addDeviceToGroup, callback) { var postBody = addDeviceToGroup; // verify the required parameter 'userId' is set if (userId === undefined || userId === null) { throw new _Error["default"]("Missing the required parameter 'userId' when calling addDevicesToUser"); } // verify the required parameter 'addDeviceToGroup' is set if (addDeviceToGroup === undefined || addDeviceToGroup === null) { throw new _Error["default"]("Missing the required parameter 'addDeviceToGroup' when calling addDevicesToUser"); } var pathParams = { 'userId': userId }; var queryParams = {}; var headerParams = {}; var formParams = {}; var authNames = ['default']; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = null; return this.apiClient.callApi('/users/{userId}/devices', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback); } /** * Callback function to receive the result of the removeDevicesFromUser operation. * @callback module:org.wso2.client.api.PUSH/UsuarioApi~removeDevicesFromUserCallback * @param {String} error Error message, if any. * @param data This operation does not return a value. * @param {String} response The complete HTTP response. */ /** * Quitar dispositivos asignados al usuario * Elimina un conjunto de dispositivos del grupo de dispositivos del usuario. El grupo de dispositivos del usuario se elimina si pasa a estar vacío * @param {String} userId Identificador del usuario * @param {module:org.wso2.client.model.PUSH/AddDeviceToGroup} addDeviceToGroup * @param {module:org.wso2.client.api.PUSH/UsuarioApi~removeDevicesFromUserCallback} callback The callback function, accepting three arguments: error, data, response */ }, { key: "removeDevicesFromUser", value: function removeDevicesFromUser(userId, addDeviceToGroup, callback) { var postBody = addDeviceToGroup; // verify the required parameter 'userId' is set if (userId === undefined || userId === null) { throw new _Error["default"]("Missing the required parameter 'userId' when calling removeDevicesFromUser"); } // verify the required parameter 'addDeviceToGroup' is set if (addDeviceToGroup === undefined || addDeviceToGroup === null) { throw new _Error["default"]("Missing the required parameter 'addDeviceToGroup' when calling removeDevicesFromUser"); } var pathParams = { 'userId': userId }; var queryParams = {}; var headerParams = {}; var formParams = {}; var authNames = ['default']; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = null; return this.apiClient.callApi('/users/{userId}/devices', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback); } }]); return UsuarioApi; }(); exports["default"] = UsuarioApi;