UNPKG

baasic-sdk-javascript

Version:

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

70 lines (69 loc) 3.47 kB
/** * @module meteringBatchClient * @description Metering Batch Client provides an easy way to consume Metering REST API end-points. In order to obtain a needed routes `meteringBatchClient` uses `meteringBatchRoute`. */ import { ApiClient, IHttpResponse } from '../../httpApi'; import { MeteringBatchRoute } from './'; import { IMeteringData } from './contracts'; export declare class MeteringBatchClient { protected meteringBatchRoute: MeteringBatchRoute; protected apiClient: ApiClient; readonly routeDefinition: MeteringBatchRoute; constructor(meteringBatchRoute: MeteringBatchRoute, apiClient: ApiClient); /** * Returns a promise that is resolved once the create data action has been performed; this action creates new data resources. * @method * @param data An MeteringData objects that need to be inserted into the system. * @returns A promise that is resolved once the create data action has been performed. * @example meteringBatchClient.create([{ applicationId : '<applicationId>', category : '<category>', name: '<name>', value: '<value>' }]) .then(function (data) { // perform success action here }, function (response, status, headers, config) { // perform error handling here }); **/ create(data: IMeteringData[]): PromiseLike<IHttpResponse<IMeteringData[]>>; /** * Returns a promise that is resolved once the update data action has been performed; this action updates specified data resources. * @method * @param data An MeteringData objects used to update specified MeteringData resources. * @returns A promise that is resolved once the update data action has been performed. * @example meteringBatchClient.update(companies) .then(function (data) { // perform success action here }, function (response, status, headers, config) { // perform error handling here }); **/ update(data: IMeteringData[]): PromiseLike<IHttpResponse<void>>; /** * Returns a promise that is resolved once the remove action has been performed. This action will remove data resources from the system if successfully completed. * @method * @param ids MeteringData ids which uniquely identify MeteringData resources that need to be deleted. * @returns A promise that is resolved once the remove action has been performed. * @example meteringClient.remove(companyIds) .then(function (data) { // perform success action here }, function (response, status, headers, config) { // perform error handling here }); **/ remove(ids: string[]): PromiseLike<IHttpResponse<void>>; } /** * @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. */