forked from NativeScript/firebase
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommon.ts
46 lines (42 loc) · 1.31 KB
/
common.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import { FirebaseApp } from '@nativescript/firebase-core';
export enum HttpMethod {
GET = 'GET',
HEAD = 'HEAD',
PUT = 'PUT',
POST = 'POST',
PATCH = 'PATCH',
TRACE = 'TRACE',
DELETE = 'DELETE',
CONNECT = 'CONNECT',
OPTIONS = 'OPTIONS',
}
export interface ITrace {
getAttribute(attribute: string): string | null;
getMetric(metricName: string): number;
getMetrics(): { [key: string]: number };
incrementMetric(metricName: string, incrementBy: number): void;
putAttribute(attribute: string, value: string): void;
putMetric(metricName: string, value: number): void;
removeMetric(metricName: string): void;
start();
stop();
}
export interface IHttpMetric {
getAttribute(attribute: string): string | null;
getAttributes(): { [key: string]: string };
putAttribute(attribute: string, value: string): void;
removeAttribute(attribute: string): void;
setHttpResponseCode(code: number | null): void;
setRequestPayloadSize(bytes: number | null): void;
setResponseContentType(contentType: string | null): void;
setResponsePayloadSize(bytes: number | null): void;
start();
stop();
}
export interface IPerformance {
app: FirebaseApp;
isPerformanceCollectionEnabled: boolean;
newHttpMetric(url: string, httpMethod: HttpMethod): IHttpMetric;
newTrace(identifier: string): ITrace;
startTrace(identifier: string): ITrace;
}