baasic-sdk-javascript
Version:
JavaScript SDK provides core functionality for building web and mobile applications on [Baasic](http://www.baasic.com/).
76 lines (75 loc) • 4.14 kB
JavaScript
;
/* globals module */
/**
* @module MediaGalleryFilesStreamsRoute
* @description Baasic Media Gallery Files Streams Route Definition provides Baasic route templates which can be expanded to Baasic REST URIs. Various services can use Baasic Media Gallery Files Streams 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 common_1 = require("../../common");
;
var contracts_1 = require("../../core/contracts");
var MediaGalleryFileStreamRoute = /** @class */ (function (_super) {
tslib_1.__extends(MediaGalleryFileStreamRoute, _super);
function MediaGalleryFileStreamRoute(appOptions) {
var _this = _super.call(this, appOptions) || this;
_this.appOptions = appOptions;
_this.getRoute = 'media-gallery-file-streams/{id}/{?mediaGalleryId,t}';
_this.createRoute = 'media-gallery-file-streams/{filename}/{?mediaGalleryId}';
_this.updateRoute = 'media-gallery-file-streams/{id}';
return _this;
}
/**
* Parses get route; this route should be expanded with id of desired file stream.
* @method
* @param id Media Gallery File id which uniquely identifies media gallery whose media gallery file need to be retrieved.
* @param data Media Gallery File object used to identify stream that needs to be retrieved from the system.
* @example mediaGalleryFileStreamRoute.get(id);
**/
MediaGalleryFileStreamRoute.prototype.get = function (id, data) {
if (!this.utility.isObject(data)) {
data = {
mediaGalleryId: data
};
}
var params = this.utility.extend({}, data);
params.id = id;
return _super.prototype.baseGet.call(this, this.getRoute, params);
};
/**
* Parses create route; this route should be expanded with the filename which indicates where the stream will be saved.
* @method
* @param data Media Gallery File object that need to be inserted into the system.
* @example mediaGalleryFileStreamRoute.create({filename: '<filename>'});
**/
MediaGalleryFileStreamRoute.prototype.create = function (data) {
return _super.prototype.baseCreate.call(this, this.createRoute, data);
};
/**
* Parses update route; this route should be expanded with the id of the previously saved resource. Additional supported items are:
* - `width` - width of derived image to update.
* - `height` - height of derived image to update.
* @method
* @param mediaGalleryId Media Gallery slug or id which uniquely identifies media gallery whose media gallery file need to be updated.
* @param data Media Gallery File object used to identify stream that needs to be updated.
* @example mediaGalleryFileStreamRoute.update({id: '<filename>'});
**/
MediaGalleryFileStreamRoute.prototype.update = function (data) {
return _super.prototype.baseUpdate.call(this, this.updateRoute, data);
};
MediaGalleryFileStreamRoute = tslib_1.__decorate([
inversify_1.injectable(),
tslib_1.__param(0, inversify_1.inject(contracts_1.TYPES.IAppOptions)),
tslib_1.__metadata("design:paramtypes", [Object])
], MediaGalleryFileStreamRoute);
return MediaGalleryFileStreamRoute;
}(common_1.BaseRoute));
exports.MediaGalleryFileStreamRoute = MediaGalleryFileStreamRoute;
/**
* @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.
- [URI Template](https://github.com/Baasic/uritemplate-js) syntax enables expanding the Baasic route templates to Baasic REST URIs providing it with an object that contains URI parameters.
- All end-point objects are transformed by the associated route service.
*/