Skip to content

Commit 9b1b297

Browse files
feat(api): update via SDK Studio (#9)
1 parent 56eea18 commit 9b1b297

File tree

1 file changed

+25
-31
lines changed

1 file changed

+25
-31
lines changed

README.md

Lines changed: 25 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
This library provides convenient access to the Zeroentropy REST API from server-side TypeScript or JavaScript.
66

7-
The REST API documentation can be found on [docs.zeroentropy.dev](https://docs.zeroentropy.dev). The full API of this library can be found in [api.md](api.md).
7+
The REST API documentation can be found on [docs.zeroentropy.dev](https://docs.zeroentropy.dev/api-reference). The full API of this library can be found in [api.md](api.md).
88

99
It is generated with [Stainless](https://www.stainlessapi.com/).
1010

@@ -27,9 +27,13 @@ const client = new Zeroentropy({
2727
});
2828

2929
async function main() {
30-
const response = await client.documents.getInfo({ collection_name: 'collection_name', path: 'path' });
30+
const response = await client.documents.add({
31+
collection_name: 'example_collection',
32+
content: { type: 'text', text: 'Example Content' },
33+
path: 'my_document.txt',
34+
});
3135

32-
console.log(response.document);
36+
console.log(response.message);
3337
}
3438

3539
main();
@@ -48,8 +52,7 @@ const client = new Zeroentropy({
4852
});
4953

5054
async function main() {
51-
const params: Zeroentropy.DocumentGetInfoParams = { collection_name: 'collection_name', path: 'path' };
52-
const response: Zeroentropy.DocumentGetInfoResponse = await client.documents.getInfo(params);
55+
const response: Zeroentropy.StatusGetStatusResponse = await client.status.getStatus();
5356
}
5457

5558
main();
@@ -66,17 +69,15 @@ a subclass of `APIError` will be thrown:
6669
<!-- prettier-ignore -->
6770
```ts
6871
async function main() {
69-
const response = await client.documents
70-
.getInfo({ collection_name: 'collection_name', path: 'path' })
71-
.catch(async (err) => {
72-
if (err instanceof Zeroentropy.APIError) {
73-
console.log(err.status); // 400
74-
console.log(err.name); // BadRequestError
75-
console.log(err.headers); // {server: 'nginx', ...}
76-
} else {
77-
throw err;
78-
}
79-
});
72+
const response = await client.status.getStatus().catch(async (err) => {
73+
if (err instanceof Zeroentropy.APIError) {
74+
console.log(err.status); // 400
75+
console.log(err.name); // BadRequestError
76+
console.log(err.headers); // {server: 'nginx', ...}
77+
} else {
78+
throw err;
79+
}
80+
});
8081
}
8182

8283
main();
@@ -111,7 +112,7 @@ const client = new Zeroentropy({
111112
});
112113

113114
// Or, configure per-request:
114-
await client.documents.getInfo({ collection_name: 'collection_name', path: 'path' }, {
115+
await client.status.getStatus({
115116
maxRetries: 5,
116117
});
117118
```
@@ -128,7 +129,7 @@ const client = new Zeroentropy({
128129
});
129130

130131
// Override per-request:
131-
await client.documents.getInfo({ collection_name: 'collection_name', path: 'path' }, {
132+
await client.status.getStatus({
132133
timeout: 5 * 1000,
133134
});
134135
```
@@ -182,17 +183,13 @@ You can also use the `.withResponse()` method to get the raw `Response` along wi
182183
```ts
183184
const client = new Zeroentropy();
184185

185-
const response = await client.documents
186-
.getInfo({ collection_name: 'collection_name', path: 'path' })
187-
.asResponse();
186+
const response = await client.status.getStatus().asResponse();
188187
console.log(response.headers.get('X-My-Header'));
189188
console.log(response.statusText); // access the underlying Response object
190189

191-
const { data: response, response: raw } = await client.documents
192-
.getInfo({ collection_name: 'collection_name', path: 'path' })
193-
.withResponse();
190+
const { data: response, response: raw } = await client.status.getStatus().withResponse();
194191
console.log(raw.headers.get('X-My-Header'));
195-
console.log(response.document);
192+
console.log(response.num_documents);
196193
```
197194

198195
### Making custom/undocumented requests
@@ -296,12 +293,9 @@ const client = new Zeroentropy({
296293
});
297294

298295
// Override per-request:
299-
await client.documents.getInfo(
300-
{ collection_name: 'collection_name', path: 'path' },
301-
{
302-
httpAgent: new http.Agent({ keepAlive: false }),
303-
},
304-
);
296+
await client.status.getStatus({
297+
httpAgent: new http.Agent({ keepAlive: false }),
298+
});
305299
```
306300

307301
## Semantic versioning

0 commit comments

Comments
 (0)