baasic-sdk-javascript
Version:
JavaScript SDK provides core functionality for building web and mobile applications on [Baasic](http://www.baasic.com/).
74 lines (73 loc) • 3.17 kB
JavaScript
;
/* globals module */
/**
* @module meteringStatisticsClient
* @description Metering Statistics Client provides an easy way to consume Metering REST API end-points. In order to obtain a needed routes `meteringStatisticsClient` uses `meteringStatisticsRoute`.
*/
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 MeteringStatisticsClient = /** @class */ (function () {
function MeteringStatisticsClient(meteringStatisticsRoute, apiClient) {
this.meteringStatisticsRoute = meteringStatisticsRoute;
this.apiClient = apiClient;
}
Object.defineProperty(MeteringStatisticsClient.prototype, "routeDefinition", {
/**
* Provides direct access to `meteringStatisticsRoute`.
* @method
* @example meteringStatisticsClient.routeDefinition.get(expandObject);
**/
get: function () {
return this.meteringStatisticsRoute;
},
enumerable: true,
configurable: true
});
/**
* Returns a promise that is resolved once the find action has been performed. Success response returns a list of metering resources matching the given criteria.
* @method
* @param options Query resource options object.
* @returns A promise that is resolved once the find action has been performed.
* @example meteringClient.find({
pageNumber : 1,
pageSize : 10,
orderBy : '<field>',
orderDirection : '<asc|desc>',
category: 'Requests',
rateBy : '<minute,hour,day,week,month,year>',
from: '2 days ago',
to: 'now'
})
.then(function (collection) {
// perform success action here
},
function (response, status, headers, config) {
// perform error handling here
});
**/
MeteringStatisticsClient.prototype.find = function (options) {
return this.apiClient.get(this.routeDefinition.find(options));
};
MeteringStatisticsClient = tslib_1.__decorate([
inversify_1.injectable(),
tslib_1.__param(0, inversify_1.inject(_1.TYPES.MeteringStatisticsRoute)),
tslib_1.__param(1, inversify_1.inject(httpApi_1.httpTYPES.ApiClient)),
tslib_1.__metadata("design:paramtypes", [_1.MeteringStatisticsRoute,
httpApi_1.ApiClient])
], MeteringStatisticsClient);
return MeteringStatisticsClient;
}());
exports.MeteringStatisticsClient = MeteringStatisticsClient;
/**
* @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 service.
*/