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) • 4.5 kB
JavaScript
;
/* globals module */
/**
* @module skillBatchClient
* @description Baasic Skill Batch Service provides Baasic route templates which can be expanded to Baasic REST URIs. Various services can use Baasic Skill Route Service to obtain needed routes while other routes will be obtained through HAL. By convention, all route services use the same function names as their corresponding services.
*/
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 SkillBatchClient = /** @class */ (function () {
function SkillBatchClient(skillBatchRoute, apiClient) {
this.skillBatchRoute = skillBatchRoute;
this.apiClient = apiClient;
}
Object.defineProperty(SkillBatchClient.prototype, "routeDefinition", {
get: function () {
return this.skillBatchRoute;
},
enumerable: true,
configurable: true
});
/**
* Returns a promise that is resolved once the create skill action has been performed; this action creates new skill resources.
* @method
* @param data A collection of skill objects that need to be inserted into the system.
* @returns A promise that is resolved once the create skill action has been performed.
* @example skillClient.create([{
description : '<description>',
name : '<name>',
slug: '<slug>'
}])
.then(function (data) {
// perform success action here
},
function (response, status, headers, config) {
// perform error handling here
});
**/
SkillBatchClient.prototype.create = function (data) {
return this.apiClient.post(this.routeDefinition.create(), this.routeDefinition.createParams(data));
};
/**
* Returns a promise that is resolved once the update skill action has been performed; this action updates specified skill resources.
* @method
* @param data A collection of skill objects used to update specified skill resources.
* @returns A promise that is resolved once the update skill action has been performed.
* @example skillBatchClient.update(companies)
.then(function (data) {
// perform success action here
},
function (response, status, headers, config) {
// perform error handling here
});
**/
SkillBatchClient.prototype.update = function (data) {
return this.apiClient.put(this.routeDefinition.update(), this.routeDefinition.updateParams(data));
};
/**
* Returns a promise that is resolved once the remove action has been performed. This action will remove skill resources from the system if successfully completed.
* @method
* @param ids Collection of skill ids which uniquely identifies skill resources that need to be deleted.
* @returns A promise that is resolved once the remove action has been performed.
* @example skillBatchClient.remove(skillIds)
.then(function (data) {
// perform success action here
},
function (response, status, headers, config) {
// perform error handling here
});
**/
SkillBatchClient.prototype.remove = function (ids) {
return this.apiClient.delete(this.skillBatchRoute.delete(), undefined, ids);
};
SkillBatchClient = tslib_1.__decorate([
inversify_1.injectable(),
tslib_1.__param(0, inversify_1.inject(_1.TYPES.SkillBatchRoute)),
tslib_1.__param(1, inversify_1.inject(httpApi_1.httpTYPES.ApiClient)),
tslib_1.__metadata("design:paramtypes", [_1.SkillBatchRoute,
httpApi_1.ApiClient])
], SkillBatchClient);
return SkillBatchClient;
}());
exports.SkillBatchClient = SkillBatchClient;
/**
* @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.
*/