agentmail 0.5.11 → 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 (301) 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/CreateDraftReplyAllRequest.d.ts +17 -0
  4. package/dist/cjs/api/resources/drafts/types/CreateDraftReplyRequest.d.ts +22 -0
  5. package/dist/cjs/api/resources/drafts/types/Draft.d.ts +1 -0
  6. package/dist/cjs/api/resources/drafts/types/DraftForwardOf.d.ts +4 -0
  7. package/dist/cjs/api/resources/drafts/types/DraftForwardOf.js +3 -0
  8. package/dist/cjs/api/resources/drafts/types/DraftItem.d.ts +1 -0
  9. package/dist/cjs/api/resources/drafts/types/DraftReplyAll.d.ts +4 -0
  10. package/dist/cjs/api/resources/drafts/types/DraftReplyAll.js +3 -0
  11. package/dist/cjs/api/resources/drafts/types/index.d.ts +5 -0
  12. package/dist/cjs/api/resources/drafts/types/index.js +5 -0
  13. package/dist/cjs/api/resources/inboxes/client/Client.d.ts +3 -0
  14. package/dist/cjs/api/resources/inboxes/client/Client.js +5 -0
  15. package/dist/cjs/api/resources/inboxes/resources/index.d.ts +2 -0
  16. package/dist/cjs/api/resources/inboxes/resources/index.js +3 -1
  17. package/dist/cjs/api/resources/inboxes/resources/messages/client/Client.d.ts +69 -0
  18. package/dist/cjs/api/resources/inboxes/resources/messages/client/Client.js +264 -0
  19. package/dist/cjs/api/resources/inboxes/resources/metrics/client/Client.d.ts +30 -4
  20. package/dist/cjs/api/resources/inboxes/resources/metrics/client/Client.js +102 -7
  21. package/dist/cjs/api/resources/inboxes/resources/metrics/client/requests/{QueryMetricsRequest.d.ts → QueryEventsRequest.d.ts} +1 -1
  22. package/dist/cjs/api/resources/inboxes/resources/metrics/client/requests/QueryEventsRequest.js +3 -0
  23. package/dist/cjs/api/resources/inboxes/resources/metrics/client/requests/QueryUsageRequest.d.ts +13 -0
  24. package/dist/cjs/api/resources/inboxes/resources/metrics/client/requests/QueryUsageRequest.js +3 -0
  25. package/dist/cjs/api/resources/inboxes/resources/metrics/client/requests/index.d.ts +2 -1
  26. package/dist/cjs/api/resources/inboxes/resources/webhooks/client/Client.d.ts +103 -0
  27. package/dist/cjs/api/resources/inboxes/resources/webhooks/client/Client.js +411 -0
  28. package/dist/cjs/api/resources/inboxes/resources/webhooks/client/index.d.ts +1 -0
  29. package/dist/cjs/api/resources/inboxes/resources/webhooks/client/index.js +17 -0
  30. package/dist/cjs/api/resources/inboxes/resources/webhooks/client/requests/InboxListWebhooksRequest.d.ts +10 -0
  31. package/dist/cjs/api/resources/inboxes/resources/webhooks/client/requests/InboxListWebhooksRequest.js +3 -0
  32. package/dist/cjs/api/resources/inboxes/resources/webhooks/client/requests/index.d.ts +1 -0
  33. package/dist/cjs/api/resources/inboxes/resources/webhooks/client/requests/index.js +2 -0
  34. package/dist/cjs/api/resources/inboxes/resources/webhooks/exports.d.ts +2 -0
  35. package/dist/cjs/api/resources/inboxes/resources/webhooks/exports.js +21 -0
  36. package/dist/cjs/api/resources/inboxes/resources/webhooks/index.d.ts +1 -0
  37. package/dist/cjs/api/resources/inboxes/resources/webhooks/index.js +17 -0
  38. package/dist/cjs/api/resources/metrics/client/Client.d.ts +27 -4
  39. package/dist/cjs/api/resources/metrics/client/Client.js +99 -7
  40. package/dist/cjs/api/resources/metrics/client/requests/{QueryMetricsRequest.d.ts → QueryEventsRequest.d.ts} +1 -1
  41. package/dist/cjs/api/resources/metrics/client/requests/QueryEventsRequest.js +3 -0
  42. package/dist/cjs/api/resources/metrics/client/requests/QueryUsageRequest.d.ts +13 -0
  43. package/dist/cjs/api/resources/metrics/client/requests/QueryUsageRequest.js +3 -0
  44. package/dist/cjs/api/resources/metrics/client/requests/index.d.ts +2 -1
  45. package/dist/cjs/api/resources/metrics/types/MetricEventType.d.ts +6 -3
  46. package/dist/cjs/api/resources/metrics/types/MetricEventType.js +6 -3
  47. package/dist/cjs/api/resources/metrics/types/Period.d.ts +2 -2
  48. package/dist/cjs/api/resources/metrics/types/QueryUsageResponse.d.ts +5 -0
  49. package/dist/cjs/api/resources/metrics/types/QueryUsageResponse.js +3 -0
  50. package/dist/cjs/api/resources/metrics/types/UsagePoint.d.ts +6 -0
  51. package/dist/cjs/api/resources/metrics/types/UsagePoint.js +3 -0
  52. package/dist/cjs/api/resources/metrics/types/UsageType.d.ts +14 -0
  53. package/dist/cjs/api/resources/metrics/types/UsageType.js +17 -0
  54. package/dist/cjs/api/resources/metrics/types/UsageTypes.d.ts +5 -0
  55. package/dist/cjs/api/resources/metrics/types/UsageTypes.js +3 -0
  56. package/dist/cjs/api/resources/metrics/types/index.d.ts +4 -0
  57. package/dist/cjs/api/resources/metrics/types/index.js +4 -0
  58. package/dist/cjs/api/resources/pods/client/Client.d.ts +3 -0
  59. package/dist/cjs/api/resources/pods/client/Client.js +5 -0
  60. package/dist/cjs/api/resources/pods/resources/index.d.ts +2 -0
  61. package/dist/cjs/api/resources/pods/resources/index.js +3 -1
  62. package/dist/cjs/api/resources/pods/resources/metrics/client/Client.d.ts +30 -4
  63. package/dist/cjs/api/resources/pods/resources/metrics/client/Client.js +102 -7
  64. package/dist/cjs/api/resources/pods/resources/metrics/client/requests/{QueryMetricsRequest.d.ts → QueryEventsRequest.d.ts} +1 -1
  65. package/dist/cjs/api/resources/pods/resources/metrics/client/requests/QueryEventsRequest.js +3 -0
  66. package/dist/cjs/api/resources/pods/resources/metrics/client/requests/QueryUsageRequest.d.ts +13 -0
  67. package/dist/cjs/api/resources/pods/resources/metrics/client/requests/QueryUsageRequest.js +3 -0
  68. package/dist/cjs/api/resources/pods/resources/metrics/client/requests/index.d.ts +2 -1
  69. package/dist/cjs/api/resources/pods/resources/webhooks/client/Client.d.ts +103 -0
  70. package/dist/cjs/api/resources/pods/resources/webhooks/client/Client.js +411 -0
  71. package/dist/cjs/api/resources/pods/resources/webhooks/client/index.d.ts +1 -0
  72. package/dist/cjs/api/resources/pods/resources/webhooks/client/index.js +17 -0
  73. package/dist/cjs/api/resources/pods/resources/webhooks/client/requests/PodListWebhooksRequest.d.ts +10 -0
  74. package/dist/cjs/api/resources/pods/resources/webhooks/client/requests/PodListWebhooksRequest.js +3 -0
  75. package/dist/cjs/api/resources/pods/resources/webhooks/client/requests/index.d.ts +1 -0
  76. package/dist/cjs/api/resources/pods/resources/webhooks/client/requests/index.js +2 -0
  77. package/dist/cjs/api/resources/pods/resources/webhooks/exports.d.ts +2 -0
  78. package/dist/cjs/api/resources/pods/resources/webhooks/exports.js +21 -0
  79. package/dist/cjs/api/resources/pods/resources/webhooks/index.d.ts +1 -0
  80. package/dist/cjs/api/resources/pods/resources/webhooks/index.js +17 -0
  81. package/dist/cjs/api/resources/webhooks/types/CreateInboxWebhookRequest.d.ts +10 -0
  82. package/dist/cjs/api/resources/webhooks/types/CreateInboxWebhookRequest.js +3 -0
  83. package/dist/cjs/api/resources/webhooks/types/CreatePodWebhookRequest.d.ts +9 -0
  84. package/dist/cjs/api/resources/webhooks/types/CreatePodWebhookRequest.js +3 -0
  85. package/dist/cjs/api/resources/webhooks/types/CreateWebhookEventTypes.d.ts +7 -0
  86. package/dist/cjs/api/resources/webhooks/types/CreateWebhookEventTypes.js +3 -0
  87. package/dist/cjs/api/resources/webhooks/types/CreateWebhookRequest.d.ts +1 -10
  88. package/dist/cjs/api/resources/webhooks/types/UpdateInboxWebhookRequest.d.ts +7 -0
  89. package/dist/cjs/api/resources/webhooks/types/UpdateInboxWebhookRequest.js +3 -0
  90. package/dist/cjs/api/resources/webhooks/types/UpdatePodWebhookRequest.d.ts +11 -0
  91. package/dist/cjs/api/resources/webhooks/types/UpdatePodWebhookRequest.js +3 -0
  92. package/dist/cjs/api/resources/webhooks/types/UpdateWebhookEventTypes.d.ts +10 -0
  93. package/dist/cjs/api/resources/webhooks/types/UpdateWebhookEventTypes.js +3 -0
  94. package/dist/cjs/api/resources/webhooks/types/UpdateWebhookRequest.d.ts +1 -14
  95. package/dist/cjs/api/resources/webhooks/types/index.d.ts +6 -0
  96. package/dist/cjs/api/resources/webhooks/types/index.js +6 -0
  97. package/dist/cjs/serialization/resources/drafts/types/CreateDraftForwardRequest.d.ts +30 -0
  98. package/dist/cjs/serialization/resources/drafts/types/CreateDraftForwardRequest.js +62 -0
  99. package/dist/cjs/serialization/resources/drafts/types/CreateDraftReplyAllRequest.d.ts +24 -0
  100. package/dist/cjs/serialization/resources/drafts/types/CreateDraftReplyAllRequest.js +56 -0
  101. package/dist/cjs/serialization/resources/drafts/types/CreateDraftReplyRequest.d.ts +32 -0
  102. package/dist/cjs/serialization/resources/drafts/types/CreateDraftReplyRequest.js +64 -0
  103. package/dist/cjs/serialization/resources/drafts/types/Draft.d.ts +2 -0
  104. package/dist/cjs/serialization/resources/drafts/types/Draft.js +2 -0
  105. package/dist/cjs/serialization/resources/drafts/types/DraftForwardOf.d.ts +7 -0
  106. package/dist/cjs/serialization/resources/drafts/types/DraftForwardOf.js +39 -0
  107. package/dist/cjs/serialization/resources/drafts/types/DraftItem.d.ts +2 -0
  108. package/dist/cjs/serialization/resources/drafts/types/DraftItem.js +2 -0
  109. package/dist/cjs/serialization/resources/drafts/types/DraftReplyAll.d.ts +7 -0
  110. package/dist/cjs/serialization/resources/drafts/types/DraftReplyAll.js +39 -0
  111. package/dist/cjs/serialization/resources/drafts/types/index.d.ts +5 -0
  112. package/dist/cjs/serialization/resources/drafts/types/index.js +5 -0
  113. package/dist/cjs/serialization/resources/metrics/types/MetricEventType.d.ts +1 -1
  114. package/dist/cjs/serialization/resources/metrics/types/MetricEventType.js +6 -3
  115. package/dist/cjs/serialization/resources/metrics/types/Period.d.ts +1 -1
  116. package/dist/cjs/serialization/resources/metrics/types/Period.js +1 -1
  117. package/dist/cjs/serialization/resources/metrics/types/QueryUsageResponse.d.ts +9 -0
  118. package/dist/cjs/serialization/resources/metrics/types/QueryUsageResponse.js +41 -0
  119. package/dist/cjs/serialization/resources/metrics/types/UsagePoint.d.ts +10 -0
  120. package/dist/cjs/serialization/resources/metrics/types/UsagePoint.js +42 -0
  121. package/dist/cjs/serialization/resources/metrics/types/UsageType.d.ts +7 -0
  122. package/dist/cjs/serialization/resources/metrics/types/UsageType.js +46 -0
  123. package/dist/cjs/serialization/resources/metrics/types/UsageTypes.d.ts +8 -0
  124. package/dist/cjs/serialization/resources/metrics/types/UsageTypes.js +40 -0
  125. package/dist/cjs/serialization/resources/metrics/types/index.d.ts +4 -0
  126. package/dist/cjs/serialization/resources/metrics/types/index.js +4 -0
  127. package/dist/cjs/serialization/resources/webhooks/types/CreateInboxWebhookRequest.d.ts +14 -0
  128. package/dist/cjs/serialization/resources/webhooks/types/CreateInboxWebhookRequest.js +46 -0
  129. package/dist/cjs/serialization/resources/webhooks/types/CreatePodWebhookRequest.d.ts +11 -0
  130. package/dist/cjs/serialization/resources/webhooks/types/CreatePodWebhookRequest.js +45 -0
  131. package/dist/cjs/serialization/resources/webhooks/types/CreateWebhookEventTypes.d.ts +8 -0
  132. package/dist/cjs/serialization/resources/webhooks/types/CreateWebhookEventTypes.js +6 -0
  133. package/dist/cjs/serialization/resources/webhooks/types/CreateWebhookRequest.d.ts +2 -9
  134. package/dist/cjs/serialization/resources/webhooks/types/CreateWebhookRequest.js +5 -10
  135. package/dist/cjs/serialization/resources/webhooks/types/UpdateInboxWebhookRequest.d.ts +10 -0
  136. package/dist/cjs/serialization/resources/webhooks/types/UpdateInboxWebhookRequest.js +42 -0
  137. package/dist/cjs/serialization/resources/webhooks/types/UpdatePodWebhookRequest.d.ts +12 -0
  138. package/dist/cjs/serialization/resources/webhooks/types/UpdatePodWebhookRequest.js +46 -0
  139. package/dist/cjs/serialization/resources/webhooks/types/UpdateWebhookEventTypes.d.ts +8 -0
  140. package/dist/cjs/serialization/resources/webhooks/types/UpdateWebhookEventTypes.js +6 -0
  141. package/dist/cjs/serialization/resources/webhooks/types/UpdateWebhookRequest.d.ts +2 -6
  142. package/dist/cjs/serialization/resources/webhooks/types/UpdateWebhookRequest.js +5 -7
  143. package/dist/cjs/serialization/resources/webhooks/types/index.d.ts +6 -0
  144. package/dist/cjs/serialization/resources/webhooks/types/index.js +6 -0
  145. package/dist/cjs/version.d.ts +1 -1
  146. package/dist/cjs/version.js +1 -1
  147. package/dist/esm/BaseClient.mjs +2 -2
  148. package/dist/esm/api/resources/drafts/types/CreateDraftForwardRequest.d.mts +21 -0
  149. package/dist/esm/api/resources/drafts/types/CreateDraftReplyAllRequest.d.mts +17 -0
  150. package/dist/esm/api/resources/drafts/types/CreateDraftReplyRequest.d.mts +22 -0
  151. package/dist/esm/api/resources/drafts/types/Draft.d.mts +1 -0
  152. package/dist/esm/api/resources/drafts/types/DraftForwardOf.d.mts +4 -0
  153. package/dist/esm/api/resources/drafts/types/DraftForwardOf.mjs +2 -0
  154. package/dist/esm/api/resources/drafts/types/DraftItem.d.mts +1 -0
  155. package/dist/esm/api/resources/drafts/types/DraftReplyAll.d.mts +4 -0
  156. package/dist/esm/api/resources/drafts/types/DraftReplyAll.mjs +2 -0
  157. package/dist/esm/api/resources/drafts/types/index.d.mts +5 -0
  158. package/dist/esm/api/resources/drafts/types/index.mjs +5 -0
  159. package/dist/esm/api/resources/inboxes/client/Client.d.mts +3 -0
  160. package/dist/esm/api/resources/inboxes/client/Client.mjs +5 -0
  161. package/dist/esm/api/resources/inboxes/resources/index.d.mts +2 -0
  162. package/dist/esm/api/resources/inboxes/resources/index.mjs +2 -0
  163. package/dist/esm/api/resources/inboxes/resources/messages/client/Client.d.mts +69 -0
  164. package/dist/esm/api/resources/inboxes/resources/messages/client/Client.mjs +264 -0
  165. package/dist/esm/api/resources/inboxes/resources/metrics/client/Client.d.mts +30 -4
  166. package/dist/esm/api/resources/inboxes/resources/metrics/client/Client.mjs +102 -7
  167. package/dist/esm/api/resources/{pods/resources/metrics/client/requests/QueryMetricsRequest.d.mts → inboxes/resources/metrics/client/requests/QueryEventsRequest.d.mts} +1 -1
  168. package/dist/esm/api/resources/inboxes/resources/metrics/client/requests/QueryEventsRequest.mjs +2 -0
  169. package/dist/esm/api/resources/inboxes/resources/metrics/client/requests/QueryUsageRequest.d.mts +13 -0
  170. package/dist/esm/api/resources/inboxes/resources/metrics/client/requests/QueryUsageRequest.mjs +2 -0
  171. package/dist/esm/api/resources/inboxes/resources/metrics/client/requests/index.d.mts +2 -1
  172. package/dist/esm/api/resources/inboxes/resources/webhooks/client/Client.d.mts +103 -0
  173. package/dist/esm/api/resources/inboxes/resources/webhooks/client/Client.mjs +374 -0
  174. package/dist/esm/api/resources/inboxes/resources/webhooks/client/index.d.mts +1 -0
  175. package/dist/esm/api/resources/inboxes/resources/webhooks/client/index.mjs +1 -0
  176. package/dist/esm/api/resources/inboxes/resources/webhooks/client/requests/InboxListWebhooksRequest.d.mts +10 -0
  177. package/dist/esm/api/resources/inboxes/resources/webhooks/client/requests/InboxListWebhooksRequest.mjs +2 -0
  178. package/dist/esm/api/resources/inboxes/resources/webhooks/client/requests/index.d.mts +1 -0
  179. package/dist/esm/api/resources/inboxes/resources/webhooks/client/requests/index.mjs +1 -0
  180. package/dist/esm/api/resources/inboxes/resources/webhooks/exports.d.mts +2 -0
  181. package/dist/esm/api/resources/inboxes/resources/webhooks/exports.mjs +3 -0
  182. package/dist/esm/api/resources/inboxes/resources/webhooks/index.d.mts +1 -0
  183. package/dist/esm/api/resources/inboxes/resources/webhooks/index.mjs +1 -0
  184. package/dist/esm/api/resources/metrics/client/Client.d.mts +27 -4
  185. package/dist/esm/api/resources/metrics/client/Client.mjs +99 -7
  186. package/dist/esm/api/resources/metrics/client/requests/{QueryMetricsRequest.d.mts → QueryEventsRequest.d.mts} +1 -1
  187. package/dist/esm/api/resources/metrics/client/requests/QueryEventsRequest.mjs +2 -0
  188. package/dist/esm/api/resources/metrics/client/requests/QueryUsageRequest.d.mts +13 -0
  189. package/dist/esm/api/resources/metrics/client/requests/QueryUsageRequest.mjs +2 -0
  190. package/dist/esm/api/resources/metrics/client/requests/index.d.mts +2 -1
  191. package/dist/esm/api/resources/metrics/types/MetricEventType.d.mts +6 -3
  192. package/dist/esm/api/resources/metrics/types/MetricEventType.mjs +6 -3
  193. package/dist/esm/api/resources/metrics/types/Period.d.mts +2 -2
  194. package/dist/esm/api/resources/metrics/types/QueryUsageResponse.d.mts +5 -0
  195. package/dist/esm/api/resources/metrics/types/QueryUsageResponse.mjs +2 -0
  196. package/dist/esm/api/resources/metrics/types/UsagePoint.d.mts +6 -0
  197. package/dist/esm/api/resources/metrics/types/UsagePoint.mjs +2 -0
  198. package/dist/esm/api/resources/metrics/types/UsageType.d.mts +14 -0
  199. package/dist/esm/api/resources/metrics/types/UsageType.mjs +14 -0
  200. package/dist/esm/api/resources/metrics/types/UsageTypes.d.mts +5 -0
  201. package/dist/esm/api/resources/metrics/types/UsageTypes.mjs +2 -0
  202. package/dist/esm/api/resources/metrics/types/index.d.mts +4 -0
  203. package/dist/esm/api/resources/metrics/types/index.mjs +4 -0
  204. package/dist/esm/api/resources/pods/client/Client.d.mts +3 -0
  205. package/dist/esm/api/resources/pods/client/Client.mjs +5 -0
  206. package/dist/esm/api/resources/pods/resources/index.d.mts +2 -0
  207. package/dist/esm/api/resources/pods/resources/index.mjs +2 -0
  208. package/dist/esm/api/resources/pods/resources/metrics/client/Client.d.mts +30 -4
  209. package/dist/esm/api/resources/pods/resources/metrics/client/Client.mjs +102 -7
  210. package/dist/esm/api/resources/{inboxes/resources/metrics/client/requests/QueryMetricsRequest.d.mts → pods/resources/metrics/client/requests/QueryEventsRequest.d.mts} +1 -1
  211. package/dist/esm/api/resources/pods/resources/metrics/client/requests/QueryEventsRequest.mjs +2 -0
  212. package/dist/esm/api/resources/pods/resources/metrics/client/requests/QueryUsageRequest.d.mts +13 -0
  213. package/dist/esm/api/resources/pods/resources/metrics/client/requests/QueryUsageRequest.mjs +2 -0
  214. package/dist/esm/api/resources/pods/resources/metrics/client/requests/index.d.mts +2 -1
  215. package/dist/esm/api/resources/pods/resources/webhooks/client/Client.d.mts +103 -0
  216. package/dist/esm/api/resources/pods/resources/webhooks/client/Client.mjs +374 -0
  217. package/dist/esm/api/resources/pods/resources/webhooks/client/index.d.mts +1 -0
  218. package/dist/esm/api/resources/pods/resources/webhooks/client/index.mjs +1 -0
  219. package/dist/esm/api/resources/pods/resources/webhooks/client/requests/PodListWebhooksRequest.d.mts +10 -0
  220. package/dist/esm/api/resources/pods/resources/webhooks/client/requests/PodListWebhooksRequest.mjs +2 -0
  221. package/dist/esm/api/resources/pods/resources/webhooks/client/requests/index.d.mts +1 -0
  222. package/dist/esm/api/resources/pods/resources/webhooks/client/requests/index.mjs +1 -0
  223. package/dist/esm/api/resources/pods/resources/webhooks/exports.d.mts +2 -0
  224. package/dist/esm/api/resources/pods/resources/webhooks/exports.mjs +3 -0
  225. package/dist/esm/api/resources/pods/resources/webhooks/index.d.mts +1 -0
  226. package/dist/esm/api/resources/pods/resources/webhooks/index.mjs +1 -0
  227. package/dist/esm/api/resources/webhooks/types/CreateInboxWebhookRequest.d.mts +10 -0
  228. package/dist/esm/api/resources/webhooks/types/CreateInboxWebhookRequest.mjs +2 -0
  229. package/dist/esm/api/resources/webhooks/types/CreatePodWebhookRequest.d.mts +9 -0
  230. package/dist/esm/api/resources/webhooks/types/CreatePodWebhookRequest.mjs +2 -0
  231. package/dist/esm/api/resources/webhooks/types/CreateWebhookEventTypes.d.mts +7 -0
  232. package/dist/esm/api/resources/webhooks/types/CreateWebhookEventTypes.mjs +2 -0
  233. package/dist/esm/api/resources/webhooks/types/CreateWebhookRequest.d.mts +1 -10
  234. package/dist/esm/api/resources/webhooks/types/UpdateInboxWebhookRequest.d.mts +7 -0
  235. package/dist/esm/api/resources/webhooks/types/UpdateInboxWebhookRequest.mjs +2 -0
  236. package/dist/esm/api/resources/webhooks/types/UpdatePodWebhookRequest.d.mts +11 -0
  237. package/dist/esm/api/resources/webhooks/types/UpdatePodWebhookRequest.mjs +2 -0
  238. package/dist/esm/api/resources/webhooks/types/UpdateWebhookEventTypes.d.mts +10 -0
  239. package/dist/esm/api/resources/webhooks/types/UpdateWebhookEventTypes.mjs +2 -0
  240. package/dist/esm/api/resources/webhooks/types/UpdateWebhookRequest.d.mts +1 -14
  241. package/dist/esm/api/resources/webhooks/types/index.d.mts +6 -0
  242. package/dist/esm/api/resources/webhooks/types/index.mjs +6 -0
  243. package/dist/esm/serialization/resources/drafts/types/CreateDraftForwardRequest.d.mts +30 -0
  244. package/dist/esm/serialization/resources/drafts/types/CreateDraftForwardRequest.mjs +26 -0
  245. package/dist/esm/serialization/resources/drafts/types/CreateDraftReplyAllRequest.d.mts +24 -0
  246. package/dist/esm/serialization/resources/drafts/types/CreateDraftReplyAllRequest.mjs +20 -0
  247. package/dist/esm/serialization/resources/drafts/types/CreateDraftReplyRequest.d.mts +32 -0
  248. package/dist/esm/serialization/resources/drafts/types/CreateDraftReplyRequest.mjs +28 -0
  249. package/dist/esm/serialization/resources/drafts/types/Draft.d.mts +2 -0
  250. package/dist/esm/serialization/resources/drafts/types/Draft.mjs +2 -0
  251. package/dist/esm/serialization/resources/drafts/types/DraftForwardOf.d.mts +7 -0
  252. package/dist/esm/serialization/resources/drafts/types/DraftForwardOf.mjs +3 -0
  253. package/dist/esm/serialization/resources/drafts/types/DraftItem.d.mts +2 -0
  254. package/dist/esm/serialization/resources/drafts/types/DraftItem.mjs +2 -0
  255. package/dist/esm/serialization/resources/drafts/types/DraftReplyAll.d.mts +7 -0
  256. package/dist/esm/serialization/resources/drafts/types/DraftReplyAll.mjs +3 -0
  257. package/dist/esm/serialization/resources/drafts/types/index.d.mts +5 -0
  258. package/dist/esm/serialization/resources/drafts/types/index.mjs +5 -0
  259. package/dist/esm/serialization/resources/metrics/types/MetricEventType.d.mts +1 -1
  260. package/dist/esm/serialization/resources/metrics/types/MetricEventType.mjs +6 -3
  261. package/dist/esm/serialization/resources/metrics/types/Period.d.mts +1 -1
  262. package/dist/esm/serialization/resources/metrics/types/Period.mjs +1 -1
  263. package/dist/esm/serialization/resources/metrics/types/QueryUsageResponse.d.mts +9 -0
  264. package/dist/esm/serialization/resources/metrics/types/QueryUsageResponse.mjs +5 -0
  265. package/dist/esm/serialization/resources/metrics/types/UsagePoint.d.mts +10 -0
  266. package/dist/esm/serialization/resources/metrics/types/UsagePoint.mjs +6 -0
  267. package/dist/esm/serialization/resources/metrics/types/UsageType.d.mts +7 -0
  268. package/dist/esm/serialization/resources/metrics/types/UsageType.mjs +10 -0
  269. package/dist/esm/serialization/resources/metrics/types/UsageTypes.d.mts +8 -0
  270. package/dist/esm/serialization/resources/metrics/types/UsageTypes.mjs +4 -0
  271. package/dist/esm/serialization/resources/metrics/types/index.d.mts +4 -0
  272. package/dist/esm/serialization/resources/metrics/types/index.mjs +4 -0
  273. package/dist/esm/serialization/resources/webhooks/types/CreateInboxWebhookRequest.d.mts +14 -0
  274. package/dist/esm/serialization/resources/webhooks/types/CreateInboxWebhookRequest.mjs +10 -0
  275. package/dist/esm/serialization/resources/webhooks/types/CreatePodWebhookRequest.d.mts +11 -0
  276. package/dist/esm/serialization/resources/webhooks/types/CreatePodWebhookRequest.mjs +9 -0
  277. package/dist/esm/serialization/resources/webhooks/types/CreateWebhookEventTypes.d.mts +8 -0
  278. package/dist/esm/serialization/resources/webhooks/types/CreateWebhookEventTypes.mjs +3 -0
  279. package/dist/esm/serialization/resources/webhooks/types/CreateWebhookRequest.d.mts +2 -9
  280. package/dist/esm/serialization/resources/webhooks/types/CreateWebhookRequest.mjs +5 -10
  281. package/dist/esm/serialization/resources/webhooks/types/UpdateInboxWebhookRequest.d.mts +10 -0
  282. package/dist/esm/serialization/resources/webhooks/types/UpdateInboxWebhookRequest.mjs +6 -0
  283. package/dist/esm/serialization/resources/webhooks/types/UpdatePodWebhookRequest.d.mts +12 -0
  284. package/dist/esm/serialization/resources/webhooks/types/UpdatePodWebhookRequest.mjs +10 -0
  285. package/dist/esm/serialization/resources/webhooks/types/UpdateWebhookEventTypes.d.mts +8 -0
  286. package/dist/esm/serialization/resources/webhooks/types/UpdateWebhookEventTypes.mjs +3 -0
  287. package/dist/esm/serialization/resources/webhooks/types/UpdateWebhookRequest.d.mts +2 -6
  288. package/dist/esm/serialization/resources/webhooks/types/UpdateWebhookRequest.mjs +5 -7
  289. package/dist/esm/serialization/resources/webhooks/types/index.d.mts +6 -0
  290. package/dist/esm/serialization/resources/webhooks/types/index.mjs +6 -0
  291. package/dist/esm/version.d.mts +1 -1
  292. package/dist/esm/version.mjs +1 -1
  293. package/dist/llms.txt +8 -4
  294. package/package.json +23 -1
  295. package/reference.md +1702 -437
  296. /package/dist/cjs/api/resources/{inboxes/resources/metrics/client/requests/QueryMetricsRequest.js → drafts/types/CreateDraftForwardRequest.js} +0 -0
  297. /package/dist/cjs/api/resources/{metrics/client/requests/QueryMetricsRequest.js → drafts/types/CreateDraftReplyAllRequest.js} +0 -0
  298. /package/dist/cjs/api/resources/{pods/resources/metrics/client/requests/QueryMetricsRequest.js → drafts/types/CreateDraftReplyRequest.js} +0 -0
  299. /package/dist/esm/api/resources/{inboxes/resources/metrics/client/requests/QueryMetricsRequest.mjs → drafts/types/CreateDraftForwardRequest.mjs} +0 -0
  300. /package/dist/esm/api/resources/{metrics/client/requests/QueryMetricsRequest.mjs → drafts/types/CreateDraftReplyAllRequest.mjs} +0 -0
  301. /package/dist/esm/api/resources/{pods/resources/metrics/client/requests/QueryMetricsRequest.mjs → drafts/types/CreateDraftReplyRequest.mjs} +0 -0
