UNPKG

baasic-sdk-javascript

Version:

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

106 lines (105 loc) 5.22 kB
"use strict"; /* globals module */ /** * @module calendarEventBatchClient * @description CalendarEventBatchClient provides an easy way to consume CalendarEventBatch REST API end-points. In order to obtain needed routes `calendarEventBatchClient` uses `calendarEventBatchRoute`. */ 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 CalendarEventBatchClient = /** @class */ (function () { function CalendarEventBatchClient(calendarEventBatchRoute, apiClient) { this.calendarEventBatchRoute = calendarEventBatchRoute; this.apiClient = apiClient; } Object.defineProperty(CalendarEventBatchClient.prototype, "routeDefinition", { get: function () { return this.calendarEventBatchRoute; }, enumerable: true, configurable: true }); /** * Returns a promise that is resolved once the create CalendarEvents action has been performed. This action creates new CalendarEvent resources. * @method * @param data CalendarEvent objects that need to be inserted into the system. * @returns A promise that is resolved once the create CalendarEvents action has been performed. * @example calendarEventBatchClient.create([{ author: <user-info>, authorId: '<author-id>', calendar: <calendar>, calendarId: '<calendar-id>', description: '<description>', detail: <calendar-event-detail>, endTime: '<end-time>', isAllDay: <true|false>, isRecurring: <true|false>, json: '<json>', startTime: '<start-time>', title: '<title'> }]) .then(function (data) { // perform success action here }, function (response, status, headers, config) { // perform error handling here }); */ CalendarEventBatchClient.prototype.create = function (data) { return this.apiClient.post(this.routeDefinition.create(), this.routeDefinition.createParams(data)); }; /** * Returns a promise that is resolved once the update CalendarEvents action has been performed; this action updates CalendarEvent resources. * @method * @param data CalendarEvent objects used to update specified CalendarEvent resources. * @returns A promise that is resolved once the update CalendarEvents action has been performed. * @example calendarEvents are resources previously fetched using get action. calendarEventBatchClient.update(calendarEvents) .then(function (data) { // perform success action here }, function (response, status, headers, config) { // perform error handling here }); */ CalendarEventBatchClient.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 CalendarEvent resources from the system if successfully completed. * @method * @param data CalendarEvent Ids which uniquely identify CalendarEvent resources to be deleted. * @returns A promise that is resolved once the remove action has been performed. * @example calendarEventIds are identifiers which uniquely identify CalendarEvent resources. calendarEventBatchClient.remove(calendarEventIds) .then(function (data) { // perform success action here }, function (response, status, headers, config) { // perform error handling here }); */ CalendarEventBatchClient.prototype.remove = function (data) { return this.apiClient.delete(this.routeDefinition.delete(), undefined, this.routeDefinition.deleteParams(data)); }; CalendarEventBatchClient = tslib_1.__decorate([ inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(__1.TYPES.CalendarEventBatchRoute)), tslib_1.__param(1, inversify_1.inject(httpApi_1.httpTYPES.ApiClient)), tslib_1.__metadata("design:paramtypes", [__1.CalendarEventBatchRoute, httpApi_1.ApiClient]) ], CalendarEventBatchClient); return CalendarEventBatchClient; }()); exports.CalendarEventBatchClient = CalendarEventBatchClient; /** * @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. - All end-point objects are transformed by the associated route definition. */