UNPKG

baasic-sdk-javascript

Version:

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

75 lines (74 loc) 3.21 kB
"use strict"; /* globals module */ /** * @module settingsClient * @description Settings Client provides an easy way to consume Password Recovery REST API end-points. In order to obtain needed routes `settingsClient` uses `settingsRoute`. */ 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 SettingsClient = /** @class */ (function () { function SettingsClient(settingsRoute, apiClient) { this.settingsRoute = settingsRoute; this.apiClient = apiClient; } Object.defineProperty(SettingsClient.prototype, "routeDefinition", { /** * Provides direct access to `settingsRoute`. * @method **/ get: function () { return this.settingsRoute; }, enumerable: true, configurable: true }); /** * Returns a promise that is resolved once the get action has been performed. Success response returns the application settings. * @method * @returns A promise that is resolved once the get action has been performed. * @example settingsClient.get() .then(function (data) { // perform success action here }, function (response, status, headers, config) { // perform error handling here }); **/ SettingsClient.prototype.get = function () { return this.apiClient.get(this.routeDefinition.get()); }; /** * Returns a promise that is resolved once the update application setting action has been performed; this action updates a application seting. * @param data A setting object used to update specified setting resource. * @returns A promise that is resolved once the update setting action has been performed. * @method * @example settingsClient.update(data) .then(function (data) { // perform success action here }, function (response, status, headers, config) { // perform error handling here }); **/ SettingsClient.prototype.update = function (data) { return this.apiClient.put(this.routeDefinition.update(data), this.routeDefinition.updateParams(data)); }; SettingsClient = tslib_1.__decorate([ inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(_1.TYPES.SettingsRoute)), tslib_1.__param(1, inversify_1.inject(httpApi_1.httpTYPES.ApiClient)), tslib_1.__metadata("design:paramtypes", [_1.SettingsRoute, httpApi_1.ApiClient]) ], SettingsClient); return SettingsClient; }()); exports.SettingsClient = SettingsClient; /** * @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 service. */