@avalabs/glacier-sdk 2.8.0-canary.5601e64.0 → 2.8.0-canary.5825aa6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +232 -160
- package/dist/index.js +184 -120
- package/esm/generated/Glacier.d.ts +4 -0
- package/esm/generated/Glacier.js +6 -0
- package/esm/generated/core/CancelablePromise.d.ts +2 -8
- package/esm/generated/core/CancelablePromise.js +41 -36
- package/esm/generated/core/OpenAPI.d.ts +5 -5
- package/esm/generated/core/request.js +25 -9
- package/esm/generated/models/ChainInfo.d.ts +1 -0
- package/esm/generated/models/GetChainResponse.d.ts +1 -0
- package/esm/generated/models/GlacierApiFeature.d.ts +5 -0
- package/esm/generated/models/GlacierApiFeature.js +6 -0
- package/esm/generated/models/PrimaryNetworkOptions.d.ts +1 -1
- package/esm/generated/models/RegisterWebhookRequest.d.ts +8 -0
- package/esm/generated/models/RpcErrorDto.d.ts +7 -0
- package/esm/generated/models/RpcErrorResponseDto.d.ts +9 -0
- package/esm/generated/models/RpcRequestBodyDto.d.ts +8 -0
- package/esm/generated/models/RpcSuccessResponseDto.d.ts +7 -0
- package/esm/generated/models/UpdateWebhookRequest.d.ts +2 -0
- package/esm/generated/models/WebhookResponse.d.ts +8 -0
- package/esm/generated/services/DefaultService.d.ts +0 -86
- package/esm/generated/services/DefaultService.js +0 -73
- package/esm/generated/services/EvmChainsService.d.ts +6 -1
- package/esm/generated/services/EvmChainsService.js +4 -2
- package/esm/generated/services/PrimaryNetworkService.d.ts +1 -1
- package/esm/generated/services/PrimaryNetworkService.js +1 -1
- package/esm/generated/services/RpcService.d.ts +25 -0
- package/esm/generated/services/RpcService.js +24 -0
- package/esm/generated/services/WebhooksService.d.ts +95 -0
- package/esm/generated/services/WebhooksService.js +80 -0
- package/esm/index.d.ts +7 -0
- package/esm/index.js +3 -0
- package/package.json +3 -3
|
@@ -93,10 +93,12 @@ const resolve = async (options, resolver) => {
|
|
|
93
93
|
return resolver;
|
|
94
94
|
};
|
|
95
95
|
const getHeaders = async (config, options) => {
|
|
96
|
-
const token = await
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
96
|
+
const [token, username, password, additionalHeaders] = await Promise.all([
|
|
97
|
+
resolve(options, config.TOKEN),
|
|
98
|
+
resolve(options, config.USERNAME),
|
|
99
|
+
resolve(options, config.PASSWORD),
|
|
100
|
+
resolve(options, config.HEADERS)
|
|
101
|
+
]);
|
|
100
102
|
const headers = Object.entries({
|
|
101
103
|
Accept: "application/json",
|
|
102
104
|
...additionalHeaders,
|
|
@@ -112,7 +114,7 @@ const getHeaders = async (config, options) => {
|
|
|
112
114
|
const credentials = base64(`${username}:${password}`);
|
|
113
115
|
headers["Authorization"] = `Basic ${credentials}`;
|
|
114
116
|
}
|
|
115
|
-
if (options.body) {
|
|
117
|
+
if (options.body !== void 0) {
|
|
116
118
|
if (options.mediaType) {
|
|
117
119
|
headers["Content-Type"] = options.mediaType;
|
|
118
120
|
} else if (isBlob(options.body)) {
|
|
@@ -126,7 +128,7 @@ const getHeaders = async (config, options) => {
|
|
|
126
128
|
return new Headers(headers);
|
|
127
129
|
};
|
|
128
130
|
const getRequestBody = (options) => {
|
|
129
|
-
if (options.body) {
|
|
131
|
+
if (options.body !== void 0) {
|
|
130
132
|
if (options.mediaType?.includes("/json")) {
|
|
131
133
|
return JSON.stringify(options.body);
|
|
132
134
|
} else if (isString(options.body) || isBlob(options.body) || isFormData(options.body)) {
|
|
@@ -165,7 +167,8 @@ const getResponseBody = async (response) => {
|
|
|
165
167
|
try {
|
|
166
168
|
const contentType = response.headers.get("Content-Type");
|
|
167
169
|
if (contentType) {
|
|
168
|
-
const
|
|
170
|
+
const jsonTypes = ["application/json", "application/problem+json"];
|
|
171
|
+
const isJSON = jsonTypes.some((type) => contentType.toLowerCase().startsWith(type));
|
|
169
172
|
if (isJSON) {
|
|
170
173
|
return await response.json();
|
|
171
174
|
} else {
|
|
@@ -194,7 +197,20 @@ const catchErrorCodes = (options, result) => {
|
|
|
194
197
|
throw new ApiError(options, result, error);
|
|
195
198
|
}
|
|
196
199
|
if (!result.ok) {
|
|
197
|
-
|
|
200
|
+
const errorStatus = result.status ?? "unknown";
|
|
201
|
+
const errorStatusText = result.statusText ?? "unknown";
|
|
202
|
+
const errorBody = (() => {
|
|
203
|
+
try {
|
|
204
|
+
return JSON.stringify(result.body, null, 2);
|
|
205
|
+
} catch (e) {
|
|
206
|
+
return void 0;
|
|
207
|
+
}
|
|
208
|
+
})();
|
|
209
|
+
throw new ApiError(
|
|
210
|
+
options,
|
|
211
|
+
result,
|
|
212
|
+
`Generic Error: status: ${errorStatus}; status text: ${errorStatusText}; body: ${errorBody}`
|
|
213
|
+
);
|
|
198
214
|
}
|
|
199
215
|
};
|
|
200
216
|
const request = (config, options) => {
|
|
@@ -224,4 +240,4 @@ const request = (config, options) => {
|
|
|
224
240
|
});
|
|
225
241
|
};
|
|
226
242
|
|
|
227
|
-
export { request, sendRequest };
|
|
243
|
+
export { base64, catchErrorCodes, getFormData, getHeaders, getQueryString, getRequestBody, getResponseBody, getResponseHeader, isBlob, isDefined, isFormData, isString, isStringWithValue, request, resolve, sendRequest };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
type PrimaryNetworkOptions = {
|
|
2
|
-
addresses
|
|
2
|
+
addresses?: Array<string>;
|
|
3
3
|
cChainEvmAddresses?: Array<string>;
|
|
4
4
|
includeChains: Array<'11111111111111111111111111111111LpoYY' | '2oYMBNV4eNHyqk2fjjV5nVQLDbtmNJzq5s3qs3Lo6ftnC6FByM' | '2JVSBoinj9C2J33VntvzYtVJNZdN2NKiwwKjcumHUWEb5DbBrm' | '2q9e4r6Mu3U68nU1fYjgbR6JvwrRx36CohpAX5UQxse55x1Q5' | 'yH8D7ThNJkxmtkuv2jgBa4P1Rn3Qpr4pPr7QYNfcdoS6k6HWp' | 'p-chain' | 'x-chain' | 'c-chain'>;
|
|
5
5
|
};
|
|
@@ -6,6 +6,14 @@ type RegisterWebhookRequest = {
|
|
|
6
6
|
chainId: string;
|
|
7
7
|
eventType: EventType;
|
|
8
8
|
metadata: AddressActivityMetadata;
|
|
9
|
+
/**
|
|
10
|
+
* Whether to include traces in the webhook payload.
|
|
11
|
+
*/
|
|
12
|
+
includeInternalTxs?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Whether to include logs in the webhook payload.
|
|
15
|
+
*/
|
|
16
|
+
includeLogs?: boolean;
|
|
9
17
|
};
|
|
10
18
|
|
|
11
19
|
export { RegisterWebhookRequest };
|
|
@@ -6,6 +6,14 @@ type WebhookResponse = {
|
|
|
6
6
|
id: string;
|
|
7
7
|
eventType: EventType;
|
|
8
8
|
metadata: AddressActivityMetadata;
|
|
9
|
+
/**
|
|
10
|
+
* Whether to include traces in the webhook payload.
|
|
11
|
+
*/
|
|
12
|
+
includeInternalTxs?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Whether to include logs in the webhook payload.
|
|
15
|
+
*/
|
|
16
|
+
includeLogs?: boolean;
|
|
9
17
|
url: string;
|
|
10
18
|
chainId: string;
|
|
11
19
|
status: WebhookStatusType;
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import { ListWebhooksResponse } from '../models/ListWebhooksResponse.js';
|
|
2
|
-
import { RegisterWebhookRequest } from '../models/RegisterWebhookRequest.js';
|
|
3
|
-
import { SharedSecretsResponse } from '../models/SharedSecretsResponse.js';
|
|
4
|
-
import { UpdateWebhookRequest } from '../models/UpdateWebhookRequest.js';
|
|
5
|
-
import { WebhookResponse } from '../models/WebhookResponse.js';
|
|
6
|
-
import { WebhookStatus } from '../models/WebhookStatus.js';
|
|
7
1
|
import { CancelablePromise } from '../core/CancelablePromise.js';
|
|
8
2
|
import { BaseHttpRequest } from '../core/BaseHttpRequest.js';
|
|
9
3
|
|
|
@@ -15,86 +9,6 @@ declare class DefaultService {
|
|
|
15
9
|
* @throws ApiError
|
|
16
10
|
*/
|
|
17
11
|
mediaControllerUploadImage(): CancelablePromise<any>;
|
|
18
|
-
/**
|
|
19
|
-
* Register a webhook
|
|
20
|
-
* Registers a new webhook.
|
|
21
|
-
* @returns WebhookResponse
|
|
22
|
-
* @throws ApiError
|
|
23
|
-
*/
|
|
24
|
-
registerWebhook({ requestBody, }: {
|
|
25
|
-
requestBody: RegisterWebhookRequest;
|
|
26
|
-
}): CancelablePromise<WebhookResponse>;
|
|
27
|
-
/**
|
|
28
|
-
* List webhooks
|
|
29
|
-
* Lists webhooks for the user.
|
|
30
|
-
* @returns ListWebhooksResponse
|
|
31
|
-
* @throws ApiError
|
|
32
|
-
*/
|
|
33
|
-
listWebhooks({ pageToken, pageSize, status, }: {
|
|
34
|
-
/**
|
|
35
|
-
* A page token, received from a previous list call. Provide this to retrieve the subsequent page.
|
|
36
|
-
*/
|
|
37
|
-
pageToken?: string;
|
|
38
|
-
/**
|
|
39
|
-
* The maximum number of items to return. The minimum page size is 1. The maximum pageSize is 100.
|
|
40
|
-
*/
|
|
41
|
-
pageSize?: number;
|
|
42
|
-
/**
|
|
43
|
-
* Status of the webhook. Use "active" to return only active webhooks, "inactive" to return only inactive webhooks. Else if no status is provided, all configured webhooks will be returned.
|
|
44
|
-
*/
|
|
45
|
-
status?: WebhookStatus;
|
|
46
|
-
}): CancelablePromise<ListWebhooksResponse>;
|
|
47
|
-
/**
|
|
48
|
-
* Get a webhook by ID
|
|
49
|
-
* Retrieves a webhook by ID.
|
|
50
|
-
* @returns WebhookResponse
|
|
51
|
-
* @throws ApiError
|
|
52
|
-
*/
|
|
53
|
-
getWebhook({ id, }: {
|
|
54
|
-
/**
|
|
55
|
-
* The webhook identifier.
|
|
56
|
-
*/
|
|
57
|
-
id: string;
|
|
58
|
-
}): CancelablePromise<WebhookResponse>;
|
|
59
|
-
/**
|
|
60
|
-
* Deactivate a webhook
|
|
61
|
-
* Deactivates a webhook by ID.
|
|
62
|
-
* @returns WebhookResponse
|
|
63
|
-
* @throws ApiError
|
|
64
|
-
*/
|
|
65
|
-
deactivateWebhook({ id, }: {
|
|
66
|
-
/**
|
|
67
|
-
* The webhook identifier.
|
|
68
|
-
*/
|
|
69
|
-
id: string;
|
|
70
|
-
}): CancelablePromise<WebhookResponse>;
|
|
71
|
-
/**
|
|
72
|
-
* Update a webhook
|
|
73
|
-
* Updates an existing webhook.
|
|
74
|
-
* @returns WebhookResponse
|
|
75
|
-
* @throws ApiError
|
|
76
|
-
*/
|
|
77
|
-
updateWebhook({ id, requestBody, }: {
|
|
78
|
-
/**
|
|
79
|
-
* The webhook identifier.
|
|
80
|
-
*/
|
|
81
|
-
id: string;
|
|
82
|
-
requestBody: UpdateWebhookRequest;
|
|
83
|
-
}): CancelablePromise<WebhookResponse>;
|
|
84
|
-
/**
|
|
85
|
-
* Generate a shared secret
|
|
86
|
-
* Generates a new shared secret.
|
|
87
|
-
* @returns SharedSecretsResponse
|
|
88
|
-
* @throws ApiError
|
|
89
|
-
*/
|
|
90
|
-
generateSharedSecret(): CancelablePromise<SharedSecretsResponse>;
|
|
91
|
-
/**
|
|
92
|
-
* Get a shared secret
|
|
93
|
-
* Get a previously generated shared secret.
|
|
94
|
-
* @returns SharedSecretsResponse
|
|
95
|
-
* @throws ApiError
|
|
96
|
-
*/
|
|
97
|
-
getSharedSecret(): CancelablePromise<SharedSecretsResponse>;
|
|
98
12
|
}
|
|
99
13
|
|
|
100
14
|
export { DefaultService };
|
|
@@ -8,79 +8,6 @@ class DefaultService {
|
|
|
8
8
|
url: "/v1/media/uploadImage"
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
|
-
registerWebhook({
|
|
12
|
-
requestBody
|
|
13
|
-
}) {
|
|
14
|
-
return this.httpRequest.request({
|
|
15
|
-
method: "POST",
|
|
16
|
-
url: "/v1/webhooks",
|
|
17
|
-
body: requestBody,
|
|
18
|
-
mediaType: "application/json"
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
listWebhooks({
|
|
22
|
-
pageToken,
|
|
23
|
-
pageSize = 10,
|
|
24
|
-
status
|
|
25
|
-
}) {
|
|
26
|
-
return this.httpRequest.request({
|
|
27
|
-
method: "GET",
|
|
28
|
-
url: "/v1/webhooks",
|
|
29
|
-
query: {
|
|
30
|
-
"pageToken": pageToken,
|
|
31
|
-
"pageSize": pageSize,
|
|
32
|
-
"status": status
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
getWebhook({
|
|
37
|
-
id
|
|
38
|
-
}) {
|
|
39
|
-
return this.httpRequest.request({
|
|
40
|
-
method: "GET",
|
|
41
|
-
url: "/v1/webhooks/{id}",
|
|
42
|
-
path: {
|
|
43
|
-
"id": id
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
deactivateWebhook({
|
|
48
|
-
id
|
|
49
|
-
}) {
|
|
50
|
-
return this.httpRequest.request({
|
|
51
|
-
method: "DELETE",
|
|
52
|
-
url: "/v1/webhooks/{id}",
|
|
53
|
-
path: {
|
|
54
|
-
"id": id
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
updateWebhook({
|
|
59
|
-
id,
|
|
60
|
-
requestBody
|
|
61
|
-
}) {
|
|
62
|
-
return this.httpRequest.request({
|
|
63
|
-
method: "PATCH",
|
|
64
|
-
url: "/v1/webhooks/{id}",
|
|
65
|
-
path: {
|
|
66
|
-
"id": id
|
|
67
|
-
},
|
|
68
|
-
body: requestBody,
|
|
69
|
-
mediaType: "application/json"
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
generateSharedSecret() {
|
|
73
|
-
return this.httpRequest.request({
|
|
74
|
-
method: "POST",
|
|
75
|
-
url: "/v1/webhooks:generateOrRotateSharedSecret"
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
getSharedSecret() {
|
|
79
|
-
return this.httpRequest.request({
|
|
80
|
-
method: "GET",
|
|
81
|
-
url: "/v1/webhooks:getSharedSecret"
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
11
|
}
|
|
85
12
|
|
|
86
13
|
export { DefaultService };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { GetChainResponse } from '../models/GetChainResponse.js';
|
|
2
|
+
import { GlacierApiFeature } from '../models/GlacierApiFeature.js';
|
|
2
3
|
import { ListChainsResponse } from '../models/ListChainsResponse.js';
|
|
3
4
|
import { NetworkType } from '../models/NetworkType.js';
|
|
4
5
|
import { CancelablePromise } from '../core/CancelablePromise.js';
|
|
@@ -13,11 +14,15 @@ declare class EvmChainsService {
|
|
|
13
14
|
* @returns ListChainsResponse
|
|
14
15
|
* @throws ApiError
|
|
15
16
|
*/
|
|
16
|
-
supportedChains({ network, }: {
|
|
17
|
+
supportedChains({ network, feature, }: {
|
|
17
18
|
/**
|
|
18
19
|
* mainnet or testnet.
|
|
19
20
|
*/
|
|
20
21
|
network?: NetworkType;
|
|
22
|
+
/**
|
|
23
|
+
* Filter by feature.
|
|
24
|
+
*/
|
|
25
|
+
feature?: GlacierApiFeature;
|
|
21
26
|
}): CancelablePromise<ListChainsResponse>;
|
|
22
27
|
/**
|
|
23
28
|
* Get chain information
|
|
@@ -3,13 +3,15 @@ class EvmChainsService {
|
|
|
3
3
|
this.httpRequest = httpRequest;
|
|
4
4
|
}
|
|
5
5
|
supportedChains({
|
|
6
|
-
network
|
|
6
|
+
network,
|
|
7
|
+
feature
|
|
7
8
|
}) {
|
|
8
9
|
return this.httpRequest.request({
|
|
9
10
|
method: "GET",
|
|
10
11
|
url: "/v1/chains",
|
|
11
12
|
query: {
|
|
12
|
-
"network": network
|
|
13
|
+
"network": network,
|
|
14
|
+
"feature": feature
|
|
13
15
|
}
|
|
14
16
|
});
|
|
15
17
|
}
|
|
@@ -170,7 +170,7 @@ declare class PrimaryNetworkService {
|
|
|
170
170
|
/**
|
|
171
171
|
* The subnet ID to filter by. If not provided, then all subnets will be returned.
|
|
172
172
|
*/
|
|
173
|
-
subnetId?:
|
|
173
|
+
subnetId?: any;
|
|
174
174
|
}): CancelablePromise<ListValidatorDetailsResponse>;
|
|
175
175
|
/**
|
|
176
176
|
* Get single validator details
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { RpcErrorResponseDto } from '../models/RpcErrorResponseDto.js';
|
|
2
|
+
import { RpcRequestBodyDto } from '../models/RpcRequestBodyDto.js';
|
|
3
|
+
import { RpcSuccessResponseDto } from '../models/RpcSuccessResponseDto.js';
|
|
4
|
+
import { CancelablePromise } from '../core/CancelablePromise.js';
|
|
5
|
+
import { BaseHttpRequest } from '../core/BaseHttpRequest.js';
|
|
6
|
+
|
|
7
|
+
declare class RpcService {
|
|
8
|
+
readonly httpRequest: BaseHttpRequest;
|
|
9
|
+
constructor(httpRequest: BaseHttpRequest);
|
|
10
|
+
/**
|
|
11
|
+
* Calls JSON-RPC method
|
|
12
|
+
* Calls JSON-RPC method.
|
|
13
|
+
* @returns any
|
|
14
|
+
* @throws ApiError
|
|
15
|
+
*/
|
|
16
|
+
rpc({ chainId, requestBody, }: {
|
|
17
|
+
/**
|
|
18
|
+
* A supported evm chain id, chain alias or blockchain id. Use the `/chains` endpoint to get a list of supported chain ids.
|
|
19
|
+
*/
|
|
20
|
+
chainId: string;
|
|
21
|
+
requestBody: (RpcRequestBodyDto | Array<RpcRequestBodyDto>);
|
|
22
|
+
}): CancelablePromise<(RpcSuccessResponseDto | RpcErrorResponseDto)>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { RpcService };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
class RpcService {
|
|
2
|
+
constructor(httpRequest) {
|
|
3
|
+
this.httpRequest = httpRequest;
|
|
4
|
+
}
|
|
5
|
+
rpc({
|
|
6
|
+
chainId,
|
|
7
|
+
requestBody
|
|
8
|
+
}) {
|
|
9
|
+
return this.httpRequest.request({
|
|
10
|
+
method: "POST",
|
|
11
|
+
url: "/v1/ext/bc/{chainId}/rpc",
|
|
12
|
+
path: {
|
|
13
|
+
"chainId": chainId
|
|
14
|
+
},
|
|
15
|
+
body: requestBody,
|
|
16
|
+
mediaType: "application/json",
|
|
17
|
+
errors: {
|
|
18
|
+
504: `Request timed out`
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { RpcService };
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { ListWebhooksResponse } from '../models/ListWebhooksResponse.js';
|
|
2
|
+
import { RegisterWebhookRequest } from '../models/RegisterWebhookRequest.js';
|
|
3
|
+
import { SharedSecretsResponse } from '../models/SharedSecretsResponse.js';
|
|
4
|
+
import { UpdateWebhookRequest } from '../models/UpdateWebhookRequest.js';
|
|
5
|
+
import { WebhookResponse } from '../models/WebhookResponse.js';
|
|
6
|
+
import { WebhookStatus } from '../models/WebhookStatus.js';
|
|
7
|
+
import { CancelablePromise } from '../core/CancelablePromise.js';
|
|
8
|
+
import { BaseHttpRequest } from '../core/BaseHttpRequest.js';
|
|
9
|
+
|
|
10
|
+
declare class WebhooksService {
|
|
11
|
+
readonly httpRequest: BaseHttpRequest;
|
|
12
|
+
constructor(httpRequest: BaseHttpRequest);
|
|
13
|
+
/**
|
|
14
|
+
* Register a webhook
|
|
15
|
+
* Registers a new webhook.
|
|
16
|
+
* @returns WebhookResponse
|
|
17
|
+
* @throws ApiError
|
|
18
|
+
*/
|
|
19
|
+
registerWebhook({ requestBody, }: {
|
|
20
|
+
requestBody: RegisterWebhookRequest;
|
|
21
|
+
}): CancelablePromise<WebhookResponse>;
|
|
22
|
+
/**
|
|
23
|
+
* List webhooks
|
|
24
|
+
* Lists webhooks for the user.
|
|
25
|
+
* @returns ListWebhooksResponse
|
|
26
|
+
* @throws ApiError
|
|
27
|
+
*/
|
|
28
|
+
listWebhooks({ pageToken, pageSize, status, }: {
|
|
29
|
+
/**
|
|
30
|
+
* A page token, received from a previous list call. Provide this to retrieve the subsequent page.
|
|
31
|
+
*/
|
|
32
|
+
pageToken?: string;
|
|
33
|
+
/**
|
|
34
|
+
* The maximum number of items to return. The minimum page size is 1. The maximum pageSize is 100.
|
|
35
|
+
*/
|
|
36
|
+
pageSize?: number;
|
|
37
|
+
/**
|
|
38
|
+
* Status of the webhook. Use "active" to return only active webhooks, "inactive" to return only inactive webhooks. Else if no status is provided, all configured webhooks will be returned.
|
|
39
|
+
*/
|
|
40
|
+
status?: WebhookStatus;
|
|
41
|
+
}): CancelablePromise<ListWebhooksResponse>;
|
|
42
|
+
/**
|
|
43
|
+
* Get a webhook by ID
|
|
44
|
+
* Retrieves a webhook by ID.
|
|
45
|
+
* @returns WebhookResponse
|
|
46
|
+
* @throws ApiError
|
|
47
|
+
*/
|
|
48
|
+
getWebhook({ id, }: {
|
|
49
|
+
/**
|
|
50
|
+
* The webhook identifier.
|
|
51
|
+
*/
|
|
52
|
+
id: string;
|
|
53
|
+
}): CancelablePromise<WebhookResponse>;
|
|
54
|
+
/**
|
|
55
|
+
* Deactivate a webhook
|
|
56
|
+
* Deactivates a webhook by ID.
|
|
57
|
+
* @returns WebhookResponse
|
|
58
|
+
* @throws ApiError
|
|
59
|
+
*/
|
|
60
|
+
deactivateWebhook({ id, }: {
|
|
61
|
+
/**
|
|
62
|
+
* The webhook identifier.
|
|
63
|
+
*/
|
|
64
|
+
id: string;
|
|
65
|
+
}): CancelablePromise<WebhookResponse>;
|
|
66
|
+
/**
|
|
67
|
+
* Update a webhook
|
|
68
|
+
* Updates an existing webhook.
|
|
69
|
+
* @returns WebhookResponse
|
|
70
|
+
* @throws ApiError
|
|
71
|
+
*/
|
|
72
|
+
updateWebhook({ id, requestBody, }: {
|
|
73
|
+
/**
|
|
74
|
+
* The webhook identifier.
|
|
75
|
+
*/
|
|
76
|
+
id: string;
|
|
77
|
+
requestBody: UpdateWebhookRequest;
|
|
78
|
+
}): CancelablePromise<WebhookResponse>;
|
|
79
|
+
/**
|
|
80
|
+
* Generate a shared secret
|
|
81
|
+
* Generates a new shared secret.
|
|
82
|
+
* @returns SharedSecretsResponse
|
|
83
|
+
* @throws ApiError
|
|
84
|
+
*/
|
|
85
|
+
generateSharedSecret(): CancelablePromise<SharedSecretsResponse>;
|
|
86
|
+
/**
|
|
87
|
+
* Get a shared secret
|
|
88
|
+
* Get a previously generated shared secret.
|
|
89
|
+
* @returns SharedSecretsResponse
|
|
90
|
+
* @throws ApiError
|
|
91
|
+
*/
|
|
92
|
+
getSharedSecret(): CancelablePromise<SharedSecretsResponse>;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export { WebhooksService };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
class WebhooksService {
|
|
2
|
+
constructor(httpRequest) {
|
|
3
|
+
this.httpRequest = httpRequest;
|
|
4
|
+
}
|
|
5
|
+
registerWebhook({
|
|
6
|
+
requestBody
|
|
7
|
+
}) {
|
|
8
|
+
return this.httpRequest.request({
|
|
9
|
+
method: "POST",
|
|
10
|
+
url: "/v1/webhooks",
|
|
11
|
+
body: requestBody,
|
|
12
|
+
mediaType: "application/json"
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
listWebhooks({
|
|
16
|
+
pageToken,
|
|
17
|
+
pageSize = 10,
|
|
18
|
+
status
|
|
19
|
+
}) {
|
|
20
|
+
return this.httpRequest.request({
|
|
21
|
+
method: "GET",
|
|
22
|
+
url: "/v1/webhooks",
|
|
23
|
+
query: {
|
|
24
|
+
"pageToken": pageToken,
|
|
25
|
+
"pageSize": pageSize,
|
|
26
|
+
"status": status
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
getWebhook({
|
|
31
|
+
id
|
|
32
|
+
}) {
|
|
33
|
+
return this.httpRequest.request({
|
|
34
|
+
method: "GET",
|
|
35
|
+
url: "/v1/webhooks/{id}",
|
|
36
|
+
path: {
|
|
37
|
+
"id": id
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
deactivateWebhook({
|
|
42
|
+
id
|
|
43
|
+
}) {
|
|
44
|
+
return this.httpRequest.request({
|
|
45
|
+
method: "DELETE",
|
|
46
|
+
url: "/v1/webhooks/{id}",
|
|
47
|
+
path: {
|
|
48
|
+
"id": id
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
updateWebhook({
|
|
53
|
+
id,
|
|
54
|
+
requestBody
|
|
55
|
+
}) {
|
|
56
|
+
return this.httpRequest.request({
|
|
57
|
+
method: "PATCH",
|
|
58
|
+
url: "/v1/webhooks/{id}",
|
|
59
|
+
path: {
|
|
60
|
+
"id": id
|
|
61
|
+
},
|
|
62
|
+
body: requestBody,
|
|
63
|
+
mediaType: "application/json"
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
generateSharedSecret() {
|
|
67
|
+
return this.httpRequest.request({
|
|
68
|
+
method: "POST",
|
|
69
|
+
url: "/v1/webhooks:generateOrRotateSharedSecret"
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
getSharedSecret() {
|
|
73
|
+
return this.httpRequest.request({
|
|
74
|
+
method: "GET",
|
|
75
|
+
url: "/v1/webhooks:getSharedSecret"
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export { WebhooksService };
|