-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathlogs.ts
More file actions
36 lines (29 loc) · 846 Bytes
/
logs.ts
File metadata and controls
36 lines (29 loc) · 846 Bytes
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
import superagent from 'superagent';
// Result defines the structure of the api response to a query
export interface Result {
logs: any;
count: number;
page: number;
page_size: number;
}
// getLogs returns Result that contains logs fetched according to the Query
export async function getLogs(query: any): Promise<Result> {
let result: superagent.Response = await superagent.get('/log').query(query);
return result.body;
}
export enum FieldType {
INT = 'int',
UINT = 'uint',
STRING = 'string',
TIME = 'time',
ENUM = 'enum',
}
export interface FieldMetaData {
name: string;
type: string;
values: string[];
}
export async function getLogDescription(): Promise<FieldMetaData[]> {
let result: superagent.Response = await superagent.get('/log-description');
return result.body;
}