agentmail 0.5.18 → 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.
Files changed (58) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/api/resources/inboxes/resources/webhooks/client/Client.d.ts +32 -0
  3. package/dist/cjs/api/resources/inboxes/resources/webhooks/client/Client.js +139 -0
  4. package/dist/cjs/api/resources/pods/resources/webhooks/client/Client.d.ts +32 -0
  5. package/dist/cjs/api/resources/pods/resources/webhooks/client/Client.js +139 -0
  6. package/dist/cjs/api/resources/webhooks/client/Client.d.ts +30 -0
  7. package/dist/cjs/api/resources/webhooks/client/Client.js +137 -0
  8. package/dist/cjs/api/resources/webhooks/types/CreateInboxWebhookRequest.d.ts +1 -0
  9. package/dist/cjs/api/resources/webhooks/types/UpdateWebhookHeadersRequest.d.ts +10 -0
  10. package/dist/cjs/api/resources/webhooks/types/UpdateWebhookHeadersRequest.js +3 -0
  11. package/dist/cjs/api/resources/webhooks/types/WebhookHeaderNamesResponse.d.ts +4 -0
  12. package/dist/cjs/api/resources/webhooks/types/WebhookHeaderNamesResponse.js +3 -0
  13. package/dist/cjs/api/resources/webhooks/types/WebhookHeaders.d.ts +6 -0
  14. package/dist/cjs/api/resources/webhooks/types/WebhookHeaders.js +3 -0
  15. package/dist/cjs/api/resources/webhooks/types/index.d.ts +3 -0
  16. package/dist/cjs/api/resources/webhooks/types/index.js +3 -0
  17. package/dist/cjs/serialization/resources/webhooks/types/CreateInboxWebhookRequest.d.ts +2 -0
  18. package/dist/cjs/serialization/resources/webhooks/types/CreateInboxWebhookRequest.js +2 -0
  19. package/dist/cjs/serialization/resources/webhooks/types/UpdateWebhookHeadersRequest.d.ts +11 -0
  20. package/dist/cjs/serialization/resources/webhooks/types/UpdateWebhookHeadersRequest.js +43 -0
  21. package/dist/cjs/serialization/resources/webhooks/types/WebhookHeaderNamesResponse.d.ts +9 -0
  22. package/dist/cjs/serialization/resources/webhooks/types/WebhookHeaderNamesResponse.js +41 -0
  23. package/dist/cjs/serialization/resources/webhooks/types/WebhookHeaders.d.ts +7 -0
  24. package/dist/cjs/serialization/resources/webhooks/types/WebhookHeaders.js +39 -0
  25. package/dist/cjs/serialization/resources/webhooks/types/index.d.ts +3 -0
  26. package/dist/cjs/serialization/resources/webhooks/types/index.js +3 -0
  27. package/dist/cjs/version.d.ts +1 -1
  28. package/dist/cjs/version.js +1 -1
  29. package/dist/esm/BaseClient.mjs +2 -2
  30. package/dist/esm/api/resources/inboxes/resources/webhooks/client/Client.d.mts +32 -0
  31. package/dist/esm/api/resources/inboxes/resources/webhooks/client/Client.mjs +139 -0
  32. package/dist/esm/api/resources/pods/resources/webhooks/client/Client.d.mts +32 -0
  33. package/dist/esm/api/resources/pods/resources/webhooks/client/Client.mjs +139 -0
  34. package/dist/esm/api/resources/webhooks/client/Client.d.mts +30 -0
  35. package/dist/esm/api/resources/webhooks/client/Client.mjs +137 -0
  36. package/dist/esm/api/resources/webhooks/types/CreateInboxWebhookRequest.d.mts +1 -0
  37. package/dist/esm/api/resources/webhooks/types/UpdateWebhookHeadersRequest.d.mts +10 -0
  38. package/dist/esm/api/resources/webhooks/types/UpdateWebhookHeadersRequest.mjs +2 -0
  39. package/dist/esm/api/resources/webhooks/types/WebhookHeaderNamesResponse.d.mts +4 -0
  40. package/dist/esm/api/resources/webhooks/types/WebhookHeaderNamesResponse.mjs +2 -0
  41. package/dist/esm/api/resources/webhooks/types/WebhookHeaders.d.mts +6 -0
  42. package/dist/esm/api/resources/webhooks/types/WebhookHeaders.mjs +2 -0
  43. package/dist/esm/api/resources/webhooks/types/index.d.mts +3 -0
  44. package/dist/esm/api/resources/webhooks/types/index.mjs +3 -0
  45. package/dist/esm/serialization/resources/webhooks/types/CreateInboxWebhookRequest.d.mts +2 -0
  46. package/dist/esm/serialization/resources/webhooks/types/CreateInboxWebhookRequest.mjs +2 -0
  47. package/dist/esm/serialization/resources/webhooks/types/UpdateWebhookHeadersRequest.d.mts +11 -0
  48. package/dist/esm/serialization/resources/webhooks/types/UpdateWebhookHeadersRequest.mjs +7 -0
  49. package/dist/esm/serialization/resources/webhooks/types/WebhookHeaderNamesResponse.d.mts +9 -0
  50. package/dist/esm/serialization/resources/webhooks/types/WebhookHeaderNamesResponse.mjs +5 -0
  51. package/dist/esm/serialization/resources/webhooks/types/WebhookHeaders.d.mts +7 -0
  52. package/dist/esm/serialization/resources/webhooks/types/WebhookHeaders.mjs +3 -0
  53. package/dist/esm/serialization/resources/webhooks/types/index.d.mts +3 -0
  54. package/dist/esm/serialization/resources/webhooks/types/index.mjs +3 -0
  55. package/dist/esm/version.d.mts +1 -1
  56. package/dist/esm/version.mjs +1 -1
  57. package/package.json +1 -1
  58. package/reference.md +440 -0
@@ -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.18",
47
- "User-Agent": "agentmail/0.5.18",
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);
@@ -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
@@ -7,4 +7,5 @@ export interface CreateInboxWebhookRequest {
7
7
  url: AgentMail.webhooks.Url;
8
8
  eventTypes: AgentMail.webhooks.CreateWebhookEventTypes;
9
9
  clientId?: AgentMail.webhooks.ClientId;
10
+ headers?: AgentMail.webhooks.WebhookHeaders;
10
11
  }
@@ -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
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ export interface WebhookHeaderNamesResponse {
2
+ /** Names of the custom delivery headers configured for this webhook. Header values are never returned. */
3
+ headerNames: string[];
4
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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>;