@@ -22,24 +22,30 @@ export class MetricsClient {
22
22
  this._options = normalizeClientOptionsWithAuth(options);
23
23
  }
24
24
  /**
25
+ * Counts of email events (sent, delivered, bounced, etc.) over time for
26
+ * the inbox. Defaults to the last 24 hours; `start` must be within the
27
+ * last 90 days, and a future `end` is clamped to now. Omit `period` for
28
+ * individual event counts, or set it to sum counts into buckets of that
29
+ * many seconds.
30
+ *
25
31
  * **CLI:**
26
32
  * ```bash
27
33
  * agentmail inboxes:metrics query --inbox-id <inbox_id>
28
34
  * ```
29
35
  *
30
36
  * @param {AgentMail.inboxes.InboxId} inbox_id
31
- * @param {AgentMail.inboxes.QueryMetricsRequest} request
37
+ * @param {AgentMail.inboxes.QueryEventsRequest} request
32
38
  * @param {MetricsClient.RequestOptions} requestOptions - Request-specific configuration.
33
39
  *
34
40
  * @throws {@link AgentMail.ValidationError}
35
41
  *
36
42
  * @example
37
- * await client.inboxes.metrics.query("inbox_id")
43
+ * await client.inboxes.metrics.queryEvents("inbox_id")
38
44
  */
