agentmail 0.5.17 → 0.5.19
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/cjs/BaseClient.js +2 -2
- package/dist/cjs/api/resources/apiKeys/types/ApiKeyPermissions.d.ts +6 -6
- package/dist/cjs/api/resources/inboxes/resources/webhooks/client/Client.d.ts +32 -0
- package/dist/cjs/api/resources/inboxes/resources/webhooks/client/Client.js +139 -0
- package/dist/cjs/api/resources/pods/resources/webhooks/client/Client.d.ts +32 -0
- package/dist/cjs/api/resources/pods/resources/webhooks/client/Client.js +139 -0
- package/dist/cjs/api/resources/webhooks/client/Client.d.ts +30 -0
- package/dist/cjs/api/resources/webhooks/client/Client.js +137 -0
- package/dist/cjs/api/resources/webhooks/types/CreateInboxWebhookRequest.d.ts +1 -0
- package/dist/cjs/api/resources/webhooks/types/UpdateWebhookHeadersRequest.d.ts +10 -0
- package/dist/cjs/api/resources/webhooks/types/UpdateWebhookHeadersRequest.js +3 -0
- package/dist/cjs/api/resources/webhooks/types/WebhookHeaderNamesResponse.d.ts +4 -0
- package/dist/cjs/api/resources/webhooks/types/WebhookHeaderNamesResponse.js +3 -0
- package/dist/cjs/api/resources/webhooks/types/WebhookHeaders.d.ts +6 -0
- package/dist/cjs/api/resources/webhooks/types/WebhookHeaders.js +3 -0
- package/dist/cjs/api/resources/webhooks/types/index.d.ts +3 -0
- package/dist/cjs/api/resources/webhooks/types/index.js +3 -0
- package/dist/cjs/serialization/resources/apiKeys/types/ApiKeyPermissions.d.ts +2 -2
- package/dist/cjs/serialization/resources/apiKeys/types/ApiKeyPermissions.js +2 -2
- package/dist/cjs/serialization/resources/webhooks/types/CreateInboxWebhookRequest.d.ts +2 -0
- package/dist/cjs/serialization/resources/webhooks/types/CreateInboxWebhookRequest.js +2 -0
- package/dist/cjs/serialization/resources/webhooks/types/UpdateWebhookHeadersRequest.d.ts +11 -0
- package/dist/cjs/serialization/resources/webhooks/types/UpdateWebhookHeadersRequest.js +43 -0
- package/dist/cjs/serialization/resources/webhooks/types/WebhookHeaderNamesResponse.d.ts +9 -0
- package/dist/cjs/serialization/resources/webhooks/types/WebhookHeaderNamesResponse.js +41 -0
- package/dist/cjs/serialization/resources/webhooks/types/WebhookHeaders.d.ts +7 -0
- package/dist/cjs/serialization/resources/webhooks/types/WebhookHeaders.js +39 -0
- package/dist/cjs/serialization/resources/webhooks/types/index.d.ts +3 -0
- package/dist/cjs/serialization/resources/webhooks/types/index.js +3 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/api/resources/apiKeys/types/ApiKeyPermissions.d.mts +6 -6
- package/dist/esm/api/resources/inboxes/resources/webhooks/client/Client.d.mts +32 -0
- package/dist/esm/api/resources/inboxes/resources/webhooks/client/Client.mjs +139 -0
- package/dist/esm/api/resources/pods/resources/webhooks/client/Client.d.mts +32 -0
- package/dist/esm/api/resources/pods/resources/webhooks/client/Client.mjs +139 -0
- package/dist/esm/api/resources/webhooks/client/Client.d.mts +30 -0
- package/dist/esm/api/resources/webhooks/client/Client.mjs +137 -0
- package/dist/esm/api/resources/webhooks/types/CreateInboxWebhookRequest.d.mts +1 -0
- package/dist/esm/api/resources/webhooks/types/UpdateWebhookHeadersRequest.d.mts +10 -0
- package/dist/esm/api/resources/webhooks/types/UpdateWebhookHeadersRequest.mjs +2 -0
- package/dist/esm/api/resources/webhooks/types/WebhookHeaderNamesResponse.d.mts +4 -0
- package/dist/esm/api/resources/webhooks/types/WebhookHeaderNamesResponse.mjs +2 -0
- package/dist/esm/api/resources/webhooks/types/WebhookHeaders.d.mts +6 -0
- package/dist/esm/api/resources/webhooks/types/WebhookHeaders.mjs +2 -0
- package/dist/esm/api/resources/webhooks/types/index.d.mts +3 -0
- package/dist/esm/api/resources/webhooks/types/index.mjs +3 -0
- package/dist/esm/serialization/resources/apiKeys/types/ApiKeyPermissions.d.mts +2 -2
- package/dist/esm/serialization/resources/apiKeys/types/ApiKeyPermissions.mjs +2 -2
- package/dist/esm/serialization/resources/webhooks/types/CreateInboxWebhookRequest.d.mts +2 -0
- package/dist/esm/serialization/resources/webhooks/types/CreateInboxWebhookRequest.mjs +2 -0
- package/dist/esm/serialization/resources/webhooks/types/UpdateWebhookHeadersRequest.d.mts +11 -0
- package/dist/esm/serialization/resources/webhooks/types/UpdateWebhookHeadersRequest.mjs +7 -0
- package/dist/esm/serialization/resources/webhooks/types/WebhookHeaderNamesResponse.d.mts +9 -0
- package/dist/esm/serialization/resources/webhooks/types/WebhookHeaderNamesResponse.mjs +5 -0
- package/dist/esm/serialization/resources/webhooks/types/WebhookHeaders.d.mts +7 -0
- package/dist/esm/serialization/resources/webhooks/types/WebhookHeaders.mjs +3 -0
- package/dist/esm/serialization/resources/webhooks/types/index.d.mts +3 -0
- package/dist/esm/serialization/resources/webhooks/types/index.mjs +3 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +440 -0
package/dist/cjs/BaseClient.js
CHANGED
|
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
|
|
|
43
43
|
const headers = (0, headers_js_1.mergeHeaders)({
|
|
44
44
|
"X-Fern-Language": "JavaScript",
|
|
45
45
|
"X-Fern-SDK-Name": "agentmail",
|
|
46
|
-
"X-Fern-SDK-Version": "0.5.
|
|
47
|
-
"User-Agent": "agentmail/0.5.
|
|
46
|
+
"X-Fern-SDK-Version": "0.5.19",
|
|
47
|
+
"User-Agent": "agentmail/0.5.19",
|
|
48
48
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
49
49
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
50
50
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
@@ -10,20 +10,20 @@ export interface ApiKeyPermissions {
|
|
|
10
10
|
inboxUpdate?: boolean;
|
|
11
11
|
/** Delete inboxes. */
|
|
12
12
|
inboxDelete?: boolean;
|
|
13
|
-
/** Read threads. */
|
|
14
|
-
threadRead?: boolean;
|
|
15
|
-
/** Delete threads. */
|
|
16
|
-
threadDelete?: boolean;
|
|
17
|
-
/** Read messages. */
|
|
13
|
+
/** Read messages. Also required to read threads. */
|
|
18
14
|
messageRead?: boolean;
|
|
19
15
|
/** Send messages. */
|
|
20
16
|
messageSend?: boolean;
|
|
21
|
-
/** Update message labels. */
|
|
17
|
+
/** Update message labels. Also required to update threads. */
|
|
22
18
|
messageUpdate?: boolean;
|
|
19
|
+
/** Delete messages. Also required to delete threads. */
|
|
20
|
+
messageDelete?: boolean;
|
|
23
21
|
/** Access messages labeled spam. */
|
|
24
22
|
labelSpamRead?: boolean;
|
|
25
23
|
/** Access messages labeled blocked. */
|
|
26
24
|
labelBlockedRead?: boolean;
|
|
25
|
+
/** Access messages labeled unauthenticated. */
|
|
26
|
+
labelUnauthenticatedRead?: boolean;
|
|
27
27
|
/** Access messages labeled trash. */
|
|
28
28
|
labelTrashRead?: boolean;
|
|
29
29
|
/** Read drafts. */
|
|
@@ -42,6 +42,21 @@ export declare class WebhooksClient {
|
|
|
42
42
|
*/
|
|
43
43
|
get(inbox_id: AgentMail.inboxes.InboxId, webhook_id: AgentMail.webhooks.WebhookId, requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<AgentMail.webhooks.Webhook>;
|
|
44
44
|
private __get;
|
|
45
|
+
/**
|
|
46
|
+
* List the names of custom HTTP headers included with deliveries to this inbox-scoped webhook.
|
|
47
|
+
* Header values are write-only and are never returned.
|
|
48
|
+
*
|
|
49
|
+
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
50
|
+
* @param {AgentMail.webhooks.WebhookId} webhook_id
|
|
51
|
+
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
52
|
+
*
|
|
53
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* await client.inboxes.webhooks.getHeaders("inbox_id", "webhook_id")
|
|
57
|
+
*/
|
|
58
|
+
getHeaders(inbox_id: AgentMail.inboxes.InboxId, webhook_id: AgentMail.webhooks.WebhookId, requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<AgentMail.webhooks.WebhookHeaderNamesResponse>;
|
|
59
|
+
private __getHeaders;
|
|
45
60
|
/**
|
|
46
61
|
* Create a webhook scoped to this inbox.
|
|
47
62
|
*
|
|
@@ -83,6 +98,23 @@ export declare class WebhooksClient {
|
|
|
83
98
|
*/
|
|
84
99
|
update(inbox_id: AgentMail.inboxes.InboxId, webhook_id: AgentMail.webhooks.WebhookId, request: AgentMail.webhooks.UpdateInboxWebhookRequest, requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<AgentMail.webhooks.Webhook>;
|
|
85
100
|
private __update;
|
|
101
|
+
/**
|
|
102
|
+
* Atomically set, replace, or remove custom HTTP headers included with deliveries to this
|
|
103
|
+
* inbox-scoped webhook. Header values remain write-only.
|
|
104
|
+
*
|
|
105
|
+
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
106
|
+
* @param {AgentMail.webhooks.WebhookId} webhook_id
|
|
107
|
+
* @param {AgentMail.webhooks.UpdateWebhookHeadersRequest} request
|
|
108
|
+
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
109
|
+
*
|
|
110
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
111
|
+
* @throws {@link AgentMail.ValidationError}
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* await client.inboxes.webhooks.updateHeaders("inbox_id", "webhook_id", {})
|
|
115
|
+
*/
|
|
116
|
+
updateHeaders(inbox_id: AgentMail.inboxes.InboxId, webhook_id: AgentMail.webhooks.WebhookId, request: AgentMail.webhooks.UpdateWebhookHeadersRequest, requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<void>;
|
|
117
|
+
private __updateHeaders;
|
|
86
118
|
/**
|
|
87
119
|
* **CLI:**
|
|
88
120
|
* ```bash
|
|
@@ -185,6 +185,72 @@ class WebhooksClient {
|
|
|
185
185
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v0/inboxes/{inbox_id}/webhooks/{webhook_id}");
|
|
186
186
|
});
|
|
187
187
|
}
|
|
188
|
+
/**
|
|
189
|
+
* List the names of custom HTTP headers included with deliveries to this inbox-scoped webhook.
|
|
190
|
+
* Header values are write-only and are never returned.
|
|
191
|
+
*
|
|
192
|
+
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
193
|
+
* @param {AgentMail.webhooks.WebhookId} webhook_id
|
|
194
|
+
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
195
|
+
*
|
|
196
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
197
|
+
*
|
|
198
|
+
* @example
|
|
199
|
+
* await client.inboxes.webhooks.getHeaders("inbox_id", "webhook_id")
|
|
200
|
+
*/
|
|
201
|
+
getHeaders(inbox_id, webhook_id, requestOptions) {
|
|
202
|
+
return core.HttpResponsePromise.fromPromise(this.__getHeaders(inbox_id, webhook_id, requestOptions));
|
|
203
|
+
}
|
|
204
|
+
__getHeaders(inbox_id, webhook_id, requestOptions) {
|
|
205
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
206
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
207
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
208
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
209
|
+
const _response = yield core.fetcher({
|
|
210
|
+
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Prod)
|
|
211
|
+
.http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/webhooks/${core.url.encodePathParam(serializers.webhooks.WebhookId.jsonOrThrow(webhook_id, { omitUndefined: true }))}/headers`),
|
|
212
|
+
method: "GET",
|
|
213
|
+
headers: _headers,
|
|
214
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
215
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
216
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
217
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
218
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
219
|
+
logging: this._options.logging,
|
|
220
|
+
});
|
|
221
|
+
if (_response.ok) {
|
|
222
|
+
return {
|
|
223
|
+
data: serializers.webhooks.WebhookHeaderNamesResponse.parseOrThrow(_response.body, {
|
|
224
|
+
unrecognizedObjectKeys: "passthrough",
|
|
225
|
+
allowUnrecognizedUnionMembers: true,
|
|
226
|
+
allowUnrecognizedEnumValues: true,
|
|
227
|
+
skipValidation: true,
|
|
228
|
+
breadcrumbsPrefix: ["response"],
|
|
229
|
+
}),
|
|
230
|
+
rawResponse: _response.rawResponse,
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
if (_response.error.reason === "status-code") {
|
|
234
|
+
switch (_response.error.statusCode) {
|
|
235
|
+
case 404:
|
|
236
|
+
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
237
|
+
unrecognizedObjectKeys: "passthrough",
|
|
238
|
+
allowUnrecognizedUnionMembers: true,
|
|
239
|
+
allowUnrecognizedEnumValues: true,
|
|
240
|
+
skipValidation: true,
|
|
241
|
+
breadcrumbsPrefix: ["response"],
|
|
242
|
+
}), _response.rawResponse);
|
|
243
|
+
default:
|
|
244
|
+
throw new errors.AgentMailError({
|
|
245
|
+
statusCode: _response.error.statusCode,
|
|
246
|
+
body: _response.error.body,
|
|
247
|
+
rawResponse: _response.rawResponse,
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v0/inboxes/{inbox_id}/webhooks/{webhook_id}/headers");
|
|
252
|
+
});
|
|
253
|
+
}
|
|
188
254
|
/**
|
|
189
255
|
* Create a webhook scoped to this inbox.
|
|
190
256
|
*
|
|
@@ -348,6 +414,79 @@ class WebhooksClient {
|
|
|
348
414
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PATCH", "/v0/inboxes/{inbox_id}/webhooks/{webhook_id}");
|
|
349
415
|
});
|
|
350
416
|
}
|
|
417
|
+
/**
|
|
418
|
+
* Atomically set, replace, or remove custom HTTP headers included with deliveries to this
|
|
419
|
+
* inbox-scoped webhook. Header values remain write-only.
|
|
420
|
+
*
|
|
421
|
+
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
422
|
+
* @param {AgentMail.webhooks.WebhookId} webhook_id
|
|
423
|
+
* @param {AgentMail.webhooks.UpdateWebhookHeadersRequest} request
|
|
424
|
+
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
425
|
+
*
|
|
426
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
427
|
+
* @throws {@link AgentMail.ValidationError}
|
|
428
|
+
*
|
|
429
|
+
* @example
|
|
430
|
+
* await client.inboxes.webhooks.updateHeaders("inbox_id", "webhook_id", {})
|
|
431
|
+
*/
|
|
432
|
+
updateHeaders(inbox_id, webhook_id, request, requestOptions) {
|
|
433
|
+
return core.HttpResponsePromise.fromPromise(this.__updateHeaders(inbox_id, webhook_id, request, requestOptions));
|
|
434
|
+
}
|
|
435
|
+
__updateHeaders(inbox_id, webhook_id, request, requestOptions) {
|
|
436
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
437
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
438
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
439
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
440
|
+
const _response = yield core.fetcher({
|
|
441
|
+
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Prod)
|
|
442
|
+
.http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/webhooks/${core.url.encodePathParam(serializers.webhooks.WebhookId.jsonOrThrow(webhook_id, { omitUndefined: true }))}/headers`),
|
|
443
|
+
method: "PATCH",
|
|
444
|
+
headers: _headers,
|
|
445
|
+
contentType: "application/json",
|
|
446
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
447
|
+
requestType: "json",
|
|
448
|
+
body: serializers.webhooks.UpdateWebhookHeadersRequest.jsonOrThrow(request, {
|
|
449
|
+
unrecognizedObjectKeys: "strip",
|
|
450
|
+
omitUndefined: true,
|
|
451
|
+
}),
|
|
452
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
453
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
454
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
455
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
456
|
+
logging: this._options.logging,
|
|
457
|
+
});
|
|
458
|
+
if (_response.ok) {
|
|
459
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
460
|
+
}
|
|
461
|
+
if (_response.error.reason === "status-code") {
|
|
462
|
+
switch (_response.error.statusCode) {
|
|
463
|
+
case 404:
|
|
464
|
+
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
465
|
+
unrecognizedObjectKeys: "passthrough",
|
|
466
|
+
allowUnrecognizedUnionMembers: true,
|
|
467
|
+
allowUnrecognizedEnumValues: true,
|
|
468
|
+
skipValidation: true,
|
|
469
|
+
breadcrumbsPrefix: ["response"],
|
|
470
|
+
}), _response.rawResponse);
|
|
471
|
+
case 400:
|
|
472
|
+
throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
|
|
473
|
+
unrecognizedObjectKeys: "passthrough",
|
|
474
|
+
allowUnrecognizedUnionMembers: true,
|
|
475
|
+
allowUnrecognizedEnumValues: true,
|
|
476
|
+
skipValidation: true,
|
|
477
|
+
breadcrumbsPrefix: ["response"],
|
|
478
|
+
}), _response.rawResponse);
|
|
479
|
+
default:
|
|
480
|
+
throw new errors.AgentMailError({
|
|
481
|
+
statusCode: _response.error.statusCode,
|
|
482
|
+
body: _response.error.body,
|
|
483
|
+
rawResponse: _response.rawResponse,
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PATCH", "/v0/inboxes/{inbox_id}/webhooks/{webhook_id}/headers");
|
|
488
|
+
});
|
|
489
|
+
}
|
|
351
490
|
/**
|
|
352
491
|
* **CLI:**
|
|
353
492
|
* ```bash
|
|
@@ -42,6 +42,21 @@ export declare class WebhooksClient {
|
|
|
42
42
|
*/
|
|
43
43
|
get(pod_id: AgentMail.pods.PodId, webhook_id: AgentMail.webhooks.WebhookId, requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<AgentMail.webhooks.Webhook>;
|
|
44
44
|
private __get;
|
|
45
|
+
/**
|
|
46
|
+
* List the names of custom HTTP headers included with deliveries to this pod-scoped webhook.
|
|
47
|
+
* Header values are write-only and are never returned.
|
|
48
|
+
*
|
|
49
|
+
* @param {AgentMail.pods.PodId} pod_id
|
|
50
|
+
* @param {AgentMail.webhooks.WebhookId} webhook_id
|
|
51
|
+
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
52
|
+
*
|
|
53
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* await client.pods.webhooks.getHeaders("pod_id", "webhook_id")
|
|
57
|
+
*/
|
|
58
|
+
getHeaders(pod_id: AgentMail.pods.PodId, webhook_id: AgentMail.webhooks.WebhookId, requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<AgentMail.webhooks.WebhookHeaderNamesResponse>;
|
|
59
|
+
private __getHeaders;
|
|
45
60
|
/**
|
|
46
61
|
* Create a webhook scoped to this pod.
|
|
47
62
|
*
|
|
@@ -83,6 +98,23 @@ export declare class WebhooksClient {
|
|
|
83
98
|
*/
|
|
84
99
|
update(pod_id: AgentMail.pods.PodId, webhook_id: AgentMail.webhooks.WebhookId, request: AgentMail.webhooks.UpdatePodWebhookRequest, requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<AgentMail.webhooks.Webhook>;
|
|
85
100
|
private __update;
|
|
101
|
+
/**
|
|
102
|
+
* Atomically set, replace, or remove custom HTTP headers included with deliveries to this
|
|
103
|
+
* pod-scoped webhook. Header values remain write-only.
|
|
104
|
+
*
|
|
105
|
+
* @param {AgentMail.pods.PodId} pod_id
|
|
106
|
+
* @param {AgentMail.webhooks.WebhookId} webhook_id
|
|
107
|
+
* @param {AgentMail.webhooks.UpdateWebhookHeadersRequest} request
|
|
108
|
+
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
109
|
+
*
|
|
110
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
111
|
+
* @throws {@link AgentMail.ValidationError}
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* await client.pods.webhooks.updateHeaders("pod_id", "webhook_id", {})
|
|
115
|
+
*/
|
|
116
|
+
updateHeaders(pod_id: AgentMail.pods.PodId, webhook_id: AgentMail.webhooks.WebhookId, request: AgentMail.webhooks.UpdateWebhookHeadersRequest, requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<void>;
|
|
117
|
+
private __updateHeaders;
|
|
86
118
|
/**
|
|
87
119
|
* **CLI:**
|
|
88
120
|
* ```bash
|
|
@@ -185,6 +185,72 @@ class WebhooksClient {
|
|
|
185
185
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v0/pods/{pod_id}/webhooks/{webhook_id}");
|
|
186
186
|
});
|
|
187
187
|
}
|
|
188
|
+
/**
|
|
189
|
+
* List the names of custom HTTP headers included with deliveries to this pod-scoped webhook.
|
|
190
|
+
* Header values are write-only and are never returned.
|
|
191
|
+
*
|
|
192
|
+
* @param {AgentMail.pods.PodId} pod_id
|
|
193
|
+
* @param {AgentMail.webhooks.WebhookId} webhook_id
|
|
194
|
+
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
195
|
+
*
|
|
196
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
197
|
+
*
|
|
198
|
+
* @example
|
|
199
|
+
* await client.pods.webhooks.getHeaders("pod_id", "webhook_id")
|
|
200
|
+
*/
|
|
201
|
+
getHeaders(pod_id, webhook_id, requestOptions) {
|
|
202
|
+
return core.HttpResponsePromise.fromPromise(this.__getHeaders(pod_id, webhook_id, requestOptions));
|
|
203
|
+
}
|
|
204
|
+
__getHeaders(pod_id, webhook_id, requestOptions) {
|
|
205
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
206
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
207
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
208
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
209
|
+
const _response = yield core.fetcher({
|
|
210
|
+
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Prod)
|
|
211
|
+
.http, `/v0/pods/${core.url.encodePathParam(serializers.pods.PodId.jsonOrThrow(pod_id, { omitUndefined: true }))}/webhooks/${core.url.encodePathParam(serializers.webhooks.WebhookId.jsonOrThrow(webhook_id, { omitUndefined: true }))}/headers`),
|
|
212
|
+
method: "GET",
|
|
213
|
+
headers: _headers,
|
|
214
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
215
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
216
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
217
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
218
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
219
|
+
logging: this._options.logging,
|
|
220
|
+
});
|
|
221
|
+
if (_response.ok) {
|
|
222
|
+
return {
|
|
223
|
+
data: serializers.webhooks.WebhookHeaderNamesResponse.parseOrThrow(_response.body, {
|
|
224
|
+
unrecognizedObjectKeys: "passthrough",
|
|
225
|
+
allowUnrecognizedUnionMembers: true,
|
|
226
|
+
allowUnrecognizedEnumValues: true,
|
|
227
|
+
skipValidation: true,
|
|
228
|
+
breadcrumbsPrefix: ["response"],
|
|
229
|
+
}),
|
|
230
|
+
rawResponse: _response.rawResponse,
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
if (_response.error.reason === "status-code") {
|
|
234
|
+
switch (_response.error.statusCode) {
|
|
235
|
+
case 404:
|
|
236
|
+
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
237
|
+
unrecognizedObjectKeys: "passthrough",
|
|
238
|
+
allowUnrecognizedUnionMembers: true,
|
|
239
|
+
allowUnrecognizedEnumValues: true,
|
|
240
|
+
skipValidation: true,
|
|
241
|
+
breadcrumbsPrefix: ["response"],
|
|
242
|
+
}), _response.rawResponse);
|
|
243
|
+
default:
|
|
244
|
+
throw new errors.AgentMailError({
|
|
245
|
+
statusCode: _response.error.statusCode,
|
|
246
|
+
body: _response.error.body,
|
|
247
|
+
rawResponse: _response.rawResponse,
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v0/pods/{pod_id}/webhooks/{webhook_id}/headers");
|
|
252
|
+
});
|
|
253
|
+
}
|
|
188
254
|
/**
|
|
189
255
|
* Create a webhook scoped to this pod.
|
|
190
256
|
*
|
|
@@ -348,6 +414,79 @@ class WebhooksClient {
|
|
|
348
414
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PATCH", "/v0/pods/{pod_id}/webhooks/{webhook_id}");
|
|
349
415
|
});
|
|
350
416
|
}
|
|
417
|
+
/**
|
|
418
|
+
* Atomically set, replace, or remove custom HTTP headers included with deliveries to this
|
|
419
|
+
* pod-scoped webhook. Header values remain write-only.
|
|
420
|
+
*
|
|
421
|
+
* @param {AgentMail.pods.PodId} pod_id
|
|
422
|
+
* @param {AgentMail.webhooks.WebhookId} webhook_id
|
|
423
|
+
* @param {AgentMail.webhooks.UpdateWebhookHeadersRequest} request
|
|
424
|
+
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
425
|
+
*
|
|
426
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
427
|
+
* @throws {@link AgentMail.ValidationError}
|
|
428
|
+
*
|
|
429
|
+
* @example
|
|
430
|
+
* await client.pods.webhooks.updateHeaders("pod_id", "webhook_id", {})
|
|
431
|
+
*/
|
|
432
|
+
updateHeaders(pod_id, webhook_id, request, requestOptions) {
|
|
433
|
+
return core.HttpResponsePromise.fromPromise(this.__updateHeaders(pod_id, webhook_id, request, requestOptions));
|
|
434
|
+
}
|
|
435
|
+
__updateHeaders(pod_id, webhook_id, request, requestOptions) {
|
|
436
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
437
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
438
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
439
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
440
|
+
const _response = yield core.fetcher({
|
|
441
|
+
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Prod)
|
|
442
|
+
.http, `/v0/pods/${core.url.encodePathParam(serializers.pods.PodId.jsonOrThrow(pod_id, { omitUndefined: true }))}/webhooks/${core.url.encodePathParam(serializers.webhooks.WebhookId.jsonOrThrow(webhook_id, { omitUndefined: true }))}/headers`),
|
|
443
|
+
method: "PATCH",
|
|
444
|
+
headers: _headers,
|
|
445
|
+
contentType: "application/json",
|
|
446
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
447
|
+
requestType: "json",
|
|
448
|
+
body: serializers.webhooks.UpdateWebhookHeadersRequest.jsonOrThrow(request, {
|
|
449
|
+
unrecognizedObjectKeys: "strip",
|
|
450
|
+
omitUndefined: true,
|
|
451
|
+
}),
|
|
452
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
453
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
454
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
455
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
456
|
+
logging: this._options.logging,
|
|
457
|
+
});
|
|
458
|
+
if (_response.ok) {
|
|
459
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
460
|
+
}
|
|
461
|
+
if (_response.error.reason === "status-code") {
|
|
462
|
+
switch (_response.error.statusCode) {
|
|
463
|
+
case 404:
|
|
464
|
+
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
465
|
+
unrecognizedObjectKeys: "passthrough",
|
|
466
|
+
allowUnrecognizedUnionMembers: true,
|
|
467
|
+
allowUnrecognizedEnumValues: true,
|
|
468
|
+
skipValidation: true,
|
|
469
|
+
breadcrumbsPrefix: ["response"],
|
|
470
|
+
}), _response.rawResponse);
|
|
471
|
+
case 400:
|
|
472
|
+
throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
|
|
473
|
+
unrecognizedObjectKeys: "passthrough",
|
|
474
|
+
allowUnrecognizedUnionMembers: true,
|
|
475
|
+
allowUnrecognizedEnumValues: true,
|
|
476
|
+
skipValidation: true,
|
|
477
|
+
breadcrumbsPrefix: ["response"],
|
|
478
|
+
}), _response.rawResponse);
|
|
479
|
+
default:
|
|
480
|
+
throw new errors.AgentMailError({
|
|
481
|
+
statusCode: _response.error.statusCode,
|
|
482
|
+
body: _response.error.body,
|
|
483
|
+
rawResponse: _response.rawResponse,
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PATCH", "/v0/pods/{pod_id}/webhooks/{webhook_id}/headers");
|
|
488
|
+
});
|
|
489
|
+
}
|
|
351
490
|
/**
|
|
352
491
|
* **CLI:**
|
|
353
492
|
* ```bash
|
|
@@ -40,6 +40,20 @@ export declare class WebhooksClient {
|
|
|
40
40
|
*/
|
|
41
41
|
get(webhook_id: AgentMail.webhooks.WebhookId, requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<AgentMail.webhooks.Webhook>;
|
|
42
42
|
private __get;
|
|
43
|
+
/**
|
|
44
|
+
* List the names of custom HTTP headers included with deliveries to this webhook. Header values are
|
|
45
|
+
* write-only and are never returned.
|
|
46
|
+
*
|
|
47
|
+
* @param {AgentMail.webhooks.WebhookId} webhook_id
|
|
48
|
+
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
49
|
+
*
|
|
50
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* await client.webhooks.getHeaders("webhook_id")
|
|
54
|
+
*/
|
|
55
|
+
getHeaders(webhook_id: AgentMail.webhooks.WebhookId, requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<AgentMail.webhooks.WebhookHeaderNamesResponse>;
|
|
56
|
+
private __getHeaders;
|
|
43
57
|
/**
|
|
44
58
|
* **CLI:**
|
|
45
59
|
* ```bash
|
|
@@ -80,6 +94,22 @@ export declare class WebhooksClient {
|
|
|
80
94
|
*/
|
|
81
95
|
update(webhook_id: AgentMail.webhooks.WebhookId, request: AgentMail.webhooks.UpdateWebhookRequest, requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<AgentMail.webhooks.Webhook>;
|
|
82
96
|
private __update;
|
|
97
|
+
/**
|
|
98
|
+
* Atomically set, replace, or remove custom HTTP headers included with deliveries to this webhook.
|
|
99
|
+
* Header values remain write-only.
|
|
100
|
+
*
|
|
101
|
+
* @param {AgentMail.webhooks.WebhookId} webhook_id
|
|
102
|
+
* @param {AgentMail.webhooks.UpdateWebhookHeadersRequest} request
|
|
103
|
+
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
104
|
+
*
|
|
105
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
106
|
+
* @throws {@link AgentMail.ValidationError}
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* await client.webhooks.updateHeaders("webhook_id", {})
|
|
110
|
+
*/
|
|
111
|
+
updateHeaders(webhook_id: AgentMail.webhooks.WebhookId, request: AgentMail.webhooks.UpdateWebhookHeadersRequest, requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<void>;
|
|
112
|
+
private __updateHeaders;
|
|
83
113
|
/**
|
|
84
114
|
* **CLI:**
|
|
85
115
|
* ```bash
|
|
@@ -183,6 +183,71 @@ class WebhooksClient {
|
|
|
183
183
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v0/webhooks/{webhook_id}");
|
|
184
184
|
});
|
|
185
185
|
}
|
|
186
|
+
/**
|
|
187
|
+
* List the names of custom HTTP headers included with deliveries to this webhook. Header values are
|
|
188
|
+
* write-only and are never returned.
|
|
189
|
+
*
|
|
190
|
+
* @param {AgentMail.webhooks.WebhookId} webhook_id
|
|
191
|
+
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
192
|
+
*
|
|
193
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
194
|
+
*
|
|
195
|
+
* @example
|
|
196
|
+
* await client.webhooks.getHeaders("webhook_id")
|
|
197
|
+
*/
|
|
198
|
+
getHeaders(webhook_id, requestOptions) {
|
|
199
|
+
return core.HttpResponsePromise.fromPromise(this.__getHeaders(webhook_id, requestOptions));
|
|
200
|
+
}
|
|
201
|
+
__getHeaders(webhook_id, requestOptions) {
|
|
202
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
203
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
204
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
205
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
206
|
+
const _response = yield core.fetcher({
|
|
207
|
+
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Prod)
|
|
208
|
+
.http, `/v0/webhooks/${core.url.encodePathParam(serializers.webhooks.WebhookId.jsonOrThrow(webhook_id, { omitUndefined: true }))}/headers`),
|
|
209
|
+
method: "GET",
|
|
210
|
+
headers: _headers,
|
|
211
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
212
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
213
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
214
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
215
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
216
|
+
logging: this._options.logging,
|
|
217
|
+
});
|
|
218
|
+
if (_response.ok) {
|
|
219
|
+
return {
|
|
220
|
+
data: serializers.webhooks.WebhookHeaderNamesResponse.parseOrThrow(_response.body, {
|
|
221
|
+
unrecognizedObjectKeys: "passthrough",
|
|
222
|
+
allowUnrecognizedUnionMembers: true,
|
|
223
|
+
allowUnrecognizedEnumValues: true,
|
|
224
|
+
skipValidation: true,
|
|
225
|
+
breadcrumbsPrefix: ["response"],
|
|
226
|
+
}),
|
|
227
|
+
rawResponse: _response.rawResponse,
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
if (_response.error.reason === "status-code") {
|
|
231
|
+
switch (_response.error.statusCode) {
|
|
232
|
+
case 404:
|
|
233
|
+
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
234
|
+
unrecognizedObjectKeys: "passthrough",
|
|
235
|
+
allowUnrecognizedUnionMembers: true,
|
|
236
|
+
allowUnrecognizedEnumValues: true,
|
|
237
|
+
skipValidation: true,
|
|
238
|
+
breadcrumbsPrefix: ["response"],
|
|
239
|
+
}), _response.rawResponse);
|
|
240
|
+
default:
|
|
241
|
+
throw new errors.AgentMailError({
|
|
242
|
+
statusCode: _response.error.statusCode,
|
|
243
|
+
body: _response.error.body,
|
|
244
|
+
rawResponse: _response.rawResponse,
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v0/webhooks/{webhook_id}/headers");
|
|
249
|
+
});
|
|
250
|
+
}
|
|
186
251
|
/**
|
|
187
252
|
* **CLI:**
|
|
188
253
|
* ```bash
|
|
@@ -345,6 +410,78 @@ class WebhooksClient {
|
|
|
345
410
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PATCH", "/v0/webhooks/{webhook_id}");
|
|
346
411
|
});
|
|
347
412
|
}
|
|
413
|
+
/**
|
|
414
|
+
* Atomically set, replace, or remove custom HTTP headers included with deliveries to this webhook.
|
|
415
|
+
* Header values remain write-only.
|
|
416
|
+
*
|
|
417
|
+
* @param {AgentMail.webhooks.WebhookId} webhook_id
|
|
418
|
+
* @param {AgentMail.webhooks.UpdateWebhookHeadersRequest} request
|
|
419
|
+
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
420
|
+
*
|
|
421
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
422
|
+
* @throws {@link AgentMail.ValidationError}
|
|
423
|
+
*
|
|
424
|
+
* @example
|
|
425
|
+
* await client.webhooks.updateHeaders("webhook_id", {})
|
|
426
|
+
*/
|
|
427
|
+
updateHeaders(webhook_id, request, requestOptions) {
|
|
428
|
+
return core.HttpResponsePromise.fromPromise(this.__updateHeaders(webhook_id, request, requestOptions));
|
|
429
|
+
}
|
|
430
|
+
__updateHeaders(webhook_id, request, requestOptions) {
|
|
431
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
432
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
433
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
434
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
435
|
+
const _response = yield core.fetcher({
|
|
436
|
+
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Prod)
|
|
437
|
+
.http, `/v0/webhooks/${core.url.encodePathParam(serializers.webhooks.WebhookId.jsonOrThrow(webhook_id, { omitUndefined: true }))}/headers`),
|
|
438
|
+
method: "PATCH",
|
|
439
|
+
headers: _headers,
|
|
440
|
+
contentType: "application/json",
|
|
441
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
442
|
+
requestType: "json",
|
|
443
|
+
body: serializers.webhooks.UpdateWebhookHeadersRequest.jsonOrThrow(request, {
|
|
444
|
+
unrecognizedObjectKeys: "strip",
|
|
445
|
+
omitUndefined: true,
|
|
446
|
+
}),
|
|
447
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
448
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
449
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
450
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
451
|
+
logging: this._options.logging,
|
|
452
|
+
});
|
|
453
|
+
if (_response.ok) {
|
|
454
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
455
|
+
}
|
|
456
|
+
if (_response.error.reason === "status-code") {
|
|
457
|
+
switch (_response.error.statusCode) {
|
|
458
|
+
case 404:
|
|
459
|
+
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
460
|
+
unrecognizedObjectKeys: "passthrough",
|
|
461
|
+
allowUnrecognizedUnionMembers: true,
|
|
462
|
+
allowUnrecognizedEnumValues: true,
|
|
463
|
+
skipValidation: true,
|
|
464
|
+
breadcrumbsPrefix: ["response"],
|
|
465
|
+
}), _response.rawResponse);
|
|
466
|
+
case 400:
|
|
467
|
+
throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
|
|
468
|
+
unrecognizedObjectKeys: "passthrough",
|
|
469
|
+
allowUnrecognizedUnionMembers: true,
|
|
470
|
+
allowUnrecognizedEnumValues: true,
|
|
471
|
+
skipValidation: true,
|
|
472
|
+
breadcrumbsPrefix: ["response"],
|
|
473
|
+
}), _response.rawResponse);
|
|
474
|
+
default:
|
|
475
|
+
throw new errors.AgentMailError({
|
|
476
|
+
statusCode: _response.error.statusCode,
|
|
477
|
+
body: _response.error.body,
|
|
478
|
+
rawResponse: _response.rawResponse,
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PATCH", "/v0/webhooks/{webhook_id}/headers");
|
|
483
|
+
});
|
|
484
|
+
}
|
|
348
485
|
/**
|
|
349
486
|
* **CLI:**
|
|
350
487
|
* ```bash
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type * as AgentMail from "../../../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Set, replace, or remove custom delivery headers. Provide at least one of `headers` or
|
|
4
|
+
* `remove_headers`. A header cannot be set and removed in the same request, regardless of casing.
|
|
5
|
+
*/
|
|
6
|
+
export interface UpdateWebhookHeadersRequest {
|
|
7
|
+
headers?: AgentMail.webhooks.WebhookHeaders;
|
|
8
|
+
/** Names of custom delivery headers to remove. */
|
|
9
|
+
removeHeaders?: string[];
|
|
10
|
+
}
|