1 import type IMetricsRequestService from './types/IMetricsRequestService';
3 export default class MetricsBase {
4 protected requestService: IMetricsRequestService;
6 constructor(requestService: IMetricsRequestService) {
7 this.requestService = requestService;
10 public init({ uid, clientID, appVersion }: { uid: string; clientID: string; appVersion: string }) {
11 this.setAuthHeaders(uid);
12 this.setVersionHeaders(clientID, appVersion);
15 public setVersionHeaders(clientID: string, appVersion: string) {
16 this.requestService.api.setVersionHeaders(clientID, appVersion);
19 public setAuthHeaders(uid: string, accessToken?: string) {
20 this.requestService.api.setAuthHeaders(uid, accessToken);
23 public clearAuthHeaders() {
24 this.requestService.api.setAuthHeaders('');
27 public setReportMetrics(reportMetrics: boolean) {
28 this.requestService.setReportMetrics(reportMetrics);
31 public processAllRequests() {
32 return this.requestService.processAllRequests();
35 public stopBatchingProcess() {
36 return this.requestService.stopBatchingProcess();
39 public startBatchingProcess() {
40 return this.requestService.startBatchingProcess();