agentmail 0.0.16 → 0.0.18

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 (143) hide show
  1. package/api/resources/inboxes/client/Client.js +3 -3
  2. package/api/resources/messages/client/Client.js +9 -9
  3. package/api/resources/messages/types/ListMessagesResponse.d.ts +6 -2
  4. package/api/resources/messages/types/Message.d.ts +13 -13
  5. package/{dist/api/resources/messages/types/MessageThreadId.d.ts → api/resources/messages/types/MessageEventId.d.ts} +2 -2
  6. package/api/resources/messages/types/MessageInReplyTo.d.ts +7 -0
  7. package/api/resources/messages/types/MessageItem.d.ts +6 -4
  8. package/api/resources/messages/types/{MessageThreadId.d.ts → MessageLabels.d.ts} +2 -2
  9. package/api/resources/messages/types/MessageReferences.d.ts +7 -0
  10. package/api/resources/messages/types/MessageReplyTo.d.ts +7 -0
  11. package/api/resources/messages/types/MessageTimestamp.d.ts +7 -0
  12. package/api/resources/messages/types/index.d.ts +6 -2
  13. package/api/resources/messages/types/index.js +6 -2
  14. package/api/resources/threads/client/Client.js +2 -2
  15. package/api/resources/threads/types/ListThreadsResponse.d.ts +8 -4
  16. package/api/resources/threads/types/Thread.d.ts +19 -15
  17. package/api/resources/{messages/types/MessageSentAt.d.ts → threads/types/ThreadEventId.d.ts} +2 -2
  18. package/api/resources/threads/types/ThreadItem.d.ts +5 -3
  19. package/{dist/api/resources/messages/types/MessageSentAt.d.ts → api/resources/threads/types/ThreadLabels.d.ts} +2 -2
  20. package/api/resources/threads/types/ThreadSenders.d.ts +7 -0
  21. package/api/resources/threads/types/ThreadSenders.js +5 -0
  22. package/api/resources/threads/types/ThreadTimestamp.d.ts +7 -0
  23. package/api/resources/threads/types/ThreadTimestamp.js +5 -0
  24. package/api/resources/threads/types/index.d.ts +4 -2
  25. package/api/resources/threads/types/index.js +4 -2
  26. package/dist/api/resources/inboxes/client/Client.js +3 -3
  27. package/dist/api/resources/messages/client/Client.js +9 -9
  28. package/dist/api/resources/messages/types/ListMessagesResponse.d.ts +6 -2
  29. package/dist/api/resources/messages/types/Message.d.ts +13 -13
  30. package/dist/api/resources/messages/types/MessageEventId.d.ts +7 -0
  31. package/dist/api/resources/messages/types/MessageEventId.js +5 -0
  32. package/dist/api/resources/messages/types/MessageInReplyTo.d.ts +7 -0
  33. package/dist/api/resources/messages/types/MessageInReplyTo.js +5 -0
  34. package/dist/api/resources/messages/types/MessageItem.d.ts +6 -4
  35. package/dist/api/resources/messages/types/MessageLabels.d.ts +7 -0
  36. package/dist/api/resources/messages/types/MessageLabels.js +5 -0
  37. package/dist/api/resources/messages/types/MessageReferences.d.ts +7 -0
  38. package/dist/api/resources/messages/types/MessageReferences.js +5 -0
  39. package/dist/api/resources/messages/types/MessageReplyTo.d.ts +7 -0
  40. package/dist/api/resources/messages/types/MessageReplyTo.js +5 -0
  41. package/dist/api/resources/messages/types/MessageTimestamp.d.ts +7 -0
  42. package/dist/api/resources/messages/types/MessageTimestamp.js +5 -0
  43. package/dist/api/resources/messages/types/index.d.ts +6 -2
  44. package/dist/api/resources/messages/types/index.js +6 -2
  45. package/dist/api/resources/threads/client/Client.js +2 -2
  46. package/dist/api/resources/threads/types/ListThreadsResponse.d.ts +8 -4
  47. package/dist/api/resources/threads/types/Thread.d.ts +19 -15
  48. package/dist/api/resources/threads/types/ThreadEventId.d.ts +7 -0
  49. package/dist/api/resources/threads/types/ThreadEventId.js +5 -0
  50. package/dist/api/resources/threads/types/ThreadItem.d.ts +5 -3
  51. package/dist/api/resources/threads/types/ThreadLabels.d.ts +7 -0
  52. package/dist/api/resources/threads/types/ThreadLabels.js +5 -0
  53. package/dist/api/resources/threads/types/ThreadSenders.d.ts +7 -0
  54. package/dist/api/resources/threads/types/ThreadSenders.js +5 -0
  55. package/dist/api/resources/threads/types/ThreadTimestamp.d.ts +7 -0
  56. package/dist/api/resources/threads/types/ThreadTimestamp.js +5 -0
  57. package/dist/api/resources/threads/types/index.d.ts +4 -2
  58. package/dist/api/resources/threads/types/index.js +4 -2
  59. package/dist/serialization/resources/messages/types/Message.d.ts +16 -8
  60. package/dist/serialization/resources/messages/types/Message.js +16 -8
  61. package/dist/serialization/resources/{threads/types/ThreadUpdatedAt.d.ts → messages/types/MessageEventId.d.ts} +2 -2
  62. package/{serialization/resources/threads/types/ThreadUpdatedAt.js → dist/serialization/resources/messages/types/MessageEventId.js} +2 -2
  63. package/dist/serialization/resources/messages/types/MessageInReplyTo.d.ts +10 -0
  64. package/dist/serialization/resources/messages/types/MessageInReplyTo.js +41 -0
  65. package/dist/serialization/resources/messages/types/MessageItem.d.ts +12 -8
  66. package/dist/serialization/resources/messages/types/MessageItem.js +12 -8
  67. package/dist/serialization/resources/{threads/types/ThreadParticipants.d.ts → messages/types/MessageLabels.d.ts} +2 -2
  68. package/dist/serialization/resources/messages/types/MessageLabels.js +41 -0
  69. package/dist/serialization/resources/messages/types/MessageReferences.d.ts +10 -0
  70. package/dist/serialization/resources/{threads/types/ThreadParticipants.js → messages/types/MessageReferences.js} +2 -2
  71. package/dist/serialization/resources/messages/types/MessageReplyTo.d.ts +10 -0
  72. package/dist/serialization/resources/messages/types/MessageReplyTo.js +41 -0
  73. package/dist/serialization/resources/messages/types/MessageTimestamp.d.ts +10 -0
  74. package/dist/serialization/resources/messages/types/{MessageThreadId.js → MessageTimestamp.js} +2 -2
  75. package/dist/serialization/resources/messages/types/index.d.ts +6 -2
  76. package/dist/serialization/resources/messages/types/index.js +6 -2
  77. package/dist/serialization/resources/threads/types/Thread.d.ts +14 -11
  78. package/dist/serialization/resources/threads/types/Thread.js +14 -11
  79. package/{serialization/resources/messages/types/MessageSentAt.d.ts → dist/serialization/resources/threads/types/ThreadEventId.d.ts} +2 -2
  80. package/dist/serialization/resources/{messages/types/MessageSentAt.js → threads/types/ThreadEventId.js} +2 -2
  81. package/dist/serialization/resources/threads/types/ThreadItem.d.ts +10 -6
  82. package/dist/serialization/resources/threads/types/ThreadItem.js +10 -6
  83. package/{serialization/resources/threads/types/ThreadParticipants.d.ts → dist/serialization/resources/threads/types/ThreadLabels.d.ts} +2 -2
  84. package/dist/serialization/resources/threads/types/ThreadLabels.js +41 -0
  85. package/dist/serialization/resources/threads/types/ThreadSenders.d.ts +10 -0
  86. package/dist/serialization/resources/threads/types/ThreadSenders.js +41 -0
  87. package/dist/serialization/resources/{messages/types/MessageThreadId.d.ts → threads/types/ThreadTimestamp.d.ts} +2 -2
  88. package/dist/serialization/resources/threads/types/{ThreadUpdatedAt.js → ThreadTimestamp.js} +2 -2
  89. package/dist/serialization/resources/threads/types/index.d.ts +4 -2
  90. package/dist/serialization/resources/threads/types/index.js +4 -2
  91. package/dist/version.d.ts +1 -1
  92. package/dist/version.js +1 -1
  93. package/package.json +1 -1
  94. package/serialization/resources/messages/types/Message.d.ts +16 -8
  95. package/serialization/resources/messages/types/Message.js +16 -8
  96. package/serialization/resources/messages/types/MessageEventId.d.ts +10 -0
  97. package/serialization/resources/messages/types/MessageEventId.js +41 -0
  98. package/serialization/resources/messages/types/MessageInReplyTo.d.ts +10 -0
  99. package/serialization/resources/messages/types/MessageInReplyTo.js +41 -0
  100. package/serialization/resources/messages/types/MessageItem.d.ts +12 -8
  101. package/serialization/resources/messages/types/MessageItem.js +12 -8
  102. package/serialization/resources/messages/types/MessageLabels.d.ts +10 -0
  103. package/serialization/resources/messages/types/MessageLabels.js +41 -0
  104. package/serialization/resources/messages/types/MessageReferences.d.ts +10 -0
  105. package/serialization/resources/messages/types/MessageReferences.js +41 -0
  106. package/serialization/resources/messages/types/MessageReplyTo.d.ts +10 -0
  107. package/serialization/resources/messages/types/MessageReplyTo.js +41 -0
  108. package/serialization/resources/messages/types/MessageTimestamp.d.ts +10 -0
  109. package/serialization/resources/messages/types/MessageTimestamp.js +41 -0
  110. package/serialization/resources/messages/types/index.d.ts +6 -2
  111. package/serialization/resources/messages/types/index.js +6 -2
  112. package/serialization/resources/threads/types/Thread.d.ts +14 -11
  113. package/serialization/resources/threads/types/Thread.js +14 -11
  114. package/{dist/serialization/resources/messages/types/MessageSentAt.d.ts → serialization/resources/threads/types/ThreadEventId.d.ts} +2 -2
  115. package/serialization/resources/{messages/types/MessageSentAt.js → threads/types/ThreadEventId.js} +2 -2
  116. package/serialization/resources/threads/types/ThreadItem.d.ts +10 -6
  117. package/serialization/resources/threads/types/ThreadItem.js +10 -6
  118. package/serialization/resources/threads/types/ThreadLabels.d.ts +10 -0
  119. package/serialization/resources/threads/types/ThreadLabels.js +41 -0
  120. package/serialization/resources/threads/types/ThreadSenders.d.ts +10 -0
  121. package/serialization/resources/threads/types/ThreadSenders.js +41 -0
  122. package/serialization/resources/threads/types/ThreadTimestamp.d.ts +10 -0
  123. package/serialization/resources/threads/types/ThreadTimestamp.js +41 -0
  124. package/serialization/resources/threads/types/index.d.ts +4 -2
  125. package/serialization/resources/threads/types/index.js +4 -2
  126. package/version.d.ts +1 -1
  127. package/version.js +1 -1
  128. package/api/resources/threads/types/ThreadParticipants.d.ts +0 -7
  129. package/api/resources/threads/types/ThreadUpdatedAt.d.ts +0 -7
  130. package/dist/api/resources/threads/types/ThreadParticipants.d.ts +0 -7
  131. package/dist/api/resources/threads/types/ThreadUpdatedAt.d.ts +0 -7
  132. package/serialization/resources/messages/types/MessageThreadId.d.ts +0 -10
  133. package/serialization/resources/messages/types/MessageThreadId.js +0 -41
  134. package/serialization/resources/threads/types/ThreadParticipants.js +0 -41
  135. package/serialization/resources/threads/types/ThreadUpdatedAt.d.ts +0 -10
  136. /package/api/resources/messages/types/{MessageSentAt.js → MessageEventId.js} +0 -0
  137. /package/api/resources/messages/types/{MessageThreadId.js → MessageInReplyTo.js} +0 -0
  138. /package/api/resources/{threads/types/ThreadParticipants.js → messages/types/MessageLabels.js} +0 -0
  139. /package/api/resources/{threads/types/ThreadUpdatedAt.js → messages/types/MessageReferences.js} +0 -0
  140. /package/{dist/api/resources/messages/types/MessageSentAt.js → api/resources/messages/types/MessageReplyTo.js} +0 -0
  141. /package/{dist/api/resources/messages/types/MessageThreadId.js → api/resources/messages/types/MessageTimestamp.js} +0 -0
  142. /package/{dist/api/resources/threads/types/ThreadParticipants.js → api/resources/threads/types/ThreadEventId.js} +0 -0
  143. /package/{dist/api/resources/threads/types/ThreadUpdatedAt.js → api/resources/threads/types/ThreadLabels.js} +0 -0
