Skip to content

Commit 42c0b1b

Browse files
committed
chore: address pr comments
1 parent 88fe7a3 commit 42c0b1b

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

src/collections/backup/client.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import {
2828
BackupReturn,
2929
BackupStatusArgs,
3030
BackupStatusReturn,
31+
ListBackupOptions,
3132
} from './types.js';
3233

3334
export 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
}

src/collections/backup/integration.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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);

src/collections/backup/types.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff 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+
};

0 commit comments

Comments
 (0)