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) 4.59 kB
"use strict"; /* globals module */ /** * @module languageBatchClient * @description Language Batch Client provides Baasic route templates which can be expanded to Baasic REST URIs. Various services can use Baasic Language 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 LanguageBatchClient = /** @class */ (function () { function LanguageBatchClient(languageBatchRoute, apiClient) { this.languageBatchRoute = languageBatchRoute; this.apiClient = apiClient; } Object.defineProperty(LanguageBatchClient.prototype, "routeDefinition", { get: function () { return this.languageBatchRoute; }, enumerable: true, configurable: true }); /** * Returns a promise that is resolved once the create company action has been performed; this action creates new company resources. * @method * @param data A collection of company objects that need to be inserted into the system. * @returns A promise that is resolved once the create company action has been performed. * @example languageBatchClient.create([{ description : '<description>', name : '<name>', slug: '<slug>' }]) .then(function (data) { // perform success action here }, function (response, status, headers, config) { // perform error handling here }); **/ LanguageBatchClient.prototype.create = function (data) { return this.apiClient.post(this.languageBatchRoute.create(), this.routeDefinition.createParams(data)); }; /** * Returns a promise that is resolved once the update company action has been performed; this action updates specified company resources. * @method * @param data A collection of company objects used to update specified company resources. * @returns A promise that is resolved once the update company action has been performed. * @example languageBatchClient.update(companies) .then(function (data) { // perform success action here }, function (response, status, headers, config) { // perform error handling here }); **/ LanguageBatchClient.prototype.update = function (data) { return this.apiClient.put(this.languageBatchRoute.update(), this.routeDefinition.updateParams(data)); }; /** * Returns a promise that is resolved once the remove action has been performed. This action will remove company resources from the system if successfully completed. * @method * @param ids Collection of company ids which uniquely identifies company resources that need to be deleted. * @returns A promise that is resolved once the remove action has been performed. * @example languageBatchClient.remove(companyIds) .then(function (data) { // perform success action here }, function (response, status, headers, config) { // perform error handling here }); **/ LanguageBatchClient.prototype.remove = function (ids) { return this.apiClient.delete(this.languageBatchRoute.delete(), undefined, ids); }; LanguageBatchClient = tslib_1.__decorate([ inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(_1.TYPES.LanguageBatchRoute)), tslib_1.__param(1, inversify_1.inject(httpApi_1.httpTYPES.ApiClient)), tslib_1.__metadata("design:paramtypes", [_1.LanguageBatchRoute, httpApi_1.ApiClient]) ], LanguageBatchClient); return LanguageBatchClient; }()); exports.LanguageBatchClient = LanguageBatchClient; /** * @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. */