Skip to content

Commit d60d321

Browse files
chore(internal): codegen related update (#40)
1 parent 861f792 commit d60d321

File tree

5 files changed

+40
-71
lines changed

5 files changed

+40
-71
lines changed

README.md

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -138,39 +138,6 @@ On timeout, an `APIConnectionTimeoutError` is thrown.
138138

139139
Note that requests which time out will be [retried twice by default](#retries).
140140

141-
## Auto-pagination
142-
143-
List methods in the ZeroEntropy API are paginated.
144-
You can use the `for await … of` syntax to iterate through items across all pages:
145-
146-
```ts
147-
async function fetchAllDocuments(params) {
148-
const allDocuments = [];
149-
// Automatically fetches more pages as needed.
150-
for await (const documentGetInfoListResponse of client.documents.getInfoList({
151-
collection_name: 'example_collection',
152-
})) {
153-
allDocuments.push(documentGetInfoListResponse);
154-
}
155-
return allDocuments;
156-
}
157-
```
158-
159-
Alternatively, you can request a single page at a time:
160-
161-
```ts
162-
let page = await client.documents.getInfoList({ collection_name: 'example_collection' });
163-
for (const documentGetInfoListResponse of page.documents) {
164-
console.log(documentGetInfoListResponse);
165-
}
166-
167-
// Convenience methods are provided for manually paginating:
168-
while (page.hasNextPage()) {
169-
page = await page.getNextPage();
170-
// ...
171-
}
172-
```
173-
174141
## Advanced Usage
175142

176143
### Accessing raw Response data (e.g., headers)

api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Methods:
4949
- <code title="post /documents/delete-document">client.documents.<a href="./src/resources/documents.ts">delete</a>({ ...params }) -> DocumentDeleteResponse</code>
5050
- <code title="post /documents/add-document">client.documents.<a href="./src/resources/documents.ts">add</a>({ ...params }) -> DocumentAddResponse</code>
5151
- <code title="post /documents/get-document-info">client.documents.<a href="./src/resources/documents.ts">getInfo</a>({ ...params }) -> DocumentGetInfoResponse</code>
52-
- <code title="post /documents/get-document-info-list">client.documents.<a href="./src/resources/documents.ts">getInfoList</a>({ ...params }) -> DocumentGetInfoListResponsesGetDocumentInfoListCursor</code>
52+
- <code title="post /documents/get-document-info-list">client.documents.<a href="./src/resources/documents.ts">getInfoList</a>({ ...params }) -> DocumentGetInfoListResponse</code>
5353
- <code title="post /documents/get-page-info">client.documents.<a href="./src/resources/documents.ts">getPageInfo</a>({ ...params }) -> DocumentGetPageInfoResponse</code>
5454

5555
# Queries

src/index.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import {
2424
DocumentDeleteResponse,
2525
DocumentGetInfoListParams,
2626
DocumentGetInfoListResponse,
27-
DocumentGetInfoListResponsesGetDocumentInfoListCursor,
2827
DocumentGetInfoParams,
2928
DocumentGetInfoResponse,
3029
DocumentGetPageInfoParams,
@@ -205,8 +204,6 @@ ZeroEntropy.Admin = Admin;
205204
ZeroEntropy.Status = Status;
206205
ZeroEntropy.Collections = Collections;
207206
ZeroEntropy.Documents = Documents;
208-
ZeroEntropy.DocumentGetInfoListResponsesGetDocumentInfoListCursor =
209-
DocumentGetInfoListResponsesGetDocumentInfoListCursor;
210207
ZeroEntropy.Queries = Queries;
211208
ZeroEntropy.Parsers = Parsers;
212209
export declare namespace ZeroEntropy {
@@ -248,7 +245,6 @@ export declare namespace ZeroEntropy {
248245
type DocumentGetInfoResponse as DocumentGetInfoResponse,
249246
type DocumentGetInfoListResponse as DocumentGetInfoListResponse,
250247
type DocumentGetPageInfoResponse as DocumentGetPageInfoResponse,
251-
DocumentGetInfoListResponsesGetDocumentInfoListCursor as DocumentGetInfoListResponsesGetDocumentInfoListCursor,
252248
type DocumentUpdateParams as DocumentUpdateParams,
253249
type DocumentDeleteParams as DocumentDeleteParams,
254250
type DocumentAddParams as DocumentAddParams,

src/resources/documents.ts

Lines changed: 39 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import { APIResource } from '../resource';
44
import * as Core from '../core';
5-
import { GetDocumentInfoListCursor, type GetDocumentInfoListCursorParams } from '../pagination';
65

76
export class Documents extends APIResource {
87
/**
@@ -80,12 +79,8 @@ export class Documents extends APIResource {
8079
getInfoList(
8180
body: DocumentGetInfoListParams,
8281
options?: Core.RequestOptions,
83-
): Core.PagePromise<DocumentGetInfoListResponsesGetDocumentInfoListCursor, DocumentGetInfoListResponse> {
84-
return this._client.getAPIList(
85-
'/documents/get-document-info-list',
86-
DocumentGetInfoListResponsesGetDocumentInfoListCursor,
87-
{ body, method: 'post', ...options },
88-
);
82+
): Core.APIPromise<DocumentGetInfoListResponse> {
83+
return this._client.post('/documents/get-document-info-list', { body, ...options });
8984
}
9085

9186
/**
@@ -103,8 +98,6 @@ export class Documents extends APIResource {
10398
}
10499
}
105100

106-
export class DocumentGetInfoListResponsesGetDocumentInfoListCursor extends GetDocumentInfoListCursor<DocumentGetInfoListResponse> {}
107-
108101
export interface DocumentUpdateResponse {
109102
new_id: string;
110103

@@ -163,29 +156,35 @@ export namespace DocumentGetInfoResponse {
163156
}
164157

165158
export interface DocumentGetInfoListResponse {
166-
id: string;
159+
documents: Array<DocumentGetInfoListResponse.Document>;
160+
}
167161

168-
collection_name: string;
162+
export namespace DocumentGetInfoListResponse {
163+
export interface Document {
164+
id: string;
169165

170-
index_status:
171-
| 'not_parsed'
172-
| 'parsing'
173-
| 'not_indexed'
174-
| 'indexing'
175-
| 'indexed'
176-
| 'parsing_failed'
177-
| 'indexing_failed';
166+
collection_name: string;
178167

179-
metadata: Record<string, string | Array<string>>;
168+
index_status:
169+
| 'not_parsed'
170+
| 'parsing'
171+
| 'not_indexed'
172+
| 'indexing'
173+
| 'indexed'
174+
| 'parsing_failed'
175+
| 'indexing_failed';
180176

181-
/**
182-
* The number of pages in this document. This will be `null` if the document is
183-
* parsing or failed to parse. It can also be `null` if the document is a filetype
184-
* that does not support pages.
185-
*/
186-
num_pages: number | null;
177+
metadata: Record<string, string | Array<string>>;
187178

188-
path: string;
179+
/**
180+
* The number of pages in this document. This will be `null` if the document is
181+
* parsing or failed to parse. It can also be `null` if the document is a filetype
182+
* that does not support pages.
183+
*/
184+
num_pages: number | null;
185+
186+
path: string;
187+
}
189188
}
190189

191190
export interface DocumentGetPageInfoResponse {
@@ -369,11 +368,23 @@ export interface DocumentGetInfoParams {
369368
include_content?: boolean;
370369
}
371370

372-
export interface DocumentGetInfoListParams extends GetDocumentInfoListCursorParams {
371+
export interface DocumentGetInfoListParams {
373372
/**
374373
* The name of the collection.
375374
*/
376375
collection_name: string;
376+
377+
/**
378+
* All documents returned will have a UUID strictly greater than the provided UUID.
379+
* (Comparison will be on the binary representations of the UUIDs)
380+
*/
381+
id_gt?: string | null;
382+
383+
/**
384+
* The maximum number of documents to return. This field is by default 1024, and
385+
* cannot be set larger than 1024
386+
*/
387+
limit?: number;
377388
}
378389

379390
export interface DocumentGetPageInfoParams {
@@ -404,9 +415,6 @@ export interface DocumentGetPageInfoParams {
404415
include_content?: boolean;
405416
}
406417

407-
Documents.DocumentGetInfoListResponsesGetDocumentInfoListCursor =
408-
DocumentGetInfoListResponsesGetDocumentInfoListCursor;
409-
410418
export declare namespace Documents {
411419
export {
412420
type DocumentUpdateResponse as DocumentUpdateResponse,
@@ -415,7 +423,6 @@ export declare namespace Documents {
415423
type DocumentGetInfoResponse as DocumentGetInfoResponse,
416424
type DocumentGetInfoListResponse as DocumentGetInfoListResponse,
417425
type DocumentGetPageInfoResponse as DocumentGetPageInfoResponse,
418-
DocumentGetInfoListResponsesGetDocumentInfoListCursor as DocumentGetInfoListResponsesGetDocumentInfoListCursor,
419426
type DocumentUpdateParams as DocumentUpdateParams,
420427
type DocumentDeleteParams as DocumentDeleteParams,
421428
type DocumentAddParams as DocumentAddParams,

src/resources/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export {
1111
type CollectionGetListParams,
1212
} from './collections';
1313
export {
14-
DocumentGetInfoListResponsesGetDocumentInfoListCursor,
1514
Documents,
1615
type DocumentUpdateResponse,
1716
type DocumentDeleteResponse,

0 commit comments

Comments
 (0)