agentmail 0.5.12 → 0.5.14

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 (219) hide show
  1. package/dist/cjs/BaseClient.d.ts +3 -0
  2. package/dist/cjs/BaseClient.js +2 -2
  3. package/dist/cjs/api/errors/ConflictError.d.ts +6 -0
  4. package/dist/cjs/api/errors/ConflictError.js +54 -0
  5. package/dist/cjs/api/errors/index.d.ts +1 -0
  6. package/dist/cjs/api/errors/index.js +1 -0
  7. package/dist/cjs/api/resources/drafts/types/CreateDraftForwardRequest.d.ts +21 -0
  8. package/dist/cjs/api/resources/drafts/types/CreateDraftForwardRequest.js +3 -0
  9. package/dist/cjs/api/resources/drafts/types/CreateDraftReplyAllRequest.d.ts +17 -0
  10. package/dist/cjs/api/resources/drafts/types/CreateDraftReplyAllRequest.js +3 -0
  11. package/dist/cjs/api/resources/drafts/types/CreateDraftReplyRequest.d.ts +22 -0
  12. package/dist/cjs/api/resources/drafts/types/CreateDraftReplyRequest.js +3 -0
  13. package/dist/cjs/api/resources/drafts/types/Draft.d.ts +1 -0
  14. package/dist/cjs/api/resources/drafts/types/DraftForwardOf.d.ts +4 -0
  15. package/dist/cjs/api/resources/drafts/types/DraftForwardOf.js +3 -0
  16. package/dist/cjs/api/resources/drafts/types/DraftItem.d.ts +1 -0
  17. package/dist/cjs/api/resources/drafts/types/DraftReplyAll.d.ts +4 -0
  18. package/dist/cjs/api/resources/drafts/types/DraftReplyAll.js +3 -0
  19. package/dist/cjs/api/resources/drafts/types/index.d.ts +5 -0
  20. package/dist/cjs/api/resources/drafts/types/index.js +5 -0
  21. package/dist/cjs/api/resources/inboxes/client/Client.d.ts +3 -0
  22. package/dist/cjs/api/resources/inboxes/client/Client.js +5 -0
  23. package/dist/cjs/api/resources/inboxes/resources/drafts/client/Client.d.ts +6 -3
  24. package/dist/cjs/api/resources/inboxes/resources/drafts/client/Client.js +11 -2
  25. package/dist/cjs/api/resources/inboxes/resources/index.d.ts +2 -0
  26. package/dist/cjs/api/resources/inboxes/resources/index.js +3 -1
  27. package/dist/cjs/api/resources/inboxes/resources/messages/client/Client.d.ts +84 -9
  28. package/dist/cjs/api/resources/inboxes/resources/messages/client/Client.js +308 -8
  29. package/dist/cjs/api/resources/inboxes/resources/webhooks/client/Client.d.ts +103 -0
  30. package/dist/cjs/api/resources/inboxes/resources/webhooks/client/Client.js +411 -0
  31. package/dist/cjs/api/resources/inboxes/resources/webhooks/client/index.d.ts +1 -0
  32. package/dist/cjs/api/resources/inboxes/resources/webhooks/client/index.js +17 -0
  33. package/dist/cjs/api/resources/inboxes/resources/webhooks/client/requests/InboxListWebhooksRequest.d.ts +10 -0
  34. package/dist/cjs/api/resources/inboxes/resources/webhooks/client/requests/InboxListWebhooksRequest.js +3 -0
  35. package/dist/cjs/api/resources/inboxes/resources/webhooks/client/requests/index.d.ts +1 -0
  36. package/dist/cjs/api/resources/inboxes/resources/webhooks/client/requests/index.js +2 -0
  37. package/dist/cjs/api/resources/inboxes/resources/webhooks/exports.d.ts +2 -0
  38. package/dist/cjs/api/resources/inboxes/resources/webhooks/exports.js +21 -0
  39. package/dist/cjs/api/resources/inboxes/resources/webhooks/index.d.ts +1 -0
  40. package/dist/cjs/api/resources/inboxes/resources/webhooks/index.js +17 -0
  41. package/dist/cjs/api/resources/pods/client/Client.d.ts +3 -0
  42. package/dist/cjs/api/resources/pods/client/Client.js +5 -0
  43. package/dist/cjs/api/resources/pods/resources/index.d.ts +2 -0
  44. package/dist/cjs/api/resources/pods/resources/index.js +3 -1
  45. package/dist/cjs/api/resources/pods/resources/webhooks/client/Client.d.ts +103 -0
  46. package/dist/cjs/api/resources/pods/resources/webhooks/client/Client.js +411 -0
  47. package/dist/cjs/api/resources/pods/resources/webhooks/client/index.d.ts +1 -0
  48. package/dist/cjs/api/resources/pods/resources/webhooks/client/index.js +17 -0
  49. package/dist/cjs/api/resources/pods/resources/webhooks/client/requests/PodListWebhooksRequest.d.ts +10 -0
  50. package/dist/cjs/api/resources/pods/resources/webhooks/client/requests/PodListWebhooksRequest.js +3 -0
  51. package/dist/cjs/api/resources/pods/resources/webhooks/client/requests/index.d.ts +1 -0
  52. package/dist/cjs/api/resources/pods/resources/webhooks/client/requests/index.js +2 -0
  53. package/dist/cjs/api/resources/pods/resources/webhooks/exports.d.ts +2 -0
  54. package/dist/cjs/api/resources/pods/resources/webhooks/exports.js +21 -0
  55. package/dist/cjs/api/resources/pods/resources/webhooks/index.d.ts +1 -0
  56. package/dist/cjs/api/resources/pods/resources/webhooks/index.js +17 -0
  57. package/dist/cjs/api/resources/webhooks/types/CreateInboxWebhookRequest.d.ts +10 -0
  58. package/dist/cjs/api/resources/webhooks/types/CreateInboxWebhookRequest.js +3 -0
  59. package/dist/cjs/api/resources/webhooks/types/CreatePodWebhookRequest.d.ts +9 -0
  60. package/dist/cjs/api/resources/webhooks/types/CreatePodWebhookRequest.js +3 -0
  61. package/dist/cjs/api/resources/webhooks/types/CreateWebhookEventTypes.d.ts +7 -0
  62. package/dist/cjs/api/resources/webhooks/types/CreateWebhookEventTypes.js +3 -0
  63. package/dist/cjs/api/resources/webhooks/types/CreateWebhookRequest.d.ts +1 -10
  64. package/dist/cjs/api/resources/webhooks/types/UpdateInboxWebhookRequest.d.ts +7 -0
  65. package/dist/cjs/api/resources/webhooks/types/UpdateInboxWebhookRequest.js +3 -0
  66. package/dist/cjs/api/resources/webhooks/types/UpdatePodWebhookRequest.d.ts +11 -0
  67. package/dist/cjs/api/resources/webhooks/types/UpdatePodWebhookRequest.js +3 -0
  68. package/dist/cjs/api/resources/webhooks/types/UpdateWebhookEventTypes.d.ts +10 -0
  69. package/dist/cjs/api/resources/webhooks/types/UpdateWebhookEventTypes.js +3 -0
  70. package/dist/cjs/api/resources/webhooks/types/UpdateWebhookRequest.d.ts +1 -14
  71. package/dist/cjs/api/resources/webhooks/types/index.d.ts +6 -0
  72. package/dist/cjs/api/resources/webhooks/types/index.js +6 -0
  73. package/dist/cjs/serialization/resources/drafts/types/CreateDraftForwardRequest.d.ts +30 -0
  74. package/dist/cjs/serialization/resources/drafts/types/CreateDraftForwardRequest.js +62 -0
  75. package/dist/cjs/serialization/resources/drafts/types/CreateDraftReplyAllRequest.d.ts +24 -0
  76. package/dist/cjs/serialization/resources/drafts/types/CreateDraftReplyAllRequest.js +56 -0
  77. package/dist/cjs/serialization/resources/drafts/types/CreateDraftReplyRequest.d.ts +32 -0
  78. package/dist/cjs/serialization/resources/drafts/types/CreateDraftReplyRequest.js +64 -0
  79. package/dist/cjs/serialization/resources/drafts/types/Draft.d.ts +2 -0
  80. package/dist/cjs/serialization/resources/drafts/types/Draft.js +2 -0
  81. package/dist/cjs/serialization/resources/drafts/types/DraftForwardOf.d.ts +7 -0
  82. package/dist/cjs/serialization/resources/drafts/types/DraftForwardOf.js +39 -0
  83. package/dist/cjs/serialization/resources/drafts/types/DraftItem.d.ts +2 -0
  84. package/dist/cjs/serialization/resources/drafts/types/DraftItem.js +2 -0
  85. package/dist/cjs/serialization/resources/drafts/types/DraftReplyAll.d.ts +7 -0
  86. package/dist/cjs/serialization/resources/drafts/types/DraftReplyAll.js +39 -0
  87. package/dist/cjs/serialization/resources/drafts/types/index.d.ts +5 -0
  88. package/dist/cjs/serialization/resources/drafts/types/index.js +5 -0
  89. package/dist/cjs/serialization/resources/webhooks/types/CreateInboxWebhookRequest.d.ts +14 -0
  90. package/dist/cjs/serialization/resources/webhooks/types/CreateInboxWebhookRequest.js +46 -0
  91. package/dist/cjs/serialization/resources/webhooks/types/CreatePodWebhookRequest.d.ts +11 -0
  92. package/dist/cjs/serialization/resources/webhooks/types/CreatePodWebhookRequest.js +45 -0
  93. package/dist/cjs/serialization/resources/webhooks/types/CreateWebhookEventTypes.d.ts +8 -0
  94. package/dist/cjs/serialization/resources/webhooks/types/CreateWebhookEventTypes.js +6 -0
  95. package/dist/cjs/serialization/resources/webhooks/types/CreateWebhookRequest.d.ts +2 -9
  96. package/dist/cjs/serialization/resources/webhooks/types/CreateWebhookRequest.js +5 -10
  97. package/dist/cjs/serialization/resources/webhooks/types/UpdateInboxWebhookRequest.d.ts +10 -0
  98. package/dist/cjs/serialization/resources/webhooks/types/UpdateInboxWebhookRequest.js +42 -0
  99. package/dist/cjs/serialization/resources/webhooks/types/UpdatePodWebhookRequest.d.ts +12 -0
  100. package/dist/cjs/serialization/resources/webhooks/types/UpdatePodWebhookRequest.js +46 -0
  101. package/dist/cjs/serialization/resources/webhooks/types/UpdateWebhookEventTypes.d.ts +8 -0
  102. package/dist/cjs/serialization/resources/webhooks/types/UpdateWebhookEventTypes.js +6 -0
  103. package/dist/cjs/serialization/resources/webhooks/types/UpdateWebhookRequest.d.ts +2 -6
  104. package/dist/cjs/serialization/resources/webhooks/types/UpdateWebhookRequest.js +5 -7
  105. package/dist/cjs/serialization/resources/webhooks/types/index.d.ts +6 -0
  106. package/dist/cjs/serialization/resources/webhooks/types/index.js +6 -0
  107. package/dist/cjs/version.d.ts +1 -1
  108. package/dist/cjs/version.js +1 -1
  109. package/dist/esm/BaseClient.d.mts +3 -0
  110. package/dist/esm/BaseClient.mjs +2 -2
  111. package/dist/esm/api/errors/ConflictError.d.mts +6 -0
  112. package/dist/esm/api/errors/ConflictError.mjs +17 -0
  113. package/dist/esm/api/errors/index.d.mts +1 -0
  114. package/dist/esm/api/errors/index.mjs +1 -0
  115. package/dist/esm/api/resources/drafts/types/CreateDraftForwardRequest.d.mts +21 -0
  116. package/dist/esm/api/resources/drafts/types/CreateDraftForwardRequest.mjs +2 -0
  117. package/dist/esm/api/resources/drafts/types/CreateDraftReplyAllRequest.d.mts +17 -0
  118. package/dist/esm/api/resources/drafts/types/CreateDraftReplyAllRequest.mjs +2 -0
  119. package/dist/esm/api/resources/drafts/types/CreateDraftReplyRequest.d.mts +22 -0
  120. package/dist/esm/api/resources/drafts/types/CreateDraftReplyRequest.mjs +2 -0
  121. package/dist/esm/api/resources/drafts/types/Draft.d.mts +1 -0
  122. package/dist/esm/api/resources/drafts/types/DraftForwardOf.d.mts +4 -0
  123. package/dist/esm/api/resources/drafts/types/DraftForwardOf.mjs +2 -0
  124. package/dist/esm/api/resources/drafts/types/DraftItem.d.mts +1 -0
  125. package/dist/esm/api/resources/drafts/types/DraftReplyAll.d.mts +4 -0
  126. package/dist/esm/api/resources/drafts/types/DraftReplyAll.mjs +2 -0
  127. package/dist/esm/api/resources/drafts/types/index.d.mts +5 -0
  128. package/dist/esm/api/resources/drafts/types/index.mjs +5 -0
  129. package/dist/esm/api/resources/inboxes/client/Client.d.mts +3 -0
  130. package/dist/esm/api/resources/inboxes/client/Client.mjs +5 -0
  131. package/dist/esm/api/resources/inboxes/resources/drafts/client/Client.d.mts +6 -3
  132. package/dist/esm/api/resources/inboxes/resources/drafts/client/Client.mjs +12 -3
  133. package/dist/esm/api/resources/inboxes/resources/index.d.mts +2 -0
  134. package/dist/esm/api/resources/inboxes/resources/index.mjs +2 -0
  135. package/dist/esm/api/resources/inboxes/resources/messages/client/Client.d.mts +84 -9
  136. package/dist/esm/api/resources/inboxes/resources/messages/client/Client.mjs +309 -9
  137. package/dist/esm/api/resources/inboxes/resources/webhooks/client/Client.d.mts +103 -0
  138. package/dist/esm/api/resources/inboxes/resources/webhooks/client/Client.mjs +374 -0
  139. package/dist/esm/api/resources/inboxes/resources/webhooks/client/index.d.mts +1 -0
  140. package/dist/esm/api/resources/inboxes/resources/webhooks/client/index.mjs +1 -0
  141. package/dist/esm/api/resources/inboxes/resources/webhooks/client/requests/InboxListWebhooksRequest.d.mts +10 -0
  142. package/dist/esm/api/resources/inboxes/resources/webhooks/client/requests/InboxListWebhooksRequest.mjs +2 -0
  143. package/dist/esm/api/resources/inboxes/resources/webhooks/client/requests/index.d.mts +1 -0
  144. package/dist/esm/api/resources/inboxes/resources/webhooks/client/requests/index.mjs +1 -0
  145. package/dist/esm/api/resources/inboxes/resources/webhooks/exports.d.mts +2 -0
  146. package/dist/esm/api/resources/inboxes/resources/webhooks/exports.mjs +3 -0
  147. package/dist/esm/api/resources/inboxes/resources/webhooks/index.d.mts +1 -0
  148. package/dist/esm/api/resources/inboxes/resources/webhooks/index.mjs +1 -0
  149. package/dist/esm/api/resources/pods/client/Client.d.mts +3 -0
  150. package/dist/esm/api/resources/pods/client/Client.mjs +5 -0
  151. package/dist/esm/api/resources/pods/resources/index.d.mts +2 -0
  152. package/dist/esm/api/resources/pods/resources/index.mjs +2 -0
  153. package/dist/esm/api/resources/pods/resources/webhooks/client/Client.d.mts +103 -0
  154. package/dist/esm/api/resources/pods/resources/webhooks/client/Client.mjs +374 -0
  155. package/dist/esm/api/resources/pods/resources/webhooks/client/index.d.mts +1 -0
  156. package/dist/esm/api/resources/pods/resources/webhooks/client/index.mjs +1 -0
  157. package/dist/esm/api/resources/pods/resources/webhooks/client/requests/PodListWebhooksRequest.d.mts +10 -0
  158. package/dist/esm/api/resources/pods/resources/webhooks/client/requests/PodListWebhooksRequest.mjs +2 -0
  159. package/dist/esm/api/resources/pods/resources/webhooks/client/requests/index.d.mts +1 -0
  160. package/dist/esm/api/resources/pods/resources/webhooks/client/requests/index.mjs +1 -0
  161. package/dist/esm/api/resources/pods/resources/webhooks/exports.d.mts +2 -0
  162. package/dist/esm/api/resources/pods/resources/webhooks/exports.mjs +3 -0
  163. package/dist/esm/api/resources/pods/resources/webhooks/index.d.mts +1 -0
  164. package/dist/esm/api/resources/pods/resources/webhooks/index.mjs +1 -0
  165. package/dist/esm/api/resources/webhooks/types/CreateInboxWebhookRequest.d.mts +10 -0
  166. package/dist/esm/api/resources/webhooks/types/CreateInboxWebhookRequest.mjs +2 -0
  167. package/dist/esm/api/resources/webhooks/types/CreatePodWebhookRequest.d.mts +9 -0
  168. package/dist/esm/api/resources/webhooks/types/CreatePodWebhookRequest.mjs +2 -0
  169. package/dist/esm/api/resources/webhooks/types/CreateWebhookEventTypes.d.mts +7 -0
  170. package/dist/esm/api/resources/webhooks/types/CreateWebhookEventTypes.mjs +2 -0
  171. package/dist/esm/api/resources/webhooks/types/CreateWebhookRequest.d.mts +1 -10
  172. package/dist/esm/api/resources/webhooks/types/UpdateInboxWebhookRequest.d.mts +7 -0
  173. package/dist/esm/api/resources/webhooks/types/UpdateInboxWebhookRequest.mjs +2 -0
  174. package/dist/esm/api/resources/webhooks/types/UpdatePodWebhookRequest.d.mts +11 -0
  175. package/dist/esm/api/resources/webhooks/types/UpdatePodWebhookRequest.mjs +2 -0
  176. package/dist/esm/api/resources/webhooks/types/UpdateWebhookEventTypes.d.mts +10 -0
  177. package/dist/esm/api/resources/webhooks/types/UpdateWebhookEventTypes.mjs +2 -0
  178. package/dist/esm/api/resources/webhooks/types/UpdateWebhookRequest.d.mts +1 -14
  179. package/dist/esm/api/resources/webhooks/types/index.d.mts +6 -0
  180. package/dist/esm/api/resources/webhooks/types/index.mjs +6 -0
  181. package/dist/esm/serialization/resources/drafts/types/CreateDraftForwardRequest.d.mts +30 -0
  182. package/dist/esm/serialization/resources/drafts/types/CreateDraftForwardRequest.mjs +26 -0
  183. package/dist/esm/serialization/resources/drafts/types/CreateDraftReplyAllRequest.d.mts +24 -0
  184. package/dist/esm/serialization/resources/drafts/types/CreateDraftReplyAllRequest.mjs +20 -0
  185. package/dist/esm/serialization/resources/drafts/types/CreateDraftReplyRequest.d.mts +32 -0
  186. package/dist/esm/serialization/resources/drafts/types/CreateDraftReplyRequest.mjs +28 -0
  187. package/dist/esm/serialization/resources/drafts/types/Draft.d.mts +2 -0
  188. package/dist/esm/serialization/resources/drafts/types/Draft.mjs +2 -0
  189. package/dist/esm/serialization/resources/drafts/types/DraftForwardOf.d.mts +7 -0
  190. package/dist/esm/serialization/resources/drafts/types/DraftForwardOf.mjs +3 -0
  191. package/dist/esm/serialization/resources/drafts/types/DraftItem.d.mts +2 -0
  192. package/dist/esm/serialization/resources/drafts/types/DraftItem.mjs +2 -0
  193. package/dist/esm/serialization/resources/drafts/types/DraftReplyAll.d.mts +7 -0
  194. package/dist/esm/serialization/resources/drafts/types/DraftReplyAll.mjs +3 -0
  195. package/dist/esm/serialization/resources/drafts/types/index.d.mts +5 -0
  196. package/dist/esm/serialization/resources/drafts/types/index.mjs +5 -0
  197. package/dist/esm/serialization/resources/webhooks/types/CreateInboxWebhookRequest.d.mts +14 -0
  198. package/dist/esm/serialization/resources/webhooks/types/CreateInboxWebhookRequest.mjs +10 -0
  199. package/dist/esm/serialization/resources/webhooks/types/CreatePodWebhookRequest.d.mts +11 -0
  200. package/dist/esm/serialization/resources/webhooks/types/CreatePodWebhookRequest.mjs +9 -0
  201. package/dist/esm/serialization/resources/webhooks/types/CreateWebhookEventTypes.d.mts +8 -0
  202. package/dist/esm/serialization/resources/webhooks/types/CreateWebhookEventTypes.mjs +3 -0
  203. package/dist/esm/serialization/resources/webhooks/types/CreateWebhookRequest.d.mts +2 -9
  204. package/dist/esm/serialization/resources/webhooks/types/CreateWebhookRequest.mjs +5 -10
  205. package/dist/esm/serialization/resources/webhooks/types/UpdateInboxWebhookRequest.d.mts +10 -0
  206. package/dist/esm/serialization/resources/webhooks/types/UpdateInboxWebhookRequest.mjs +6 -0
  207. package/dist/esm/serialization/resources/webhooks/types/UpdatePodWebhookRequest.d.mts +12 -0
  208. package/dist/esm/serialization/resources/webhooks/types/UpdatePodWebhookRequest.mjs +10 -0
  209. package/dist/esm/serialization/resources/webhooks/types/UpdateWebhookEventTypes.d.mts +8 -0
  210. package/dist/esm/serialization/resources/webhooks/types/UpdateWebhookEventTypes.mjs +3 -0
  211. package/dist/esm/serialization/resources/webhooks/types/UpdateWebhookRequest.d.mts +2 -6
  212. package/dist/esm/serialization/resources/webhooks/types/UpdateWebhookRequest.mjs +5 -7
  213. package/dist/esm/serialization/resources/webhooks/types/index.d.mts +6 -0
  214. package/dist/esm/serialization/resources/webhooks/types/index.mjs +6 -0
  215. package/dist/esm/version.d.mts +1 -1
  216. package/dist/esm/version.mjs +1 -1
  217. package/dist/llms.txt +21 -4
  218. package/package.json +23 -1
  219. package/reference.md +1466 -440
