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
|
@@ -149,6 +149,72 @@ export class WebhooksClient {
|
|
|
149
149
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v0/pods/{pod_id}/webhooks/{webhook_id}");
|
|
150
150
|
});
|
|
151
151
|
}
|
|
152
|
+
/**
|
|
153
|
+
* List the names of custom HTTP headers included with deliveries to this pod-scoped webhook.
|
|
154
|
+
* Header values are write-only and are never returned.
|
|
155
|
+
*
|
|
156
|
+
* @param {AgentMail.pods.PodId} pod_id
|
|
157
|
+
* @param {AgentMail.webhooks.WebhookId} webhook_id
|
|
158
|
+
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
159
|
+
*
|
|
160
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
161
|
+
*
|
|
162
|
+
* @example
|
|
163
|
+
* await client.pods.webhooks.getHeaders("pod_id", "webhook_id")
|
|
164
|
+
*/
|
|
165
|
+
getHeaders(pod_id, webhook_id, requestOptions) {
|
|
166
|
+
return core.HttpResponsePromise.fromPromise(this.__getHeaders(pod_id, webhook_id, requestOptions));
|
|
167
|
+
}
|
|
168
|
+
__getHeaders(pod_id, webhook_id, requestOptions) {
|
|
169
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
170
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
171
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
172
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
173
|
+
const _response = yield core.fetcher({
|
|
174
|
+
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)
|
|
175
|
+
.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`),
|
|
176
|
+
method: "GET",
|
|
177
|
+
headers: _headers,
|
|
178
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
179
|
+
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,
|
|
180
|
+
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,
|
|
181
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
182
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
183
|
+
logging: this._options.logging,
|
|
184
|
+
});
|
|
185
|
+
if (_response.ok) {
|
|
186
|
+
return {
|
|
187
|
+
data: serializers.webhooks.WebhookHeaderNamesResponse.parseOrThrow(_response.body, {
|
|
188
|
+
unrecognizedObjectKeys: "passthrough",
|
|
189
|
+
allowUnrecognizedUnionMembers: true,
|
|
190
|
+
allowUnrecognizedEnumValues: true,
|
|
191
|
+
skipValidation: true,
|
|
192
|
+
breadcrumbsPrefix: ["response"],
|
|
193
|
+
}),
|
|
194
|
+
rawResponse: _response.rawResponse,
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
if (_response.error.reason === "status-code") {
|
|
198
|
+
switch (_response.error.statusCode) {
|
|
199
|
+
case 404:
|
|
200
|
+
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
201
|
+
unrecognizedObjectKeys: "passthrough",
|
|
202
|
+
allowUnrecognizedUnionMembers: true,
|
|
203
|
+
allowUnrecognizedEnumValues: true,
|
|
204
|
+
skipValidation: true,
|
|
205
|
+
breadcrumbsPrefix: ["response"],
|
|
206
|
+
}), _response.rawResponse);
|
|
207
|
+
default:
|
|
208
|
+
throw new errors.AgentMailError({
|
|
209
|
+
statusCode: _response.error.statusCode,
|
|
210
|
+
body: _response.error.body,
|
|
211
|
+
rawResponse: _response.rawResponse,
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v0/pods/{pod_id}/webhooks/{webhook_id}/headers");
|
|
216
|
+
});
|
|
217
|
+
}
|
|
152
218
|
/**
|
|
153
219
|
* Create a webhook scoped to this pod.
|
|
154
220
|
*
|
|
@@ -312,6 +378,79 @@ export class WebhooksClient {
|
|
|
312
378
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PATCH", "/v0/pods/{pod_id}/webhooks/{webhook_id}");
|
|
313
379
|
});
|
|
314
380
|
}
|
|
381
|
+
/**
|
|
382
|
+
* Atomically set, replace, or remove custom HTTP headers included with deliveries to this
|
|
383
|
+
* pod-scoped webhook. Header values remain write-only.
|
|
384
|
+
*
|
|
385
|
+
* @param {AgentMail.pods.PodId} pod_id
|
|
386
|
+
* @param {AgentMail.webhooks.WebhookId} webhook_id
|
|
387
|
+
* @param {AgentMail.webhooks.UpdateWebhookHeadersRequest} request
|
|
388
|
+
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
389
|
+
*
|
|
390
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
391
|
+
* @throws {@link AgentMail.ValidationError}
|
|
392
|
+
*
|
|
393
|
+
* @example
|
|
394
|
+
* await client.pods.webhooks.updateHeaders("pod_id", "webhook_id", {})
|
|
395
|
+
*/
|
|
396
|
+
updateHeaders(pod_id, webhook_id, request, requestOptions) {
|
|
397
|
+
return core.HttpResponsePromise.fromPromise(this.__updateHeaders(pod_id, webhook_id, request, requestOptions));
|
|
398
|
+
}
|
|
399
|
+
__updateHeaders(pod_id, webhook_id, request, requestOptions) {
|
|
400
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
401
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
402
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
403
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
404
|
+
const _response = yield core.fetcher({
|
|
405
|
+
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)
|
|
406
|
+
.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`),
|
|
407
|
+
method: "PATCH",
|
|
408
|
+
headers: _headers,
|
|
409
|
+
contentType: "application/json",
|
|
410
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
411
|
+
requestType: "json",
|
|
412
|
+
body: serializers.webhooks.UpdateWebhookHeadersRequest.jsonOrThrow(request, {
|
|
413
|
+
unrecognizedObjectKeys: "strip",
|
|
414
|
+
omitUndefined: true,
|
|
415
|
+
}),
|
|
416
|
+
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,
|
|
417
|
+
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,
|
|
418
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
419
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
420
|
+
logging: this._options.logging,
|
|
421
|
+
});
|
|
422
|
+
if (_response.ok) {
|
|
423
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
424
|
+
}
|
|
425
|
+
if (_response.error.reason === "status-code") {
|
|
426
|
+
switch (_response.error.statusCode) {
|
|
427
|
+
case 404:
|
|
428
|
+
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
429
|
+
unrecognizedObjectKeys: "passthrough",
|
|
430
|
+
allowUnrecognizedUnionMembers: true,
|
|
431
|
+
allowUnrecognizedEnumValues: true,
|
|
432
|
+
skipValidation: true,
|
|
433
|
+
breadcrumbsPrefix: ["response"],
|
|
434
|
+
}), _response.rawResponse);
|
|
435
|
+
case 400:
|
|
436
|
+
throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
|
|
437
|
+
unrecognizedObjectKeys: "passthrough",
|
|
438
|
+
allowUnrecognizedUnionMembers: true,
|
|
439
|
+
allowUnrecognizedEnumValues: true,
|
|
440
|
+
skipValidation: true,
|
|
441
|
+
breadcrumbsPrefix: ["response"],
|
|
442
|
+
}), _response.rawResponse);
|
|
443
|
+
default:
|
|
444
|
+
throw new errors.AgentMailError({
|
|
445
|
+
statusCode: _response.error.statusCode,
|
|
446
|
+
body: _response.error.body,
|
|
447
|
+
rawResponse: _response.rawResponse,
|
|
448
|
+
});
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PATCH", "/v0/pods/{pod_id}/webhooks/{webhook_id}/headers");
|
|
452
|
+
});
|
|
453
|
+
}
|
|
315
454
|
/**
|
|
316
455
|
* **CLI:**
|
|
317
456
|
* ```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
|
|
@@ -147,6 +147,71 @@ export class WebhooksClient {
|
|
|
147
147
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v0/webhooks/{webhook_id}");
|
|
148
148
|
});
|
|
149
149
|
}
|
|
150
|
+
/**
|
|
151
|
+
* List the names of custom HTTP headers included with deliveries to this webhook. Header values are
|
|
152
|
+
* write-only and are never returned.
|
|
153
|
+
*
|
|
154
|
+
* @param {AgentMail.webhooks.WebhookId} webhook_id
|
|
155
|
+
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
156
|
+
*
|
|
157
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* await client.webhooks.getHeaders("webhook_id")
|
|
161
|
+
*/
|
|
162
|
+
getHeaders(webhook_id, requestOptions) {
|
|
163
|
+
return core.HttpResponsePromise.fromPromise(this.__getHeaders(webhook_id, requestOptions));
|
|
164
|
+
}
|
|
165
|
+
__getHeaders(webhook_id, requestOptions) {
|
|
166
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
167
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
168
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
169
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
170
|
+
const _response = yield core.fetcher({
|
|
171
|
+
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)
|
|
172
|
+
.http, `/v0/webhooks/${core.url.encodePathParam(serializers.webhooks.WebhookId.jsonOrThrow(webhook_id, { omitUndefined: true }))}/headers`),
|
|
173
|
+
method: "GET",
|
|
174
|
+
headers: _headers,
|
|
175
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
176
|
+
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,
|
|
177
|
+
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,
|
|
178
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
179
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
180
|
+
logging: this._options.logging,
|
|
181
|
+
});
|
|
182
|
+
if (_response.ok) {
|
|
183
|
+
return {
|
|
184
|
+
data: serializers.webhooks.WebhookHeaderNamesResponse.parseOrThrow(_response.body, {
|
|
185
|
+
unrecognizedObjectKeys: "passthrough",
|
|
186
|
+
allowUnrecognizedUnionMembers: true,
|
|
187
|
+
allowUnrecognizedEnumValues: true,
|
|
188
|
+
skipValidation: true,
|
|
189
|
+
breadcrumbsPrefix: ["response"],
|
|
190
|
+
}),
|
|
191
|
+
rawResponse: _response.rawResponse,
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
if (_response.error.reason === "status-code") {
|
|
195
|
+
switch (_response.error.statusCode) {
|
|
196
|
+
case 404:
|
|
197
|
+
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
198
|
+
unrecognizedObjectKeys: "passthrough",
|
|
199
|
+
allowUnrecognizedUnionMembers: true,
|
|
200
|
+
allowUnrecognizedEnumValues: true,
|
|
201
|
+
skipValidation: true,
|
|
202
|
+
breadcrumbsPrefix: ["response"],
|
|
203
|
+
}), _response.rawResponse);
|
|
204
|
+
default:
|
|
205
|
+
throw new errors.AgentMailError({
|
|
206
|
+
statusCode: _response.error.statusCode,
|
|
207
|
+
body: _response.error.body,
|
|
208
|
+
rawResponse: _response.rawResponse,
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v0/webhooks/{webhook_id}/headers");
|
|
213
|
+
});
|
|
214
|
+
}
|
|
150
215
|
/**
|
|
151
216
|
* **CLI:**
|
|
152
217
|
* ```bash
|
|
@@ -309,6 +374,78 @@ export class WebhooksClient {
|
|
|
309
374
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PATCH", "/v0/webhooks/{webhook_id}");
|
|
310
375
|
});
|
|
311
376
|
}
|
|
377
|
+
/**
|
|
378
|
+
* Atomically set, replace, or remove custom HTTP headers included with deliveries to this webhook.
|
|
379
|
+
* Header values remain write-only.
|
|
380
|
+
*
|
|
381
|
+
* @param {AgentMail.webhooks.WebhookId} webhook_id
|
|
382
|
+
* @param {AgentMail.webhooks.UpdateWebhookHeadersRequest} request
|
|
383
|
+
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
384
|
+
*
|
|
385
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
386
|
+
* @throws {@link AgentMail.ValidationError}
|
|
387
|
+
*
|
|
388
|
+
* @example
|
|
389
|
+
* await client.webhooks.updateHeaders("webhook_id", {})
|
|
390
|
+
*/
|
|
391
|
+
updateHeaders(webhook_id, request, requestOptions) {
|
|
392
|
+
return core.HttpResponsePromise.fromPromise(this.__updateHeaders(webhook_id, request, requestOptions));
|
|
393
|
+
}
|
|
394
|
+
__updateHeaders(webhook_id, request, requestOptions) {
|
|
395
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
396
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
397
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
398
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
399
|
+
const _response = yield core.fetcher({
|
|
400
|
+
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)
|
|
401
|
+
.http, `/v0/webhooks/${core.url.encodePathParam(serializers.webhooks.WebhookId.jsonOrThrow(webhook_id, { omitUndefined: true }))}/headers`),
|
|
402
|
+
method: "PATCH",
|
|
403
|
+
headers: _headers,
|
|
404
|
+
contentType: "application/json",
|
|
405
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
406
|
+
requestType: "json",
|
|
407
|
+
body: serializers.webhooks.UpdateWebhookHeadersRequest.jsonOrThrow(request, {
|
|
408
|
+
unrecognizedObjectKeys: "strip",
|
|
409
|
+
omitUndefined: true,
|
|
410
|
+
}),
|
|
411
|
+
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,
|
|
412
|
+
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,
|
|
413
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
414
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
415
|
+
logging: this._options.logging,
|
|
416
|
+
});
|
|
417
|
+
if (_response.ok) {
|
|
418
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
419
|
+
}
|
|
420
|
+
if (_response.error.reason === "status-code") {
|
|
421
|
+
switch (_response.error.statusCode) {
|
|
422
|
+
case 404:
|
|
423
|
+
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
424
|
+
unrecognizedObjectKeys: "passthrough",
|
|
425
|
+
allowUnrecognizedUnionMembers: true,
|
|
426
|
+
allowUnrecognizedEnumValues: true,
|
|
427
|
+
skipValidation: true,
|
|
428
|
+
breadcrumbsPrefix: ["response"],
|
|
429
|
+
}), _response.rawResponse);
|
|
430
|
+
case 400:
|
|
431
|
+
throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
|
|
432
|
+
unrecognizedObjectKeys: "passthrough",
|
|
433
|
+
allowUnrecognizedUnionMembers: true,
|
|
434
|
+
allowUnrecognizedEnumValues: true,
|
|
435
|
+
skipValidation: true,
|
|
436
|
+
breadcrumbsPrefix: ["response"],
|
|
437
|
+
}), _response.rawResponse);
|
|
438
|
+
default:
|
|
439
|
+
throw new errors.AgentMailError({
|
|
440
|
+
statusCode: _response.error.statusCode,
|
|
441
|
+
body: _response.error.body,
|
|
442
|
+
rawResponse: _response.rawResponse,
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PATCH", "/v0/webhooks/{webhook_id}/headers");
|
|
447
|
+
});
|
|
448
|
+
}
|
|
312
449
|
/**
|
|
313
450
|
* **CLI:**
|
|
314
451
|
* ```bash
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type * as AgentMail from "../../../index.mjs";
|
|
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
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom HTTP headers to include with every delivery to this webhook. Header values are write-only:
|
|
3
|
+
* AgentMail never returns them from webhook read endpoints. The map must contain at least one entry
|
|
4
|
+
* when provided, and every name and value must be a valid HTTP header.
|
|
5
|
+
*/
|
|
6
|
+
export type WebhookHeaders = Record<string, string>;
|
|
@@ -7,7 +7,10 @@ export * from "./ListWebhooksResponse.mjs";
|
|
|
7
7
|
export * from "./UpdateInboxWebhookRequest.mjs";
|
|
8
8
|
export * from "./UpdatePodWebhookRequest.mjs";
|
|
9
9
|
export * from "./UpdateWebhookEventTypes.mjs";
|
|
10
|
+
export * from "./UpdateWebhookHeadersRequest.mjs";
|
|
10
11
|
export * from "./UpdateWebhookRequest.mjs";
|
|
11
12
|
export * from "./Url.mjs";
|
|
12
13
|
export * from "./Webhook.mjs";
|
|
14
|
+
export * from "./WebhookHeaderNamesResponse.mjs";
|
|
15
|
+
export * from "./WebhookHeaders.mjs";
|
|
13
16
|
export * from "./WebhookId.mjs";
|
|
@@ -7,7 +7,10 @@ export * from "./ListWebhooksResponse.mjs";
|
|
|
7
7
|
export * from "./UpdateInboxWebhookRequest.mjs";
|
|
8
8
|
export * from "./UpdatePodWebhookRequest.mjs";
|
|
9
9
|
export * from "./UpdateWebhookEventTypes.mjs";
|
|
10
|
+
export * from "./UpdateWebhookHeadersRequest.mjs";
|
|
10
11
|
export * from "./UpdateWebhookRequest.mjs";
|
|
11
12
|
export * from "./Url.mjs";
|
|
12
13
|
export * from "./Webhook.mjs";
|
|
14
|
+
export * from "./WebhookHeaderNamesResponse.mjs";
|
|
15
|
+
export * from "./WebhookHeaders.mjs";
|
|
13
16
|
export * from "./WebhookId.mjs";
|
|
@@ -8,13 +8,13 @@ export declare namespace ApiKeyPermissions {
|
|
|
8
8
|
inbox_create?: boolean | null;
|
|
9
9
|
inbox_update?: boolean | null;
|
|
10
10
|
inbox_delete?: boolean | null;
|
|
11
|
-
thread_read?: boolean | null;
|
|
12
|
-
thread_delete?: boolean | null;
|
|
13
11
|
message_read?: boolean | null;
|
|
14
12
|
message_send?: boolean | null;
|
|
15
13
|
message_update?: boolean | null;
|
|
14
|
+
message_delete?: boolean | null;
|
|
16
15
|
label_spam_read?: boolean | null;
|
|
17
16
|
label_blocked_read?: boolean | null;
|
|
17
|
+
label_unauthenticated_read?: boolean | null;
|
|
18
18
|
label_trash_read?: boolean | null;
|
|
19
19
|
draft_read?: boolean | null;
|
|
20
20
|
draft_create?: boolean | null;
|
|
@@ -5,13 +5,13 @@ export const ApiKeyPermissions = core.serialization.object({
|
|
|
5
5
|
inboxCreate: core.serialization.property("inbox_create", core.serialization.boolean().optional()),
|
|
6
6
|
inboxUpdate: core.serialization.property("inbox_update", core.serialization.boolean().optional()),
|
|
7
7
|
inboxDelete: core.serialization.property("inbox_delete", core.serialization.boolean().optional()),
|
|
8
|
-
threadRead: core.serialization.property("thread_read", core.serialization.boolean().optional()),
|
|
9
|
-
threadDelete: core.serialization.property("thread_delete", core.serialization.boolean().optional()),
|
|
10
8
|
messageRead: core.serialization.property("message_read", core.serialization.boolean().optional()),
|
|
11
9
|
messageSend: core.serialization.property("message_send", core.serialization.boolean().optional()),
|
|
12
10
|
messageUpdate: core.serialization.property("message_update", core.serialization.boolean().optional()),
|
|
11
|
+
messageDelete: core.serialization.property("message_delete", core.serialization.boolean().optional()),
|
|
13
12
|
labelSpamRead: core.serialization.property("label_spam_read", core.serialization.boolean().optional()),
|
|
14
13
|
labelBlockedRead: core.serialization.property("label_blocked_read", core.serialization.boolean().optional()),
|
|
14
|
+
labelUnauthenticatedRead: core.serialization.property("label_unauthenticated_read", core.serialization.boolean().optional()),
|
|
15
15
|
labelTrashRead: core.serialization.property("label_trash_read", core.serialization.boolean().optional()),
|
|
16
16
|
draftRead: core.serialization.property("draft_read", core.serialization.boolean().optional()),
|
|
17
17
|
draftCreate: core.serialization.property("draft_create", core.serialization.boolean().optional()),
|
|
@@ -4,11 +4,13 @@ import type * as serializers from "../../../index.mjs";
|
|
|
4
4
|
import { ClientId } from "./ClientId.mjs";
|
|
5
5
|
import { CreateWebhookEventTypes } from "./CreateWebhookEventTypes.mjs";
|
|
6
6
|
import { Url } from "./Url.mjs";
|
|
7
|
+
import { WebhookHeaders } from "./WebhookHeaders.mjs";
|
|
7
8
|
export declare const CreateInboxWebhookRequest: core.serialization.ObjectSchema<serializers.webhooks.CreateInboxWebhookRequest.Raw, AgentMail.webhooks.CreateInboxWebhookRequest>;
|
|
8
9
|
export declare namespace CreateInboxWebhookRequest {
|
|
9
10
|
interface Raw {
|
|
10
11
|
url: Url.Raw;
|
|
11
12
|
event_types: CreateWebhookEventTypes.Raw;
|
|
12
13
|
client_id?: ClientId.Raw | null;
|
|
14
|
+
headers?: WebhookHeaders.Raw | null;
|
|
13
15
|
}
|
|
14
16
|
}
|
|
@@ -3,8 +3,10 @@ import * as core from "../../../../core/index.mjs";
|
|
|
3
3
|
import { ClientId } from "./ClientId.mjs";
|
|
4
4
|
import { CreateWebhookEventTypes } from "./CreateWebhookEventTypes.mjs";
|
|
5
5
|
import { Url } from "./Url.mjs";
|
|
6
|
+
import { WebhookHeaders } from "./WebhookHeaders.mjs";
|
|
6
7
|
export const CreateInboxWebhookRequest = core.serialization.object({
|
|
7
8
|
url: Url,
|
|
8
9
|
eventTypes: core.serialization.property("event_types", CreateWebhookEventTypes),
|
|
9
10
|
clientId: core.serialization.property("client_id", ClientId.optional()),
|
|
11
|
+
headers: WebhookHeaders.optional(),
|
|
10
12
|
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type * as AgentMail from "../../../../api/index.mjs";
|
|
2
|
+
import * as core from "../../../../core/index.mjs";
|
|
3
|
+
import type * as serializers from "../../../index.mjs";
|
|
4
|
+
import { WebhookHeaders } from "./WebhookHeaders.mjs";
|
|
5
|
+
export declare const UpdateWebhookHeadersRequest: core.serialization.ObjectSchema<serializers.webhooks.UpdateWebhookHeadersRequest.Raw, AgentMail.webhooks.UpdateWebhookHeadersRequest>;
|
|
6
|
+
export declare namespace UpdateWebhookHeadersRequest {
|
|
7
|
+
interface Raw {
|
|
8
|
+
headers?: WebhookHeaders.Raw | null;
|
|
9
|
+
remove_headers?: string[] | null;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
import * as core from "../../../../core/index.mjs";
|
|
3
|
+
import { WebhookHeaders } from "./WebhookHeaders.mjs";
|
|
4
|
+
export const UpdateWebhookHeadersRequest = core.serialization.object({
|
|
5
|
+
headers: WebhookHeaders.optional(),
|
|
6
|
+
removeHeaders: core.serialization.property("remove_headers", core.serialization.list(core.serialization.string()).optional()),
|
|
7
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type * as AgentMail from "../../../../api/index.mjs";
|
|
2
|
+
import * as core from "../../../../core/index.mjs";
|
|
3
|
+
import type * as serializers from "../../../index.mjs";
|
|
4
|
+
export declare const WebhookHeaderNamesResponse: core.serialization.ObjectSchema<serializers.webhooks.WebhookHeaderNamesResponse.Raw, AgentMail.webhooks.WebhookHeaderNamesResponse>;
|
|
5
|
+
export declare namespace WebhookHeaderNamesResponse {
|
|
6
|
+
interface Raw {
|
|
7
|
+
header_names: string[];
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
import * as core from "../../../../core/index.mjs";
|
|
3
|
+
export const WebhookHeaderNamesResponse = core.serialization.object({
|
|
4
|
+
headerNames: core.serialization.property("header_names", core.serialization.list(core.serialization.string())),
|
|
5
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type * as AgentMail from "../../../../api/index.mjs";
|
|
2
|
+
import * as core from "../../../../core/index.mjs";
|
|
3
|
+
import type * as serializers from "../../../index.mjs";
|
|
4
|
+
export declare const WebhookHeaders: core.serialization.Schema<serializers.webhooks.WebhookHeaders.Raw, AgentMail.webhooks.WebhookHeaders>;
|
|
5
|
+
export declare namespace WebhookHeaders {
|
|
6
|
+
type Raw = Record<string, string>;
|
|
7
|
+
}
|
|
@@ -7,7 +7,10 @@ export * from "./ListWebhooksResponse.mjs";
|
|
|
7
7
|
export * from "./UpdateInboxWebhookRequest.mjs";
|
|
8
8
|
export * from "./UpdatePodWebhookRequest.mjs";
|
|
9
9
|
export * from "./UpdateWebhookEventTypes.mjs";
|
|
10
|
+
export * from "./UpdateWebhookHeadersRequest.mjs";
|
|
10
11
|
export * from "./UpdateWebhookRequest.mjs";
|
|
11
12
|
export * from "./Url.mjs";
|
|
12
13
|
export * from "./Webhook.mjs";
|
|
14
|
+
export * from "./WebhookHeaderNamesResponse.mjs";
|
|
15
|
+
export * from "./WebhookHeaders.mjs";
|
|
13
16
|
export * from "./WebhookId.mjs";
|
|
@@ -7,7 +7,10 @@ export * from "./ListWebhooksResponse.mjs";
|
|
|
7
7
|
export * from "./UpdateInboxWebhookRequest.mjs";
|
|
8
8
|
export * from "./UpdatePodWebhookRequest.mjs";
|
|
9
9
|
export * from "./UpdateWebhookEventTypes.mjs";
|
|
10
|
+
export * from "./UpdateWebhookHeadersRequest.mjs";
|
|
10
11
|
export * from "./UpdateWebhookRequest.mjs";
|
|
11
12
|
export * from "./Url.mjs";
|
|
12
13
|
export * from "./Webhook.mjs";
|
|
14
|
+
export * from "./WebhookHeaderNamesResponse.mjs";
|
|
15
|
+
export * from "./WebhookHeaders.mjs";
|
|
13
16
|
export * from "./WebhookId.mjs";
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.5.
|
|
1
|
+
export declare const SDK_VERSION = "0.5.19";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.5.
|
|
1
|
+
export const SDK_VERSION = "0.5.19";
|