UNPKG

baasic-sdk-javascript

Version:

JavaScript SDK provides core functionality for building web and mobile applications on [Baasic](http://www.baasic.com/).

92 lines (91 loc) 5.06 kB
"use strict"; /* globals module */ /** * @module notificationsSubscriptionsUsersBatchClient * @description Notifications Subscriptions Users Batch Client provides an easy way to consume Notifications REST API end-points. In order to obtain needed routes `notificationsSubscriptionsUsersBatchUsersClient` uses `notificationsSubscriptionsUsersBatchRoute`. */ Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); var inversify_1 = require("inversify"); ; var httpApi_1 = require("../../httpApi"); var _1 = require("./"); var NotificationsSubscriptionsUsersBatchClient = /** @class */ (function () { function NotificationsSubscriptionsUsersBatchClient(notificationsSubscriptionsUsersBatchRoute, apiClient) { this.notificationsSubscriptionsUsersBatchRoute = notificationsSubscriptionsUsersBatchRoute; this.apiClient = apiClient; } Object.defineProperty(NotificationsSubscriptionsUsersBatchClient.prototype, "routeDefinition", { get: function () { return this.notificationsSubscriptionsUsersBatchRoute; }, enumerable: true, configurable: true }); /** * Returns a promise that is resolved once the create user subscription action has been performed; this action creates new user subscription resources. * @method * @param data UserSubscription collection that need to be inserted into the system. * @returns A promise that is resolved once the create user subscription action has been performed. * @example notificationsSubscriptionsUsersBatchClient.create([{ channel: '<channel-name>', userId: '<user-id>' }]) .then(function (data) { // perform success action here }, function (response, status, headers, config) { // perform error handling here }); */ NotificationsSubscriptionsUsersBatchClient.prototype.create = function (data) { return this.apiClient.post(this.routeDefinition.create(), this.routeDefinition.createParams(data)); }; /** * Returns a promise that is resolved once the remove action has been performed. This action will remove user subscription resources from the system if successfully completed. * @method * @param ids The subscription ids which uniquely identify UserSubscription resources that need to be deleted. * @returns A promise that is resolved once the remove action has been performed. * @example notificationsSubscriptionsUsersBatchClient.remove(subscriptionIds) .then(function (data) { // perform success action here }, function (response, status, headers, config) { // perform error handling here }); */ NotificationsSubscriptionsUsersBatchClient.prototype.remove = function (ids) { return this.apiClient.delete(this.notificationsSubscriptionsUsersBatchRoute.delete(), undefined, ids); }; /** * Returns a promise that is resolved once the update user subscriptions action has been performed; this action updates specified user subscription resources. * @method * @param data UserSubscription objects used to update specified UserSubscription resources. * @returns A promise that is resolved once the update user subscriptions action has been performed. * @example notificationsSubscriptionsUsersBatchClient.update(subscriptions) .then(function (data) { // perform success action here }, function (response, status, headers, config) { // perform error handling here }); */ NotificationsSubscriptionsUsersBatchClient.prototype.update = function (data) { return this.apiClient.put(this.routeDefinition.update(), this.routeDefinition.updateParams(data)); }; NotificationsSubscriptionsUsersBatchClient = tslib_1.__decorate([ inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(_1.TYPES.NotificationsSubscriptionsUsersBatchRoute)), tslib_1.__param(1, inversify_1.inject(httpApi_1.httpTYPES.ApiClient)), tslib_1.__metadata("design:paramtypes", [_1.NotificationsSubscriptionsUsersBatchRoute, httpApi_1.ApiClient]) ], NotificationsSubscriptionsUsersBatchClient); return NotificationsSubscriptionsUsersBatchClient; }()); exports.NotificationsSubscriptionsUsersBatchClient = NotificationsSubscriptionsUsersBatchClient; /** * @overview ***Notes:** - Refer to the [REST API documentation](https://github.com/Baasic/baasic-rest-api/wiki) for detailed information about available Baasic REST API end-points. - All end-point objects are transformed by the associated route service. */