File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed
packages/backend/src/api/endpoints Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " @clerk/backend " : patch
3
+ ---
4
+
5
+ Added API keys list method to the backend SDK client
Original file line number Diff line number Diff line change
1
+ import type { ClerkPaginationRequest } from '@clerk/types' ;
2
+
1
3
import { joinPaths } from '../../util/path' ;
2
4
import type { APIKey } from '../resources/APIKey' ;
3
5
import { AbstractAPI } from './AbstractApi' ;
4
6
5
7
const basePath = '/api_keys' ;
6
8
9
+ type GetAPIKeyListParams = ClerkPaginationRequest < {
10
+ /**
11
+ * The user or organization ID to query API keys by
12
+ */
13
+ subject : string ;
14
+ /**
15
+ * Whether to include invalid API keys.
16
+ *
17
+ * @default false
18
+ */
19
+ includeInvalid ?: boolean ;
20
+ } > ;
21
+
7
22
type CreateAPIKeyParams = {
8
23
type ?: 'api_key' ;
9
24
/**
10
25
* API key name
11
26
*/
12
27
name : string ;
13
28
/**
14
- * user or organization ID the API key is associated with
29
+ * The user or organization ID to associate the API key with
15
30
*/
16
31
subject : string ;
17
32
/**
@@ -36,6 +51,14 @@ type RevokeAPIKeyParams = {
36
51
} ;
37
52
38
53
export class APIKeysAPI extends AbstractAPI {
54
+ async list ( queryParams : GetAPIKeyListParams ) {
55
+ return this . request < APIKey [ ] > ( {
56
+ method : 'GET' ,
57
+ path : basePath ,
58
+ queryParams,
59
+ } ) ;
60
+ }
61
+
39
62
async create ( params : CreateAPIKeyParams ) {
40
63
return this . request < APIKey > ( {
41
64
method : 'POST' ,
You can’t perform that action at this time.
0 commit comments