agentmail 0.5.18 → 0.5.20

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 (172) hide show
  1. package/LICENSE +21 -0
  2. package/dist/cjs/BaseClient.js +2 -2
  3. package/dist/cjs/api/resources/domains/types/CreateDomainRequest.d.ts +1 -0
  4. package/dist/cjs/api/resources/domains/types/Domain.d.ts +1 -0
  5. package/dist/cjs/api/resources/domains/types/DomainItem.d.ts +1 -0
  6. package/dist/cjs/api/resources/domains/types/TrackingEnabled.d.ts +6 -0
  7. package/dist/cjs/api/resources/domains/types/TrackingEnabled.js +3 -0
  8. package/dist/cjs/api/resources/domains/types/UpdateDomainRequest.d.ts +3 -1
  9. package/dist/cjs/api/resources/domains/types/index.d.ts +1 -0
  10. package/dist/cjs/api/resources/domains/types/index.js +1 -0
  11. package/dist/cjs/api/resources/events/types/EventType.d.ts +1 -0
  12. package/dist/cjs/api/resources/events/types/EventType.js +1 -0
  13. package/dist/cjs/api/resources/events/types/MessageOpenedEvent.d.ts +11 -0
  14. package/dist/cjs/api/resources/events/types/MessageOpenedEvent.js +3 -0
  15. package/dist/cjs/api/resources/events/types/Open.d.ts +7 -0
  16. package/dist/cjs/api/resources/events/types/Open.js +3 -0
  17. package/dist/cjs/api/resources/events/types/index.d.ts +2 -0
  18. package/dist/cjs/api/resources/events/types/index.js +2 -0
  19. package/dist/cjs/api/resources/inboxes/resources/webhooks/client/Client.d.ts +32 -0
  20. package/dist/cjs/api/resources/inboxes/resources/webhooks/client/Client.js +139 -0
  21. package/dist/cjs/api/resources/messages/types/ReplyAllMessageRequest.d.ts +1 -0
  22. package/dist/cjs/api/resources/messages/types/ReplyToMessageRequest.d.ts +1 -0
  23. package/dist/cjs/api/resources/messages/types/SendMessageRequest.d.ts +1 -0
  24. package/dist/cjs/api/resources/messages/types/TrackOpens.d.ts +7 -0
  25. package/dist/cjs/api/resources/messages/types/TrackOpens.js +3 -0
  26. package/dist/cjs/api/resources/messages/types/index.d.ts +1 -0
  27. package/dist/cjs/api/resources/messages/types/index.js +1 -0
  28. package/dist/cjs/api/resources/pods/resources/webhooks/client/Client.d.ts +32 -0
  29. package/dist/cjs/api/resources/pods/resources/webhooks/client/Client.js +139 -0
  30. package/dist/cjs/api/resources/webhooks/client/Client.d.ts +30 -0
  31. package/dist/cjs/api/resources/webhooks/client/Client.js +137 -0
  32. package/dist/cjs/api/resources/webhooks/types/CreateInboxWebhookRequest.d.ts +1 -0
  33. package/dist/cjs/api/resources/webhooks/types/UpdateWebhookHeadersRequest.d.ts +10 -0
  34. package/dist/cjs/api/resources/webhooks/types/UpdateWebhookHeadersRequest.js +3 -0
  35. package/dist/cjs/api/resources/webhooks/types/WebhookHeaderNamesResponse.d.ts +4 -0
  36. package/dist/cjs/api/resources/webhooks/types/WebhookHeaderNamesResponse.js +3 -0
  37. package/dist/cjs/api/resources/webhooks/types/WebhookHeaders.d.ts +6 -0
  38. package/dist/cjs/api/resources/webhooks/types/WebhookHeaders.js +3 -0
  39. package/dist/cjs/api/resources/webhooks/types/index.d.ts +3 -0
  40. package/dist/cjs/api/resources/webhooks/types/index.js +3 -0
  41. package/dist/cjs/api/resources/websockets/client/Socket.d.ts +1 -1
  42. package/dist/cjs/serialization/resources/domains/types/CreateDomainRequest.d.ts +2 -0
  43. package/dist/cjs/serialization/resources/domains/types/CreateDomainRequest.js +2 -0
  44. package/dist/cjs/serialization/resources/domains/types/Domain.d.ts +2 -0
  45. package/dist/cjs/serialization/resources/domains/types/Domain.js +2 -0
  46. package/dist/cjs/serialization/resources/domains/types/DomainItem.d.ts +2 -0
  47. package/dist/cjs/serialization/resources/domains/types/DomainItem.js +2 -0
  48. package/dist/cjs/serialization/resources/domains/types/TrackingEnabled.d.ts +7 -0
  49. package/dist/cjs/serialization/resources/domains/types/TrackingEnabled.js +39 -0
  50. package/dist/cjs/serialization/resources/domains/types/UpdateDomainRequest.d.ts +2 -0
  51. package/dist/cjs/serialization/resources/domains/types/UpdateDomainRequest.js +2 -0
  52. package/dist/cjs/serialization/resources/domains/types/index.d.ts +1 -0
  53. package/dist/cjs/serialization/resources/domains/types/index.js +1 -0
  54. package/dist/cjs/serialization/resources/events/types/EventType.d.ts +1 -1
  55. package/dist/cjs/serialization/resources/events/types/EventType.js +1 -0
  56. package/dist/cjs/serialization/resources/events/types/MessageOpenedEvent.d.ts +14 -0
  57. package/dist/cjs/serialization/resources/events/types/MessageOpenedEvent.js +46 -0
  58. package/dist/cjs/serialization/resources/events/types/Open.d.ts +16 -0
  59. package/dist/cjs/serialization/resources/events/types/Open.js +48 -0
  60. package/dist/cjs/serialization/resources/events/types/index.d.ts +2 -0
  61. package/dist/cjs/serialization/resources/events/types/index.js +2 -0
  62. package/dist/cjs/serialization/resources/messages/types/ReplyAllMessageRequest.d.ts +2 -0
  63. package/dist/cjs/serialization/resources/messages/types/ReplyAllMessageRequest.js +2 -0
  64. package/dist/cjs/serialization/resources/messages/types/ReplyToMessageRequest.d.ts +2 -0
  65. package/dist/cjs/serialization/resources/messages/types/ReplyToMessageRequest.js +2 -0
  66. package/dist/cjs/serialization/resources/messages/types/SendMessageRequest.d.ts +2 -0
  67. package/dist/cjs/serialization/resources/messages/types/SendMessageRequest.js +2 -0
  68. package/dist/cjs/serialization/resources/messages/types/TrackOpens.d.ts +7 -0
  69. package/dist/cjs/serialization/resources/messages/types/TrackOpens.js +39 -0
  70. package/dist/cjs/serialization/resources/messages/types/index.d.ts +1 -0
  71. package/dist/cjs/serialization/resources/messages/types/index.js +1 -0
  72. package/dist/cjs/serialization/resources/webhooks/types/CreateInboxWebhookRequest.d.ts +2 -0
  73. package/dist/cjs/serialization/resources/webhooks/types/CreateInboxWebhookRequest.js +2 -0
  74. package/dist/cjs/serialization/resources/webhooks/types/UpdateWebhookHeadersRequest.d.ts +11 -0
  75. package/dist/cjs/serialization/resources/webhooks/types/UpdateWebhookHeadersRequest.js +43 -0
  76. package/dist/cjs/serialization/resources/webhooks/types/WebhookHeaderNamesResponse.d.ts +9 -0
  77. package/dist/cjs/serialization/resources/webhooks/types/WebhookHeaderNamesResponse.js +41 -0
  78. package/dist/cjs/serialization/resources/webhooks/types/WebhookHeaders.d.ts +7 -0
  79. package/dist/cjs/serialization/resources/webhooks/types/WebhookHeaders.js +39 -0
  80. package/dist/cjs/serialization/resources/webhooks/types/index.d.ts +3 -0
  81. package/dist/cjs/serialization/resources/webhooks/types/index.js +3 -0
  82. package/dist/cjs/serialization/resources/websockets/client/socket/WebsocketsSocketResponse.d.ts +3 -2
  83. package/dist/cjs/serialization/resources/websockets/client/socket/WebsocketsSocketResponse.js +2 -0
  84. package/dist/cjs/version.d.ts +1 -1
  85. package/dist/cjs/version.js +1 -1
  86. package/dist/esm/BaseClient.mjs +2 -2
  87. package/dist/esm/api/resources/domains/types/CreateDomainRequest.d.mts +1 -0
  88. package/dist/esm/api/resources/domains/types/Domain.d.mts +1 -0
  89. package/dist/esm/api/resources/domains/types/DomainItem.d.mts +1 -0
  90. package/dist/esm/api/resources/domains/types/TrackingEnabled.d.mts +6 -0
  91. package/dist/esm/api/resources/domains/types/TrackingEnabled.mjs +2 -0
  92. package/dist/esm/api/resources/domains/types/UpdateDomainRequest.d.mts +3 -1
  93. package/dist/esm/api/resources/domains/types/index.d.mts +1 -0
  94. package/dist/esm/api/resources/domains/types/index.mjs +1 -0
  95. package/dist/esm/api/resources/events/types/EventType.d.mts +1 -0
  96. package/dist/esm/api/resources/events/types/EventType.mjs +1 -0
  97. package/dist/esm/api/resources/events/types/MessageOpenedEvent.d.mts +11 -0
  98. package/dist/esm/api/resources/events/types/MessageOpenedEvent.mjs +2 -0
  99. package/dist/esm/api/resources/events/types/Open.d.mts +7 -0
  100. package/dist/esm/api/resources/events/types/Open.mjs +2 -0
  101. package/dist/esm/api/resources/events/types/index.d.mts +2 -0
  102. package/dist/esm/api/resources/events/types/index.mjs +2 -0
  103. package/dist/esm/api/resources/inboxes/resources/webhooks/client/Client.d.mts +32 -0
  104. package/dist/esm/api/resources/inboxes/resources/webhooks/client/Client.mjs +139 -0
  105. package/dist/esm/api/resources/messages/types/ReplyAllMessageRequest.d.mts +1 -0
  106. package/dist/esm/api/resources/messages/types/ReplyToMessageRequest.d.mts +1 -0
  107. package/dist/esm/api/resources/messages/types/SendMessageRequest.d.mts +1 -0
  108. package/dist/esm/api/resources/messages/types/TrackOpens.d.mts +7 -0
  109. package/dist/esm/api/resources/messages/types/TrackOpens.mjs +2 -0
  110. package/dist/esm/api/resources/messages/types/index.d.mts +1 -0
  111. package/dist/esm/api/resources/messages/types/index.mjs +1 -0
  112. package/dist/esm/api/resources/pods/resources/webhooks/client/Client.d.mts +32 -0
  113. package/dist/esm/api/resources/pods/resources/webhooks/client/Client.mjs +139 -0
  114. package/dist/esm/api/resources/webhooks/client/Client.d.mts +30 -0
  115. package/dist/esm/api/resources/webhooks/client/Client.mjs +137 -0
  116. package/dist/esm/api/resources/webhooks/types/CreateInboxWebhookRequest.d.mts +1 -0
  117. package/dist/esm/api/resources/webhooks/types/UpdateWebhookHeadersRequest.d.mts +10 -0
  118. package/dist/esm/api/resources/webhooks/types/UpdateWebhookHeadersRequest.mjs +2 -0
  119. package/dist/esm/api/resources/webhooks/types/WebhookHeaderNamesResponse.d.mts +4 -0
  120. package/dist/esm/api/resources/webhooks/types/WebhookHeaderNamesResponse.mjs +2 -0
  121. package/dist/esm/api/resources/webhooks/types/WebhookHeaders.d.mts +6 -0
  122. package/dist/esm/api/resources/webhooks/types/WebhookHeaders.mjs +2 -0
  123. package/dist/esm/api/resources/webhooks/types/index.d.mts +3 -0
  124. package/dist/esm/api/resources/webhooks/types/index.mjs +3 -0
  125. package/dist/esm/api/resources/websockets/client/Socket.d.mts +1 -1
  126. package/dist/esm/serialization/resources/domains/types/CreateDomainRequest.d.mts +2 -0
  127. package/dist/esm/serialization/resources/domains/types/CreateDomainRequest.mjs +2 -0
  128. package/dist/esm/serialization/resources/domains/types/Domain.d.mts +2 -0
  129. package/dist/esm/serialization/resources/domains/types/Domain.mjs +2 -0
  130. package/dist/esm/serialization/resources/domains/types/DomainItem.d.mts +2 -0
  131. package/dist/esm/serialization/resources/domains/types/DomainItem.mjs +2 -0
  132. package/dist/esm/serialization/resources/domains/types/TrackingEnabled.d.mts +7 -0
  133. package/dist/esm/serialization/resources/domains/types/TrackingEnabled.mjs +3 -0
  134. package/dist/esm/serialization/resources/domains/types/UpdateDomainRequest.d.mts +2 -0
  135. package/dist/esm/serialization/resources/domains/types/UpdateDomainRequest.mjs +2 -0
  136. package/dist/esm/serialization/resources/domains/types/index.d.mts +1 -0
  137. package/dist/esm/serialization/resources/domains/types/index.mjs +1 -0
  138. package/dist/esm/serialization/resources/events/types/EventType.d.mts +1 -1
  139. package/dist/esm/serialization/resources/events/types/EventType.mjs +1 -0
  140. package/dist/esm/serialization/resources/events/types/MessageOpenedEvent.d.mts +14 -0
  141. package/dist/esm/serialization/resources/events/types/MessageOpenedEvent.mjs +10 -0
  142. package/dist/esm/serialization/resources/events/types/Open.d.mts +16 -0
  143. package/dist/esm/serialization/resources/events/types/Open.mjs +12 -0
  144. package/dist/esm/serialization/resources/events/types/index.d.mts +2 -0
  145. package/dist/esm/serialization/resources/events/types/index.mjs +2 -0
  146. package/dist/esm/serialization/resources/messages/types/ReplyAllMessageRequest.d.mts +2 -0
  147. package/dist/esm/serialization/resources/messages/types/ReplyAllMessageRequest.mjs +2 -0
  148. package/dist/esm/serialization/resources/messages/types/ReplyToMessageRequest.d.mts +2 -0
  149. package/dist/esm/serialization/resources/messages/types/ReplyToMessageRequest.mjs +2 -0
  150. package/dist/esm/serialization/resources/messages/types/SendMessageRequest.d.mts +2 -0
  151. package/dist/esm/serialization/resources/messages/types/SendMessageRequest.mjs +2 -0
  152. package/dist/esm/serialization/resources/messages/types/TrackOpens.d.mts +7 -0
  153. package/dist/esm/serialization/resources/messages/types/TrackOpens.mjs +3 -0
  154. package/dist/esm/serialization/resources/messages/types/index.d.mts +1 -0
  155. package/dist/esm/serialization/resources/messages/types/index.mjs +1 -0
  156. package/dist/esm/serialization/resources/webhooks/types/CreateInboxWebhookRequest.d.mts +2 -0
  157. package/dist/esm/serialization/resources/webhooks/types/CreateInboxWebhookRequest.mjs +2 -0
  158. package/dist/esm/serialization/resources/webhooks/types/UpdateWebhookHeadersRequest.d.mts +11 -0
  159. package/dist/esm/serialization/resources/webhooks/types/UpdateWebhookHeadersRequest.mjs +7 -0
  160. package/dist/esm/serialization/resources/webhooks/types/WebhookHeaderNamesResponse.d.mts +9 -0
  161. package/dist/esm/serialization/resources/webhooks/types/WebhookHeaderNamesResponse.mjs +5 -0
  162. package/dist/esm/serialization/resources/webhooks/types/WebhookHeaders.d.mts +7 -0
  163. package/dist/esm/serialization/resources/webhooks/types/WebhookHeaders.mjs +3 -0
  164. package/dist/esm/serialization/resources/webhooks/types/index.d.mts +3 -0
  165. package/dist/esm/serialization/resources/webhooks/types/index.mjs +3 -0
  166. package/dist/esm/serialization/resources/websockets/client/socket/WebsocketsSocketResponse.d.mts +3 -2
  167. package/dist/esm/serialization/resources/websockets/client/socket/WebsocketsSocketResponse.mjs +2 -0
  168. package/dist/esm/version.d.mts +1 -1
  169. package/dist/esm/version.mjs +1 -1
  170. package/dist/llms.txt +13 -0
  171. package/package.json +10 -2
  172. package/reference.md +440 -0
