agentmail 0.4.13 → 0.4.15

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 (247) hide show
  1. package/README.md +46 -14
  2. package/dist/cjs/BaseClient.js +2 -2
  3. package/dist/cjs/Client.d.ts +12 -0
  4. package/dist/cjs/Client.js +74 -0
  5. package/dist/cjs/api/errors/UnprocessableError.d.ts +6 -0
  6. package/dist/cjs/api/errors/UnprocessableError.js +54 -0
  7. package/dist/cjs/api/errors/index.d.ts +1 -0
  8. package/dist/cjs/api/errors/index.js +1 -0
  9. package/dist/cjs/api/resources/agent/exports.d.ts +2 -0
  10. package/dist/cjs/api/resources/agent/exports.js +21 -0
  11. package/dist/cjs/api/resources/apiKeys/exports.d.ts +2 -0
  12. package/dist/cjs/api/resources/apiKeys/exports.js +21 -0
  13. package/dist/cjs/api/resources/attachments/exports.d.ts +1 -0
  14. package/dist/cjs/api/resources/attachments/exports.js +18 -0
  15. package/dist/cjs/api/resources/domains/exports.d.ts +2 -0
  16. package/dist/cjs/api/resources/domains/exports.js +21 -0
  17. package/dist/cjs/api/resources/drafts/exports.d.ts +2 -0
  18. package/dist/cjs/api/resources/drafts/exports.js +21 -0
  19. package/dist/cjs/api/resources/events/exports.d.ts +1 -0
  20. package/dist/cjs/api/resources/events/exports.js +18 -0
  21. package/dist/cjs/api/resources/inboxes/exports.d.ts +3 -0
  22. package/dist/cjs/api/resources/inboxes/exports.js +22 -0
  23. package/dist/cjs/api/resources/inboxes/resources/apiKeys/exports.d.ts +2 -0
  24. package/dist/cjs/api/resources/inboxes/resources/apiKeys/exports.js +21 -0
  25. package/dist/cjs/api/resources/inboxes/resources/drafts/exports.d.ts +2 -0
  26. package/dist/cjs/api/resources/inboxes/resources/drafts/exports.js +21 -0
  27. package/dist/cjs/api/resources/inboxes/resources/lists/exports.d.ts +2 -0
  28. package/dist/cjs/api/resources/inboxes/resources/lists/exports.js +21 -0
  29. package/dist/cjs/api/resources/inboxes/resources/messages/client/Client.d.ts +1 -1
  30. package/dist/cjs/api/resources/inboxes/resources/messages/client/Client.js +1 -1
  31. package/dist/cjs/api/resources/inboxes/resources/messages/exports.d.ts +2 -0
  32. package/dist/cjs/api/resources/inboxes/resources/messages/exports.js +21 -0
  33. package/dist/cjs/api/resources/inboxes/resources/metrics/exports.d.ts +2 -0
  34. package/dist/cjs/api/resources/inboxes/resources/metrics/exports.js +21 -0
  35. package/dist/cjs/api/resources/inboxes/resources/threads/client/Client.d.ts +17 -0
  36. package/dist/cjs/api/resources/inboxes/resources/threads/client/Client.js +90 -0
  37. package/dist/cjs/api/resources/inboxes/resources/threads/exports.d.ts +2 -0
  38. package/dist/cjs/api/resources/inboxes/resources/threads/exports.js +21 -0
  39. package/dist/cjs/api/resources/lists/exports.d.ts +2 -0
  40. package/dist/cjs/api/resources/lists/exports.js +21 -0
  41. package/dist/cjs/api/resources/messages/exports.d.ts +1 -0
  42. package/dist/cjs/api/resources/messages/exports.js +18 -0
  43. package/dist/cjs/api/resources/messages/types/UpdateMessageResponse.d.ts +5 -0
  44. package/dist/cjs/api/resources/messages/types/UpdateMessageResponse.js +3 -0
  45. package/dist/cjs/api/resources/messages/types/index.d.ts +1 -0
  46. package/dist/cjs/api/resources/messages/types/index.js +1 -0
  47. package/dist/cjs/api/resources/metrics/exports.d.ts +2 -0
  48. package/dist/cjs/api/resources/metrics/exports.js +21 -0
  49. package/dist/cjs/api/resources/metrics/types/QueryMetricsResponse.d.ts +1 -1
  50. package/dist/cjs/api/resources/organizations/exports.d.ts +2 -0
  51. package/dist/cjs/api/resources/organizations/exports.js +21 -0
  52. package/dist/cjs/api/resources/pods/exports.d.ts +3 -0
  53. package/dist/cjs/api/resources/pods/exports.js +22 -0
  54. package/dist/cjs/api/resources/pods/resources/apiKeys/exports.d.ts +2 -0
  55. package/dist/cjs/api/resources/pods/resources/apiKeys/exports.js +21 -0
  56. package/dist/cjs/api/resources/pods/resources/domains/exports.d.ts +2 -0
  57. package/dist/cjs/api/resources/pods/resources/domains/exports.js +21 -0
  58. package/dist/cjs/api/resources/pods/resources/drafts/exports.d.ts +2 -0
  59. package/dist/cjs/api/resources/pods/resources/drafts/exports.js +21 -0
  60. package/dist/cjs/api/resources/pods/resources/inboxes/exports.d.ts +2 -0
  61. package/dist/cjs/api/resources/pods/resources/inboxes/exports.js +21 -0
  62. package/dist/cjs/api/resources/pods/resources/lists/exports.d.ts +2 -0
  63. package/dist/cjs/api/resources/pods/resources/lists/exports.js +21 -0
  64. package/dist/cjs/api/resources/pods/resources/metrics/exports.d.ts +2 -0
  65. package/dist/cjs/api/resources/pods/resources/metrics/exports.js +21 -0
  66. package/dist/cjs/api/resources/pods/resources/threads/client/Client.d.ts +17 -0
  67. package/dist/cjs/api/resources/pods/resources/threads/client/Client.js +90 -0
  68. package/dist/cjs/api/resources/pods/resources/threads/exports.d.ts +2 -0
  69. package/dist/cjs/api/resources/pods/resources/threads/exports.js +21 -0
  70. package/dist/cjs/api/resources/threads/client/Client.d.ts +16 -0
  71. package/dist/cjs/api/resources/threads/client/Client.js +89 -0
  72. package/dist/cjs/api/resources/threads/exports.d.ts +2 -0
  73. package/dist/cjs/api/resources/threads/exports.js +21 -0
  74. package/dist/cjs/api/resources/threads/types/UpdateThreadRequest.d.ts +6 -0
  75. package/dist/cjs/api/resources/threads/types/UpdateThreadRequest.js +3 -0
  76. package/dist/cjs/api/resources/threads/types/UpdateThreadResponse.d.ts +5 -0
  77. package/dist/cjs/api/resources/threads/types/UpdateThreadResponse.js +3 -0
  78. package/dist/cjs/api/resources/threads/types/index.d.ts +2 -0
  79. package/dist/cjs/api/resources/threads/types/index.js +2 -0
  80. package/dist/cjs/api/resources/webhooks/exports.d.ts +3 -0
  81. package/dist/cjs/api/resources/webhooks/exports.js +22 -0
  82. package/dist/cjs/api/resources/webhooks/resources/events/exports.d.ts +1 -0
  83. package/dist/cjs/api/resources/webhooks/resources/events/exports.js +18 -0
  84. package/dist/cjs/api/resources/websockets/client/Client.d.ts +6 -0
  85. package/dist/cjs/api/resources/websockets/client/Client.js +8 -3
  86. package/dist/cjs/api/resources/websockets/client/Socket.d.ts +2 -2
  87. package/dist/cjs/api/resources/websockets/client/Socket.js +2 -2
  88. package/dist/cjs/api/resources/websockets/exports.d.ts +3 -0
  89. package/dist/cjs/api/resources/websockets/exports.js +23 -0
  90. package/dist/cjs/core/fetcher/BinaryResponse.d.ts +1 -1
  91. package/dist/cjs/core/fetcher/Fetcher.js +8 -2
  92. package/dist/cjs/core/fetcher/index.d.ts +2 -0
  93. package/dist/cjs/core/fetcher/index.js +3 -1
  94. package/dist/cjs/core/fetcher/makePassthroughRequest.d.ts +49 -0
  95. package/dist/cjs/core/fetcher/makePassthroughRequest.js +135 -0
  96. package/dist/cjs/core/fetcher/makeRequest.d.ts +6 -1
  97. package/dist/cjs/core/fetcher/makeRequest.js +30 -9
  98. package/dist/cjs/core/runtime/runtime.js +8 -7
  99. package/dist/cjs/core/schemas/builders/list/list.js +12 -17
  100. package/dist/cjs/core/schemas/builders/object/object.js +102 -40
  101. package/dist/cjs/core/schemas/builders/object-like/getObjectLikeUtils.js +10 -3
  102. package/dist/cjs/core/schemas/builders/record/index.d.ts +2 -2
  103. package/dist/cjs/core/schemas/builders/record/index.js +2 -1
  104. package/dist/cjs/core/schemas/builders/record/record.d.ts +2 -1
  105. package/dist/cjs/core/schemas/builders/record/record.js +63 -25
  106. package/dist/cjs/core/schemas/builders/record/types.d.ts +2 -0
  107. package/dist/cjs/core/schemas/builders/union/union.js +9 -12
  108. package/dist/cjs/core/schemas/utils/isPlainObject.js +4 -6
  109. package/dist/cjs/core/websocket/ws.d.ts +14 -2
  110. package/dist/cjs/core/websocket/ws.js +51 -7
  111. package/dist/cjs/serialization/resources/messages/types/UpdateMessageResponse.d.ts +12 -0
  112. package/dist/cjs/serialization/resources/messages/types/UpdateMessageResponse.js +44 -0
  113. package/dist/cjs/serialization/resources/messages/types/index.d.ts +1 -0
  114. package/dist/cjs/serialization/resources/messages/types/index.js +1 -0
  115. package/dist/cjs/serialization/resources/metrics/types/QueryMetricsResponse.js +1 -1
  116. package/dist/cjs/serialization/resources/threads/types/UpdateThreadRequest.d.ts +10 -0
  117. package/dist/cjs/serialization/resources/threads/types/UpdateThreadRequest.js +42 -0
  118. package/dist/cjs/serialization/resources/threads/types/UpdateThreadResponse.d.ts +12 -0
  119. package/dist/cjs/serialization/resources/threads/types/UpdateThreadResponse.js +44 -0
  120. package/dist/cjs/serialization/resources/threads/types/index.d.ts +2 -0
  121. package/dist/cjs/serialization/resources/threads/types/index.js +2 -0
  122. package/dist/cjs/version.d.ts +1 -1
  123. package/dist/cjs/version.js +1 -1
  124. package/dist/esm/BaseClient.mjs +2 -2
  125. package/dist/esm/Client.d.mts +12 -0
  126. package/dist/esm/Client.mjs +41 -0
  127. package/dist/esm/api/errors/UnprocessableError.d.mts +6 -0
  128. package/dist/esm/api/errors/UnprocessableError.mjs +17 -0
  129. package/dist/esm/api/errors/index.d.mts +1 -0
  130. package/dist/esm/api/errors/index.mjs +1 -0
  131. package/dist/esm/api/resources/agent/exports.d.mts +2 -0
  132. package/dist/esm/api/resources/agent/exports.mjs +3 -0
  133. package/dist/esm/api/resources/apiKeys/exports.d.mts +2 -0
  134. package/dist/esm/api/resources/apiKeys/exports.mjs +3 -0
  135. package/dist/esm/api/resources/attachments/exports.d.mts +1 -0
  136. package/dist/esm/api/resources/attachments/exports.mjs +2 -0
  137. package/dist/esm/api/resources/domains/exports.d.mts +2 -0
  138. package/dist/esm/api/resources/domains/exports.mjs +3 -0
  139. package/dist/esm/api/resources/drafts/exports.d.mts +2 -0
  140. package/dist/esm/api/resources/drafts/exports.mjs +3 -0
  141. package/dist/esm/api/resources/events/exports.d.mts +1 -0
  142. package/dist/esm/api/resources/events/exports.mjs +2 -0
  143. package/dist/esm/api/resources/inboxes/exports.d.mts +3 -0
  144. package/dist/esm/api/resources/inboxes/exports.mjs +4 -0
  145. package/dist/esm/api/resources/inboxes/resources/apiKeys/exports.d.mts +2 -0
  146. package/dist/esm/api/resources/inboxes/resources/apiKeys/exports.mjs +3 -0
  147. package/dist/esm/api/resources/inboxes/resources/drafts/exports.d.mts +2 -0
  148. package/dist/esm/api/resources/inboxes/resources/drafts/exports.mjs +3 -0
  149. package/dist/esm/api/resources/inboxes/resources/lists/exports.d.mts +2 -0
  150. package/dist/esm/api/resources/inboxes/resources/lists/exports.mjs +3 -0
  151. package/dist/esm/api/resources/inboxes/resources/messages/client/Client.d.mts +1 -1
  152. package/dist/esm/api/resources/inboxes/resources/messages/client/Client.mjs +1 -1
  153. package/dist/esm/api/resources/inboxes/resources/messages/exports.d.mts +2 -0
  154. package/dist/esm/api/resources/inboxes/resources/messages/exports.mjs +3 -0
  155. package/dist/esm/api/resources/inboxes/resources/metrics/exports.d.mts +2 -0
  156. package/dist/esm/api/resources/inboxes/resources/metrics/exports.mjs +3 -0
  157. package/dist/esm/api/resources/inboxes/resources/threads/client/Client.d.mts +17 -0
  158. package/dist/esm/api/resources/inboxes/resources/threads/client/Client.mjs +90 -0
  159. package/dist/esm/api/resources/inboxes/resources/threads/exports.d.mts +2 -0
  160. package/dist/esm/api/resources/inboxes/resources/threads/exports.mjs +3 -0
  161. package/dist/esm/api/resources/lists/exports.d.mts +2 -0
  162. package/dist/esm/api/resources/lists/exports.mjs +3 -0
  163. package/dist/esm/api/resources/messages/exports.d.mts +1 -0
  164. package/dist/esm/api/resources/messages/exports.mjs +2 -0
  165. package/dist/esm/api/resources/messages/types/UpdateMessageResponse.d.mts +5 -0
  166. package/dist/esm/api/resources/messages/types/UpdateMessageResponse.mjs +2 -0
  167. package/dist/esm/api/resources/messages/types/index.d.mts +1 -0
  168. package/dist/esm/api/resources/messages/types/index.mjs +1 -0
  169. package/dist/esm/api/resources/metrics/exports.d.mts +2 -0
  170. package/dist/esm/api/resources/metrics/exports.mjs +3 -0
  171. package/dist/esm/api/resources/metrics/types/QueryMetricsResponse.d.mts +1 -1
  172. package/dist/esm/api/resources/organizations/exports.d.mts +2 -0
  173. package/dist/esm/api/resources/organizations/exports.mjs +3 -0
  174. package/dist/esm/api/resources/pods/exports.d.mts +3 -0
  175. package/dist/esm/api/resources/pods/exports.mjs +4 -0
  176. package/dist/esm/api/resources/pods/resources/apiKeys/exports.d.mts +2 -0
  177. package/dist/esm/api/resources/pods/resources/apiKeys/exports.mjs +3 -0
  178. package/dist/esm/api/resources/pods/resources/domains/exports.d.mts +2 -0
  179. package/dist/esm/api/resources/pods/resources/domains/exports.mjs +3 -0
  180. package/dist/esm/api/resources/pods/resources/drafts/exports.d.mts +2 -0
  181. package/dist/esm/api/resources/pods/resources/drafts/exports.mjs +3 -0
  182. package/dist/esm/api/resources/pods/resources/inboxes/exports.d.mts +2 -0
  183. package/dist/esm/api/resources/pods/resources/inboxes/exports.mjs +3 -0
  184. package/dist/esm/api/resources/pods/resources/lists/exports.d.mts +2 -0
  185. package/dist/esm/api/resources/pods/resources/lists/exports.mjs +3 -0
  186. package/dist/esm/api/resources/pods/resources/metrics/exports.d.mts +2 -0
  187. package/dist/esm/api/resources/pods/resources/metrics/exports.mjs +3 -0
  188. package/dist/esm/api/resources/pods/resources/threads/client/Client.d.mts +17 -0
  189. package/dist/esm/api/resources/pods/resources/threads/client/Client.mjs +90 -0
  190. package/dist/esm/api/resources/pods/resources/threads/exports.d.mts +2 -0
  191. package/dist/esm/api/resources/pods/resources/threads/exports.mjs +3 -0
  192. package/dist/esm/api/resources/threads/client/Client.d.mts +16 -0
  193. package/dist/esm/api/resources/threads/client/Client.mjs +89 -0
  194. package/dist/esm/api/resources/threads/exports.d.mts +2 -0
  195. package/dist/esm/api/resources/threads/exports.mjs +3 -0
  196. package/dist/esm/api/resources/threads/types/UpdateThreadRequest.d.mts +6 -0
  197. package/dist/esm/api/resources/threads/types/UpdateThreadRequest.mjs +2 -0
  198. package/dist/esm/api/resources/threads/types/UpdateThreadResponse.d.mts +5 -0
  199. package/dist/esm/api/resources/threads/types/UpdateThreadResponse.mjs +2 -0
  200. package/dist/esm/api/resources/threads/types/index.d.mts +2 -0
  201. package/dist/esm/api/resources/threads/types/index.mjs +2 -0
  202. package/dist/esm/api/resources/webhooks/exports.d.mts +3 -0
  203. package/dist/esm/api/resources/webhooks/exports.mjs +4 -0
  204. package/dist/esm/api/resources/webhooks/resources/events/exports.d.mts +1 -0
  205. package/dist/esm/api/resources/webhooks/resources/events/exports.mjs +2 -0
  206. package/dist/esm/api/resources/websockets/client/Client.d.mts +6 -0
  207. package/dist/esm/api/resources/websockets/client/Client.mjs +8 -3
  208. package/dist/esm/api/resources/websockets/client/Socket.d.mts +2 -2
  209. package/dist/esm/api/resources/websockets/client/Socket.mjs +2 -2
  210. package/dist/esm/api/resources/websockets/exports.d.mts +3 -0
  211. package/dist/esm/api/resources/websockets/exports.mjs +4 -0
  212. package/dist/esm/core/fetcher/BinaryResponse.d.mts +1 -1
  213. package/dist/esm/core/fetcher/Fetcher.mjs +8 -2
  214. package/dist/esm/core/fetcher/index.d.mts +2 -0
  215. package/dist/esm/core/fetcher/index.mjs +1 -0
  216. package/dist/esm/core/fetcher/makePassthroughRequest.d.mts +49 -0
  217. package/dist/esm/core/fetcher/makePassthroughRequest.mjs +132 -0
  218. package/dist/esm/core/fetcher/makeRequest.d.mts +6 -1
  219. package/dist/esm/core/fetcher/makeRequest.mjs +28 -9
  220. package/dist/esm/core/runtime/runtime.mjs +8 -7
  221. package/dist/esm/core/schemas/builders/list/list.mjs +12 -17
  222. package/dist/esm/core/schemas/builders/object/object.mjs +102 -40
  223. package/dist/esm/core/schemas/builders/object-like/getObjectLikeUtils.mjs +10 -3
  224. package/dist/esm/core/schemas/builders/record/index.d.mts +2 -2
  225. package/dist/esm/core/schemas/builders/record/index.mjs +1 -1
  226. package/dist/esm/core/schemas/builders/record/record.d.mts +2 -1
  227. package/dist/esm/core/schemas/builders/record/record.mjs +62 -25
  228. package/dist/esm/core/schemas/builders/record/types.d.mts +2 -0
  229. package/dist/esm/core/schemas/builders/union/union.mjs +9 -12
  230. package/dist/esm/core/schemas/utils/isPlainObject.mjs +4 -6
  231. package/dist/esm/core/websocket/ws.d.mts +14 -2
  232. package/dist/esm/core/websocket/ws.mjs +51 -7
  233. package/dist/esm/serialization/resources/messages/types/UpdateMessageResponse.d.mts +12 -0
  234. package/dist/esm/serialization/resources/messages/types/UpdateMessageResponse.mjs +8 -0
  235. package/dist/esm/serialization/resources/messages/types/index.d.mts +1 -0
  236. package/dist/esm/serialization/resources/messages/types/index.mjs +1 -0
  237. package/dist/esm/serialization/resources/metrics/types/QueryMetricsResponse.mjs +1 -1
  238. package/dist/esm/serialization/resources/threads/types/UpdateThreadRequest.d.mts +10 -0
  239. package/dist/esm/serialization/resources/threads/types/UpdateThreadRequest.mjs +6 -0
  240. package/dist/esm/serialization/resources/threads/types/UpdateThreadResponse.d.mts +12 -0
  241. package/dist/esm/serialization/resources/threads/types/UpdateThreadResponse.mjs +8 -0
  242. package/dist/esm/serialization/resources/threads/types/index.d.mts +2 -0
  243. package/dist/esm/serialization/resources/threads/types/index.mjs +2 -0
  244. package/dist/esm/version.d.mts +1 -1
  245. package/dist/esm/version.mjs +1 -1
  246. package/package.json +305 -13
  247. package/reference.md +231 -1
