File tree Expand file tree Collapse file tree 3 files changed +12
-6
lines changed Expand file tree Collapse file tree 3 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ import {
2828 BackupReturn ,
2929 BackupStatusArgs ,
3030 BackupStatusReturn ,
31+ ListBackupOptions ,
3132} from './types.js' ;
3233
3334export const backup = ( connection : Connection ) : Backup => {
@@ -205,9 +206,9 @@ export const backup = (connection: Connection): Backup => {
205206 }
206207 : parseResponse ( res ) ;
207208 } ,
208- list : ( backend : Backend , sortAscending ?: boolean ) : Promise < BackupReturn [ ] > => {
209+ list : ( backend : Backend , opts ?: ListBackupOptions ) : Promise < BackupReturn [ ] > => {
209210 let url = `/backups/${ backend } ` ;
210- if ( sortAscending ) {
211+ if ( opts ?. startedAtAsc ) {
211212 url += '?order=asc' ;
212213 }
213214 return connection . get < BackupReturn [ ] > ( url ) ;
@@ -265,8 +266,8 @@ export interface Backup {
265266 /** List existing backups (completed and in-progress) created in a given backend.
266267 *
267268 * @param {Backend } backend Backend whence to list backups.
268- * @param {sortAscending } [boolean] Sort list of backups in ascending order based on creation time. Default is descending order .
269+ * @param {ListBackupOptions } [opts] The options available when listing backups .
269270 * @returns {Promise<BackupReturn[]> } The response from Weaviate.
270- * * /
271- list ( backend : Backend , sortAscending ?: boolean ) : Promise < BackupReturn [ ] > ;
271+ */
272+ list ( backend : Backend , opts ?: ListBackupOptions ) : Promise < BackupReturn [ ] > ;
272273}
Original file line number Diff line number Diff line change @@ -247,7 +247,7 @@ describe('Integration testing of backups', () => {
247247 }
248248
249249 const sortAscending = true ;
250- const gotBackups = await client . backup . list ( 'filesystem' , sortAscending ) ;
250+ const gotBackups = await client . backup . list ( 'filesystem' , { startedAtAsc : sortAscending } ) ;
251251
252252 // There may be other backups created in other tests;
253253 expect ( gotBackups . length ) . toBeGreaterThanOrEqual ( wantBackups . length ) ;
Original file line number Diff line number Diff line change @@ -78,3 +78,8 @@ export type BackupCancelArgs = {
7878 /** The backend to use for the backup. */
7979 backend : Backend ;
8080} ;
81+
82+ /** The options available when listing backups. */
83+ export type ListBackupOptions = {
84+ startedAtAsc ?: boolean ;
85+ } ;
You can’t perform that action at this time.
0 commit comments