@@ -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
@@ -149,6 +149,72 @@ export class WebhooksClient {
149
149
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v0/inboxes/{inbox_id}/webhooks/{webhook_id}");
150
150
  });
151
151
  }
152
+ /**
153
+ * List the names of custom HTTP headers included with deliveries to this inbox-scoped webhook.
154
+ * Header values are write-only and are never returned.
155
+ *
156
+ * @param {AgentMail.inboxes.InboxId} inbox_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.inboxes.webhooks.getHeaders("inbox_id", "webhook_id")
164
+ */
165
+ getHeaders(inbox_id, webhook_id, requestOptions) {
166
+ return core.HttpResponsePromise.fromPromise(this.__getHeaders(inbox_id, webhook_id, requestOptions));
167
+ }
168
+ __getHeaders(inbox_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/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`),
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/inboxes/{inbox_id}/webhooks/{webhook_id}/headers");
216
+ });
217
+ }
152
218
  /**
153
219
  * Create a webhook scoped to this inbox.
154
220
  *
@@ -312,6 +378,79 @@ export class WebhooksClient {
312
378
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "PATCH", "/v0/inboxes/{inbox_id}/webhooks/{webhook_id}");
313
379
  });
314
380
  }
381
+ /**
382
+ * Atomically set, replace, or remove custom HTTP headers included with deliveries to this
383
+ * inbox-scoped webhook. Header values remain write-only.
384
+ *
385
+ * @param {AgentMail.inboxes.InboxId} inbox_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.inboxes.webhooks.updateHeaders("inbox_id", "webhook_id", {})
395
+ */
396
+ updateHeaders(inbox_id, webhook_id, request, requestOptions) {
397
+ return core.HttpResponsePromise.fromPromise(this.__updateHeaders(inbox_id, webhook_id, request, requestOptions));
398
+ }
399
+ __updateHeaders(inbox_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/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`),
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/inboxes/{inbox_id}/webhooks/{webhook_id}/headers");
452
+ });
453
+ }
315
454
  /**
316
455
  * **CLI:**
317
456
  * ```bash
@@ -6,4 +6,5 @@ export interface ReplyAllMessageRequest {
6
6
  html?: AgentMail.MessageHtml;
7
7
  attachments?: AgentMail.SendMessageAttachments;
8
8
  headers?: AgentMail.SendMessageHeaders;
9
+ trackOpens?: AgentMail.TrackOpens;
9
10
  }
@@ -10,4 +10,5 @@ export interface ReplyToMessageRequest {
10
10
  html?: AgentMail.MessageHtml;
11
11
  attachments?: AgentMail.SendMessageAttachments;
12
12
  headers?: AgentMail.SendMessageHeaders;
13
+ trackOpens?: AgentMail.TrackOpens;
13
14
  }
@@ -10,4 +10,5 @@ export interface SendMessageRequest {
10
10
  html?: AgentMail.MessageHtml;
11
11
  attachments?: AgentMail.SendMessageAttachments;
12
12
  headers?: AgentMail.SendMessageHeaders;
13
+ trackOpens?: AgentMail.TrackOpens;
13
14
  }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Track when this message is first opened. Requires a custom domain with tracking enabled and
3
+ * an HTML body. Opens surface as the `opened` label on the message and as a `message.opened`
4
+ * event. One pixel is injected per message, not per recipient, so a message with several
5
+ * recipients fires once when any of them opens it, and the event does not identify which one.
6
+ */
7
+ export type TrackOpens = boolean;
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -42,6 +42,7 @@ export * from "./SendMessageReplyTo.mjs";
42
42
  export * from "./SendMessageRequest.mjs";
43
43
  export * from "./SendMessageResponse.mjs";
44
44
  export * from "./SendMessageTo.mjs";
45
+ export * from "./TrackOpens.mjs";
45
46
  export * from "./UpdateMessageLabels.mjs";
46
47
  export * from "./UpdateMessageRequest.mjs";
47
48
  export * from "./UpdateMessageResponse.mjs";
@@ -42,6 +42,7 @@ export * from "./SendMessageReplyTo.mjs";
42
42
  export * from "./SendMessageRequest.mjs";
43
43
  export * from "./SendMessageResponse.mjs";
44
44
  export * from "./SendMessageTo.mjs";
45
+ export * from "./TrackOpens.mjs";
45
46
  export * from "./UpdateMessageLabels.mjs";
46
47
  export * from "./UpdateMessageRequest.mjs";
47
48
  export * from "./UpdateMessageResponse.mjs";
@@ -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
@@ -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