-
Notifications
You must be signed in to change notification settings - Fork 303
/
keys-manager.ts
102 lines (91 loc) · 2.4 KB
/
keys-manager.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import * as runtime from '../../../lib/runtime.js';
import type { InitOverride, ApiResponse } from '../../../lib/runtime.js';
import type {
GetSigningKeys200ResponseInner,
PostSigningKeys201Response,
PutSigningKeys200Response,
GetSigningKeyRequest,
PutSigningKeysRequest,
} from '../models/index.js';
const { BaseAPI } = runtime;
/**
*
*/
export class KeysManager extends BaseAPI {
/**
* Get an Application Signing Key by its key id
*
* @throws {RequiredError}
*/
async get(
requestParameters: GetSigningKeyRequest,
initOverrides?: InitOverride
): Promise<ApiResponse<GetSigningKeys200ResponseInner>> {
runtime.validateRequiredRequestParams(requestParameters, ['kid']);
const response = await this.request(
{
path: `/keys/signing/{kid}`.replace(
'{kid}',
encodeURIComponent(String(requestParameters.kid))
),
method: 'GET',
},
initOverrides
);
return runtime.JSONApiResponse.fromResponse(response);
}
/**
* Get all Application Signing Keys
*
* @throws {RequiredError}
*/
async getAll(
initOverrides?: InitOverride
): Promise<ApiResponse<Array<GetSigningKeys200ResponseInner>>> {
const response = await this.request(
{
path: `/keys/signing`,
method: 'GET',
},
initOverrides
);
return runtime.JSONApiResponse.fromResponse(response);
}
/**
* Rotate the Application Signing Key
*
* @throws {RequiredError}
*/
async rotate(initOverrides?: InitOverride): Promise<ApiResponse<PostSigningKeys201Response>> {
const response = await this.request(
{
path: `/keys/signing/rotate`,
method: 'POST',
},
initOverrides
);
return runtime.JSONApiResponse.fromResponse(response);
}
/**
* Revoke an Application Signing Key by its key id
*
* @throws {RequiredError}
*/
async revoke(
requestParameters: PutSigningKeysRequest,
initOverrides?: InitOverride
): Promise<ApiResponse<PutSigningKeys200Response>> {
runtime.validateRequiredRequestParams(requestParameters, ['kid']);
const response = await this.request(
{
path: `/keys/signing/{kid}/revoke`.replace(
'{kid}',
encodeURIComponent(String(requestParameters.kid))
),
method: 'PUT',
},
initOverrides
);
return runtime.JSONApiResponse.fromResponse(response);
}
}