@@ -93,7 +93,7 @@ class Messages {
93
93
  const _response = yield core.fetcher({
94
94
  url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.AgentMailEnvironment.Production, `/v0/inboxes/${encodeURIComponent(serializers.InboxId.jsonOrThrow(inboxId))}/messages`),
95
95
  method: "GET",
96
- headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.16", "User-Agent": "agentmail/0.0.16", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
96
+ headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.18", "User-Agent": "agentmail/0.0.18", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
97
97
  contentType: "application/json",
98
98
  queryParameters: _queryParams,
99
99
  requestType: "json",
@@ -156,7 +156,7 @@ class Messages {
156
156
  const _response = yield core.fetcher({
157
157
  url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.AgentMailEnvironment.Production, `/v0/inboxes/${encodeURIComponent(serializers.InboxId.jsonOrThrow(inboxId))}/messages/${encodeURIComponent(serializers.MessageId.jsonOrThrow(messageId))}`),
158
158
  method: "GET",
159
- headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.16", "User-Agent": "agentmail/0.0.16", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
159
+ headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.18", "User-Agent": "agentmail/0.0.18", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
160
160
  contentType: "application/json",
161
161
  requestType: "json",
162
162
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -211,7 +211,7 @@ class Messages {
211
211
  const _response = yield core.fetcher({
212
212
  url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.AgentMailEnvironment.Production, `/v0/inboxes/${encodeURIComponent(serializers.InboxId.jsonOrThrow(inboxId))}/messages/${encodeURIComponent(serializers.MessageId.jsonOrThrow(messageId))}/attachments/${encodeURIComponent(serializers.AttachmentId.jsonOrThrow(attachmentId))}`),
213
213
  method: "GET",
214
- headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.16", "User-Agent": "agentmail/0.0.16", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
214
+ headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.18", "User-Agent": "agentmail/0.0.18", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
215
215
  contentType: "application/json",
216
216
  requestType: "json",
217
217
  responseType: "streaming",
@@ -275,9 +275,9 @@ class Messages {
275
275
  return __awaiter(this, void 0, void 0, function* () {
276
276
  var _a, _b;
277
277
  const _response = yield core.fetcher({
278
- url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.AgentMailEnvironment.Production, `/v0/inboxes/${encodeURIComponent(serializers.InboxId.jsonOrThrow(inboxId))}/messages`),
278
+ url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.AgentMailEnvironment.Production, `/v0/inboxes/${encodeURIComponent(serializers.InboxId.jsonOrThrow(inboxId))}/messages/send`),
279
279
  method: "POST",
280
- headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.16", "User-Agent": "agentmail/0.0.16", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
280
+ headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.18", "User-Agent": "agentmail/0.0.18", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
281
281
  contentType: "application/json",
282
282
  requestType: "json",
283
283
  body: serializers.SendMessageRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -323,7 +323,7 @@ class Messages {
323
323
  body: _response.error.rawBody,
324
324
  });
325
325
  case "timeout":
326
- throw new errors.AgentMailTimeoutError("Timeout exceeded when calling POST /v0/inboxes/{inbox_id}/messages.");
326
+ throw new errors.AgentMailTimeoutError("Timeout exceeded when calling POST /v0/inboxes/{inbox_id}/messages/send.");
327
327
  case "unknown":
328
328
  throw new errors.AgentMailError({
329
329
  message: _response.error.errorMessage,
@@ -352,9 +352,9 @@ class Messages {
352
352
  return __awaiter(this, void 0, void 0, function* () {
353
353
  var _a, _b;
354
354
  const _response = yield core.fetcher({
355
- url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.AgentMailEnvironment.Production, `/v0/inboxes/${encodeURIComponent(serializers.InboxId.jsonOrThrow(inboxId))}/messages/${encodeURIComponent(serializers.MessageId.jsonOrThrow(messageId))}`),
355
+ url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.AgentMailEnvironment.Production, `/v0/inboxes/${encodeURIComponent(serializers.InboxId.jsonOrThrow(inboxId))}/messages/${encodeURIComponent(serializers.MessageId.jsonOrThrow(messageId))}/reply`),
356
356
  method: "POST",
357
- headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.16", "User-Agent": "agentmail/0.0.16", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
357
+ headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.18", "User-Agent": "agentmail/0.0.18", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
358
358
  contentType: "application/json",
359
359
  requestType: "json",
360
360
  body: serializers.ReplyToMessageRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -400,7 +400,7 @@ class Messages {
400
400
  body: _response.error.rawBody,
401
401
  });
402
402
  case "timeout":
403
- throw new errors.AgentMailTimeoutError("Timeout exceeded when calling POST /v0/inboxes/{inbox_id}/messages/{message_id}.");
403
+ throw new errors.AgentMailTimeoutError("Timeout exceeded when calling POST /v0/inboxes/{inbox_id}/messages/{message_id}/reply.");
404
404
  case "unknown":
405
405
  throw new errors.AgentMailError({
406
406
  message: _response.error.errorMessage,
@@ -8,7 +8,9 @@ import * as AgentMail from "../../../index";
8
8
  * messages: [{
9
9
  * messageId: "msg_123",
10
10
  * threadId: "thread_123",
11
- * sentAt: "2024-01-15T09:30:00Z",
11
+ * eventId: "event_123",
12
+ * labels: ["RECEIVED", "UNREAD"],
13
+ * timestamp: "2024-01-15T09:30:00Z",
12
14
  * from: "alice@example.com",
13
15
  * to: ["bob@example.com"],
14
16
  * subject: "Project Discussion",
@@ -25,7 +27,9 @@ import * as AgentMail from "../../../index";
25
27
  * }, {
26
28
  * messageId: "msg_456",
27
29
  * threadId: "thread_123",
28
- * sentAt: "2024-01-15T10:15:00Z",
30
+ * eventId: "event_456",
31
+ * labels: ["SENT"],
32
+ * timestamp: "2024-01-15T10:15:00Z",
29
33
  * from: "bob@example.com",
30
34
  * to: ["alice@example.com"],
31
35
  * subject: "Re: Project Discussion",
@@ -7,8 +7,9 @@ import * as AgentMail from "../../../index";
7
7
  * {
8
8
  * messageId: "msg_123",
9
9
  * threadId: "thread_123",
10
- * sentAt: "2024-01-15T09:30:00Z",
11
- * receivedAt: "2024-01-15T09:30:00Z",
10
+ * eventId: "event_123",
11
+ * labels: ["RECEIVED", "UNREAD"],
12
+ * timestamp: "2024-01-15T09:30:00Z",
12
13
  * from: "alice@example.com",
13
14
  * replyTo: "alice.work@example.com",
14
15
  * to: ["bob@example.com"],
@@ -26,18 +27,18 @@ import * as AgentMail from "../../../index";
26
27
  * inline: false
27
28
  * }],
28
29
  * inReplyTo: "msg_122",
29
- * references: ["msg_121", "msg_122"]
30
+ * references: ["msg_121", "msg_122"],
31
+ * inboxId: "yourinbox@agentmail.to"
30
32
  * }
31
33
  */
32
34
  export interface Message {
35
+ threadId: AgentMail.ThreadId;
33
36
  messageId: AgentMail.MessageId;
34
- threadId: AgentMail.MessageThreadId;
35
- sentAt: AgentMail.MessageSentAt;
36
- /** Time at which message was received. */
37
- receivedAt?: Date;
37
+ eventId: AgentMail.MessageEventId;
38
+ labels: AgentMail.MessageLabels;
39
+ timestamp: AgentMail.MessageTimestamp;
38
40
  from: AgentMail.MessageFrom;
39
- /** Address to reply to. In format `username@domain.com` or `Display Name <username@domain.com>`. */
40
- replyTo?: string;
41
+ replyTo?: AgentMail.MessageReplyTo;
41
42
  subject?: AgentMail.MessageSubject;
42
43
  preview?: AgentMail.MessagePreview;
43
44
  to: AgentMail.MessageTo;
@@ -46,8 +47,7 @@ export interface Message {
46
47
  text?: AgentMail.MessageText;
47
48
  html?: AgentMail.MessageHtml;
48
49
  attachments?: AgentMail.MessageAttachments;
49
- /** ID of message being replied to. */
50
- inReplyTo?: string;
51
- /** IDs of previous messages in thread. */
52
- references?: string[];
50
+ inReplyTo?: AgentMail.MessageInReplyTo;
51
+ references?: AgentMail.MessageReferences;
52
+ inboxId: AgentMail.InboxId;
53
53
  }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * Event ID of message.
6
+ */
7
+ export type MessageEventId = string;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * ID of message being replied to.
6
+ */
7
+ export type MessageInReplyTo = string | undefined;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -3,14 +3,16 @@
3
3
  */
4
4
  import * as AgentMail from "../../../index";
5
5
  export interface MessageItem {
6
- messageId: AgentMail.MessageId;
7
6
  threadId: AgentMail.ThreadId;
8
- sentAt: AgentMail.MessageSentAt;
7
+ messageId: AgentMail.MessageId;
8
+ eventId: AgentMail.MessageEventId;
9
+ labels: AgentMail.MessageLabels;
10
+ timestamp: AgentMail.MessageTimestamp;
9
11
  from: AgentMail.MessageFrom;
10
- subject?: AgentMail.MessageSubject;
11
- preview?: AgentMail.MessagePreview;
12
12
  to: AgentMail.MessageTo;
13
13
  cc?: AgentMail.MessageCc;
14
14
  bcc?: AgentMail.MessageBcc;
15
+ subject?: AgentMail.MessageSubject;
16
+ preview?: AgentMail.MessagePreview;
15
17
  attachments?: AgentMail.MessageAttachments;
16
18
  }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * Labels of message.
6
+ */
7
+ export type MessageLabels = string[];
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * IDs of previous messages in thread.
6
+ */
7
+ export type MessageReferences = string[] | undefined;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * Address to reply to. In format `username@domain.com` or `Display Name <username@domain.com>`.
6
+ */
7
+ export type MessageReplyTo = string | undefined;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * Time at which message was sent or drafted.
6
+ */
7
+ export type MessageTimestamp = Date;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -5,16 +5,20 @@ export * from "./AttachmentSize";
5
5
  export * from "./AttachmentInline";
6
6
  export * from "./Attachment";
7
7
  export * from "./MessageId";
8
- export * from "./MessageSentAt";
8
+ export * from "./MessageEventId";
9
+ export * from "./MessageLabels";
10
+ export * from "./MessageTimestamp";
9
11
  export * from "./MessageFrom";
12
+ export * from "./MessageReplyTo";
10
13
  export * from "./MessageSubject";
11
14
  export * from "./MessagePreview";
12
15
  export * from "./MessageTo";
13
16
  export * from "./MessageCc";
14
17
  export * from "./MessageBcc";
15
18
  export * from "./MessageAttachments";
19
+ export * from "./MessageInReplyTo";
20
+ export * from "./MessageReferences";
16
21
  export * from "./MessageItem";
17
- export * from "./MessageThreadId";
18
22
  export * from "./MessageText";
19
23
  export * from "./MessageHtml";
20
24
  export * from "./Message";
@@ -21,16 +21,20 @@ __exportStar(require("./AttachmentSize"), exports);
21
21
  __exportStar(require("./AttachmentInline"), exports);
22
22
  __exportStar(require("./Attachment"), exports);
23
23
  __exportStar(require("./MessageId"), exports);
24
- __exportStar(require("./MessageSentAt"), exports);
24
+ __exportStar(require("./MessageEventId"), exports);
25
+ __exportStar(require("./MessageLabels"), exports);
26
+ __exportStar(require("./MessageTimestamp"), exports);
25
27
  __exportStar(require("./MessageFrom"), exports);
28
+ __exportStar(require("./MessageReplyTo"), exports);
26
29
  __exportStar(require("./MessageSubject"), exports);
27
30
  __exportStar(require("./MessagePreview"), exports);
28
31
  __exportStar(require("./MessageTo"), exports);
29
32
  __exportStar(require("./MessageCc"), exports);
30
33
  __exportStar(require("./MessageBcc"), exports);
31
34
  __exportStar(require("./MessageAttachments"), exports);
35
+ __exportStar(require("./MessageInReplyTo"), exports);
36
+ __exportStar(require("./MessageReferences"), exports);
32
37
  __exportStar(require("./MessageItem"), exports);
33
- __exportStar(require("./MessageThreadId"), exports);
34
38
  __exportStar(require("./MessageText"), exports);
35
39
  __exportStar(require("./MessageHtml"), exports);
36
40
  __exportStar(require("./Message"), exports);
@@ -93,7 +93,7 @@ class Threads {
93
93
  const _response = yield core.fetcher({
94
94
  url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.AgentMailEnvironment.Production, `/v0/inboxes/${encodeURIComponent(serializers.InboxId.jsonOrThrow(inboxId))}/threads`),
95
95
  method: "GET",
96
- headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.16", "User-Agent": "agentmail/0.0.16", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
96
+ headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.18", "User-Agent": "agentmail/0.0.18", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
97
97
  contentType: "application/json",
98
98
  queryParameters: _queryParams,
99
99
  requestType: "json",
@@ -156,7 +156,7 @@ class Threads {
156
156
  const _response = yield core.fetcher({
157
157
  url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.AgentMailEnvironment.Production, `/v0/inboxes/${encodeURIComponent(serializers.InboxId.jsonOrThrow(inboxId))}/threads/${encodeURIComponent(serializers.ThreadId.jsonOrThrow(threadId))}`),
158
158
  method: "GET",
159
- headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.16", "User-Agent": "agentmail/0.0.16", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
159
+ headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.18", "User-Agent": "agentmail/0.0.18", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
160
160
  contentType: "application/json",
161
161
  requestType: "json",
162
162
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -7,16 +7,20 @@ import * as AgentMail from "../../../index";
7
7
  * {
8
8
  * threads: [{
9
9
  * threadId: "thread_123",
10
- * updatedAt: "2024-01-15T09:30:00Z",
11
- * participants: ["alice@example.com", "bob@example.com"],
10
+ * eventId: "event_123",
11
+ * labels: ["RECEIVED", "UNREAD"],
12
+ * timestamp: "2024-01-15T09:30:00Z",
13
+ * senders: ["alice@example.com", "bob@example.com"],
12
14
  * recipients: ["alice@example.com", "bob@example.com"],
13
15
  * messageCount: 3,
14
16
  * subject: "Project Discussion",
15
17
  * preview: "Let's review the timeline for..."
16
18
  * }, {
17
19
  * threadId: "thread_456",
18
- * updatedAt: "2024-01-15T10:15:00Z",
19
- * participants: ["charlie@example.com"],
20
+ * eventId: "event_456",
21
+ * labels: ["SENT"],
22
+ * timestamp: "2024-01-15T10:15:00Z",
23
+ * senders: ["charlie@example.com"],
20
24
  * recipients: ["david@example.com"],
21
25
  * messageCount: 1,
22
26
  * subject: "Weekly Update",
@@ -5,37 +5,41 @@ import * as AgentMail from "../../../index";
5
5
  /**
6
6
  * @example
7
7
  * {
8
- * threadId: "thread_123",
9
8
  * inboxId: "yourinbox@agentmail.to",
10
- * createdAt: "2024-01-15T09:30:00Z",
11
- * updatedAt: "2024-01-15T10:15:00Z",
12
- * subject: "Project Discussion",
13
- * participants: ["alice@example.com"],
9
+ * threadId: "thread_123",
10
+ * eventId: "event_123",
11
+ * labels: ["RECEIVED", "UNREAD"],
12
+ * timestamp: "2024-01-15T09:30:00Z",
13
+ * senders: ["alice@example.com"],
14
14
  * recipients: ["bob@example.com"],
15
15
  * messageCount: 1,
16
+ * subject: "Project Discussion",
17
+ * preview: "Let's review the timeline for...",
16
18
  * messages: [{
17
19
  * messageId: "msg_123",
18
20
  * threadId: "thread_123",
19
- * sentAt: "2024-01-15T09:30:00Z",
20
- * receivedAt: "2024-01-15T09:30:00Z",
21
+ * eventId: "event_123",
22
+ * labels: ["RECEIVED", "UNREAD"],
23
+ * timestamp: "2024-01-15T09:30:00Z",
21
24
  * from: "alice@example.com",
22
25
  * to: ["bob@example.com"],
23
- * text: "Let's review the timeline for the project."
26
+ * text: "Let's review the timeline for the project.",
27
+ * inboxId: "yourinbox@agentmail.to"
24
28
  * }]
25
29
  * }
26
30
  */
27
31
  export interface Thread {
28
32
  threadId: AgentMail.ThreadId;
29
- inboxId: AgentMail.InboxId;
30
- /** Time at which thread was created. */
31
- createdAt: Date;
32
- updatedAt: AgentMail.ThreadUpdatedAt;
33
- participants: AgentMail.ThreadParticipants;
33
+ eventId: AgentMail.ThreadEventId;
34
+ labels: AgentMail.ThreadLabels;
35
+ timestamp: AgentMail.ThreadTimestamp;
36
+ senders: AgentMail.ThreadSenders;
34
37
  recipients: AgentMail.ThreadRecipients;
38
+ messageCount: AgentMail.ThreadMessageCount;
35
39
  subject?: AgentMail.ThreadSubject;
36
40
  preview?: AgentMail.ThreadPreview;
37
- messageCount: AgentMail.ThreadMessageCount;
41
+ attachments?: AgentMail.ThreadAttachments;
38
42
  /** Messages in thread. Ordered by `sent_at` ascending. */
39
43
  messages: AgentMail.Message[];
40
- attachments?: AgentMail.ThreadAttachments;
44
+ inboxId: AgentMail.InboxId;
41
45
  }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * Event ID of thread.
6
+ */
7
+ export type ThreadEventId = string;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -4,11 +4,13 @@
4
4
  import * as AgentMail from "../../../index";
5
5
  export interface ThreadItem {
6
6
  threadId: AgentMail.ThreadId;
7
- updatedAt: AgentMail.ThreadUpdatedAt;
8
- participants: AgentMail.ThreadParticipants;
7
+ eventId: AgentMail.ThreadEventId;
8
+ labels: AgentMail.ThreadLabels;
9
+ timestamp: AgentMail.ThreadTimestamp;
10
+ senders: AgentMail.ThreadSenders;
9
11
  recipients: AgentMail.ThreadRecipients;
12
+ messageCount: AgentMail.ThreadMessageCount;
10
13
  subject?: AgentMail.ThreadSubject;
11
14
  preview?: AgentMail.ThreadPreview;
12
- messageCount: AgentMail.ThreadMessageCount;
13
15
  attachments?: AgentMail.ThreadAttachments;
14
16
  }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * Labels of thread.
6
+ */
7
+ export type ThreadLabels = string[];
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * Addresses of senders in thread. In format `username@domain.com` or `Display Name <username@domain.com>`
6
+ */
7
+ export type ThreadSenders = string[];
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * Time at which last message was sent.
6
+ */
7
+ export type ThreadTimestamp = Date;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,7 +1,9 @@
1
1
  export * from "./ThreadAttachment";
2
2
  export * from "./ThreadId";
3
- export * from "./ThreadUpdatedAt";
4
- export * from "./ThreadParticipants";
3
+ export * from "./ThreadEventId";
4
+ export * from "./ThreadLabels";
5
+ export * from "./ThreadTimestamp";
6
+ export * from "./ThreadSenders";
5
7
  export * from "./ThreadRecipients";
6
8
  export * from "./ThreadMessageCount";
7
9
  export * from "./ThreadSubject";
@@ -16,8 +16,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./ThreadAttachment"), exports);
18
18
  __exportStar(require("./ThreadId"), exports);
19
- __exportStar(require("./ThreadUpdatedAt"), exports);
20
- __exportStar(require("./ThreadParticipants"), exports);
19
+ __exportStar(require("./ThreadEventId"), exports);
20
+ __exportStar(require("./ThreadLabels"), exports);
21
+ __exportStar(require("./ThreadTimestamp"), exports);
22
+ __exportStar(require("./ThreadSenders"), exports);
21
23
  __exportStar(require("./ThreadRecipients"), exports);
22
24
  __exportStar(require("./ThreadMessageCount"), exports);
23
25
  __exportStar(require("./ThreadSubject"), exports);
@@ -4,10 +4,13 @@
4
4
  import * as serializers from "../../../index";
5
5
  import * as AgentMail from "../../../../api/index";
6
6
  import * as core from "../../../../core";
7
+ import { ThreadId } from "../../threads/types/ThreadId";
7
8
  import { MessageId } from "./MessageId";
8
- import { MessageThreadId } from "./MessageThreadId";
9
- import { MessageSentAt } from "./MessageSentAt";
9
+ import { MessageEventId } from "./MessageEventId";
10
+ import { MessageLabels } from "./MessageLabels";
11
+ import { MessageTimestamp } from "./MessageTimestamp";
10
12
  import { MessageFrom } from "./MessageFrom";
13
+ import { MessageReplyTo } from "./MessageReplyTo";
11
14
  import { MessageSubject } from "./MessageSubject";
12
15
  import { MessagePreview } from "./MessagePreview";
13
16
  import { MessageTo } from "./MessageTo";
@@ -16,15 +19,19 @@ import { MessageBcc } from "./MessageBcc";
16
19
  import { MessageText } from "./MessageText";
17
20
  import { MessageHtml } from "./MessageHtml";
18
21
  import { MessageAttachments } from "./MessageAttachments";
22
+ import { MessageInReplyTo } from "./MessageInReplyTo";
23
+ import { MessageReferences } from "./MessageReferences";
24
+ import { InboxId } from "../../inboxes/types/InboxId";
19
25
  export declare const Message: core.serialization.ObjectSchema<serializers.Message.Raw, AgentMail.Message>;
20
26
  export declare namespace Message {
21
27
  interface Raw {
28
+ thread_id: ThreadId.Raw;
22
29
  message_id: MessageId.Raw;
23
- thread_id: MessageThreadId.Raw;
24
- sent_at: MessageSentAt.Raw;
25
- received_at?: string | null;
30
+ event_id: MessageEventId.Raw;
31
+ labels: MessageLabels.Raw;
32
+ timestamp: MessageTimestamp.Raw;
26
33
  from: MessageFrom.Raw;
27
- reply_to?: string | null;
34
+ reply_to?: MessageReplyTo.Raw;
28
35
  subject?: MessageSubject.Raw | null;
29
36
  preview?: MessagePreview.Raw | null;
30
37
  to: MessageTo.Raw;
@@ -33,7 +40,8 @@ export declare namespace Message {
33
40
  text?: MessageText.Raw | null;
34
41
  html?: MessageHtml.Raw | null;
35
42
  attachments?: MessageAttachments.Raw | null;
36
- in_reply_to?: string | null;
37
- references?: string[] | null;
43
+ in_reply_to?: MessageInReplyTo.Raw;
44
+ references?: MessageReferences.Raw;
45
+ inbox_id: InboxId.Raw;
38
46
  }
39
47
  }