2
2
3
3
import * as Core from 'openai/core' ;
4
4
import { APIResource } from 'openai/resource' ;
5
+ import { isRequestOptions } from 'openai/core' ;
5
6
import * as BatchesAPI from 'openai/resources/batches' ;
7
+ import { CursorPage , type CursorPageParams } from 'openai/pagination' ;
6
8
7
9
export class Batches extends APIResource {
8
10
/**
@@ -19,6 +21,21 @@ export class Batches extends APIResource {
19
21
return this . _client . get ( `/batches/${ batchId } ` , options ) ;
20
22
}
21
23
24
+ /**
25
+ * List your organization's batches.
26
+ */
27
+ list ( query ?: BatchListParams , options ?: Core . RequestOptions ) : Core . PagePromise < BatchesPage , Batch > ;
28
+ list ( options ?: Core . RequestOptions ) : Core . PagePromise < BatchesPage , Batch > ;
29
+ list (
30
+ query : BatchListParams | Core . RequestOptions = { } ,
31
+ options ?: Core . RequestOptions ,
32
+ ) : Core . PagePromise < BatchesPage , Batch > {
33
+ if ( isRequestOptions ( query ) ) {
34
+ return this . list ( { } , query ) ;
35
+ }
36
+ return this . _client . getAPIList ( '/batches' , BatchesPage , { query, ...options } ) ;
37
+ }
38
+
22
39
/**
23
40
* Cancels an in-progress batch.
24
41
*/
@@ -27,6 +44,8 @@ export class Batches extends APIResource {
27
44
}
28
45
}
29
46
47
+ export class BatchesPage extends CursorPage < Batch > { }
48
+
30
49
export interface Batch {
31
50
id : string ;
32
51
@@ -217,9 +236,13 @@ export interface BatchCreateParams {
217
236
metadata ?: Record < string , string > | null ;
218
237
}
219
238
239
+ export interface BatchListParams extends CursorPageParams { }
240
+
220
241
export namespace Batches {
221
242
export import Batch = BatchesAPI . Batch ;
222
243
export import BatchError = BatchesAPI . BatchError ;
223
244
export import BatchRequestCounts = BatchesAPI . BatchRequestCounts ;
245
+ export import BatchesPage = BatchesAPI . BatchesPage ;
224
246
export import BatchCreateParams = BatchesAPI . BatchCreateParams ;
247
+ export import BatchListParams = BatchesAPI . BatchListParams ;
225
248
}
0 commit comments