@sentio/api 1.0.2-rc.3 → 1.0.2-rc.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +48 -1
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -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)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentio/api",
3
- "version": "1.0.2-rc.3",
3
+ "version": "1.0.2-rc.4",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",