UNPKG

baasic-sdk-javascript

Version:

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

64 lines (63 loc) 3.07 kB
"use strict"; /* globals module */ /** * @module notificationsPublishBatchClient * @description Notifications Publish Batch Client provides an easy way to consume Notifications REST API end-points. In order to obtain needed routes `notificationsPublishBatchClient` uses `notificationsPublishBatchRoute`. */ 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 NotificationsPublishBatchClient = /** @class */ (function () { function NotificationsPublishBatchClient(notificationsPublishBatchRoute, apiClient) { this.notificationsPublishBatchRoute = notificationsPublishBatchRoute; this.apiClient = apiClient; } Object.defineProperty(NotificationsPublishBatchClient.prototype, "routeDefinition", { get: function () { return this.notificationsPublishBatchRoute; }, enumerable: true, configurable: true }); /** * Returns a promise that is resolved once the create notification action has been performed; this action creates new notification resources. * @method * @param data The notification collection. * @returns A promise that is resolved once the create notification action has been performed. * @example notificationsPublishBatchClient.create([{ channels: ['<channel-name', '<channel-name>'], moduleName: '<module-name>', templateName: '<template-name>', templateContext: { prop1: '<prop1-value>', prop2: '<prop2-value>' } }]) .then(function (data) { // perform success action here }, function (response, status, headers, config) { // perform error handling here }); */ NotificationsPublishBatchClient.prototype.create = function (data) { return this.apiClient.post(this.routeDefinition.create(), this.routeDefinition.createParams(data)); }; NotificationsPublishBatchClient = tslib_1.__decorate([ inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(_1.TYPES.NotificationsPublishBatchRoute)), tslib_1.__param(1, inversify_1.inject(httpApi_1.httpTYPES.ApiClient)), tslib_1.__metadata("design:paramtypes", [_1.NotificationsPublishBatchRoute, httpApi_1.ApiClient]) ], NotificationsPublishBatchClient); return NotificationsPublishBatchClient; }()); exports.NotificationsPublishBatchClient = NotificationsPublishBatchClient; /** * @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. */