@@ -39,13 +39,13 @@ const index_js_1 = require("../runtime/index.js");
39
39
  const qs_js_1 = require("../url/qs.js");
40
40
  const Events = __importStar(require("./events.js"));
41
41
  const getGlobalWebSocket = () => {
42
- if (typeof WebSocket !== "undefined") {
42
+ if (index_js_1.RUNTIME.type === "node" || index_js_1.RUNTIME.type === "bun" || index_js_1.RUNTIME.type === "deno") {
43
+ return ws_1.WebSocket;
44
+ }
45
+ else if (typeof WebSocket !== "undefined") {
43
46
  // @ts-ignore
44
47
  return WebSocket;
45
48
  }
46
- else if (index_js_1.RUNTIME.type === "node") {
47
- return ws_1.WebSocket;
48
- }
49
49
  return undefined;
50
50
  };
51
51
  /**
@@ -64,7 +64,7 @@ const DEFAULT_OPTIONS = {
64
64
  debug: false,
65
65
  };
66
66
  class ReconnectingWebSocket {
67
- constructor({ url, protocols, options, headers, queryParameters }) {
67
+ constructor({ url, protocols, options, headers, queryParameters, abortSignal }) {
68
68
  this._listeners = {
69
69
  error: [],
70
70
  message: [],
@@ -98,6 +98,27 @@ class ReconnectingWebSocket {
98
98
  * this indicates that the connection is ready to send and receive data
99
99
  */
100
100
  this.onopen = null;
101
+ this._handleAbort = () => {
102
+ if (this._closeCalled) {
103
+ return;
104
+ }
105
+ this._debug("abort signal fired");
106
+ this._shouldReconnect = false;
107
+ this._closeCalled = true;
108
+ this._clearTimeouts();
109
+ if (this._ws) {
110
+ this._removeListeners();
111
+ // Absorb async errors emitted by ws when closing during CONNECTING state
112
+ this._ws.addEventListener("error", () => { });
113
+ try {
114
+ this._ws.close(1000, "aborted");
115
+ this._handleClose(new Events.CloseEvent(1000, "aborted", this));
116
+ }
117
+ catch (_error) {
118
+ // ignore
119
+ }
120
+ }
121
+ };
101
122
  this._handleOpen = (event) => {
102
123
  this._debug("open event");
103
124
  const { minUptime = DEFAULT_OPTIONS.minUptime } = this._options;
@@ -148,6 +169,10 @@ class ReconnectingWebSocket {
148
169
  this._options = options !== null && options !== void 0 ? options : DEFAULT_OPTIONS;
149
170
  this._headers = headers;
150
171
  this._queryParameters = queryParameters;
172
+ this._abortSignal = abortSignal;
173
+ if (this._abortSignal) {
174
+ this._abortSignal.addEventListener("abort", this._handleAbort, { once: true });
175
+ }
151
176
  if (this._options.startClosed) {
152
177
  this._shouldReconnect = false;
153
178
  }
@@ -211,7 +236,9 @@ class ReconnectingWebSocket {
211
236
  if (this._ws) {
212
237
  return this._ws.readyState;
213
238
  }
214
- return this._options.startClosed ? ReconnectingWebSocket.CLOSED : ReconnectingWebSocket.CONNECTING;
239
+ return this._options.startClosed
240
+ ? ReconnectingWebSocket.ReadyState.CLOSED
241
+ : ReconnectingWebSocket.ReadyState.CONNECTING;
215
242
  }
216
243
  /**
217
244
  * The URL as resolved by the constructor
@@ -340,9 +367,14 @@ class ReconnectingWebSocket {
340
367
  throw Error("Invalid URL");
341
368
  }
342
369
  _connect() {
370
+ var _a;
343
371
  if (this._connectLock || !this._shouldReconnect) {
344
372
  return;
345
373
  }
374
+ if ((_a = this._abortSignal) === null || _a === void 0 ? void 0 : _a.aborted) {
375
+ this._debug("connect aborted");
376
+ return;
377
+ }
346
378
  this._connectLock = true;
347
379
  const { maxRetries = DEFAULT_OPTIONS.maxRetries, connectionTimeout = DEFAULT_OPTIONS.connectionTimeout, WebSocket = getGlobalWebSocket(), } = this._options;
348
380
  if (this._retryCount >= maxRetries) {
@@ -358,7 +390,9 @@ class ReconnectingWebSocket {
358
390
  this._wait()
359
391
  .then(() => this._getNextUrl(this._url))
360
392
  .then((url) => {
361
- if (this._closeCalled) {
393
+ var _a;
394
+ if (this._closeCalled || ((_a = this._abortSignal) === null || _a === void 0 ? void 0 : _a.aborted)) {
395
+ this._connectLock = false;
362
396
  return;
363
397
  }
364
398
  const options = {};
@@ -388,6 +422,8 @@ class ReconnectingWebSocket {
388
422
  return;
389
423
  }
390
424
  this._removeListeners();
425
+ // Absorb async errors emitted by ws when closing during CONNECTING state
426
+ this._ws.addEventListener("error", () => { });
391
427
  try {
392
428
  this._ws.close(code, reason);
393
429
  this._handleClose(new Events.CloseEvent(code, reason, this));
@@ -442,3 +478,11 @@ ReconnectingWebSocket.CONNECTING = 0;
442
478
  ReconnectingWebSocket.OPEN = 1;
443
479
  ReconnectingWebSocket.CLOSING = 2;
444
480
  ReconnectingWebSocket.CLOSED = 3;
481
+ (function (ReconnectingWebSocket) {
482
+ ReconnectingWebSocket.ReadyState = {
483
+ CONNECTING: 0,
484
+ OPEN: 1,
485
+ CLOSING: 2,
486
+ CLOSED: 3,
487
+ };
488
+ })(ReconnectingWebSocket || (exports.ReconnectingWebSocket = ReconnectingWebSocket = {}));
@@ -0,0 +1,12 @@
1
+ import type * as AgentMail from "../../../../api/index.js";
2
+ import * as core from "../../../../core/index.js";
3
+ import type * as serializers from "../../../index.js";
4
+ import { MessageId } from "./MessageId.js";
5
+ import { MessageLabels } from "./MessageLabels.js";
6
+ export declare const UpdateMessageResponse: core.serialization.ObjectSchema<serializers.UpdateMessageResponse.Raw, AgentMail.UpdateMessageResponse>;
7
+ export declare namespace UpdateMessageResponse {
8
+ interface Raw {
9
+ message_id: MessageId.Raw;
10
+ labels: MessageLabels.Raw;
11
+ }
12
+ }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.UpdateMessageResponse = void 0;
38
+ const core = __importStar(require("../../../../core/index.js"));
39
+ const MessageId_js_1 = require("./MessageId.js");
40
+ const MessageLabels_js_1 = require("./MessageLabels.js");
41
+ exports.UpdateMessageResponse = core.serialization.object({
42
+ messageId: core.serialization.property("message_id", MessageId_js_1.MessageId),
43
+ labels: MessageLabels_js_1.MessageLabels,
44
+ });
@@ -34,3 +34,4 @@ export * from "./SendMessageRequest.js";
34
34
  export * from "./SendMessageResponse.js";
35
35
  export * from "./SendMessageTo.js";
36
36
  export * from "./UpdateMessageRequest.js";
37
+ export * from "./UpdateMessageResponse.js";
@@ -50,3 +50,4 @@ __exportStar(require("./SendMessageRequest.js"), exports);
50
50
  __exportStar(require("./SendMessageResponse.js"), exports);
51
51
  __exportStar(require("./SendMessageTo.js"), exports);
52
52
  __exportStar(require("./UpdateMessageRequest.js"), exports);
53
+ __exportStar(require("./UpdateMessageResponse.js"), exports);
@@ -38,4 +38,4 @@ exports.QueryMetricsResponse = void 0;
38
38
  const core = __importStar(require("../../../../core/index.js"));
39
39
  const MetricBucket_js_1 = require("./MetricBucket.js");
40
40
  const MetricEventType_js_1 = require("./MetricEventType.js");
41
- exports.QueryMetricsResponse = core.serialization.record(MetricEventType_js_1.MetricEventType, core.serialization.list(MetricBucket_js_1.MetricBucket).optional());
41
+ exports.QueryMetricsResponse = core.serialization.partialRecord(MetricEventType_js_1.MetricEventType, core.serialization.list(MetricBucket_js_1.MetricBucket).optional());
@@ -0,0 +1,10 @@
1
+ import type * as AgentMail from "../../../../api/index.js";
2
+ import * as core from "../../../../core/index.js";
3
+ import type * as serializers from "../../../index.js";
4
+ export declare const UpdateThreadRequest: core.serialization.ObjectSchema<serializers.UpdateThreadRequest.Raw, AgentMail.UpdateThreadRequest>;
5
+ export declare namespace UpdateThreadRequest {
6
+ interface Raw {
7
+ add_labels?: string[] | null;
8
+ remove_labels?: string[] | null;
9
+ }
10
+ }
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.UpdateThreadRequest = void 0;
38
+ const core = __importStar(require("../../../../core/index.js"));
39
+ exports.UpdateThreadRequest = core.serialization.object({
40
+ addLabels: core.serialization.property("add_labels", core.serialization.list(core.serialization.string()).optional()),
41
+ removeLabels: core.serialization.property("remove_labels", core.serialization.list(core.serialization.string()).optional()),
42
+ });
@@ -0,0 +1,12 @@
1
+ import type * as AgentMail from "../../../../api/index.js";
2
+ import * as core from "../../../../core/index.js";
3
+ import type * as serializers from "../../../index.js";
4
+ import { ThreadId } from "./ThreadId.js";
5
+ import { ThreadLabels } from "./ThreadLabels.js";
6
+ export declare const UpdateThreadResponse: core.serialization.ObjectSchema<serializers.UpdateThreadResponse.Raw, AgentMail.UpdateThreadResponse>;
7
+ export declare namespace UpdateThreadResponse {
8
+ interface Raw {
9
+ thread_id: ThreadId.Raw;
10
+ labels: ThreadLabels.Raw;
11
+ }
12
+ }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.UpdateThreadResponse = void 0;
38
+ const core = __importStar(require("../../../../core/index.js"));
39
+ const ThreadId_js_1 = require("./ThreadId.js");
40
+ const ThreadLabels_js_1 = require("./ThreadLabels.js");
41
+ exports.UpdateThreadResponse = core.serialization.object({
42
+ threadId: core.serialization.property("thread_id", ThreadId_js_1.ThreadId),
43
+ labels: ThreadLabels_js_1.ThreadLabels,
44
+ });
@@ -16,3 +16,5 @@ export * from "./ThreadSize.js";
16
16
  export * from "./ThreadSubject.js";
17
17
  export * from "./ThreadTimestamp.js";
18
18
  export * from "./ThreadUpdatedAt.js";
19
+ export * from "./UpdateThreadRequest.js";
20
+ export * from "./UpdateThreadResponse.js";
@@ -32,3 +32,5 @@ __exportStar(require("./ThreadSize.js"), exports);
32
32
  __exportStar(require("./ThreadSubject.js"), exports);
33
33
  __exportStar(require("./ThreadTimestamp.js"), exports);
34
34
  __exportStar(require("./ThreadUpdatedAt.js"), exports);
35
+ __exportStar(require("./UpdateThreadRequest.js"), exports);
36
+ __exportStar(require("./UpdateThreadResponse.js"), exports);
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.4.13";
1
+ export declare const SDK_VERSION = "0.4.15";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "0.4.13";
4
+ exports.SDK_VERSION = "0.4.15";
@@ -6,8 +6,8 @@ export function normalizeClientOptions(options) {
6
6
  const headers = mergeHeaders({
7
7
  "X-Fern-Language": "JavaScript",
8
8
  "X-Fern-SDK-Name": "agentmail",
9
- "X-Fern-SDK-Version": "0.4.13",
10
- "User-Agent": "agentmail/0.4.13",
9
+ "X-Fern-SDK-Version": "0.4.15",
10
+ "User-Agent": "agentmail/0.4.15",
11
11
  "X-Fern-Runtime": core.RUNTIME.type,
12
12
  "X-Fern-Runtime-Version": core.RUNTIME.version,
13
13
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -12,6 +12,7 @@ import { WebhooksClient } from "./api/resources/webhooks/client/Client.mjs";
12
12
  import { WebsocketsClient } from "./api/resources/websockets/client/Client.mjs";
13
13
  import type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.mjs";
14
14
  import { type NormalizedClientOptionsWithAuth } from "./BaseClient.mjs";
15
+ import * as core from "./core/index.mjs";
15
16
  export declare namespace AgentMailClient {
16
17
  type Options = BaseClientOptions;
17
18
  interface RequestOptions extends BaseRequestOptions {
@@ -44,4 +45,15 @@ export declare class AgentMailClient {
44
45
  get organizations(): OrganizationsClient;
45
46
  get threads(): ThreadsClient;
46
47
  get websockets(): WebsocketsClient;
48
+ /**
49
+ * Make a passthrough request using the SDK's configured auth, retry, logging, etc.
50
+ * This is useful for making requests to endpoints not yet supported in the SDK.
51
+ * The input can be a URL string, URL object, or Request object. Relative paths are resolved against the configured base URL.
52
+ *
53
+ * @param {Request | string | URL} input - The URL, path, or Request object.
54
+ * @param {RequestInit} init - Standard fetch RequestInit options.
55
+ * @param {core.PassthroughRequest.RequestOptions} requestOptions - Per-request overrides (timeout, retries, headers, abort signal).
56
+ * @returns {Promise<Response>} A standard Response object.
57
+ */
58
+ fetch(input: Request | string | URL, init?: RequestInit, requestOptions?: core.PassthroughRequest.RequestOptions): Promise<Response>;
47
59
  }
@@ -1,4 +1,13 @@
1
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
+ };
2
11
  import { AgentClient } from "./api/resources/agent/client/Client.mjs";
3
12
  import { ApiKeysClient } from "./api/resources/apiKeys/client/Client.mjs";
4
13
  import { DomainsClient } from "./api/resources/domains/client/Client.mjs";
@@ -12,6 +21,8 @@ import { ThreadsClient } from "./api/resources/threads/client/Client.mjs";
12
21
  import { WebhooksClient } from "./api/resources/webhooks/client/Client.mjs";
13
22
  import { WebsocketsClient } from "./api/resources/websockets/client/Client.mjs";
14
23
  import { normalizeClientOptionsWithAuth } from "./BaseClient.mjs";
24
+ import * as core from "./core/index.mjs";
25
+ import * as environments from "./environments.mjs";
15
26
  export class AgentMailClient {
16
27
  constructor(options = {}) {
17
28
  this._options = normalizeClientOptionsWithAuth(options);
@@ -64,4 +75,34 @@ export class AgentMailClient {
64
75
  var _a;
65
76
  return ((_a = this._websockets) !== null && _a !== void 0 ? _a : (this._websockets = new WebsocketsClient(this._options)));
66
77
  }
78
+ /**
79
+ * Make a passthrough request using the SDK's configured auth, retry, logging, etc.
80
+ * This is useful for making requests to endpoints not yet supported in the SDK.
81
+ * The input can be a URL string, URL object, or Request object. Relative paths are resolved against the configured base URL.
82
+ *
83
+ * @param {Request | string | URL} input - The URL, path, or Request object.
84
+ * @param {RequestInit} init - Standard fetch RequestInit options.
85
+ * @param {core.PassthroughRequest.RequestOptions} requestOptions - Per-request overrides (timeout, retries, headers, abort signal).
86
+ * @returns {Promise<Response>} A standard Response object.
87
+ */
88
+ fetch(input, init, requestOptions) {
89
+ return __awaiter(this, void 0, void 0, function* () {
90
+ var _a;
91
+ return core.makePassthroughRequest(input, init, {
92
+ baseUrl: (_a = this._options.baseUrl) !== null && _a !== void 0 ? _a : (() => __awaiter(this, void 0, void 0, function* () {
93
+ var _a;
94
+ const env = yield core.Supplier.get(this._options.environment);
95
+ return typeof env === "string"
96
+ ? env
97
+ : ((_a = env === null || env === void 0 ? void 0 : env.http) !== null && _a !== void 0 ? _a : environments.AgentMailEnvironment.Prod.http);
98
+ })),
99
+ headers: this._options.headers,
100
+ timeoutInSeconds: this._options.timeoutInSeconds,
101
+ maxRetries: this._options.maxRetries,
102
+ fetch: this._options.fetch,
103
+ logging: this._options.logging,
104
+ getAuthHeaders: () => __awaiter(this, void 0, void 0, function* () { return (yield this._options.authProvider.getAuthRequest()).headers; }),
105
+ }, requestOptions);
106
+ });
107
+ }
67
108
  }
@@ -0,0 +1,6 @@
1
+ import type * as core from "../../core/index.mjs";
2
+ import * as errors from "../../errors/index.mjs";
3
+ import type * as AgentMail from "../index.mjs";
4
+ export declare class UnprocessableError extends errors.AgentMailError {
5
+ constructor(body: AgentMail.ErrorResponse, rawResponse?: core.RawResponse);
6
+ }
@@ -0,0 +1,17 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ import * as errors from "../../errors/index.mjs";
3
+ export class UnprocessableError extends errors.AgentMailError {
4
+ constructor(body, rawResponse) {
5
+ super({
6
+ message: "UnprocessableError",
7
+ statusCode: 422,
8
+ body: body,
9
+ rawResponse: rawResponse,
10
+ });
11
+ Object.setPrototypeOf(this, new.target.prototype);
12
+ if (Error.captureStackTrace) {
13
+ Error.captureStackTrace(this, this.constructor);
14
+ }
15
+ this.name = this.constructor.name;
16
+ }
17
+ }
@@ -1,3 +1,4 @@
1
1
  export * from "./IsTakenError.mjs";
2
2
  export * from "./NotFoundError.mjs";
3
+ export * from "./UnprocessableError.mjs";
3
4
  export * from "./ValidationError.mjs";
@@ -1,3 +1,4 @@
1
1
  export * from "./IsTakenError.mjs";
2
2
  export * from "./NotFoundError.mjs";
3
+ export * from "./UnprocessableError.mjs";
3
4
  export * from "./ValidationError.mjs";
@@ -0,0 +1,2 @@
1
+ export { AgentClient } from "./client/Client.mjs";
2
+ export * from "./client/index.mjs";
@@ -0,0 +1,3 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export { AgentClient } from "./client/Client.mjs";
3
+ export * from "./client/index.mjs";
@@ -0,0 +1,2 @@
1
+ export { ApiKeysClient } from "./client/Client.mjs";
2
+ export * from "./client/index.mjs";
@@ -0,0 +1,3 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export { ApiKeysClient } from "./client/Client.mjs";
3
+ export * from "./client/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./index.mjs";
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export * from "./index.mjs";
@@ -0,0 +1,2 @@
1
+ export { DomainsClient } from "./client/Client.mjs";
2
+ export * from "./client/index.mjs";
@@ -0,0 +1,3 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export { DomainsClient } from "./client/Client.mjs";
3
+ export * from "./client/index.mjs";
@@ -0,0 +1,2 @@
1
+ export { DraftsClient } from "./client/Client.mjs";
2
+ export * from "./client/index.mjs";
@@ -0,0 +1,3 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export { DraftsClient } from "./client/Client.mjs";
3
+ export * from "./client/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./index.mjs";
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export * from "./index.mjs";
@@ -0,0 +1,3 @@
1
+ export { InboxesClient } from "./client/Client.mjs";
2
+ export * from "./client/index.mjs";
3
+ export * from "./resources/index.mjs";
@@ -0,0 +1,4 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export { InboxesClient } from "./client/Client.mjs";
3
+ export * from "./client/index.mjs";
4
+ export * from "./resources/index.mjs";
@@ -0,0 +1,2 @@
1
+ export { ApiKeysClient } from "./client/Client.mjs";
2
+ export * from "./client/index.mjs";
@@ -0,0 +1,3 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export { ApiKeysClient } from "./client/Client.mjs";
3
+ export * from "./client/index.mjs";
@@ -0,0 +1,2 @@
1
+ export { DraftsClient } from "./client/Client.mjs";
2
+ export * from "./client/index.mjs";
@@ -0,0 +1,3 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export { DraftsClient } from "./client/Client.mjs";
3
+ export * from "./client/index.mjs";
@@ -0,0 +1,2 @@
1
+ export { ListsClient } from "./client/Client.mjs";
2
+ export * from "./client/index.mjs";
@@ -0,0 +1,3 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export { ListsClient } from "./client/Client.mjs";
3
+ export * from "./client/index.mjs";
@@ -71,7 +71,7 @@ export declare class MessagesClient {
71
71
  * @example
72
72
  * await client.inboxes.messages.update("inbox_id", "message_id", {})
73
73
  */
74
- update(inbox_id: AgentMail.inboxes.InboxId, message_id: AgentMail.MessageId, request: AgentMail.UpdateMessageRequest, requestOptions?: MessagesClient.RequestOptions): core.HttpResponsePromise<AgentMail.Message>;
74
+ update(inbox_id: AgentMail.inboxes.InboxId, message_id: AgentMail.MessageId, request: AgentMail.UpdateMessageRequest, requestOptions?: MessagesClient.RequestOptions): core.HttpResponsePromise<AgentMail.UpdateMessageResponse>;
75
75
  private __update;
76
76
  /**
77
77
  * @param {AgentMail.inboxes.InboxId} inbox_id
@@ -335,7 +335,7 @@ export class MessagesClient {
335
335
  });
336
336
  if (_response.ok) {
337
337
  return {
338
- data: serializers.Message.parseOrThrow(_response.body, {
338
+ data: serializers.UpdateMessageResponse.parseOrThrow(_response.body, {
339
339
  unrecognizedObjectKeys: "passthrough",
340
340
  allowUnrecognizedUnionMembers: true,
341
341
  allowUnrecognizedEnumValues: true,
@@ -0,0 +1,2 @@
1
+ export { MessagesClient } from "./client/Client.mjs";
2
+ export * from "./client/index.mjs";
@@ -0,0 +1,3 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export { MessagesClient } from "./client/Client.mjs";
3
+ export * from "./client/index.mjs";
@@ -0,0 +1,2 @@
1
+ export { MetricsClient } from "./client/Client.mjs";
2
+ export * from "./client/index.mjs";
@@ -0,0 +1,3 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export { MetricsClient } from "./client/Client.mjs";
3
+ export * from "./client/index.mjs";
@@ -47,6 +47,23 @@ export declare class ThreadsClient {
47
47
  */
48
48
  getAttachment(inbox_id: AgentMail.inboxes.InboxId, thread_id: AgentMail.ThreadId, attachment_id: AgentMail.AttachmentId, requestOptions?: ThreadsClient.RequestOptions): core.HttpResponsePromise<AgentMail.AttachmentResponse>;
49
49
  private __getAttachment;
50
+ /**
51
+ * Updates thread labels. Cannot add or remove system labels (sent, received, bounced, etc.). Rejects requests with a `422` for threads with 100 or more messages.
52
+ *
53
+ * @param {AgentMail.inboxes.InboxId} inbox_id
54
+ * @param {AgentMail.ThreadId} thread_id
55
+ * @param {AgentMail.UpdateThreadRequest} request
56
+ * @param {ThreadsClient.RequestOptions} requestOptions - Request-specific configuration.
57
+ *
58
+ * @throws {@link AgentMail.ValidationError}
59
+ * @throws {@link AgentMail.NotFoundError}
60
+ * @throws {@link AgentMail.UnprocessableError}
61
+ *
62
+ * @example
63
+ * await client.inboxes.threads.update("inbox_id", "thread_id", {})
64
+ */
65
+ update(inbox_id: AgentMail.inboxes.InboxId, thread_id: AgentMail.ThreadId, request: AgentMail.UpdateThreadRequest, requestOptions?: ThreadsClient.RequestOptions): core.HttpResponsePromise<AgentMail.UpdateThreadResponse>;
66
+ private __update;
50
67
  /**
51
68
  * Moves the thread to trash by adding a trash label to all messages. If the thread is already in trash, it will be permanently deleted. Use `permanent=true` to force permanent deletion.
52
69
  *