@@ -768,10 +768,11 @@ class MessagesClient {
768
768
  *
769
769
  * @param {AgentMail.inboxes.InboxId} inbox_id
770
770
  * @param {AgentMail.SendMessageRequest} request
771
- * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
771
+ * @param {MessagesClient.IdempotentRequestOptions} requestOptions - Request-specific configuration.
772
772
  *
773
773
  * @throws {@link AgentMail.ValidationError}
774
774
  * @throws {@link AgentMail.NotFoundError}
775
+ * @throws {@link AgentMail.ConflictError}
775
776
  * @throws {@link AgentMail.MessageRejectedError}
776
777
  *
777
778
  * @example
@@ -784,7 +785,7 @@ class MessagesClient {
784
785
  return __awaiter(this, void 0, void 0, function* () {
785
786
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
786
787
  const _authRequest = yield this._options.authProvider.getAuthRequest();
787
- 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);
788
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "Idempotency-Key": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
788
789
  const _response = yield core.fetcher({
789
790
  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)
790
791
  .http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages/send`),
@@ -833,6 +834,14 @@ class MessagesClient {
833
834
  skipValidation: true,
834
835
  breadcrumbsPrefix: ["response"],
835
836
  }), _response.rawResponse);
837
+ case 409:
838
+ throw new AgentMail.ConflictError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
839
+ unrecognizedObjectKeys: "passthrough",
840
+ allowUnrecognizedUnionMembers: true,
841
+ allowUnrecognizedEnumValues: true,
842
+ skipValidation: true,
843
+ breadcrumbsPrefix: ["response"],
844
+ }), _response.rawResponse);
836
845
  case 403:
837
846
  throw new AgentMail.MessageRejectedError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
838
847
  unrecognizedObjectKeys: "passthrough",
@@ -861,10 +870,11 @@ class MessagesClient {
861
870
  * @param {AgentMail.inboxes.InboxId} inbox_id
862
871
  * @param {AgentMail.MessageId} message_id
863
872
  * @param {AgentMail.ReplyToMessageRequest} request
864
- * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
873
+ * @param {MessagesClient.IdempotentRequestOptions} requestOptions - Request-specific configuration.
865
874
  *
866
875
  * @throws {@link AgentMail.ValidationError}
867
876
  * @throws {@link AgentMail.NotFoundError}
877
+ * @throws {@link AgentMail.ConflictError}
868
878
  * @throws {@link AgentMail.MessageRejectedError}
869
879
  *
870
880
  * @example
@@ -877,7 +887,7 @@ class MessagesClient {
877
887
  return __awaiter(this, void 0, void 0, function* () {
878
888
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
879
889
  const _authRequest = yield this._options.authProvider.getAuthRequest();
880
- 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);
890
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "Idempotency-Key": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
881
891
  const _response = yield core.fetcher({
882
892
  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)
883
893
  .http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages/${core.url.encodePathParam(serializers.MessageId.jsonOrThrow(message_id, { omitUndefined: true }))}/reply`),
@@ -926,6 +936,14 @@ class MessagesClient {
926
936
  skipValidation: true,
927
937
  breadcrumbsPrefix: ["response"],
928
938
  }), _response.rawResponse);
939
+ case 409:
940
+ throw new AgentMail.ConflictError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
941
+ unrecognizedObjectKeys: "passthrough",
942
+ allowUnrecognizedUnionMembers: true,
943
+ allowUnrecognizedEnumValues: true,
944
+ skipValidation: true,
945
+ breadcrumbsPrefix: ["response"],
946
+ }), _response.rawResponse);
929
947
  case 403:
930
948
  throw new AgentMail.MessageRejectedError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
931
949
  unrecognizedObjectKeys: "passthrough",
@@ -954,10 +972,11 @@ class MessagesClient {
954
972
  * @param {AgentMail.inboxes.InboxId} inbox_id
955
973
  * @param {AgentMail.MessageId} message_id
956
974
  * @param {AgentMail.ReplyAllMessageRequest} request
957
- * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
975
+ * @param {MessagesClient.IdempotentRequestOptions} requestOptions - Request-specific configuration.
958
976
  *
959
977
  * @throws {@link AgentMail.ValidationError}
960
978
  * @throws {@link AgentMail.NotFoundError}
979
+ * @throws {@link AgentMail.ConflictError}
961
980
  * @throws {@link AgentMail.MessageRejectedError}
962
981
  *
963
982
  * @example
@@ -970,7 +989,7 @@ class MessagesClient {
970
989
  return __awaiter(this, void 0, void 0, function* () {
971
990
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
972
991
  const _authRequest = yield this._options.authProvider.getAuthRequest();
973
- 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);
992
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "Idempotency-Key": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
974
993
  const _response = yield core.fetcher({
975
994
  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)
976
995
  .http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages/${core.url.encodePathParam(serializers.MessageId.jsonOrThrow(message_id, { omitUndefined: true }))}/reply-all`),
@@ -1019,6 +1038,14 @@ class MessagesClient {
1019
1038
  skipValidation: true,
1020
1039
  breadcrumbsPrefix: ["response"],
1021
1040
  }), _response.rawResponse);
1041
+ case 409:
1042
+ throw new AgentMail.ConflictError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
1043
+ unrecognizedObjectKeys: "passthrough",
1044
+ allowUnrecognizedUnionMembers: true,
1045
+ allowUnrecognizedEnumValues: true,
1046
+ skipValidation: true,
1047
+ breadcrumbsPrefix: ["response"],
1048
+ }), _response.rawResponse);
1022
1049
  case 403:
1023
1050
  throw new AgentMail.MessageRejectedError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
1024
1051
  unrecognizedObjectKeys: "passthrough",
@@ -1047,10 +1074,11 @@ class MessagesClient {
1047
1074
  * @param {AgentMail.inboxes.InboxId} inbox_id
1048
1075
  * @param {AgentMail.MessageId} message_id
1049
1076
  * @param {AgentMail.SendMessageRequest} request
1050
- * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
1077
+ * @param {MessagesClient.IdempotentRequestOptions} requestOptions - Request-specific configuration.
1051
1078
  *
1052
1079
  * @throws {@link AgentMail.ValidationError}
1053
1080
  * @throws {@link AgentMail.NotFoundError}
1081
+ * @throws {@link AgentMail.ConflictError}
1054
1082
  * @throws {@link AgentMail.MessageRejectedError}
1055
1083
  *
1056
1084
  * @example
@@ -1063,7 +1091,7 @@ class MessagesClient {
1063
1091
  return __awaiter(this, void 0, void 0, function* () {
1064
1092
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1065
1093
  const _authRequest = yield this._options.authProvider.getAuthRequest();
1066
- 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);
1094
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "Idempotency-Key": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1067
1095
  const _response = yield core.fetcher({
1068
1096
  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)
1069
1097
  .http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages/${core.url.encodePathParam(serializers.MessageId.jsonOrThrow(message_id, { omitUndefined: true }))}/forward`),
@@ -1112,6 +1140,14 @@ class MessagesClient {
1112
1140
  skipValidation: true,
1113
1141
  breadcrumbsPrefix: ["response"],
1114
1142
  }), _response.rawResponse);
1143
+ case 409:
1144
+ throw new AgentMail.ConflictError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
1145
+ unrecognizedObjectKeys: "passthrough",
1146
+ allowUnrecognizedUnionMembers: true,
1147
+ allowUnrecognizedEnumValues: true,
1148
+ skipValidation: true,
1149
+ breadcrumbsPrefix: ["response"],
1150
+ }), _response.rawResponse);
1115
1151
  case 403:
1116
1152
  throw new AgentMail.MessageRejectedError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
1117
1153
  unrecognizedObjectKeys: "passthrough",
@@ -1131,5 +1167,269 @@ class MessagesClient {
1131
1167
  return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v0/inboxes/{inbox_id}/messages/{message_id}/forward");
1132
1168
  });
1133
1169
  }
1170
+ /**
1171
+ * Create a draft that replies to a message instead of sending it. The
1172
+ * recipients, subject, and threading are derived from the source message.
1173
+ * Send it later with `Send Draft`.
1174
+ *
1175
+ * **CLI:**
1176
+ * ```bash
1177
+ * agentmail inboxes:messages draft-reply --inbox-id <inbox_id> --message-id <message_id> --text "Reply text"
1178
+ * ```
1179
+ *
1180
+ * @param {AgentMail.inboxes.InboxId} inbox_id
1181
+ * @param {AgentMail.MessageId} message_id
1182
+ * @param {AgentMail.CreateDraftReplyRequest} request
1183
+ * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
1184
+ *
1185
+ * @throws {@link AgentMail.ValidationError}
1186
+ * @throws {@link AgentMail.NotFoundError}
1187
+ *
1188
+ * @example
1189
+ * await client.inboxes.messages.draftReply("inbox_id", "message_id", {})
1190
+ */
1191
+ draftReply(inbox_id, message_id, request, requestOptions) {
1192
+ return core.HttpResponsePromise.fromPromise(this.__draftReply(inbox_id, message_id, request, requestOptions));
1193
+ }
1194
+ __draftReply(inbox_id, message_id, request, requestOptions) {
1195
+ return __awaiter(this, void 0, void 0, function* () {
1196
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1197
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
1198
+ 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);
1199
+ const _response = yield core.fetcher({
1200
+ 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)
1201
+ .http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages/${core.url.encodePathParam(serializers.MessageId.jsonOrThrow(message_id, { omitUndefined: true }))}/draft-reply`),
1202
+ method: "POST",
1203
+ headers: _headers,
1204
+ contentType: "application/json",
1205
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
1206
+ requestType: "json",
1207
+ body: serializers.CreateDraftReplyRequest.jsonOrThrow(request, {
1208
+ unrecognizedObjectKeys: "strip",
1209
+ omitUndefined: true,
1210
+ }),
1211
+ 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,
1212
+ 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,
1213
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
1214
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
1215
+ logging: this._options.logging,
1216
+ });
1217
+ if (_response.ok) {
1218
+ return {
1219
+ data: serializers.Draft.parseOrThrow(_response.body, {
1220
+ unrecognizedObjectKeys: "passthrough",
1221
+ allowUnrecognizedUnionMembers: true,
1222
+ allowUnrecognizedEnumValues: true,
1223
+ skipValidation: true,
1224
+ breadcrumbsPrefix: ["response"],
1225
+ }),
1226
+ rawResponse: _response.rawResponse,
1227
+ };
1228
+ }
1229
+ if (_response.error.reason === "status-code") {
1230
+ switch (_response.error.statusCode) {
1231
+ case 400:
1232
+ throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
1233
+ unrecognizedObjectKeys: "passthrough",
1234
+ allowUnrecognizedUnionMembers: true,
1235
+ allowUnrecognizedEnumValues: true,
1236
+ skipValidation: true,
1237
+ breadcrumbsPrefix: ["response"],
1238
+ }), _response.rawResponse);
1239
+ case 404:
1240
+ throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
1241
+ unrecognizedObjectKeys: "passthrough",
1242
+ allowUnrecognizedUnionMembers: true,
1243
+ allowUnrecognizedEnumValues: true,
1244
+ skipValidation: true,
1245
+ breadcrumbsPrefix: ["response"],
1246
+ }), _response.rawResponse);
1247
+ default:
1248
+ throw new errors.AgentMailError({
1249
+ statusCode: _response.error.statusCode,
1250
+ body: _response.error.body,
1251
+ rawResponse: _response.rawResponse,
1252
+ });
1253
+ }
1254
+ }
1255
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v0/inboxes/{inbox_id}/messages/{message_id}/draft-reply");
1256
+ });
1257
+ }
1258
+ /**
1259
+ * Create a draft that replies to every recipient of a message instead of
1260
+ * sending it. Recipients, subject, and threading are derived from the
1261
+ * source message. Send it later with `Send Draft`.
1262
+ *
1263
+ * **CLI:**
1264
+ * ```bash
1265
+ * agentmail inboxes:messages draft-reply-all --inbox-id <inbox_id> --message-id <message_id> --text "Reply text"
1266
+ * ```
1267
+ *
1268
+ * @param {AgentMail.inboxes.InboxId} inbox_id
1269
+ * @param {AgentMail.MessageId} message_id
1270
+ * @param {AgentMail.CreateDraftReplyAllRequest} request
1271
+ * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
1272
+ *
1273
+ * @throws {@link AgentMail.ValidationError}
1274
+ * @throws {@link AgentMail.NotFoundError}
1275
+ *
1276
+ * @example
1277
+ * await client.inboxes.messages.draftReplyAll("inbox_id", "message_id", {})
1278
+ */
1279
+ draftReplyAll(inbox_id, message_id, request, requestOptions) {
1280
+ return core.HttpResponsePromise.fromPromise(this.__draftReplyAll(inbox_id, message_id, request, requestOptions));
1281
+ }
1282
+ __draftReplyAll(inbox_id, message_id, request, requestOptions) {
1283
+ return __awaiter(this, void 0, void 0, function* () {
1284
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1285
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
1286
+ 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);
1287
+ const _response = yield core.fetcher({
1288
+ 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)
1289
+ .http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages/${core.url.encodePathParam(serializers.MessageId.jsonOrThrow(message_id, { omitUndefined: true }))}/draft-reply-all`),
1290
+ method: "POST",
1291
+ headers: _headers,
1292
+ contentType: "application/json",
1293
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
1294
+ requestType: "json",
1295
+ body: serializers.CreateDraftReplyAllRequest.jsonOrThrow(request, {
1296
+ unrecognizedObjectKeys: "strip",
1297
+ omitUndefined: true,
1298
+ }),
1299
+ 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,
1300
+ 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,
1301
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
1302
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
1303
+ logging: this._options.logging,
1304
+ });
1305
+ if (_response.ok) {
1306
+ return {
1307
+ data: serializers.Draft.parseOrThrow(_response.body, {
1308
+ unrecognizedObjectKeys: "passthrough",
1309
+ allowUnrecognizedUnionMembers: true,
1310
+ allowUnrecognizedEnumValues: true,
1311
+ skipValidation: true,
1312
+ breadcrumbsPrefix: ["response"],
1313
+ }),
1314
+ rawResponse: _response.rawResponse,
1315
+ };
1316
+ }
1317
+ if (_response.error.reason === "status-code") {
1318
+ switch (_response.error.statusCode) {
1319
+ case 400:
1320
+ throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
1321
+ unrecognizedObjectKeys: "passthrough",
1322
+ allowUnrecognizedUnionMembers: true,
1323
+ allowUnrecognizedEnumValues: true,
1324
+ skipValidation: true,
1325
+ breadcrumbsPrefix: ["response"],
1326
+ }), _response.rawResponse);
1327
+ case 404:
1328
+ throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
1329
+ unrecognizedObjectKeys: "passthrough",
1330
+ allowUnrecognizedUnionMembers: true,
1331
+ allowUnrecognizedEnumValues: true,
1332
+ skipValidation: true,
1333
+ breadcrumbsPrefix: ["response"],
1334
+ }), _response.rawResponse);
1335
+ default:
1336
+ throw new errors.AgentMailError({
1337
+ statusCode: _response.error.statusCode,
1338
+ body: _response.error.body,
1339
+ rawResponse: _response.rawResponse,
1340
+ });
1341
+ }
1342
+ }
1343
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v0/inboxes/{inbox_id}/messages/{message_id}/draft-reply-all");
1344
+ });
1345
+ }
1346
+ /**
1347
+ * Create a draft that forwards a message instead of sending it. The subject
1348
+ * and threading are derived from the source message, whose body and
1349
+ * attachments are merged in at send time. Send it later with `Send Draft`.
1350
+ *
1351
+ * **CLI:**
1352
+ * ```bash
1353
+ * agentmail inboxes:messages draft-forward --inbox-id <inbox_id> --message-id <message_id> --to recipient@example.com
1354
+ * ```
1355
+ *
1356
+ * @param {AgentMail.inboxes.InboxId} inbox_id
1357
+ * @param {AgentMail.MessageId} message_id
1358
+ * @param {AgentMail.CreateDraftForwardRequest} request
1359
+ * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
1360
+ *
1361
+ * @throws {@link AgentMail.ValidationError}
1362
+ * @throws {@link AgentMail.NotFoundError}
1363
+ *
1364
+ * @example
1365
+ * await client.inboxes.messages.draftForward("inbox_id", "message_id", {})
1366
+ */
1367
+ draftForward(inbox_id, message_id, request, requestOptions) {
1368
+ return core.HttpResponsePromise.fromPromise(this.__draftForward(inbox_id, message_id, request, requestOptions));
1369
+ }
1370
+ __draftForward(inbox_id, message_id, request, requestOptions) {
1371
+ return __awaiter(this, void 0, void 0, function* () {
1372
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1373
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
1374
+ 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);
1375
+ const _response = yield core.fetcher({
1376
+ 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)
1377
+ .http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages/${core.url.encodePathParam(serializers.MessageId.jsonOrThrow(message_id, { omitUndefined: true }))}/draft-forward`),
1378
+ method: "POST",
1379
+ headers: _headers,
1380
+ contentType: "application/json",
1381
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
1382
+ requestType: "json",
1383
+ body: serializers.CreateDraftForwardRequest.jsonOrThrow(request, {
1384
+ unrecognizedObjectKeys: "strip",
1385
+ omitUndefined: true,
1386
+ }),
1387
+ 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,
1388
+ 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,
1389
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
1390
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
1391
+ logging: this._options.logging,
1392
+ });
1393
+ if (_response.ok) {
1394
+ return {
1395
+ data: serializers.Draft.parseOrThrow(_response.body, {
1396
+ unrecognizedObjectKeys: "passthrough",
1397
+ allowUnrecognizedUnionMembers: true,
1398
+ allowUnrecognizedEnumValues: true,
1399
+ skipValidation: true,
1400
+ breadcrumbsPrefix: ["response"],
1401
+ }),
1402
+ rawResponse: _response.rawResponse,
1403
+ };
1404
+ }
1405
+ if (_response.error.reason === "status-code") {
1406
+ switch (_response.error.statusCode) {
1407
+ case 400:
1408
+ throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
1409
+ unrecognizedObjectKeys: "passthrough",
1410
+ allowUnrecognizedUnionMembers: true,
1411
+ allowUnrecognizedEnumValues: true,
1412
+ skipValidation: true,
1413
+ breadcrumbsPrefix: ["response"],
1414
+ }), _response.rawResponse);
1415
+ case 404:
1416
+ throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
1417
+ unrecognizedObjectKeys: "passthrough",
1418
+ allowUnrecognizedUnionMembers: true,
1419
+ allowUnrecognizedEnumValues: true,
1420
+ skipValidation: true,
1421
+ breadcrumbsPrefix: ["response"],
1422
+ }), _response.rawResponse);
1423
+ default:
1424
+ throw new errors.AgentMailError({
1425
+ statusCode: _response.error.statusCode,
1426
+ body: _response.error.body,
1427
+ rawResponse: _response.rawResponse,
1428
+ });
1429
+ }
1430
+ }
1431
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v0/inboxes/{inbox_id}/messages/{message_id}/draft-forward");
1432
+ });
1433
+ }
1134
1434
  }
1135
1435
  exports.MessagesClient = MessagesClient;
@@ -0,0 +1,103 @@
1
+ import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../BaseClient.js";
2
+ import { type NormalizedClientOptionsWithAuth } from "../../../../../../BaseClient.js";
3
+ import * as core from "../../../../../../core/index.js";
4
+ import * as AgentMail from "../../../../../index.js";
5
+ export declare namespace WebhooksClient {
6
+ type Options = BaseClientOptions;
7
+ interface RequestOptions extends BaseRequestOptions {
8
+ }
9
+ }
10
+ export declare class WebhooksClient {
11
+ protected readonly _options: NormalizedClientOptionsWithAuth<WebhooksClient.Options>;
12
+ constructor(options?: WebhooksClient.Options);
13
+ /**
14
+ * **CLI:**
15
+ * ```bash
16
+ * agentmail inboxes:webhooks list --inbox-id <inbox_id>
17
+ * ```
18
+ *
19
+ * @param {AgentMail.inboxes.InboxId} inbox_id
20
+ * @param {AgentMail.inboxes.InboxListWebhooksRequest} request
21
+ * @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
22
+ *
23
+ * @example
24
+ * await client.inboxes.webhooks.list("inbox_id")
25
+ */
26
+ list(inbox_id: AgentMail.inboxes.InboxId, request?: AgentMail.inboxes.InboxListWebhooksRequest, requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<AgentMail.webhooks.ListWebhooksResponse>;
27
+ private __list;
28
+ /**
29
+ * **CLI:**
30
+ * ```bash
31
+ * agentmail inboxes:webhooks get --inbox-id <inbox_id> --webhook-id <webhook_id>
32
+ * ```
33
+ *
34
+ * @param {AgentMail.inboxes.InboxId} inbox_id
35
+ * @param {AgentMail.webhooks.WebhookId} webhook_id
36
+ * @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
37
+ *
38
+ * @throws {@link AgentMail.NotFoundError}
39
+ *
40
+ * @example
41
+ * await client.inboxes.webhooks.get("inbox_id", "webhook_id")
42
+ */
43
+ get(inbox_id: AgentMail.inboxes.InboxId, webhook_id: AgentMail.webhooks.WebhookId, requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<AgentMail.webhooks.Webhook>;
44
+ private __get;
45
+ /**
46
+ * Create a webhook scoped to this inbox.
47
+ *
48
+ * **CLI:**
49
+ * ```bash
50
+ * agentmail inboxes:webhooks create --inbox-id <inbox_id> --url https://example.com/webhook --event-type message.received
51
+ * ```
52
+ *
53
+ * @param {AgentMail.inboxes.InboxId} inbox_id
54
+ * @param {AgentMail.webhooks.CreateInboxWebhookRequest} request
55
+ * @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
56
+ *
57
+ * @throws {@link AgentMail.ValidationError}
58
+ *
59
+ * @example
60
+ * await client.inboxes.webhooks.create("inbox_id", {
61
+ * url: "url",
62
+ * eventTypes: ["message.received", "message.received"]
63
+ * })
64
+ */
65
+ create(inbox_id: AgentMail.inboxes.InboxId, request: AgentMail.webhooks.CreateInboxWebhookRequest, requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<AgentMail.webhooks.Webhook>;
66
+ private __create;
67
+ /**
68
+ * **CLI:**
69
+ * ```bash
70
+ * agentmail inboxes:webhooks update --inbox-id <inbox_id> --webhook-id <webhook_id> --event-type message.received
71
+ * ```
72
+ *
73
+ * @param {AgentMail.inboxes.InboxId} inbox_id
74
+ * @param {AgentMail.webhooks.WebhookId} webhook_id
75
+ * @param {AgentMail.webhooks.UpdateInboxWebhookRequest} request
76
+ * @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
77
+ *
78
+ * @throws {@link AgentMail.NotFoundError}
79
+ * @throws {@link AgentMail.ValidationError}
80
+ *
81
+ * @example
82
+ * await client.inboxes.webhooks.update("inbox_id", "webhook_id", {})
83
+ */
84
+ update(inbox_id: AgentMail.inboxes.InboxId, webhook_id: AgentMail.webhooks.WebhookId, request: AgentMail.webhooks.UpdateInboxWebhookRequest, requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<AgentMail.webhooks.Webhook>;
85
+ private __update;
86
+ /**
87
+ * **CLI:**
88
+ * ```bash
89
+ * agentmail inboxes:webhooks delete --inbox-id <inbox_id> --webhook-id <webhook_id>
90
+ * ```
91
+ *
92
+ * @param {AgentMail.inboxes.InboxId} inbox_id
93
+ * @param {AgentMail.webhooks.WebhookId} webhook_id
94
+ * @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
95
+ *
96
+ * @throws {@link AgentMail.NotFoundError}
97
+ *
98
+ * @example
99
+ * await client.inboxes.webhooks.delete("inbox_id", "webhook_id")
100
+ */
101
+ delete(inbox_id: AgentMail.inboxes.InboxId, webhook_id: AgentMail.webhooks.WebhookId, requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<void>;
102
+ private __delete;
103
+ }