UNPKG

baasic-sdk-javascript

Version:

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

147 lines (146 loc) 8.46 kB
"use strict"; /* globals module */ /** * @module calendarEventRsvpRoute * @description BaasicCalendarEventRsvpRoute Definition provides Baasic route templates which can be expanded to Baasic REST URIs. Various services can use BaasicCalendarEventRsvpRoute 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 common_1 = require("../../../common"); ; var contracts_1 = require("../../../core/contracts"); var CalendarEventRsvpRoute = /** @class */ (function (_super) { tslib_1.__extends(CalendarEventRsvpRoute, _super); function CalendarEventRsvpRoute(appOptions) { var _this = _super.call(this, appOptions) || this; _this.appOptions = appOptions; _this.findRoute = 'calendar-rsvp-details/{?searchQuery,page,rpp,sort,embed,fields,ids,calendarIds,calendarNames,invitationTypeIds,invitationOnly,statusIds,typeIds,from,to,registrationCloseFrom,registrationCloseTo}'; _this.getRoute = 'calendar-rsvp-details/{id}/{?embed,fields}'; _this.createRoute = 'calendar-rsvp-details'; _this.updateRoute = 'calendar-rsvp-details/{id}'; _this.deleteRoute = 'calendar-rsvp-details/{id}'; _this.purgeRoute = 'calendar-rsvp-details/{id}/purge'; return _this; } /** * Parses find route which can be expanded with additional options. Supported items are: * - `searchQuery` - A string referencing CalendarEventRsvp properties using the phrase or BQL (Baasic Query Language) search. * - `page` - A value used to set the page number, i.e. to retrieve certain CalendarEventRsvp subset from the storage. * - `rpp` - A value used to limit the size of result set per page. * - `sort` - A string used to set the CalendarEventRsvp property to sort the result collection by. * - `embed` - Comma separated list of resources to be contained within the current representation. * - `ids` - CalendarEventRsvp ids which uniquely identify CalendarEventRsvp resources that need to be retrieved. * - `calendarIds` - Calendar ids which uniquely identify Calendar resources used for filtering. * - `calendarNames` - Calendar names which identify Calendar resources used for filtering. * - `invitationTypeIds` - CalendarEventRsvpInvitationType ids which uniquely identify CalendarEventRsvpInvitationType resources used for filtering. * - `invitationOnly` - A value used to filter events which are invitation-only. * - `statusIds` - CalendarEventStatus ids which uniquely identify CalendarEventStatus resources used for filtering. * - `typeIds` - CalendarEventType ids which uniquely identify CalendarEventType resources used for filtering. * - `from` - A value used to filter eventRsvps starting from this date. * - `to` - A value used to filter eventRsvps ending to this date. * - `registrationCloseFrom` - A value used to filter eventRsvps where registration is open from this date. * - `registrationCloseTo` - A value used to filter eventRsvps where registration is closed to this date, * @method * @param options Query resource GetCalendarEventRsvpOptions object. * @example calendarEventRsvpRoute.find({searchQuery: '<search-phrase>'}); */ CalendarEventRsvpRoute.prototype.find = function (options) { var opt; if (options) { opt = options; opt.to = this.getToDate(opt); opt.from = this.getFromDate(opt); opt.registrationCloseFrom = this.getRegistrationCloseFromDate(opt); opt.registrationCloseTo = this.getRegistrationCloseToDate(opt); } else { opt = {}; } return _super.prototype.baseFind.call(this, this.findRoute, opt); }; /** * Parses get route which must be expanded with the id of the previously created CalendarEventRsvp resource. This route can be expanded using additional GetRequestOptions. Supported items are: * - `embed` - Comma separated list of resources to be contained within the current representation. * @method * @param id CalendarEventRsvp id which uniquely identifies CalendarEventRsvp resource that needs to be retrieved. * @param options Query resource GetRequestOptions object. * @example calendarEventRsvpRoute.get(id); */ CalendarEventRsvpRoute.prototype.get = function (id, options) { return _super.prototype.baseGet.call(this, this.getRoute, id, options); }; /** * Parses create route. This URI template does not expose any additional options. * @method * @param data A CalendarEventRsvp object that needs to be inserted into the system. * @example calendarEventRsvpRoute.create(data); */ CalendarEventRsvpRoute.prototype.create = function (data) { return _super.prototype.baseCreate.call(this, this.createRoute, data); }; /** * Parses update route. This URI template does not expose any additional options. * @method * @param data A CalendarEventRsvp object used to update specified CalendarEventRsvp resource. * @example calendarEventRsvpRoute.update(data); */ CalendarEventRsvpRoute.prototype.update = function (data) { return _super.prototype.baseUpdate.call(this, this.updateRoute, data); }; /** * Parses delte route. This URI template does not expose any additional options. * @method * @param data A CalendarEventRsvp object used to delete specified CalendarEventRsvp resource. * @example calendarEventRsvpRoute.delete(data); */ CalendarEventRsvpRoute.prototype.delete = function (data) { return _super.prototype.baseDelete.call(this, this.deleteRoute, data); }; /** * Parses purge Route which must be expanded with the previously created CalendarEvent resource. This route does not expose any additional options. * @param data A CalendarEvent object that will have it's CalendarEventRsvps purged. * @example calendarEventRsvpRoute.purge(calendarEvent) */ CalendarEventRsvpRoute.prototype.purge = function (data) { return _super.prototype.parse.call(this, this.purgeRoute); }; CalendarEventRsvpRoute.prototype.getToDate = function (options) { if (!this.utility.isUndefined(options.to) && options.to !== null) { return options.to.toISOString(); } return undefined; }; CalendarEventRsvpRoute.prototype.getFromDate = function (options) { if (!this.utility.isUndefined(options.from) && options.from !== null) { return options.from.toISOString(); } return undefined; }; CalendarEventRsvpRoute.prototype.getRegistrationCloseFromDate = function (options) { if (!this.utility.isUndefined(options.registrationCloseFrom) && options.registrationCloseFrom !== null) { return options.registrationCloseFrom.toISOString(); } return undefined; }; CalendarEventRsvpRoute.prototype.getRegistrationCloseToDate = function (options) { if (!this.utility.isUndefined(options.registrationCloseTo) && options.registrationCloseTo !== null) { return options.registrationCloseTo.toISOString(); } return undefined; }; CalendarEventRsvpRoute = tslib_1.__decorate([ inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(contracts_1.TYPES.IAppOptions)), tslib_1.__metadata("design:paramtypes", [Object]) ], CalendarEventRsvpRoute); return CalendarEventRsvpRoute; }(common_1.BaseRoute)); exports.CalendarEventRsvpRoute = CalendarEventRsvpRoute; /** * @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. */