@@ -13,29 +13,29 @@ pnpm add @sentio/api
13
13
### Example 1: get project list
14
14
15
15
``` ts
16
- import { Configuration , WebApi } from " @sentio/api" ;
16
+ import { client , WebService } from " @sentio/api" ;
17
17
18
- const config = new Configuration ({
19
- apiKey : process .env .SENTIO_API_KEY ,
18
+ client . setConfig ({
19
+ auth : process .env .SENTIO_API_KEY ,
20
20
});
21
- const api = new WebApi (config );
22
- const projects = await api .getProjectList ();
21
+ const projects = await WebService .getProjectList ();
23
22
console .log (projects );
24
23
```
25
24
26
25
### Example 2: insight query
27
26
28
27
``` ts
29
- import { Configuration , WebApi , DataApi } from " @sentio/api" ;
28
+ import { client , DataService } from " @sentio/api" ;
30
29
31
- const config = new Configuration ({
32
- apiKey : process .env .SENTIO_API_KEY ,
30
+ client . setConfig ({
31
+ auth : process .env .SENTIO_API_KEY ,
33
32
});
34
33
35
- const dataApi = new DataApi (config );
36
- const res = await dataApi .query ({
37
- owner: " sentio" ,
38
- slug: " coinbase" ,
34
+ const res = await DataService .query ({
35
+ path: {
36
+ owner: " sentio" ,
37
+ slug: " coinbase" ,
38
+ },
39
39
body: {
40
40
timeRange: {
41
41
start: " now-30d" ,
@@ -51,7 +51,7 @@ const res = await dataApi.query({
51
51
alias: " " ,
52
52
id: " a" ,
53
53
labelSelector: {},
54
- aggregate: null ,
54
+ aggregate: undefined ,
55
55
functions: [],
56
56
disabled: false ,
57
57
},
@@ -67,6 +67,7 @@ const res = await dataApi.query({
67
67
},
68
68
},
69
69
});
70
+ console .log (res );
70
71
```
71
72
72
73
## Documentation
0 commit comments