22
33import { APIResource } from '../resource' ;
44import * as Core from '../core' ;
5+ import { GetDocumentInfoListCursor , type GetDocumentInfoListCursorParams } from '../pagination' ;
56
67export class Documents extends APIResource {
78 /**
@@ -79,8 +80,12 @@ export class Documents extends APIResource {
7980 getInfoList (
8081 body : DocumentGetInfoListParams ,
8182 options ?: Core . RequestOptions ,
82- ) : Core . APIPromise < DocumentGetInfoListResponse > {
83- return this . _client . post ( '/documents/get-document-info-list' , { body, ...options } ) ;
83+ ) : Core . PagePromise < DocumentGetInfoListResponsesGetDocumentInfoListCursor , DocumentGetInfoListResponse > {
84+ return this . _client . getAPIList (
85+ '/documents/get-document-info-list' ,
86+ DocumentGetInfoListResponsesGetDocumentInfoListCursor ,
87+ { body, method : 'post' , ...options } ,
88+ ) ;
8489 }
8590
8691 /**
@@ -98,6 +103,8 @@ export class Documents extends APIResource {
98103 }
99104}
100105
106+ export class DocumentGetInfoListResponsesGetDocumentInfoListCursor extends GetDocumentInfoListCursor < DocumentGetInfoListResponse > { }
107+
101108export interface DocumentUpdateResponse {
102109 new_id : string ;
103110
@@ -170,51 +177,45 @@ export namespace DocumentGetInfoResponse {
170177}
171178
172179export interface DocumentGetInfoListResponse {
173- documents : Array < DocumentGetInfoListResponse . Document > ;
174- }
180+ id : string ;
175181
176- export namespace DocumentGetInfoListResponse {
177- export interface Document {
178- id : string ;
182+ collection_name : string ;
179183
180- collection_name : string ;
184+ created_at : string ;
181185
182- created_at : string ;
186+ /**
187+ * A URL to the document data, which can be used to download the raw document
188+ * content or to display the document in frontend applications.
189+ *
190+ * NOTE: If a `/documents/update-document` call returned a new document id, then
191+ * this url will be invalidated and must be retrieved again.
192+ */
193+ file_url : string ;
183194
184- /**
185- * A URL to the document data, which can be used to download the raw document
186- * content or to display the document in frontend applications.
187- *
188- * NOTE: If a `/documents/update-document` call returned a new document id, then
189- * this url will be invalidated and must be retrieved again.
190- */
191- file_url : string ;
195+ index_status :
196+ | 'not_parsed'
197+ | 'parsing'
198+ | 'not_indexed'
199+ | 'indexing'
200+ | 'indexed'
201+ | 'parsing_failed'
202+ | 'indexing_failed' ;
192203
193- index_status :
194- | 'not_parsed'
195- | 'parsing'
196- | 'not_indexed'
197- | 'indexing'
198- | 'indexed'
199- | 'parsing_failed'
200- | 'indexing_failed' ;
204+ metadata : Record < string , string | Array < string > > ;
201205
202- metadata : Record < string , string | Array < string > > ;
203-
204- /**
205- * The number of pages in this document. This will be `null` if the document is
206- * parsing or failed to parse. It can also be `null` if the document is a filetype
207- * that does not support pages.
208- */
209- num_pages : number | null ;
206+ /**
207+ * The number of pages in this document. This will be `null` if the document is
208+ * parsing or failed to parse. It can also be `null` if the document is a filetype
209+ * that does not support pages.
210+ */
211+ num_pages : number | null ;
210212
211- path : string ;
213+ path : string ;
212214
213- /**
214- * The total size of the raw document data, in bytes.
215- */
216- size : number ;
217- }
215+ /**
216+ * The total size of the raw document data, in bytes.
217+ */
218+ size : number ;
218219}
219220
220221export interface DocumentGetPageInfoResponse {
@@ -401,26 +402,12 @@ export interface DocumentGetInfoParams {
401402 include_content ?: boolean ;
402403}
403404
404- export interface DocumentGetInfoListParams {
405+ export interface DocumentGetInfoListParams extends GetDocumentInfoListCursorParams {
405406 /**
406407 * The name of the collection.
407408 */
408409 collection_name : string ;
409410
410- /**
411- * The maximum number of documents to return. This field is by default 1024, and
412- * cannot be set larger than 1024
413- */
414- limit ?: number ;
415-
416- /**
417- * All documents returned will have a path strictly greater than the provided
418- * `path_gt` argument. (Comparison will be based on lexicographic comparison. It is
419- * guaranteed that two strings are lexicographically equal if and only if they have
420- * identical binary representations.).
421- */
422- path_gt ?: string | null ;
423-
424411 /**
425412 * All documents returned will have a path that starts with the provided path
426413 * prefix.
@@ -456,6 +443,9 @@ export interface DocumentGetPageInfoParams {
456443 include_content ?: boolean ;
457444}
458445
446+ Documents . DocumentGetInfoListResponsesGetDocumentInfoListCursor =
447+ DocumentGetInfoListResponsesGetDocumentInfoListCursor ;
448+
459449export declare namespace Documents {
460450 export {
461451 type DocumentUpdateResponse as DocumentUpdateResponse ,
@@ -464,6 +454,7 @@ export declare namespace Documents {
464454 type DocumentGetInfoResponse as DocumentGetInfoResponse ,
465455 type DocumentGetInfoListResponse as DocumentGetInfoListResponse ,
466456 type DocumentGetPageInfoResponse as DocumentGetPageInfoResponse ,
457+ DocumentGetInfoListResponsesGetDocumentInfoListCursor as DocumentGetInfoListResponsesGetDocumentInfoListCursor ,
467458 type DocumentUpdateParams as DocumentUpdateParams ,
468459 type DocumentDeleteParams as DocumentDeleteParams ,
469460 type DocumentAddParams as DocumentAddParams ,
0 commit comments