import { Service } from '../../core/nqs/Services'; import AppAnalyticsRequest from '../AppAnalyticsRequest'; import { Method } from '../../common/Constants'; export default class AppAnalyticsRequestHandler { private _requests; private _waitingForToken; private readyToSend; private servicesToWait; /** * Npaw Communication implements an abstraction layer over API requests. * Internally, Communication implements queues of {@link Request} objects. * This queue can be blocked using {@link Transform} * */ constructor(); shouldSendStats(): boolean; /** * Enqueues the provided request * * @param { AppAnalyticsRequest } request Request to be enqueued */ sendRequest(request: AppAnalyticsRequest): void; prepareParams(request: AppAnalyticsRequest): void; /** * Build a generic request to the given host. * * @param {string} service A string with the service to be called. ie... * @param {Object} [params] Object of key:value params. * @param {Method} method Type of request (GET, POST, ...) * @param {any} body body of the request * @param {function} [onSuccessCallback] The defined onSuccess callback to the request * @param {function} [onFailCallback] The defined onFail callback to the request */ buildRequest(service: Service, params: any, method?: Method, body?: any, onSuccessCallback?: () => void, onFailCallback?: () => void): AppAnalyticsRequest; /** * Execute pending requests in the queue. Returns rejected ones to the queue. */ private _processRequests; }