22
33import { APIResource } from '../core/resource' ;
44import { APIPromise } from '../core/api-promise' ;
5+ import { OffsetPagination , type OffsetPaginationParams , PagePromise } from '../core/pagination' ;
56import { type Uploadable } from '../core/uploads' ;
67import { buildHeaders } from '../internal/headers' ;
78import { RequestOptions } from '../internal/request-options' ;
@@ -17,11 +18,20 @@ export class Extensions extends APIResource {
1718 *
1819 * @example
1920 * ```ts
20- * const extensions = await client.extensions.list();
21+ * // Automatically fetches more pages as needed.
22+ * for await (const extensionListResponse of client.extensions.list()) {
23+ * // ...
24+ * }
2125 * ```
2226 */
23- list ( options ?: RequestOptions ) : APIPromise < ExtensionListResponse > {
24- return this . _client . get ( '/extensions' , options ) ;
27+ list (
28+ query : ExtensionListParams | null | undefined = { } ,
29+ options ?: RequestOptions ,
30+ ) : PagePromise < ExtensionListResponsesOffsetPagination , ExtensionListResponse > {
31+ return this . _client . getAPIList ( '/extensions' , OffsetPagination < ExtensionListResponse > , {
32+ query,
33+ ...options ,
34+ } ) ;
2535 }
2636
2737 /**
@@ -103,39 +113,37 @@ export class Extensions extends APIResource {
103113 }
104114}
105115
106- export type ExtensionListResponse = Array < ExtensionListResponse . ExtensionListResponseItem > ;
116+ export type ExtensionListResponsesOffsetPagination = OffsetPagination < ExtensionListResponse > ;
107117
108- export namespace ExtensionListResponse {
118+ /**
119+ * A browser extension uploaded to Kernel.
120+ */
121+ export interface ExtensionListResponse {
109122 /**
110- * A browser extension uploaded to Kernel.
123+ * Unique identifier for the extension
111124 */
112- export interface ExtensionListResponseItem {
113- /**
114- * Unique identifier for the extension
115- */
116- id : string ;
125+ id : string ;
117126
118- /**
119- * Timestamp when the extension was created
120- */
121- created_at : string ;
127+ /**
128+ * Timestamp when the extension was created
129+ */
130+ created_at : string ;
122131
123- /**
124- * Size of the extension archive in bytes
125- */
126- size_bytes : number ;
132+ /**
133+ * Size of the extension archive in bytes
134+ */
135+ size_bytes : number ;
127136
128- /**
129- * Timestamp when the extension was last used
130- */
131- last_used_at ?: string | null ;
137+ /**
138+ * Timestamp when the extension was last used
139+ */
140+ last_used_at ?: string | null ;
132141
133- /**
134- * Optional, easier-to-reference name for the extension. Must be unique within the
135- * project.
136- */
137- name ?: string | null ;
138- }
142+ /**
143+ * Optional, easier-to-reference name for the extension. Must be unique within the
144+ * project.
145+ */
146+ name ?: string | null ;
139147}
140148
141149/**
@@ -169,6 +177,8 @@ export interface ExtensionUploadResponse {
169177 name ?: string | null ;
170178}
171179
180+ export interface ExtensionListParams extends OffsetPaginationParams { }
181+
172182export interface ExtensionDownloadFromChromeStoreParams {
173183 /**
174184 * Chrome Web Store URL for the extension.
@@ -197,6 +207,8 @@ export declare namespace Extensions {
197207 export {
198208 type ExtensionListResponse as ExtensionListResponse ,
199209 type ExtensionUploadResponse as ExtensionUploadResponse ,
210+ type ExtensionListResponsesOffsetPagination as ExtensionListResponsesOffsetPagination ,
211+ type ExtensionListParams as ExtensionListParams ,
200212 type ExtensionDownloadFromChromeStoreParams as ExtensionDownloadFromChromeStoreParams ,
201213 type ExtensionUploadParams as ExtensionUploadParams ,
202214 } ;
0 commit comments