22
33import * as Core from 'openai/core' ;
44import { APIResource } from 'openai/resource' ;
5+ import { isRequestOptions } from 'openai/core' ;
56import * as BatchesAPI from 'openai/resources/batches' ;
7+ import { CursorPage , type CursorPageParams } from 'openai/pagination' ;
68
79export class Batches extends APIResource {
810 /**
@@ -19,6 +21,21 @@ export class Batches extends APIResource {
1921 return this . _client . get ( `/batches/${ batchId } ` , options ) ;
2022 }
2123
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+
2239 /**
2340 * Cancels an in-progress batch.
2441 */
@@ -27,6 +44,8 @@ export class Batches extends APIResource {
2744 }
2845}
2946
47+ export class BatchesPage extends CursorPage < Batch > { }
48+
3049export interface Batch {
3150 id : string ;
3251
@@ -217,9 +236,13 @@ export interface BatchCreateParams {
217236 metadata ?: Record < string , string > | null ;
218237}
219238
239+ export interface BatchListParams extends CursorPageParams { }
240+
220241export namespace Batches {
221242 export import Batch = BatchesAPI . Batch ;
222243 export import BatchError = BatchesAPI . BatchError ;
223244 export import BatchRequestCounts = BatchesAPI . BatchRequestCounts ;
245+ export import BatchesPage = BatchesAPI . BatchesPage ;
224246 export import BatchCreateParams = BatchesAPI . BatchCreateParams ;
247+ export import BatchListParams = BatchesAPI . BatchListParams ;
225248}
0 commit comments