UNPKG

baasic-sdk-javascript

Version:

JavaScript SDK provides core functionality for building web and mobile applications on [Baasic](http://www.baasic.com/).

105 lines (104 loc) 5.81 kB
"use strict"; /* globals module */ /** * @module blogPostStatusRoute * @description Baasic Blog Post Status Route Definition provides Baasic route templates which can be expanded to Baasic REST URIs. Various services can use Baasic Blog Post Status 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 BlogPostStatusRoute = /** @class */ (function (_super) { tslib_1.__extends(BlogPostStatusRoute, _super); function BlogPostStatusRoute(appOptions) { var _this = _super.call(this, appOptions) || this; _this.appOptions = appOptions; _this.findRoute = 'loookups/blog-post-statuses/{?searchQuery,ids,from,to,page,rpp,sort,embed,fields}'; _this.getRoute = 'loookups/blog-post-statuses/{id}/{?embed,fields}'; _this.purgeRoute = 'loookups/blog-post-statuses/purge'; _this.createRoute = 'loookups/blog-post-statuses'; _this.updateRoute = 'loookups/blog-post-statuses/{id}'; _this.deleteRoute = 'loookups/blog-post-statuses/{id}'; return _this; } /** * Parses find blog post status route which can be expanded with additional options. Supported items are: * - `searchQuery` - A string referencing blog properties using the phrase or BQL (Baasic Query Language) search. * - `page` - A value used to set the page number, i.e. to retrieve certain blog subset from the storage. * - `rpp` - A value used to limit the size of result set per page. * - `sort` - A string used to set the blog property to sort the result collection by. * - `embed` - Comma separated list of resources to be contained within the current representation. * - `startDate` - A value used to specify the blog creation, publish or archive date date starting from which blog resource collection should be returned. * - `endDate` - A value used to specify the blog creation, publish or archive date until (and including) which blog resource collection should be returned. * @method * @param options A promise that is resolved once the find action has been performed. * @example blogPostStatusRoute.find.expand({searchQuery: '<search-phrase>'}); **/ BlogPostStatusRoute.prototype.find = function (options) { var opt = options || {}; return _super.prototype.baseFind.call(this, this.findRoute, opt); }; /** * Parses get blog route which must be expanded with the Id of the previously created blog resource in the system. Additional expand supported items are: * - `embed` - Comma separated list of resources to be contained within the current representation. * @method * @param id blog slug or id which uniquely identifies blog resource that needs to be retrieved. * @param options Options object that contains embed items. * @example blogPostStatusRoute.get({id: '<blog-id>'}); **/ BlogPostStatusRoute.prototype.get = function (id, options) { return _super.prototype.baseGet.call(this, this.getRoute, id, options); }; /** * Parses purge blog route, this URI template doesn't expose any additional properties. * @method * @example blogPostStatusRoute.purge(); **/ BlogPostStatusRoute.prototype.purge = function () { return _super.prototype.baseDelete.call(this, this.purgeRoute, {}); }; /** * Parses create blog post status route; this URI template doesn't expose any additional properties. * @method * @example blogPostStatusRoute.create(); **/ BlogPostStatusRoute.prototype.create = function () { return _super.prototype.baseCreate.call(this, this.createRoute, {}); }; /** * Parses update blog post status route; this URI template doesn't expose any additional properties. * @method * @param data An blog post status object that needs to be updated into the system. * @example blogPostStatusRoute.update(data); **/ BlogPostStatusRoute.prototype.update = function (data) { return _super.prototype.baseUpdate.call(this, this.updateRoute, data); }; /** * Parses delete blog post status route; this URI template doesn't expose any additional properties. * @method * @param data An blog post status object that needs to be removed from the system. * @example blogPostStatusRoute.delete(data); **/ BlogPostStatusRoute.prototype.delete = function (data) { return _super.prototype.baseDelete.call(this, this.deleteRoute, data); }; BlogPostStatusRoute = tslib_1.__decorate([ inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(contracts_1.TYPES.IAppOptions)), tslib_1.__metadata("design:paramtypes", [Object]) ], BlogPostStatusRoute); return BlogPostStatusRoute; }(common_1.BaseRoute)); exports.BlogPostStatusRoute = BlogPostStatusRoute; /** * @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. - [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. */