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.8 kB
JavaScript
;
/* globals module */
/**
* @module mediaGalleryFileBatchClient
* @description Media Gallery Batch Client provides Baasic route templates which can be expanded to Baasic REST URIs. Various services can use Baasic Media Gallery 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 MediaGalleryFileBatchClient = /** @class */ (function () {
function MediaGalleryFileBatchClient(mediaGalleryBatchRoute, apiClient) {
this.mediaGalleryBatchRoute = mediaGalleryBatchRoute;
this.apiClient = apiClient;
}
Object.defineProperty(MediaGalleryFileBatchClient.prototype, "routeDefinition", {
get: function () {
return this.mediaGalleryBatchRoute;
},
enumerable: true,
configurable: true
});
/**
* Returns a promise that is resolved once the update action has been performed; this action updates specified media gallery file resources.
* @method
* @param data A collection of media gallery file objects used to update specified media gallery file resources.
* @returns A promise that is resolved once the update action has been performed.
* @example mediaGalleryFileBatchClient.update(files)
.then(function (data) {
// perform success action here
},
function (response, status, headers, config) {
// perform error handling here
});
**/
MediaGalleryFileBatchClient.prototype.update = function (data) {
return this.apiClient.put(this.routeDefinition.update(), this.routeDefinition.updateParams(data));
};
/**
* Returns a promise that is resolved once the unlink action has been performed. This action will remove media gallery file resources from the system if successfully completed. Specified media galleries and all accompanying derived resources will be removed from the system.
* @method
* @param ids Collection of media gallery Id which uniquely identifies media gallery file resources that need to be deleted.
* @example // Remove original media gallery file resources
mediaGalleryFileBatchClient.unlink([<media-gallery-id>])
.then(function (data) {
// perform success action here
},
function (response, status, headers, config) {
// perform error handling here
});
**/
MediaGalleryFileBatchClient.prototype.unlink = function (ids) {
return this.apiClient.delete(this.mediaGalleryBatchRoute.unlink(), undefined, ids);
};
/**
* Returns a promise that is resolved once the create action has been performed; this action creates specified media gallery file resources.
* @method
* @param data A collection of media gallery file objects used to create specified media gallery file resources.
* @returns A promise that is resolved once the create action has been performed.
* @example mediaGalleryFileBatchClient.link(files)
.then(function (data) {
// perform success action here
},
function (response, status, headers, config) {
// perform error handling here
});
**/
MediaGalleryFileBatchClient.prototype.link = function (data) {
return this.apiClient.post(this.routeDefinition.link(), this.routeDefinition.createParams(data));
};
MediaGalleryFileBatchClient = tslib_1.__decorate([
inversify_1.injectable(),
tslib_1.__param(0, inversify_1.inject(_1.TYPES.MediaGalleryBatchRoute)),
tslib_1.__param(1, inversify_1.inject(httpApi_1.httpTYPES.ApiClient)),
tslib_1.__metadata("design:paramtypes", [_1.MediaGalleryFileBatchRoute,
httpApi_1.ApiClient])
], MediaGalleryFileBatchClient);
return MediaGalleryFileBatchClient;
}());
exports.MediaGalleryFileBatchClient = MediaGalleryFileBatchClient;
/**
* @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.
*/