baasic-sdk-javascript
Version:
JavaScript SDK provides core functionality for building web and mobile applications on [Baasic](http://www.baasic.com/).
91 lines (90 loc) • 4.46 kB
JavaScript
;
/* globals module */
/**
* @module commerceCountryStateBatchClient
* @description Commerce Country State Batch Client provides an easy way to consume Commerce REST API end-points. In order to obtain a needed routes `commerceCountryStateBatchClient` uses `commerceCountryStateBatchRoute`.
*/
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 CommerceLookupsCountryStateBatchClient = /** @class */ (function () {
function CommerceLookupsCountryStateBatchClient(commerceLookupsCountryStateBatchRoute, apiClient) {
this.commerceLookupsCountryStateBatchRoute = commerceLookupsCountryStateBatchRoute;
this.apiClient = apiClient;
}
Object.defineProperty(CommerceLookupsCountryStateBatchClient.prototype, "routeDefinition", {
get: function () {
return this.commerceLookupsCountryStateBatchRoute;
},
enumerable: true,
configurable: true
});
/**
* Returns a promise that is resolved once the create commerce action has been performed; this action creates a new commerce resources.
* @method
* @example commerceLookupsCountryStateBatchClient.create([{
countryId: '<country-id>',
name : '<name>',
abrv: '<abbreviation>',
description: '<description>'
}])
.then(function (data) {
// perform success action here
},
function (response, status, headers, config) {
// perform error handling here
});
**/
CommerceLookupsCountryStateBatchClient.prototype.create = function (data) {
return this.apiClient.post(this.routeDefinition.create(), this.routeDefinition.createParams(data));
};
/**
* Returns a promise that is resolved once the update commerce action has been performed; this action updates specified commerce resources.
* @method
* @example commerceLookupsCountryStateBatchClient.update(commerceCountryStates)
.then(function (data) {
// perform success action here
},
function (response, status, headers, config) {
// perform error handling here
});
**/
CommerceLookupsCountryStateBatchClient.prototype.update = function (data) {
return this.apiClient.put(this.routeDefinition.update(), this.routeDefinition.updateParams(data));
};
/**
* Returns a promise that is resolved once the remove commerce action has been performed. This action will remove commerce resources from the system if successfully completed.
* @method
* @example commerceLookupsCountryStateBatchClient.remove(commerceCountryStateIds)
.then(function (data) {
// perform success action here
},
function (response, status, headers, config) {
// perform error handling here
});
**/
CommerceLookupsCountryStateBatchClient.prototype.remove = function (ids) {
return this.apiClient.delete(this.commerceLookupsCountryStateBatchRoute.delete(), undefined, ids);
};
CommerceLookupsCountryStateBatchClient = tslib_1.__decorate([
inversify_1.injectable(),
tslib_1.__param(0, inversify_1.inject(__1.TYPES.CommerceLookupsCountryStateBatchRoute)),
tslib_1.__param(1, inversify_1.inject(httpApi_1.httpTYPES.ApiClient)),
tslib_1.__metadata("design:paramtypes", [__1.CommerceLookupsCountryStateBatchRoute,
httpApi_1.ApiClient])
], CommerceLookupsCountryStateBatchClient);
return CommerceLookupsCountryStateBatchClient;
}());
exports.CommerceLookupsCountryStateBatchClient = CommerceLookupsCountryStateBatchClient;
/**
* @copyright (c) 2017 Mono Ltd
* @license MIT
* @author Mono Ltd
* @overview
***Notes:**
- Refer to the [Baasic REST API](http://dev.baasic.com/api/reference/home) for detailed information about available Baasic REST API end-points.
- All end-point objects are transformed by the associated route service.
*/