Skip to content

Commit f583315

Browse files
committed
chore: update README
1 parent c9c2b36 commit f583315

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

README.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,29 +13,29 @@ pnpm add @sentio/api
1313
### Example 1: get project list
1414

1515
```ts
16-
import { Configuration, WebApi } from "@sentio/api";
16+
import { client, WebService } from "@sentio/api";
1717

18-
const config = new Configuration({
19-
apiKey: process.env.SENTIO_API_KEY,
18+
client.setConfig({
19+
auth: process.env.SENTIO_API_KEY,
2020
});
21-
const api = new WebApi(config);
22-
const projects = await api.getProjectList();
21+
const projects = await WebService.getProjectList();
2322
console.log(projects);
2423
```
2524

2625
### Example 2: insight query
2726

2827
```ts
29-
import { Configuration, WebApi, DataApi } from "@sentio/api";
28+
import { client, DataService } from "@sentio/api";
3029

31-
const config = new Configuration({
32-
apiKey: process.env.SENTIO_API_KEY,
30+
client.setConfig({
31+
auth: process.env.SENTIO_API_KEY,
3332
});
3433

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+
},
3939
body: {
4040
timeRange: {
4141
start: "now-30d",
@@ -51,7 +51,7 @@ const res = await dataApi.query({
5151
alias: "",
5252
id: "a",
5353
labelSelector: {},
54-
aggregate: null,
54+
aggregate: undefined,
5555
functions: [],
5656
disabled: false,
5757
},
@@ -67,6 +67,7 @@ const res = await dataApi.query({
6767
},
6868
},
6969
});
70+
console.log(res);
7071
```
7172

7273
## Documentation

test/simple.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { WebService } from "../src/index.js";
2-
import { client } from "../src/client.gen.js";
1+
import { client, WebService } from "../src/index.js";
32
import test from "node:test";
43
import assert from "assert";
54

0 commit comments

Comments
 (0)