baasic-sdk-javascript
Version:
JavaScript SDK provides core functionality for building web and mobile applications on [Baasic](http://www.baasic.com/).
89 lines (88 loc) • 4.86 kB
JavaScript
;
/* globals module */
/**
* @module shoppingCartItemsBatchClient
* @description Shopping Cart Item Batch Client provides Baasic route templates which can be expanded to Baasic REST URIs. Various services can use Baasic Shopping Cart Item Batch Route Definition 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 ShoppingCartItemBatchClient = /** @class */ (function () {
function ShoppingCartItemBatchClient(shoppingCartItemBatchRoute, apiClient) {
this.shoppingCartItemBatchRoute = shoppingCartItemBatchRoute;
this.apiClient = apiClient;
}
Object.defineProperty(ShoppingCartItemBatchClient.prototype, "routeDefinition", {
get: function () {
return this.shoppingCartItemBatchRoute;
},
enumerable: true,
configurable: true
});
/**
* Returns a promise that is resolved once the update action has been performed; this action updates specified shopping cart item resources.
* @method
* @param data A collection of shopping cart item objects used to update specified shopping cart item resources.
* @returns A promise that is resolved once the update action has been performed.
* @example shoppingCartItemsBatchClient.update(files)
.then(function (data) {
// perform success action here
},
function (response, status, headers, config) {
// perform error handling here
});
**/
ShoppingCartItemBatchClient.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 shopping cart item resources from the system if successfully completed. Specified shopping cart items and all accompanying derived resources will be removed from the system.
* @method
* @param ids Collection of shopping cart item Id which uniquely identifies shopping cart item resources that need to be deleted.
* @example // Remove original shopping cart item resources
shoppingCartItemsBatchClient.remove([<shopping-cart-item-id>])
.then(function (data) {
// perform success action here
},
function (response, status, headers, config) {
// perform error handling here
});
**/
ShoppingCartItemBatchClient.prototype.remove = function (ids) {
return this.apiClient.delete(this.shoppingCartItemBatchRoute.delete(), undefined, ids);
};
/**
* Returns a promise that is resolved once the create action has been performed; this action creates specified shopping cart item resources.
* @method
* @param data A collection of shopping cart item objects used to create specified shopping cart item resources.
* @returns A promise that is resolved once the create action has been performed.
* @example shoppingCartItemsBatchClient.create(files)
.then(function (data) {
// perform success action here
},
function (response, status, headers, config) {
// perform error handling here
});
**/
ShoppingCartItemBatchClient.prototype.create = function (data) {
return this.apiClient.post(this.routeDefinition.create(), this.routeDefinition.createParams(data));
};
ShoppingCartItemBatchClient = tslib_1.__decorate([
inversify_1.injectable(),
tslib_1.__param(0, inversify_1.inject(_1.TYPES.ShoppingCartItemBatchRoute)),
tslib_1.__param(1, inversify_1.inject(httpApi_1.httpTYPES.ApiClient)),
tslib_1.__metadata("design:paramtypes", [_1.ShoppingCartItemBatchRoute,
httpApi_1.ApiClient])
], ShoppingCartItemBatchClient);
return ShoppingCartItemBatchClient;
}());
exports.ShoppingCartItemBatchClient = ShoppingCartItemBatchClient;
/**
* @overview
***Notes:**
- Refer to the [REST API documentation](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.
*/