Skip to content

Commit 0006c82

Browse files
authored
chore(backend): Add missing orderBy field to machine list params (#6767)
1 parent 526d505 commit 0006c82

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

.changeset/gentle-lamps-collect.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
"@clerk/backend": patch
3+
---
4+
5+
Added missing `orderBy` field to machines list method
6+
7+
Example:
8+
9+
```ts
10+
clerkClient.machines.list({
11+
...params,
12+
orderBy: 'name'
13+
})
14+
```

packages/backend/src/api/endpoints/MachineApi.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1+
import type { ClerkPaginationRequest } from '@clerk/types';
2+
13
import { joinPaths } from '../../util/path';
24
import type { PaginatedResourceResponse } from '../resources/Deserializer';
35
import type { Machine } from '../resources/Machine';
46
import type { MachineScope } from '../resources/MachineScope';
57
import type { MachineSecretKey } from '../resources/MachineSecretKey';
68
import { AbstractAPI } from './AbstractApi';
9+
import type { WithSign } from './util-types';
710

811
const basePath = '/machines';
912

@@ -37,11 +40,17 @@ type UpdateMachineParams = {
3740
defaultTokenTtl?: number;
3841
};
3942

40-
type GetMachineListParams = {
41-
limit?: number;
42-
offset?: number;
43+
type GetMachineListParams = ClerkPaginationRequest<{
44+
/**
45+
* Sorts machines by name or created_at.
46+
* By prepending one of those values with + or -, we can choose to sort in ascending (ASC) or descending (DESC) order.
47+
*/
48+
orderBy?: WithSign<'name' | 'created_at'>;
49+
/**
50+
* Returns machines that have a ID or name that matches the given query.
51+
*/
4352
query?: string;
44-
};
53+
}>;
4554

4655
type RotateMachineSecretKeyParams = {
4756
/**

0 commit comments

Comments
 (0)