File tree 1 file changed +48
-1
lines changed
1 file changed +48
-1
lines changed Original file line number Diff line number Diff line change @@ -10,10 +10,11 @@ pnpm add @sentio/api
10
10
11
11
## Usage
12
12
13
+ ### Example 1: get project list
14
+
13
15
``` ts
14
16
import { Configuration , WebApi } from " @sentio/api" ;
15
17
16
-
17
18
const config = new Configuration ({
18
19
apiKey: process .env .SENTIO_API_KEY ,
19
20
});
@@ -22,6 +23,52 @@ const projects = await api.getProjectList();
22
23
console .log (projects );
23
24
```
24
25
26
+ ### Example 2: insight query
27
+
28
+ ``` ts
29
+ import { Configuration , WebApi , DataApi } from " @sentio/api" ;
30
+
31
+ const config = new Configuration ({
32
+ apiKey: process .env .SENTIO_API_KEY ,
33
+ });
34
+
35
+ const dataApi = new DataApi (config );
36
+ const res = await dataApi .query ({
37
+ owner: " sentio" ,
38
+ slug: " coinbase" ,
39
+ body: {
40
+ timeRange: {
41
+ start: " now-30d" ,
42
+ end: " now" ,
43
+ step: 3600 ,
44
+ timezone: " America/Los_Angeles" ,
45
+ },
46
+ limit: 20 ,
47
+ queries: [
48
+ {
49
+ metricsQuery: {
50
+ query: " cbETH_price" ,
51
+ alias: " " ,
52
+ id: " a" ,
53
+ labelSelector: {},
54
+ aggregate: null ,
55
+ functions: [],
56
+ disabled: false ,
57
+ },
58
+ dataSource: " METRICS" ,
59
+ sourceName: " " ,
60
+ },
61
+ ],
62
+ formulas: [],
63
+ cachePolicy: {
64
+ noCache: false ,
65
+ cacheTtlSecs: 1296000 ,
66
+ cacheRefreshTtlSecs: 1800 ,
67
+ },
68
+ },
69
+ });
70
+ ```
71
+
25
72
## Documentation
26
73
27
74
[ Sentio API Reference] ( https://docs.sentio.xyz/reference )
You can’t perform that action at this time.
0 commit comments