39
- query(inbox_id, request = {}, requestOptions) {
40
- return core.HttpResponsePromise.fromPromise(this.__query(inbox_id, request, requestOptions));
45
+ queryEvents(inbox_id, request = {}, requestOptions) {
46
+ return core.HttpResponsePromise.fromPromise(this.__queryEvents(inbox_id, request, requestOptions));
41
47
  }
42
- __query(inbox_id_1) {
48
+ __queryEvents(inbox_id_1) {
43
49
  return __awaiter(this, arguments, void 0, function* (inbox_id, request = {}, requestOptions) {
44
50
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
45
51
  const { eventTypes, start, end, period, limit, descending } = request;
@@ -64,7 +70,7 @@ export class MetricsClient {
64
70
  const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
65
71
  const _response = yield core.fetcher({
66
72
  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)
67
- .http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/metrics`),
73
+ .http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/metrics/events`),
68
74
  method: "GET",
69
75
  headers: _headers,
70
76
  queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
@@ -104,7 +110,96 @@ export class MetricsClient {
104
110
  });
105
111
  }
106
112
  }
107
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v0/inboxes/{inbox_id}/metrics");
113
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v0/inboxes/{inbox_id}/metrics/events");
114
+ });
115
+ }
116
+ /**
117
+ * Cumulative usage series for the inbox. Each point is the running total
118
+ * of the usage type at that timestamp, not the change within the bucket.
119
+ * Inbox-scoped queries carry `storage_bytes`, `message_count`, and
120
+ * `thread_count`; requested types that don't apply to the scope are
121
+ * ignored. Defaults to the last 24 hours; `start` must be within the
122
+ * last 90 days, and a future `end` is clamped to now. The range divided
123
+ * by `period` must not exceed 1000 buckets.
124
+ *
125
+ * @param {AgentMail.inboxes.InboxId} inbox_id
126
+ * @param {AgentMail.inboxes.QueryUsageRequest} request
127
+ * @param {MetricsClient.RequestOptions} requestOptions - Request-specific configuration.
128
+ *
129
+ * @throws {@link AgentMail.ValidationError}
130
+ *
131
+ * @example
132
+ * await client.inboxes.metrics.queryUsage("inbox_id")
133
+ */
134
+ queryUsage(inbox_id, request = {}, requestOptions) {
135
+ return core.HttpResponsePromise.fromPromise(this.__queryUsage(inbox_id, request, requestOptions));
136
+ }
137
+ __queryUsage(inbox_id_1) {
138
+ return __awaiter(this, arguments, void 0, function* (inbox_id, request = {}, requestOptions) {
139
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
140
+ const { usageTypes, start, end, period, limit, descending } = request;
141
+ const _queryParams = {
142
+ usage_types: usageTypes != null
143
+ ? toJson(serializers.UsageTypes.jsonOrThrow(usageTypes, {
144
+ unrecognizedObjectKeys: "strip",
145
+ omitUndefined: true,
146
+ }))
147
+ : undefined,
148
+ start: start != null
149
+ ? serializers.Start.jsonOrThrow(start, { unrecognizedObjectKeys: "strip", omitUndefined: true })
150
+ : undefined,
151
+ end: end != null
152
+ ? serializers.End.jsonOrThrow(end, { unrecognizedObjectKeys: "strip", omitUndefined: true })
153
+ : undefined,
154
+ period,
155
+ limit,
156
+ descending,
157
+ };
158
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
159
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
160
+ const _response = yield core.fetcher({
161
+ 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)
162
+ .http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/metrics/usage`),
163
+ method: "GET",
164
+ headers: _headers,
165
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
166
+ 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,
167
+ 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,
168
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
169
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
170
+ logging: this._options.logging,
171
+ });
172
+ if (_response.ok) {
173
+ return {
174
+ data: serializers.QueryUsageResponse.parseOrThrow(_response.body, {
175
+ unrecognizedObjectKeys: "passthrough",
176
+ allowUnrecognizedUnionMembers: true,
177
+ allowUnrecognizedEnumValues: true,
178
+ skipValidation: true,
179
+ breadcrumbsPrefix: ["response"],
180
+ }),
181
+ rawResponse: _response.rawResponse,
182
+ };
183
+ }
184
+ if (_response.error.reason === "status-code") {
185
+ switch (_response.error.statusCode) {
186
+ case 400:
187
+ throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
188
+ unrecognizedObjectKeys: "passthrough",
189
+ allowUnrecognizedUnionMembers: true,
190
+ allowUnrecognizedEnumValues: true,
191
+ skipValidation: true,
192
+ breadcrumbsPrefix: ["response"],
193
+ }), _response.rawResponse);
194
+ default:
195
+ throw new errors.AgentMailError({
196
+ statusCode: _response.error.statusCode,
197
+ body: _response.error.body,
198
+ rawResponse: _response.rawResponse,
199
+ });
200
+ }
201
+ }
202
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v0/inboxes/{inbox_id}/metrics/usage");
108
203
  });
109
204
  }
110
205
  }
@@ -3,7 +3,7 @@ import type * as AgentMail from "../../../../../../index.mjs";
3
3
  * @example
4
4
  * {}
5
5
  */
6
- export interface QueryMetricsRequest {
6
+ export interface QueryEventsRequest {
7
7
  eventTypes?: AgentMail.MetricEventTypes;
8
8
  start?: AgentMail.Start;
9
9
  end?: AgentMail.End;
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,13 @@
1
+ import type * as AgentMail from "../../../../../../index.mjs";
2
+ /**
3
+ * @example
4
+ * {}
5
+ */
6
+ export interface QueryUsageRequest {
7
+ usageTypes?: AgentMail.UsageTypes;
8
+ start?: AgentMail.Start;
9
+ end?: AgentMail.End;
10
+ period?: AgentMail.Period;
11
+ limit?: AgentMail.MetricLimit;
12
+ descending?: AgentMail.Descending;
13
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -1 +1,2 @@
1
- export type { QueryMetricsRequest } from "./QueryMetricsRequest.mjs";
1
+ export type { QueryEventsRequest } from "./QueryEventsRequest.mjs";
2
+ export type { QueryUsageRequest } from "./QueryUsageRequest.mjs";
@@ -0,0 +1,103 @@
1
+ import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../BaseClient.mjs";
2
+ import { type NormalizedClientOptionsWithAuth } from "../../../../../../BaseClient.mjs";
3
+ import * as core from "../../../../../../core/index.mjs";
4
+ import * as AgentMail from "../../../../../index.mjs";
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
+ }
@@ -0,0 +1,374 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ import { normalizeClientOptionsWithAuth } from "../../../../../../BaseClient.mjs";
12
+ import { mergeHeaders } from "../../../../../../core/headers.mjs";
13
+ import * as core from "../../../../../../core/index.mjs";
14
+ import * as environments from "../../../../../../environments.mjs";
15
+ import { handleNonStatusCodeError } from "../../../../../../errors/handleNonStatusCodeError.mjs";
16
+ import * as errors from "../../../../../../errors/index.mjs";
17
+ import * as serializers from "../../../../../../serialization/index.mjs";
18
+ import * as AgentMail from "../../../../../index.mjs";
19
+ export class WebhooksClient {
20
+ constructor(options = {}) {
21
+ this._options = normalizeClientOptionsWithAuth(options);
22
+ }
23
+ /**
24
+ * **CLI:**
25
+ * ```bash
26
+ * agentmail inboxes:webhooks list --inbox-id <inbox_id>
27
+ * ```
28
+ *
29
+ * @param {AgentMail.inboxes.InboxId} inbox_id
30
+ * @param {AgentMail.inboxes.InboxListWebhooksRequest} request
31
+ * @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
32
+ *
33
+ * @example
34
+ * await client.inboxes.webhooks.list("inbox_id")
35
+ */
36
+ list(inbox_id, request = {}, requestOptions) {
37
+ return core.HttpResponsePromise.fromPromise(this.__list(inbox_id, request, requestOptions));
38
+ }
39
+ __list(inbox_id_1) {
40
+ return __awaiter(this, arguments, void 0, function* (inbox_id, request = {}, requestOptions) {
41
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
42
+ const { limit, pageToken, ascending } = request;
43
+ const _queryParams = {
44
+ limit,
45
+ page_token: pageToken,
46
+ ascending,
47
+ };
48
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
49
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
50
+ const _response = yield core.fetcher({
51
+ 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)
52
+ .http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/webhooks`),
53
+ method: "GET",
54
+ headers: _headers,
55
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
56
+ 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,
57
+ 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,
58
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
59
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
60
+ logging: this._options.logging,
61
+ });
62
+ if (_response.ok) {
63
+ return {
64
+ data: serializers.webhooks.ListWebhooksResponse.parseOrThrow(_response.body, {
65
+ unrecognizedObjectKeys: "passthrough",
66
+ allowUnrecognizedUnionMembers: true,
67
+ allowUnrecognizedEnumValues: true,
68
+ skipValidation: true,
69
+ breadcrumbsPrefix: ["response"],
70
+ }),
71
+ rawResponse: _response.rawResponse,
72
+ };
73
+ }
74
+ if (_response.error.reason === "status-code") {
75
+ throw new errors.AgentMailError({
76
+ statusCode: _response.error.statusCode,
77
+ body: _response.error.body,
78
+ rawResponse: _response.rawResponse,
79
+ });
80
+ }
81
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v0/inboxes/{inbox_id}/webhooks");
82
+ });
83
+ }
84
+ /**
85
+ * **CLI:**
86
+ * ```bash
87
+ * agentmail inboxes:webhooks get --inbox-id <inbox_id> --webhook-id <webhook_id>
88
+ * ```
89
+ *
90
+ * @param {AgentMail.inboxes.InboxId} inbox_id
91
+ * @param {AgentMail.webhooks.WebhookId} webhook_id
92
+ * @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
93
+ *
94
+ * @throws {@link AgentMail.NotFoundError}
95
+ *
96
+ * @example
97
+ * await client.inboxes.webhooks.get("inbox_id", "webhook_id")
98
+ */
99
+ get(inbox_id, webhook_id, requestOptions) {
100
+ return core.HttpResponsePromise.fromPromise(this.__get(inbox_id, webhook_id, requestOptions));
101
+ }
102
+ __get(inbox_id, webhook_id, requestOptions) {
103
+ return __awaiter(this, void 0, void 0, function* () {
104
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
105
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
106
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
107
+ const _response = yield core.fetcher({
108
+ 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)
109
+ .http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/webhooks/${core.url.encodePathParam(serializers.webhooks.WebhookId.jsonOrThrow(webhook_id, { omitUndefined: true }))}`),
110
+ method: "GET",
111
+ headers: _headers,
112
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
113
+ 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,
114
+ 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,
115
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
116
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
117
+ logging: this._options.logging,
118
+ });
119
+ if (_response.ok) {
120
+ return {
121
+ data: serializers.webhooks.Webhook.parseOrThrow(_response.body, {
122
+ unrecognizedObjectKeys: "passthrough",
123
+ allowUnrecognizedUnionMembers: true,
124
+ allowUnrecognizedEnumValues: true,
125
+ skipValidation: true,
126
+ breadcrumbsPrefix: ["response"],
127
+ }),
128
+ rawResponse: _response.rawResponse,
129
+ };
130
+ }
131
+ if (_response.error.reason === "status-code") {
132
+ switch (_response.error.statusCode) {
133
+ case 404:
134
+ throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
135
+ unrecognizedObjectKeys: "passthrough",
136
+ allowUnrecognizedUnionMembers: true,
137
+ allowUnrecognizedEnumValues: true,
138
+ skipValidation: true,
139
+ breadcrumbsPrefix: ["response"],
140
+ }), _response.rawResponse);
141
+ default:
142
+ throw new errors.AgentMailError({
143
+ statusCode: _response.error.statusCode,
144
+ body: _response.error.body,
145
+ rawResponse: _response.rawResponse,
146
+ });
147
+ }
148
+ }
149
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v0/inboxes/{inbox_id}/webhooks/{webhook_id}");
150
+ });
151
+ }
152
+ /**
153
+ * Create a webhook scoped to this inbox.
154
+ *
155
+ * **CLI:**
156
+ * ```bash
157
+ * agentmail inboxes:webhooks create --inbox-id <inbox_id> --url https://example.com/webhook --event-type message.received
158
+ * ```
159
+ *
160
+ * @param {AgentMail.inboxes.InboxId} inbox_id
161
+ * @param {AgentMail.webhooks.CreateInboxWebhookRequest} request
162
+ * @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
163
+ *
164
+ * @throws {@link AgentMail.ValidationError}
165
+ *
166
+ * @example
167
+ * await client.inboxes.webhooks.create("inbox_id", {
168
+ * url: "url",
169
+ * eventTypes: ["message.received", "message.received"]
170
+ * })
171
+ */
172
+ create(inbox_id, request, requestOptions) {
173
+ return core.HttpResponsePromise.fromPromise(this.__create(inbox_id, request, requestOptions));
174
+ }
175
+ __create(inbox_id, request, requestOptions) {
176
+ return __awaiter(this, void 0, void 0, function* () {
177
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
178
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
179
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
180
+ const _response = yield core.fetcher({
181
+ 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)
182
+ .http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/webhooks`),
183
+ method: "POST",
184
+ headers: _headers,
185
+ contentType: "application/json",
186
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
187
+ requestType: "json",
188
+ body: serializers.webhooks.CreateInboxWebhookRequest.jsonOrThrow(request, {
189
+ unrecognizedObjectKeys: "strip",
190
+ omitUndefined: true,
191
+ }),
192
+ 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,
193
+ 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,
194
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
195
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
196
+ logging: this._options.logging,
197
+ });
198
+ if (_response.ok) {
199
+ return {
200
+ data: serializers.webhooks.Webhook.parseOrThrow(_response.body, {
201
+ unrecognizedObjectKeys: "passthrough",
202
+ allowUnrecognizedUnionMembers: true,
203
+ allowUnrecognizedEnumValues: true,
204
+ skipValidation: true,
205
+ breadcrumbsPrefix: ["response"],
206
+ }),
207
+ rawResponse: _response.rawResponse,
208
+ };
209
+ }
210
+ if (_response.error.reason === "status-code") {
211
+ switch (_response.error.statusCode) {
212
+ case 400:
213
+ throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
214
+ unrecognizedObjectKeys: "passthrough",
215
+ allowUnrecognizedUnionMembers: true,
216
+ allowUnrecognizedEnumValues: true,
217
+ skipValidation: true,
218
+ breadcrumbsPrefix: ["response"],
219
+ }), _response.rawResponse);
220
+ default:
221
+ throw new errors.AgentMailError({
222
+ statusCode: _response.error.statusCode,
223
+ body: _response.error.body,
224
+ rawResponse: _response.rawResponse,
225
+ });
226
+ }
227
+ }
228
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v0/inboxes/{inbox_id}/webhooks");
229
+ });
230
+ }
231
+ /**
232
+ * **CLI:**
233
+ * ```bash
234
+ * agentmail inboxes:webhooks update --inbox-id <inbox_id> --webhook-id <webhook_id> --event-type message.received
235
+ * ```
236
+ *
237
+ * @param {AgentMail.inboxes.InboxId} inbox_id
238
+ * @param {AgentMail.webhooks.WebhookId} webhook_id
239
+ * @param {AgentMail.webhooks.UpdateInboxWebhookRequest} request
240
+ * @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
241
+ *
242
+ * @throws {@link AgentMail.NotFoundError}
243
+ * @throws {@link AgentMail.ValidationError}
244
+ *
245
+ * @example
246
+ * await client.inboxes.webhooks.update("inbox_id", "webhook_id", {})
247
+ */
248
+ update(inbox_id, webhook_id, request, requestOptions) {
249
+ return core.HttpResponsePromise.fromPromise(this.__update(inbox_id, webhook_id, request, requestOptions));
250
+ }
251
+ __update(inbox_id, webhook_id, request, requestOptions) {
252
+ return __awaiter(this, void 0, void 0, function* () {
253
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
254
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
255
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
256
+ const _response = yield core.fetcher({
257
+ 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)
258
+ .http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/webhooks/${core.url.encodePathParam(serializers.webhooks.WebhookId.jsonOrThrow(webhook_id, { omitUndefined: true }))}`),
259
+ method: "PATCH",
260
+ headers: _headers,
261
+ contentType: "application/json",
262
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
263
+ requestType: "json",
264
+ body: serializers.webhooks.UpdateInboxWebhookRequest.jsonOrThrow(request, {
265
+ unrecognizedObjectKeys: "strip",
266
+ omitUndefined: true,
267
+ }),
268
+ 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,
269
+ 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,
270
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
271
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
272
+ logging: this._options.logging,
273
+ });
274
+ if (_response.ok) {
275
+ return {
276
+ data: serializers.webhooks.Webhook.parseOrThrow(_response.body, {
277
+ unrecognizedObjectKeys: "passthrough",
278
+ allowUnrecognizedUnionMembers: true,
279
+ allowUnrecognizedEnumValues: true,
280
+ skipValidation: true,
281
+ breadcrumbsPrefix: ["response"],
282
+ }),
283
+ rawResponse: _response.rawResponse,
284
+ };
285
+ }
286
+ if (_response.error.reason === "status-code") {
287
+ switch (_response.error.statusCode) {
288
+ case 404:
289
+ throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
290
+ unrecognizedObjectKeys: "passthrough",
291
+ allowUnrecognizedUnionMembers: true,
292
+ allowUnrecognizedEnumValues: true,
293
+ skipValidation: true,
294
+ breadcrumbsPrefix: ["response"],
295
+ }), _response.rawResponse);
296
+ case 400:
297
+ throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
298
+ unrecognizedObjectKeys: "passthrough",
299
+ allowUnrecognizedUnionMembers: true,
300
+ allowUnrecognizedEnumValues: true,
301
+ skipValidation: true,
302
+ breadcrumbsPrefix: ["response"],
303
+ }), _response.rawResponse);
304
+ default:
305
+ throw new errors.AgentMailError({
306
+ statusCode: _response.error.statusCode,
307
+ body: _response.error.body,
308
+ rawResponse: _response.rawResponse,
309
+ });
310
+ }
311
+ }
312
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "PATCH", "/v0/inboxes/{inbox_id}/webhooks/{webhook_id}");
313
+ });
314
+ }
315
+ /**
316
+ * **CLI:**
317
+ * ```bash
318
+ * agentmail inboxes:webhooks delete --inbox-id <inbox_id> --webhook-id <webhook_id>
319
+ * ```
320
+ *
321
+ * @param {AgentMail.inboxes.InboxId} inbox_id
322
+ * @param {AgentMail.webhooks.WebhookId} webhook_id
323
+ * @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
324
+ *
325
+ * @throws {@link AgentMail.NotFoundError}
326
+ *
327
+ * @example
328
+ * await client.inboxes.webhooks.delete("inbox_id", "webhook_id")
329
+ */
330
+ delete(inbox_id, webhook_id, requestOptions) {
331
+ return core.HttpResponsePromise.fromPromise(this.__delete(inbox_id, webhook_id, requestOptions));
332
+ }
333
+ __delete(inbox_id, webhook_id, requestOptions) {
334
+ return __awaiter(this, void 0, void 0, function* () {
335
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
336
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
337
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
338
+ const _response = yield core.fetcher({
339
+ 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)
340
+ .http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/webhooks/${core.url.encodePathParam(serializers.webhooks.WebhookId.jsonOrThrow(webhook_id, { omitUndefined: true }))}`),
341
+ method: "DELETE",
342
+ headers: _headers,
343
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
344
+ 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,
345
+ 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,
346
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
347
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
348
+ logging: this._options.logging,
349
+ });
350
+ if (_response.ok) {
351
+ return { data: undefined, rawResponse: _response.rawResponse };
352
+ }
353
+ if (_response.error.reason === "status-code") {
354
+ switch (_response.error.statusCode) {
355
+ case 404:
356
+ throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
357
+ unrecognizedObjectKeys: "passthrough",
358
+ allowUnrecognizedUnionMembers: true,
359
+ allowUnrecognizedEnumValues: true,
360
+ skipValidation: true,
361
+ breadcrumbsPrefix: ["response"],
362
+ }), _response.rawResponse);
363
+ default:
364
+ throw new errors.AgentMailError({
365
+ statusCode: _response.error.statusCode,
366
+ body: _response.error.body,
367
+ rawResponse: _response.rawResponse,
368
+ });
369
+ }
370
+ }
371
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v0/inboxes/{inbox_id}/webhooks/{webhook_id}");
372
+ });
373
+ }
374
+ }