agentmail 0.5.12 → 0.5.13

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 (205) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/api/resources/drafts/types/CreateDraftForwardRequest.d.ts +21 -0
  3. package/dist/cjs/api/resources/drafts/types/CreateDraftForwardRequest.js +3 -0
  4. package/dist/cjs/api/resources/drafts/types/CreateDraftReplyAllRequest.d.ts +17 -0
  5. package/dist/cjs/api/resources/drafts/types/CreateDraftReplyAllRequest.js +3 -0
  6. package/dist/cjs/api/resources/drafts/types/CreateDraftReplyRequest.d.ts +22 -0
  7. package/dist/cjs/api/resources/drafts/types/CreateDraftReplyRequest.js +3 -0
  8. package/dist/cjs/api/resources/drafts/types/Draft.d.ts +1 -0
  9. package/dist/cjs/api/resources/drafts/types/DraftForwardOf.d.ts +4 -0
  10. package/dist/cjs/api/resources/drafts/types/DraftForwardOf.js +3 -0
  11. package/dist/cjs/api/resources/drafts/types/DraftItem.d.ts +1 -0
  12. package/dist/cjs/api/resources/drafts/types/DraftReplyAll.d.ts +4 -0
  13. package/dist/cjs/api/resources/drafts/types/DraftReplyAll.js +3 -0
  14. package/dist/cjs/api/resources/drafts/types/index.d.ts +5 -0
  15. package/dist/cjs/api/resources/drafts/types/index.js +5 -0
  16. package/dist/cjs/api/resources/inboxes/client/Client.d.ts +3 -0
  17. package/dist/cjs/api/resources/inboxes/client/Client.js +5 -0
  18. package/dist/cjs/api/resources/inboxes/resources/index.d.ts +2 -0
  19. package/dist/cjs/api/resources/inboxes/resources/index.js +3 -1
  20. package/dist/cjs/api/resources/inboxes/resources/messages/client/Client.d.ts +69 -0
  21. package/dist/cjs/api/resources/inboxes/resources/messages/client/Client.js +264 -0
  22. package/dist/cjs/api/resources/inboxes/resources/webhooks/client/Client.d.ts +103 -0
  23. package/dist/cjs/api/resources/inboxes/resources/webhooks/client/Client.js +411 -0
  24. package/dist/cjs/api/resources/inboxes/resources/webhooks/client/index.d.ts +1 -0
  25. package/dist/cjs/api/resources/inboxes/resources/webhooks/client/index.js +17 -0
  26. package/dist/cjs/api/resources/inboxes/resources/webhooks/client/requests/InboxListWebhooksRequest.d.ts +10 -0
  27. package/dist/cjs/api/resources/inboxes/resources/webhooks/client/requests/InboxListWebhooksRequest.js +3 -0
  28. package/dist/cjs/api/resources/inboxes/resources/webhooks/client/requests/index.d.ts +1 -0
  29. package/dist/cjs/api/resources/inboxes/resources/webhooks/client/requests/index.js +2 -0
  30. package/dist/cjs/api/resources/inboxes/resources/webhooks/exports.d.ts +2 -0
  31. package/dist/cjs/api/resources/inboxes/resources/webhooks/exports.js +21 -0
  32. package/dist/cjs/api/resources/inboxes/resources/webhooks/index.d.ts +1 -0
  33. package/dist/cjs/api/resources/inboxes/resources/webhooks/index.js +17 -0
  34. package/dist/cjs/api/resources/pods/client/Client.d.ts +3 -0
  35. package/dist/cjs/api/resources/pods/client/Client.js +5 -0
  36. package/dist/cjs/api/resources/pods/resources/index.d.ts +2 -0
  37. package/dist/cjs/api/resources/pods/resources/index.js +3 -1
  38. package/dist/cjs/api/resources/pods/resources/webhooks/client/Client.d.ts +103 -0
  39. package/dist/cjs/api/resources/pods/resources/webhooks/client/Client.js +411 -0
  40. package/dist/cjs/api/resources/pods/resources/webhooks/client/index.d.ts +1 -0
  41. package/dist/cjs/api/resources/pods/resources/webhooks/client/index.js +17 -0
  42. package/dist/cjs/api/resources/pods/resources/webhooks/client/requests/PodListWebhooksRequest.d.ts +10 -0
  43. package/dist/cjs/api/resources/pods/resources/webhooks/client/requests/PodListWebhooksRequest.js +3 -0
  44. package/dist/cjs/api/resources/pods/resources/webhooks/client/requests/index.d.ts +1 -0
  45. package/dist/cjs/api/resources/pods/resources/webhooks/client/requests/index.js +2 -0
  46. package/dist/cjs/api/resources/pods/resources/webhooks/exports.d.ts +2 -0
  47. package/dist/cjs/api/resources/pods/resources/webhooks/exports.js +21 -0
  48. package/dist/cjs/api/resources/pods/resources/webhooks/index.d.ts +1 -0
  49. package/dist/cjs/api/resources/pods/resources/webhooks/index.js +17 -0
  50. package/dist/cjs/api/resources/webhooks/types/CreateInboxWebhookRequest.d.ts +10 -0
  51. package/dist/cjs/api/resources/webhooks/types/CreateInboxWebhookRequest.js +3 -0
  52. package/dist/cjs/api/resources/webhooks/types/CreatePodWebhookRequest.d.ts +9 -0
  53. package/dist/cjs/api/resources/webhooks/types/CreatePodWebhookRequest.js +3 -0
  54. package/dist/cjs/api/resources/webhooks/types/CreateWebhookEventTypes.d.ts +7 -0
  55. package/dist/cjs/api/resources/webhooks/types/CreateWebhookEventTypes.js +3 -0
  56. package/dist/cjs/api/resources/webhooks/types/CreateWebhookRequest.d.ts +1 -10
  57. package/dist/cjs/api/resources/webhooks/types/UpdateInboxWebhookRequest.d.ts +7 -0
  58. package/dist/cjs/api/resources/webhooks/types/UpdateInboxWebhookRequest.js +3 -0
  59. package/dist/cjs/api/resources/webhooks/types/UpdatePodWebhookRequest.d.ts +11 -0
  60. package/dist/cjs/api/resources/webhooks/types/UpdatePodWebhookRequest.js +3 -0
  61. package/dist/cjs/api/resources/webhooks/types/UpdateWebhookEventTypes.d.ts +10 -0
  62. package/dist/cjs/api/resources/webhooks/types/UpdateWebhookEventTypes.js +3 -0
  63. package/dist/cjs/api/resources/webhooks/types/UpdateWebhookRequest.d.ts +1 -14
  64. package/dist/cjs/api/resources/webhooks/types/index.d.ts +6 -0
  65. package/dist/cjs/api/resources/webhooks/types/index.js +6 -0
  66. package/dist/cjs/serialization/resources/drafts/types/CreateDraftForwardRequest.d.ts +30 -0
  67. package/dist/cjs/serialization/resources/drafts/types/CreateDraftForwardRequest.js +62 -0
  68. package/dist/cjs/serialization/resources/drafts/types/CreateDraftReplyAllRequest.d.ts +24 -0
  69. package/dist/cjs/serialization/resources/drafts/types/CreateDraftReplyAllRequest.js +56 -0
  70. package/dist/cjs/serialization/resources/drafts/types/CreateDraftReplyRequest.d.ts +32 -0
  71. package/dist/cjs/serialization/resources/drafts/types/CreateDraftReplyRequest.js +64 -0
  72. package/dist/cjs/serialization/resources/drafts/types/Draft.d.ts +2 -0
  73. package/dist/cjs/serialization/resources/drafts/types/Draft.js +2 -0
  74. package/dist/cjs/serialization/resources/drafts/types/DraftForwardOf.d.ts +7 -0
  75. package/dist/cjs/serialization/resources/drafts/types/DraftForwardOf.js +39 -0
  76. package/dist/cjs/serialization/resources/drafts/types/DraftItem.d.ts +2 -0
  77. package/dist/cjs/serialization/resources/drafts/types/DraftItem.js +2 -0
  78. package/dist/cjs/serialization/resources/drafts/types/DraftReplyAll.d.ts +7 -0
  79. package/dist/cjs/serialization/resources/drafts/types/DraftReplyAll.js +39 -0
  80. package/dist/cjs/serialization/resources/drafts/types/index.d.ts +5 -0
  81. package/dist/cjs/serialization/resources/drafts/types/index.js +5 -0
  82. package/dist/cjs/serialization/resources/webhooks/types/CreateInboxWebhookRequest.d.ts +14 -0
  83. package/dist/cjs/serialization/resources/webhooks/types/CreateInboxWebhookRequest.js +46 -0
  84. package/dist/cjs/serialization/resources/webhooks/types/CreatePodWebhookRequest.d.ts +11 -0
  85. package/dist/cjs/serialization/resources/webhooks/types/CreatePodWebhookRequest.js +45 -0
  86. package/dist/cjs/serialization/resources/webhooks/types/CreateWebhookEventTypes.d.ts +8 -0
  87. package/dist/cjs/serialization/resources/webhooks/types/CreateWebhookEventTypes.js +6 -0
  88. package/dist/cjs/serialization/resources/webhooks/types/CreateWebhookRequest.d.ts +2 -9
  89. package/dist/cjs/serialization/resources/webhooks/types/CreateWebhookRequest.js +5 -10
  90. package/dist/cjs/serialization/resources/webhooks/types/UpdateInboxWebhookRequest.d.ts +10 -0
  91. package/dist/cjs/serialization/resources/webhooks/types/UpdateInboxWebhookRequest.js +42 -0
  92. package/dist/cjs/serialization/resources/webhooks/types/UpdatePodWebhookRequest.d.ts +12 -0
  93. package/dist/cjs/serialization/resources/webhooks/types/UpdatePodWebhookRequest.js +46 -0
  94. package/dist/cjs/serialization/resources/webhooks/types/UpdateWebhookEventTypes.d.ts +8 -0
  95. package/dist/cjs/serialization/resources/webhooks/types/UpdateWebhookEventTypes.js +6 -0
  96. package/dist/cjs/serialization/resources/webhooks/types/UpdateWebhookRequest.d.ts +2 -6
  97. package/dist/cjs/serialization/resources/webhooks/types/UpdateWebhookRequest.js +5 -7
  98. package/dist/cjs/serialization/resources/webhooks/types/index.d.ts +6 -0
  99. package/dist/cjs/serialization/resources/webhooks/types/index.js +6 -0
  100. package/dist/cjs/version.d.ts +1 -1
  101. package/dist/cjs/version.js +1 -1
  102. package/dist/esm/BaseClient.mjs +2 -2
  103. package/dist/esm/api/resources/drafts/types/CreateDraftForwardRequest.d.mts +21 -0
  104. package/dist/esm/api/resources/drafts/types/CreateDraftForwardRequest.mjs +2 -0
  105. package/dist/esm/api/resources/drafts/types/CreateDraftReplyAllRequest.d.mts +17 -0
  106. package/dist/esm/api/resources/drafts/types/CreateDraftReplyAllRequest.mjs +2 -0
  107. package/dist/esm/api/resources/drafts/types/CreateDraftReplyRequest.d.mts +22 -0
  108. package/dist/esm/api/resources/drafts/types/CreateDraftReplyRequest.mjs +2 -0
  109. package/dist/esm/api/resources/drafts/types/Draft.d.mts +1 -0
  110. package/dist/esm/api/resources/drafts/types/DraftForwardOf.d.mts +4 -0
  111. package/dist/esm/api/resources/drafts/types/DraftForwardOf.mjs +2 -0
  112. package/dist/esm/api/resources/drafts/types/DraftItem.d.mts +1 -0
  113. package/dist/esm/api/resources/drafts/types/DraftReplyAll.d.mts +4 -0
  114. package/dist/esm/api/resources/drafts/types/DraftReplyAll.mjs +2 -0
  115. package/dist/esm/api/resources/drafts/types/index.d.mts +5 -0
  116. package/dist/esm/api/resources/drafts/types/index.mjs +5 -0
  117. package/dist/esm/api/resources/inboxes/client/Client.d.mts +3 -0
  118. package/dist/esm/api/resources/inboxes/client/Client.mjs +5 -0
  119. package/dist/esm/api/resources/inboxes/resources/index.d.mts +2 -0
  120. package/dist/esm/api/resources/inboxes/resources/index.mjs +2 -0
  121. package/dist/esm/api/resources/inboxes/resources/messages/client/Client.d.mts +69 -0
  122. package/dist/esm/api/resources/inboxes/resources/messages/client/Client.mjs +264 -0
  123. package/dist/esm/api/resources/inboxes/resources/webhooks/client/Client.d.mts +103 -0
  124. package/dist/esm/api/resources/inboxes/resources/webhooks/client/Client.mjs +374 -0
  125. package/dist/esm/api/resources/inboxes/resources/webhooks/client/index.d.mts +1 -0
  126. package/dist/esm/api/resources/inboxes/resources/webhooks/client/index.mjs +1 -0
  127. package/dist/esm/api/resources/inboxes/resources/webhooks/client/requests/InboxListWebhooksRequest.d.mts +10 -0
  128. package/dist/esm/api/resources/inboxes/resources/webhooks/client/requests/InboxListWebhooksRequest.mjs +2 -0
  129. package/dist/esm/api/resources/inboxes/resources/webhooks/client/requests/index.d.mts +1 -0
  130. package/dist/esm/api/resources/inboxes/resources/webhooks/client/requests/index.mjs +1 -0
  131. package/dist/esm/api/resources/inboxes/resources/webhooks/exports.d.mts +2 -0
  132. package/dist/esm/api/resources/inboxes/resources/webhooks/exports.mjs +3 -0
  133. package/dist/esm/api/resources/inboxes/resources/webhooks/index.d.mts +1 -0
  134. package/dist/esm/api/resources/inboxes/resources/webhooks/index.mjs +1 -0
  135. package/dist/esm/api/resources/pods/client/Client.d.mts +3 -0
  136. package/dist/esm/api/resources/pods/client/Client.mjs +5 -0
  137. package/dist/esm/api/resources/pods/resources/index.d.mts +2 -0
  138. package/dist/esm/api/resources/pods/resources/index.mjs +2 -0
  139. package/dist/esm/api/resources/pods/resources/webhooks/client/Client.d.mts +103 -0
  140. package/dist/esm/api/resources/pods/resources/webhooks/client/Client.mjs +374 -0
  141. package/dist/esm/api/resources/pods/resources/webhooks/client/index.d.mts +1 -0
  142. package/dist/esm/api/resources/pods/resources/webhooks/client/index.mjs +1 -0
  143. package/dist/esm/api/resources/pods/resources/webhooks/client/requests/PodListWebhooksRequest.d.mts +10 -0
  144. package/dist/esm/api/resources/pods/resources/webhooks/client/requests/PodListWebhooksRequest.mjs +2 -0
  145. package/dist/esm/api/resources/pods/resources/webhooks/client/requests/index.d.mts +1 -0
  146. package/dist/esm/api/resources/pods/resources/webhooks/client/requests/index.mjs +1 -0
  147. package/dist/esm/api/resources/pods/resources/webhooks/exports.d.mts +2 -0
  148. package/dist/esm/api/resources/pods/resources/webhooks/exports.mjs +3 -0
  149. package/dist/esm/api/resources/pods/resources/webhooks/index.d.mts +1 -0
  150. package/dist/esm/api/resources/pods/resources/webhooks/index.mjs +1 -0
  151. package/dist/esm/api/resources/webhooks/types/CreateInboxWebhookRequest.d.mts +10 -0
  152. package/dist/esm/api/resources/webhooks/types/CreateInboxWebhookRequest.mjs +2 -0
  153. package/dist/esm/api/resources/webhooks/types/CreatePodWebhookRequest.d.mts +9 -0
  154. package/dist/esm/api/resources/webhooks/types/CreatePodWebhookRequest.mjs +2 -0
  155. package/dist/esm/api/resources/webhooks/types/CreateWebhookEventTypes.d.mts +7 -0
  156. package/dist/esm/api/resources/webhooks/types/CreateWebhookEventTypes.mjs +2 -0
  157. package/dist/esm/api/resources/webhooks/types/CreateWebhookRequest.d.mts +1 -10
  158. package/dist/esm/api/resources/webhooks/types/UpdateInboxWebhookRequest.d.mts +7 -0
  159. package/dist/esm/api/resources/webhooks/types/UpdateInboxWebhookRequest.mjs +2 -0
  160. package/dist/esm/api/resources/webhooks/types/UpdatePodWebhookRequest.d.mts +11 -0
  161. package/dist/esm/api/resources/webhooks/types/UpdatePodWebhookRequest.mjs +2 -0
  162. package/dist/esm/api/resources/webhooks/types/UpdateWebhookEventTypes.d.mts +10 -0
  163. package/dist/esm/api/resources/webhooks/types/UpdateWebhookEventTypes.mjs +2 -0
  164. package/dist/esm/api/resources/webhooks/types/UpdateWebhookRequest.d.mts +1 -14
  165. package/dist/esm/api/resources/webhooks/types/index.d.mts +6 -0
  166. package/dist/esm/api/resources/webhooks/types/index.mjs +6 -0
  167. package/dist/esm/serialization/resources/drafts/types/CreateDraftForwardRequest.d.mts +30 -0
  168. package/dist/esm/serialization/resources/drafts/types/CreateDraftForwardRequest.mjs +26 -0
  169. package/dist/esm/serialization/resources/drafts/types/CreateDraftReplyAllRequest.d.mts +24 -0
  170. package/dist/esm/serialization/resources/drafts/types/CreateDraftReplyAllRequest.mjs +20 -0
  171. package/dist/esm/serialization/resources/drafts/types/CreateDraftReplyRequest.d.mts +32 -0
  172. package/dist/esm/serialization/resources/drafts/types/CreateDraftReplyRequest.mjs +28 -0
  173. package/dist/esm/serialization/resources/drafts/types/Draft.d.mts +2 -0
  174. package/dist/esm/serialization/resources/drafts/types/Draft.mjs +2 -0
  175. package/dist/esm/serialization/resources/drafts/types/DraftForwardOf.d.mts +7 -0
  176. package/dist/esm/serialization/resources/drafts/types/DraftForwardOf.mjs +3 -0
  177. package/dist/esm/serialization/resources/drafts/types/DraftItem.d.mts +2 -0
  178. package/dist/esm/serialization/resources/drafts/types/DraftItem.mjs +2 -0
  179. package/dist/esm/serialization/resources/drafts/types/DraftReplyAll.d.mts +7 -0
  180. package/dist/esm/serialization/resources/drafts/types/DraftReplyAll.mjs +3 -0
  181. package/dist/esm/serialization/resources/drafts/types/index.d.mts +5 -0
  182. package/dist/esm/serialization/resources/drafts/types/index.mjs +5 -0
  183. package/dist/esm/serialization/resources/webhooks/types/CreateInboxWebhookRequest.d.mts +14 -0
  184. package/dist/esm/serialization/resources/webhooks/types/CreateInboxWebhookRequest.mjs +10 -0
  185. package/dist/esm/serialization/resources/webhooks/types/CreatePodWebhookRequest.d.mts +11 -0
  186. package/dist/esm/serialization/resources/webhooks/types/CreatePodWebhookRequest.mjs +9 -0
  187. package/dist/esm/serialization/resources/webhooks/types/CreateWebhookEventTypes.d.mts +8 -0
  188. package/dist/esm/serialization/resources/webhooks/types/CreateWebhookEventTypes.mjs +3 -0
  189. package/dist/esm/serialization/resources/webhooks/types/CreateWebhookRequest.d.mts +2 -9
  190. package/dist/esm/serialization/resources/webhooks/types/CreateWebhookRequest.mjs +5 -10
  191. package/dist/esm/serialization/resources/webhooks/types/UpdateInboxWebhookRequest.d.mts +10 -0
  192. package/dist/esm/serialization/resources/webhooks/types/UpdateInboxWebhookRequest.mjs +6 -0
  193. package/dist/esm/serialization/resources/webhooks/types/UpdatePodWebhookRequest.d.mts +12 -0
  194. package/dist/esm/serialization/resources/webhooks/types/UpdatePodWebhookRequest.mjs +10 -0
  195. package/dist/esm/serialization/resources/webhooks/types/UpdateWebhookEventTypes.d.mts +8 -0
  196. package/dist/esm/serialization/resources/webhooks/types/UpdateWebhookEventTypes.mjs +3 -0
  197. package/dist/esm/serialization/resources/webhooks/types/UpdateWebhookRequest.d.mts +2 -6
  198. package/dist/esm/serialization/resources/webhooks/types/UpdateWebhookRequest.mjs +5 -7
  199. package/dist/esm/serialization/resources/webhooks/types/index.d.mts +6 -0
  200. package/dist/esm/serialization/resources/webhooks/types/index.mjs +6 -0
  201. package/dist/esm/version.d.mts +1 -1
  202. package/dist/esm/version.mjs +1 -1
  203. package/dist/llms.txt +8 -4
  204. package/package.json +23 -1
  205. package/reference.md +1454 -428
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
43
43
  const headers = (0, headers_js_1.mergeHeaders)({
44
44
  "X-Fern-Language": "JavaScript",
45
45
  "X-Fern-SDK-Name": "agentmail",
46
- "X-Fern-SDK-Version": "0.5.12",
47
- "User-Agent": "agentmail/0.5.12",
46
+ "X-Fern-SDK-Version": "0.5.13",
47
+ "User-Agent": "agentmail/0.5.13",
48
48
  "X-Fern-Runtime": core.RUNTIME.type,
49
49
  "X-Fern-Runtime-Version": core.RUNTIME.version,
50
50
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -0,0 +1,21 @@
1
+ import type * as AgentMail from "../../../index.js";
2
+ /**
3
+ * Body for creating a draft that forwards a message. The subject and
4
+ * threading are derived from the source message, whose body and attachments
5
+ * are merged in at send time. Recipients are optional, so a forward draft can
6
+ * be saved without an address and addressed later.
7
+ */
8
+ export interface CreateDraftForwardRequest {
9
+ labels?: AgentMail.DraftLabels;
10
+ replyTo?: AgentMail.DraftReplyTo;
11
+ to?: AgentMail.DraftTo;
12
+ cc?: AgentMail.DraftCc;
13
+ bcc?: AgentMail.DraftBcc;
14
+ subject?: AgentMail.DraftSubject;
15
+ text?: AgentMail.DraftText;
16
+ html?: AgentMail.DraftHtml;
17
+ /** Attachments to include in draft. */
18
+ attachments?: AgentMail.SendAttachment[];
19
+ sendAt?: AgentMail.DraftSendAt;
20
+ clientId?: AgentMail.DraftClientId;
21
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,17 @@
1
+ import type * as AgentMail from "../../../index.js";
2
+ /**
3
+ * Body for creating a draft that replies to the whole thread. Recipients,
4
+ * `in_reply_to`, `references`, and the subject are always derived from the
5
+ * source message, so `to`, `cc`, and `bcc` are not accepted.
6
+ */
7
+ export interface CreateDraftReplyAllRequest {
8
+ labels?: AgentMail.DraftLabels;
9
+ replyTo?: AgentMail.DraftReplyTo;
10
+ subject?: AgentMail.DraftSubject;
11
+ text?: AgentMail.DraftText;
12
+ html?: AgentMail.DraftHtml;
13
+ /** Attachments to include in draft. */
14
+ attachments?: AgentMail.SendAttachment[];
15
+ sendAt?: AgentMail.DraftSendAt;
16
+ clientId?: AgentMail.DraftClientId;
17
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,22 @@
1
+ import type * as AgentMail from "../../../index.js";
2
+ /**
3
+ * Body for creating a draft that replies to a message. `in_reply_to`,
4
+ * `references`, and the subject are derived from the source message. Set
5
+ * `reply_all` to address the whole thread (you cannot then also pass `to`,
6
+ * `cc`, or `bcc`).
7
+ */
8
+ export interface CreateDraftReplyRequest {
9
+ labels?: AgentMail.DraftLabels;
10
+ replyTo?: AgentMail.DraftReplyTo;
11
+ to?: AgentMail.DraftTo;
12
+ cc?: AgentMail.DraftCc;
13
+ bcc?: AgentMail.DraftBcc;
14
+ replyAll?: AgentMail.DraftReplyAll;
15
+ subject?: AgentMail.DraftSubject;
16
+ text?: AgentMail.DraftText;
17
+ html?: AgentMail.DraftHtml;
18
+ /** Attachments to include in draft. */
19
+ attachments?: AgentMail.SendAttachment[];
20
+ sendAt?: AgentMail.DraftSendAt;
21
+ clientId?: AgentMail.DraftClientId;
22
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -14,6 +14,7 @@ export interface Draft {
14
14
  html?: AgentMail.DraftHtml;
15
15
  attachments?: AgentMail.DraftAttachments;
16
16
  inReplyTo?: AgentMail.DraftInReplyTo;
17
+ forwardOf?: AgentMail.DraftForwardOf;
17
18
  /** IDs of previous messages in thread. */
18
19
  references?: string[];
19
20
  sendStatus?: AgentMail.DraftSendStatus;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * ID of message being forwarded.
3
+ */
4
+ export type DraftForwardOf = string;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -10,6 +10,7 @@ export interface DraftItem {
10
10
  preview?: AgentMail.DraftPreview;
11
11
  attachments?: AgentMail.DraftAttachments;
12
12
  inReplyTo?: AgentMail.DraftInReplyTo;
13
+ forwardOf?: AgentMail.DraftForwardOf;
13
14
  sendStatus?: AgentMail.DraftSendStatus;
14
15
  sendAt?: AgentMail.DraftSendAt;
15
16
  updatedAt: AgentMail.DraftUpdatedAt;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Reply to all recipients of the original message.
3
+ */
4
+ export type DraftReplyAll = boolean;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,15 +1,20 @@
1
+ export * from "./CreateDraftForwardRequest.js";
2
+ export * from "./CreateDraftReplyAllRequest.js";
3
+ export * from "./CreateDraftReplyRequest.js";
1
4
  export * from "./CreateDraftRequest.js";
2
5
  export * from "./Draft.js";
3
6
  export * from "./DraftAttachments.js";
4
7
  export * from "./DraftBcc.js";
5
8
  export * from "./DraftCc.js";
6
9
  export * from "./DraftClientId.js";
10
+ export * from "./DraftForwardOf.js";
7
11
  export * from "./DraftHtml.js";
8
12
  export * from "./DraftId.js";
9
13
  export * from "./DraftInReplyTo.js";
10
14
  export * from "./DraftItem.js";
11
15
  export * from "./DraftLabels.js";
12
16
  export * from "./DraftPreview.js";
17
+ export * from "./DraftReplyAll.js";
13
18
  export * from "./DraftReplyTo.js";
14
19
  export * from "./DraftSendAt.js";
15
20
  export * from "./DraftSendStatus.js";
@@ -14,18 +14,23 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./CreateDraftForwardRequest.js"), exports);
18
+ __exportStar(require("./CreateDraftReplyAllRequest.js"), exports);
19
+ __exportStar(require("./CreateDraftReplyRequest.js"), exports);
17
20
  __exportStar(require("./CreateDraftRequest.js"), exports);
18
21
  __exportStar(require("./Draft.js"), exports);
19
22
  __exportStar(require("./DraftAttachments.js"), exports);
20
23
  __exportStar(require("./DraftBcc.js"), exports);
21
24
  __exportStar(require("./DraftCc.js"), exports);
22
25
  __exportStar(require("./DraftClientId.js"), exports);
26
+ __exportStar(require("./DraftForwardOf.js"), exports);
23
27
  __exportStar(require("./DraftHtml.js"), exports);
24
28
  __exportStar(require("./DraftId.js"), exports);
25
29
  __exportStar(require("./DraftInReplyTo.js"), exports);
26
30
  __exportStar(require("./DraftItem.js"), exports);
27
31
  __exportStar(require("./DraftLabels.js"), exports);
28
32
  __exportStar(require("./DraftPreview.js"), exports);
33
+ __exportStar(require("./DraftReplyAll.js"), exports);
29
34
  __exportStar(require("./DraftReplyTo.js"), exports);
30
35
  __exportStar(require("./DraftSendAt.js"), exports);
31
36
  __exportStar(require("./DraftSendStatus.js"), exports);
@@ -9,6 +9,7 @@ import { ListsClient } from "../resources/lists/client/Client.js";
9
9
  import { MessagesClient } from "../resources/messages/client/Client.js";
10
10
  import { MetricsClient } from "../resources/metrics/client/Client.js";
11
11
  import { ThreadsClient } from "../resources/threads/client/Client.js";
12
+ import { WebhooksClient } from "../resources/webhooks/client/Client.js";
12
13
  export declare namespace InboxesClient {
13
14
  type Options = BaseClientOptions;
14
15
  interface RequestOptions extends BaseRequestOptions {
@@ -19,6 +20,7 @@ export declare class InboxesClient {
19
20
  protected _threads: ThreadsClient | undefined;
20
21
  protected _messages: MessagesClient | undefined;
21
22
  protected _drafts: DraftsClient | undefined;
23
+ protected _webhooks: WebhooksClient | undefined;
22
24
  protected _lists: ListsClient | undefined;
23
25
  protected _metrics: MetricsClient | undefined;
24
26
  protected _events: EventsClient | undefined;
@@ -27,6 +29,7 @@ export declare class InboxesClient {
27
29
  get threads(): ThreadsClient;
28
30
  get messages(): MessagesClient;
29
31
  get drafts(): DraftsClient;
32
+ get webhooks(): WebhooksClient;
30
33
  get lists(): ListsClient;
31
34
  get metrics(): MetricsClient;
32
35
  get events(): EventsClient;
@@ -59,6 +59,7 @@ const Client_js_4 = require("../resources/lists/client/Client.js");
59
59
  const Client_js_5 = require("../resources/messages/client/Client.js");
60
60
  const Client_js_6 = require("../resources/metrics/client/Client.js");
61
61
  const Client_js_7 = require("../resources/threads/client/Client.js");
62
+ const Client_js_8 = require("../resources/webhooks/client/Client.js");
62
63
  class InboxesClient {
63
64
  constructor(options = {}) {
64
65
  this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
@@ -75,6 +76,10 @@ class InboxesClient {
75
76
  var _a;
76
77
  return ((_a = this._drafts) !== null && _a !== void 0 ? _a : (this._drafts = new Client_js_2.DraftsClient(this._options)));
77
78
  }
79
+ get webhooks() {
80
+ var _a;
81
+ return ((_a = this._webhooks) !== null && _a !== void 0 ? _a : (this._webhooks = new Client_js_8.WebhooksClient(this._options)));
82
+ }
78
83
  get lists() {
79
84
  var _a;
80
85
  return ((_a = this._lists) !== null && _a !== void 0 ? _a : (this._lists = new Client_js_4.ListsClient(this._options)));
@@ -12,3 +12,5 @@ export * from "./metrics/client/requests/index.js";
12
12
  export * as metrics from "./metrics/index.js";
13
13
  export * from "./threads/client/requests/index.js";
14
14
  export * as threads from "./threads/index.js";
15
+ export * from "./webhooks/client/requests/index.js";
16
+ export * as webhooks from "./webhooks/index.js";
@@ -36,7 +36,7 @@ var __importStar = (this && this.__importStar) || (function () {
36
36
  };
37
37
  })();
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.threads = exports.metrics = exports.messages = exports.lists = exports.events = exports.drafts = exports.apiKeys = void 0;
39
+ exports.webhooks = exports.threads = exports.metrics = exports.messages = exports.lists = exports.events = exports.drafts = exports.apiKeys = void 0;
40
40
  __exportStar(require("./apiKeys/client/requests/index.js"), exports);
41
41
  exports.apiKeys = __importStar(require("./apiKeys/index.js"));
42
42
  __exportStar(require("./drafts/client/requests/index.js"), exports);
@@ -51,3 +51,5 @@ __exportStar(require("./metrics/client/requests/index.js"), exports);
51
51
  exports.metrics = __importStar(require("./metrics/index.js"));
52
52
  __exportStar(require("./threads/client/requests/index.js"), exports);
53
53
  exports.threads = __importStar(require("./threads/index.js"));
54
+ __exportStar(require("./webhooks/client/requests/index.js"), exports);
55
+ exports.webhooks = __importStar(require("./webhooks/index.js"));
@@ -271,4 +271,73 @@ export declare class MessagesClient {
271
271
  */
272
272
  forward(inbox_id: AgentMail.inboxes.InboxId, message_id: AgentMail.MessageId, request: AgentMail.SendMessageRequest, requestOptions?: MessagesClient.RequestOptions): core.HttpResponsePromise<AgentMail.SendMessageResponse>;
273
273
  private __forward;
274
+ /**
275
+ * Create a draft that replies to a message instead of sending it. The
276
+ * recipients, subject, and threading are derived from the source message.
277
+ * Send it later with `Send Draft`.
278
+ *
279
+ * **CLI:**
280
+ * ```bash
281
+ * agentmail inboxes:messages draft-reply --inbox-id <inbox_id> --message-id <message_id> --text "Reply text"
282
+ * ```
283
+ *
284
+ * @param {AgentMail.inboxes.InboxId} inbox_id
285
+ * @param {AgentMail.MessageId} message_id
286
+ * @param {AgentMail.CreateDraftReplyRequest} request
287
+ * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
288
+ *
289
+ * @throws {@link AgentMail.ValidationError}
290
+ * @throws {@link AgentMail.NotFoundError}
291
+ *
292
+ * @example
293
+ * await client.inboxes.messages.draftReply("inbox_id", "message_id", {})
294
+ */
295
+ draftReply(inbox_id: AgentMail.inboxes.InboxId, message_id: AgentMail.MessageId, request: AgentMail.CreateDraftReplyRequest, requestOptions?: MessagesClient.RequestOptions): core.HttpResponsePromise<AgentMail.Draft>;
296
+ private __draftReply;
297
+ /**
298
+ * Create a draft that replies to every recipient of a message instead of
299
+ * sending it. Recipients, subject, and threading are derived from the
300
+ * source message. Send it later with `Send Draft`.
301
+ *
302
+ * **CLI:**
303
+ * ```bash
304
+ * agentmail inboxes:messages draft-reply-all --inbox-id <inbox_id> --message-id <message_id> --text "Reply text"
305
+ * ```
306
+ *
307
+ * @param {AgentMail.inboxes.InboxId} inbox_id
308
+ * @param {AgentMail.MessageId} message_id
309
+ * @param {AgentMail.CreateDraftReplyAllRequest} request
310
+ * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
311
+ *
312
+ * @throws {@link AgentMail.ValidationError}
313
+ * @throws {@link AgentMail.NotFoundError}
314
+ *
315
+ * @example
316
+ * await client.inboxes.messages.draftReplyAll("inbox_id", "message_id", {})
317
+ */
318
+ draftReplyAll(inbox_id: AgentMail.inboxes.InboxId, message_id: AgentMail.MessageId, request: AgentMail.CreateDraftReplyAllRequest, requestOptions?: MessagesClient.RequestOptions): core.HttpResponsePromise<AgentMail.Draft>;
319
+ private __draftReplyAll;
320
+ /**
321
+ * Create a draft that forwards a message instead of sending it. The subject
322
+ * and threading are derived from the source message, whose body and
323
+ * attachments are merged in at send time. Send it later with `Send Draft`.
324
+ *
325
+ * **CLI:**
326
+ * ```bash
327
+ * agentmail inboxes:messages draft-forward --inbox-id <inbox_id> --message-id <message_id> --to recipient@example.com
328
+ * ```
329
+ *
330
+ * @param {AgentMail.inboxes.InboxId} inbox_id
331
+ * @param {AgentMail.MessageId} message_id
332
+ * @param {AgentMail.CreateDraftForwardRequest} request
333
+ * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
334
+ *
335
+ * @throws {@link AgentMail.ValidationError}
336
+ * @throws {@link AgentMail.NotFoundError}
337
+ *
338
+ * @example
339
+ * await client.inboxes.messages.draftForward("inbox_id", "message_id", {})
340
+ */
341
+ draftForward(inbox_id: AgentMail.inboxes.InboxId, message_id: AgentMail.MessageId, request: AgentMail.CreateDraftForwardRequest, requestOptions?: MessagesClient.RequestOptions): core.HttpResponsePromise<AgentMail.Draft>;
342
+ private __draftForward;
274
343
  }
@@ -1131,5 +1131,269 @@ class MessagesClient {
1131
1131
  return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v0/inboxes/{inbox_id}/messages/{message_id}/forward");
1132
1132
  });
1133
1133
  }
1134
+ /**
1135
+ * Create a draft that replies to a message instead of sending it. The
1136
+ * recipients, subject, and threading are derived from the source message.
1137
+ * Send it later with `Send Draft`.
1138
+ *
1139
+ * **CLI:**
1140
+ * ```bash
1141
+ * agentmail inboxes:messages draft-reply --inbox-id <inbox_id> --message-id <message_id> --text "Reply text"
1142
+ * ```
1143
+ *
1144
+ * @param {AgentMail.inboxes.InboxId} inbox_id
1145
+ * @param {AgentMail.MessageId} message_id
1146
+ * @param {AgentMail.CreateDraftReplyRequest} request
1147
+ * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
1148
+ *
1149
+ * @throws {@link AgentMail.ValidationError}
1150
+ * @throws {@link AgentMail.NotFoundError}
1151
+ *
1152
+ * @example
1153
+ * await client.inboxes.messages.draftReply("inbox_id", "message_id", {})
1154
+ */
1155
+ draftReply(inbox_id, message_id, request, requestOptions) {
1156
+ return core.HttpResponsePromise.fromPromise(this.__draftReply(inbox_id, message_id, request, requestOptions));
1157
+ }
1158
+ __draftReply(inbox_id, message_id, request, requestOptions) {
1159
+ return __awaiter(this, void 0, void 0, function* () {
1160
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1161
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
1162
+ 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);
1163
+ const _response = yield core.fetcher({
1164
+ 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)
1165
+ .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`),
1166
+ method: "POST",
1167
+ headers: _headers,
1168
+ contentType: "application/json",
1169
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
1170
+ requestType: "json",
1171
+ body: serializers.CreateDraftReplyRequest.jsonOrThrow(request, {
1172
+ unrecognizedObjectKeys: "strip",
1173
+ omitUndefined: true,
1174
+ }),
1175
+ 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,
1176
+ 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,
1177
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
1178
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
1179
+ logging: this._options.logging,
1180
+ });
1181
+ if (_response.ok) {
1182
+ return {
1183
+ data: serializers.Draft.parseOrThrow(_response.body, {
1184
+ unrecognizedObjectKeys: "passthrough",
1185
+ allowUnrecognizedUnionMembers: true,
1186
+ allowUnrecognizedEnumValues: true,
1187
+ skipValidation: true,
1188
+ breadcrumbsPrefix: ["response"],
1189
+ }),
1190
+ rawResponse: _response.rawResponse,
1191
+ };
1192
+ }
1193
+ if (_response.error.reason === "status-code") {
1194
+ switch (_response.error.statusCode) {
1195
+ case 400:
1196
+ throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
1197
+ unrecognizedObjectKeys: "passthrough",
1198
+ allowUnrecognizedUnionMembers: true,
1199
+ allowUnrecognizedEnumValues: true,
1200
+ skipValidation: true,
1201
+ breadcrumbsPrefix: ["response"],
1202
+ }), _response.rawResponse);
1203
+ case 404:
1204
+ throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
1205
+ unrecognizedObjectKeys: "passthrough",
1206
+ allowUnrecognizedUnionMembers: true,
1207
+ allowUnrecognizedEnumValues: true,
1208
+ skipValidation: true,
1209
+ breadcrumbsPrefix: ["response"],
1210
+ }), _response.rawResponse);
1211
+ default:
1212
+ throw new errors.AgentMailError({
1213
+ statusCode: _response.error.statusCode,
1214
+ body: _response.error.body,
1215
+ rawResponse: _response.rawResponse,
1216
+ });
1217
+ }
1218
+ }
1219
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v0/inboxes/{inbox_id}/messages/{message_id}/draft-reply");
1220
+ });
1221
+ }
1222
+ /**
1223
+ * Create a draft that replies to every recipient of a message instead of
1224
+ * sending it. Recipients, subject, and threading are derived from the
1225
+ * source message. Send it later with `Send Draft`.
1226
+ *
1227
+ * **CLI:**
1228
+ * ```bash
1229
+ * agentmail inboxes:messages draft-reply-all --inbox-id <inbox_id> --message-id <message_id> --text "Reply text"
1230
+ * ```
1231
+ *
1232
+ * @param {AgentMail.inboxes.InboxId} inbox_id
1233
+ * @param {AgentMail.MessageId} message_id
1234
+ * @param {AgentMail.CreateDraftReplyAllRequest} request
1235
+ * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
1236
+ *
1237
+ * @throws {@link AgentMail.ValidationError}
1238
+ * @throws {@link AgentMail.NotFoundError}
1239
+ *
1240
+ * @example
1241
+ * await client.inboxes.messages.draftReplyAll("inbox_id", "message_id", {})
1242
+ */
1243
+ draftReplyAll(inbox_id, message_id, request, requestOptions) {
1244
+ return core.HttpResponsePromise.fromPromise(this.__draftReplyAll(inbox_id, message_id, request, requestOptions));
1245
+ }
1246
+ __draftReplyAll(inbox_id, message_id, request, requestOptions) {
1247
+ return __awaiter(this, void 0, void 0, function* () {
1248
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1249
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
1250
+ 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);
1251
+ const _response = yield core.fetcher({
1252
+ 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)
1253
+ .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`),
1254
+ method: "POST",
1255
+ headers: _headers,
1256
+ contentType: "application/json",
1257
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
1258
+ requestType: "json",
1259
+ body: serializers.CreateDraftReplyAllRequest.jsonOrThrow(request, {
1260
+ unrecognizedObjectKeys: "strip",
1261
+ omitUndefined: true,
1262
+ }),
1263
+ 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,
1264
+ 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,
1265
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
1266
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
1267
+ logging: this._options.logging,
1268
+ });
1269
+ if (_response.ok) {
1270
+ return {
1271
+ data: serializers.Draft.parseOrThrow(_response.body, {
1272
+ unrecognizedObjectKeys: "passthrough",
1273
+ allowUnrecognizedUnionMembers: true,
1274
+ allowUnrecognizedEnumValues: true,
1275
+ skipValidation: true,
1276
+ breadcrumbsPrefix: ["response"],
1277
+ }),
1278
+ rawResponse: _response.rawResponse,
1279
+ };
1280
+ }
1281
+ if (_response.error.reason === "status-code") {
1282
+ switch (_response.error.statusCode) {
1283
+ case 400:
1284
+ throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
1285
+ unrecognizedObjectKeys: "passthrough",
1286
+ allowUnrecognizedUnionMembers: true,
1287
+ allowUnrecognizedEnumValues: true,
1288
+ skipValidation: true,
1289
+ breadcrumbsPrefix: ["response"],
1290
+ }), _response.rawResponse);
1291
+ case 404:
1292
+ throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
1293
+ unrecognizedObjectKeys: "passthrough",
1294
+ allowUnrecognizedUnionMembers: true,
1295
+ allowUnrecognizedEnumValues: true,
1296
+ skipValidation: true,
1297
+ breadcrumbsPrefix: ["response"],
1298
+ }), _response.rawResponse);
1299
+ default:
1300
+ throw new errors.AgentMailError({
1301
+ statusCode: _response.error.statusCode,
1302
+ body: _response.error.body,
1303
+ rawResponse: _response.rawResponse,
1304
+ });
1305
+ }
1306
+ }
1307
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v0/inboxes/{inbox_id}/messages/{message_id}/draft-reply-all");
1308
+ });
1309
+ }
1310
+ /**
1311
+ * Create a draft that forwards a message instead of sending it. The subject
1312
+ * and threading are derived from the source message, whose body and
1313
+ * attachments are merged in at send time. Send it later with `Send Draft`.
1314
+ *
1315
+ * **CLI:**
1316
+ * ```bash
1317
+ * agentmail inboxes:messages draft-forward --inbox-id <inbox_id> --message-id <message_id> --to recipient@example.com
1318
+ * ```
1319
+ *
1320
+ * @param {AgentMail.inboxes.InboxId} inbox_id
1321
+ * @param {AgentMail.MessageId} message_id
1322
+ * @param {AgentMail.CreateDraftForwardRequest} request
1323
+ * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
1324
+ *
1325
+ * @throws {@link AgentMail.ValidationError}
1326
+ * @throws {@link AgentMail.NotFoundError}
1327
+ *
1328
+ * @example
1329
+ * await client.inboxes.messages.draftForward("inbox_id", "message_id", {})
1330
+ */
1331
+ draftForward(inbox_id, message_id, request, requestOptions) {
1332
+ return core.HttpResponsePromise.fromPromise(this.__draftForward(inbox_id, message_id, request, requestOptions));
1333
+ }
1334
+ __draftForward(inbox_id, message_id, request, requestOptions) {
1335
+ return __awaiter(this, void 0, void 0, function* () {
1336
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1337
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
1338
+ 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);
1339
+ const _response = yield core.fetcher({
1340
+ 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)
1341
+ .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`),
1342
+ method: "POST",
1343
+ headers: _headers,
1344
+ contentType: "application/json",
1345
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
1346
+ requestType: "json",
1347
+ body: serializers.CreateDraftForwardRequest.jsonOrThrow(request, {
1348
+ unrecognizedObjectKeys: "strip",
1349
+ omitUndefined: true,
1350
+ }),
1351
+ 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,
1352
+ 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,
1353
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
1354
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
1355
+ logging: this._options.logging,
1356
+ });
1357
+ if (_response.ok) {
1358
+ return {
1359
+ data: serializers.Draft.parseOrThrow(_response.body, {
1360
+ unrecognizedObjectKeys: "passthrough",
1361
+ allowUnrecognizedUnionMembers: true,
1362
+ allowUnrecognizedEnumValues: true,
1363
+ skipValidation: true,
1364
+ breadcrumbsPrefix: ["response"],
1365
+ }),
1366
+ rawResponse: _response.rawResponse,
1367
+ };
1368
+ }
1369
+ if (_response.error.reason === "status-code") {
1370
+ switch (_response.error.statusCode) {
1371
+ case 400:
1372
+ throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
1373
+ unrecognizedObjectKeys: "passthrough",
1374
+ allowUnrecognizedUnionMembers: true,
1375
+ allowUnrecognizedEnumValues: true,
1376
+ skipValidation: true,
1377
+ breadcrumbsPrefix: ["response"],
1378
+ }), _response.rawResponse);
1379
+ case 404:
1380
+ throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
1381
+ unrecognizedObjectKeys: "passthrough",
1382
+ allowUnrecognizedUnionMembers: true,
1383
+ allowUnrecognizedEnumValues: true,
1384
+ skipValidation: true,
1385
+ breadcrumbsPrefix: ["response"],
1386
+ }), _response.rawResponse);
1387
+ default:
1388
+ throw new errors.AgentMailError({
1389
+ statusCode: _response.error.statusCode,
1390
+ body: _response.error.body,
1391
+ rawResponse: _response.rawResponse,
1392
+ });
1393
+ }
1394
+ }
1395
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v0/inboxes/{inbox_id}/messages/{message_id}/draft-forward");
1396
+ });
1397
+ }
1134
1398
  }
1135
1399
  exports.MessagesClient = MessagesClient;