@@ -26,17 +26,13 @@ const client = new ZeroEntropy({
2626 apiKey: process .env [' ZEROENTROPY_API_KEY' ], // This is the default and can be omitted
2727});
2828
29- async function main () {
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- });
35-
36- console .log (response .message );
37- }
29+ const response = await client .documents .add ({
30+ collection_name: ' example_collection' ,
31+ content: { type: ' text' , text: ' Example Content' },
32+ path: ' my_document.txt' ,
33+ });
3834
39- main ( );
35+ console . log ( response . message );
4036```
4137
4238### Request & Response types
@@ -51,11 +47,7 @@ const client = new ZeroEntropy({
5147 apiKey: process .env [' ZEROENTROPY_API_KEY' ], // This is the default and can be omitted
5248});
5349
54- async function main() {
55- const response: ZeroEntropy .StatusGetStatusResponse = await client .status .getStatus ();
56- }
57-
58- main ();
50+ const response: ZeroEntropy .StatusGetStatusResponse = await client .status .getStatus ();
5951```
6052
6153Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.
@@ -68,22 +60,18 @@ a subclass of `APIError` will be thrown:
6860
6961<!-- prettier-ignore -->
7062``` ts
71- async function main() {
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- });
81- }
82-
83- main ();
63+ const response = await client .status .getStatus ().catch (async (err ) => {
64+ if (err instanceof ZeroEntropy .APIError ) {
65+ console .log (err .status ); // 400
66+ console .log (err .name ); // BadRequestError
67+ console .log (err .headers ); // {server: 'nginx', ...}
68+ } else {
69+ throw err ;
70+ }
71+ });
8472```
8573
86- Error codes are as followed :
74+ Error codes are as follows :
8775
8876| Status Code | Error Type |
8977| ----------- | -------------------------- |
0 commit comments