baasic-sdk-javascript
Version:
JavaScript SDK provides core functionality for building web and mobile applications on [Baasic](http://www.baasic.com/).
74 lines (73 loc) • 3.45 kB
JavaScript
;
/* globals module */
/**
* @module notificationsPublishClient
* @description Notifications Publish Client provides an easy way to consume Notifications REST API end-points. In order to obtain needed routes `notificationsPublishClient` uses `notificationsPublishRoute`.
*/
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 NotificationsPublishClient = /** @class */ (function () {
function NotificationsPublishClient(notificationsPublishRoute, notificationsPublishBatchClient, apiClient) {
this.notificationsPublishRoute = notificationsPublishRoute;
this.notificationsPublishBatchClient = notificationsPublishBatchClient;
this.apiClient = apiClient;
}
Object.defineProperty(NotificationsPublishClient.prototype, "routeDefinition", {
get: function () {
return this.notificationsPublishRoute;
},
enumerable: true,
configurable: true
});
Object.defineProperty(NotificationsPublishClient.prototype, "batch", {
get: function () {
return this.notificationsPublishBatchClient;
},
enumerable: true,
configurable: true
});
/**
* Returns a promise that is resolved once the create notification action has been performed; this action creates a new notification resource.
* @method
* @param data The notification.
* @returns A promise that is resolved once the create notification action has been performed.
* @example notificationsPublishClient.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
});
*/
NotificationsPublishClient.prototype.create = function (data) {
return this.apiClient.post(this.routeDefinition.create(), this.routeDefinition.createParams(data));
};
NotificationsPublishClient = tslib_1.__decorate([
inversify_1.injectable(),
tslib_1.__param(0, inversify_1.inject(_1.TYPES.NotificationsPublishRoute)),
tslib_1.__param(1, inversify_1.inject(_1.TYPES.NotificationsPublishBatchClient)),
tslib_1.__param(2, inversify_1.inject(httpApi_1.httpTYPES.ApiClient)),
tslib_1.__metadata("design:paramtypes", [_1.NotificationsPublishRoute,
_1.NotificationsPublishBatchClient,
httpApi_1.ApiClient])
], NotificationsPublishClient);
return NotificationsPublishClient;
}());
exports.NotificationsPublishClient = NotificationsPublishClient;
/**
* @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.
*/