agentmail 0.0.27 → 0.0.29

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 (62) hide show
  1. package/api/resources/drafts/client/Client.js +2 -2
  2. package/api/resources/inboxes/client/Client.js +3 -3
  3. package/api/resources/inboxes/resources/drafts/client/Client.d.ts +16 -0
  4. package/api/resources/inboxes/resources/drafts/client/Client.js +89 -3
  5. package/api/resources/inboxes/resources/drafts/types/SendDraftRequest.d.ts +7 -0
  6. package/api/resources/inboxes/resources/drafts/types/SendDraftRequest.js +5 -0
  7. package/api/resources/inboxes/resources/drafts/types/index.d.ts +1 -0
  8. package/api/resources/inboxes/resources/drafts/types/index.js +1 -0
  9. package/api/resources/inboxes/resources/messages/client/Client.d.ts +20 -3
  10. package/api/resources/inboxes/resources/messages/client/Client.js +94 -15
  11. package/api/resources/inboxes/resources/messages/types/SendMessageRequest.d.ts +2 -1
  12. package/api/resources/inboxes/resources/messages/types/UpdateMessageRequest.d.ts +9 -0
  13. package/api/resources/inboxes/resources/messages/types/UpdateMessageRequest.js +5 -0
  14. package/api/resources/inboxes/resources/messages/types/index.d.ts +1 -0
  15. package/api/resources/inboxes/resources/messages/types/index.js +1 -0
  16. package/api/resources/inboxes/resources/threads/client/Client.js +2 -2
  17. package/api/resources/threads/client/Client.js +2 -2
  18. package/api/resources/webhooks/client/Client.js +4 -4
  19. package/dist/api/resources/drafts/client/Client.js +2 -2
  20. package/dist/api/resources/inboxes/client/Client.js +3 -3
  21. package/dist/api/resources/inboxes/resources/drafts/client/Client.d.ts +16 -0
  22. package/dist/api/resources/inboxes/resources/drafts/client/Client.js +89 -3
  23. package/dist/api/resources/inboxes/resources/drafts/types/SendDraftRequest.d.ts +7 -0
  24. package/dist/api/resources/inboxes/resources/drafts/types/SendDraftRequest.js +5 -0
  25. package/dist/api/resources/inboxes/resources/drafts/types/index.d.ts +1 -0
  26. package/dist/api/resources/inboxes/resources/drafts/types/index.js +1 -0
  27. package/dist/api/resources/inboxes/resources/messages/client/Client.d.ts +20 -3
  28. package/dist/api/resources/inboxes/resources/messages/client/Client.js +94 -15
  29. package/dist/api/resources/inboxes/resources/messages/types/SendMessageRequest.d.ts +2 -1
  30. package/dist/api/resources/inboxes/resources/messages/types/UpdateMessageRequest.d.ts +9 -0
  31. package/dist/api/resources/inboxes/resources/messages/types/UpdateMessageRequest.js +5 -0
  32. package/dist/api/resources/inboxes/resources/messages/types/index.d.ts +1 -0
  33. package/dist/api/resources/inboxes/resources/messages/types/index.js +1 -0
  34. package/dist/api/resources/inboxes/resources/threads/client/Client.js +2 -2
  35. package/dist/api/resources/threads/client/Client.js +2 -2
  36. package/dist/api/resources/webhooks/client/Client.js +4 -4
  37. package/dist/serialization/resources/inboxes/resources/drafts/types/SendDraftRequest.d.ts +13 -0
  38. package/dist/serialization/resources/inboxes/resources/drafts/types/SendDraftRequest.js +44 -0
  39. package/dist/serialization/resources/inboxes/resources/drafts/types/index.d.ts +1 -0
  40. package/dist/serialization/resources/inboxes/resources/drafts/types/index.js +1 -0
  41. package/dist/serialization/resources/inboxes/resources/messages/types/SendMessageRequest.d.ts +3 -1
  42. package/dist/serialization/resources/inboxes/resources/messages/types/SendMessageRequest.js +3 -1
  43. package/dist/serialization/resources/inboxes/resources/messages/types/UpdateMessageRequest.d.ts +13 -0
  44. package/dist/serialization/resources/inboxes/resources/messages/types/UpdateMessageRequest.js +44 -0
  45. package/dist/serialization/resources/inboxes/resources/messages/types/index.d.ts +1 -0
  46. package/dist/serialization/resources/inboxes/resources/messages/types/index.js +1 -0
  47. package/dist/version.d.ts +1 -1
  48. package/dist/version.js +1 -1
  49. package/package.json +1 -1
  50. package/reference.md +135 -1
  51. package/serialization/resources/inboxes/resources/drafts/types/SendDraftRequest.d.ts +13 -0
  52. package/serialization/resources/inboxes/resources/drafts/types/SendDraftRequest.js +44 -0
  53. package/serialization/resources/inboxes/resources/drafts/types/index.d.ts +1 -0
  54. package/serialization/resources/inboxes/resources/drafts/types/index.js +1 -0
  55. package/serialization/resources/inboxes/resources/messages/types/SendMessageRequest.d.ts +3 -1
  56. package/serialization/resources/inboxes/resources/messages/types/SendMessageRequest.js +3 -1
  57. package/serialization/resources/inboxes/resources/messages/types/UpdateMessageRequest.d.ts +13 -0
  58. package/serialization/resources/inboxes/resources/messages/types/UpdateMessageRequest.js +44 -0
  59. package/serialization/resources/inboxes/resources/messages/types/index.d.ts +1 -0
  60. package/serialization/resources/inboxes/resources/messages/types/index.js +1 -0
  61. package/version.d.ts +1 -1
  62. package/version.js +1 -1
@@ -86,7 +86,7 @@ class Drafts {
86
86
  const _response = yield core.fetcher({
87
87
  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/drafts"),
88
88
  method: "GET",
89
- headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.27", "User-Agent": "agentmail/0.0.27", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
89
+ headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.29", "User-Agent": "agentmail/0.0.29", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
90
90
  contentType: "application/json",
91
91
  queryParameters: _queryParams,
92
92
  requestType: "json",
@@ -150,7 +150,7 @@ class Drafts {
150
150
  const _response = yield core.fetcher({
151
151
  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/drafts/${encodeURIComponent(serializers.inboxes.DraftId.jsonOrThrow(draftId))}`),
152
152
  method: "GET",
153
- headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.27", "User-Agent": "agentmail/0.0.27", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
153
+ headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.29", "User-Agent": "agentmail/0.0.29", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
154
154
  contentType: "application/json",
155
155
  requestType: "json",
156
156
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -95,7 +95,7 @@ class Inboxes {
95
95
  const _response = yield core.fetcher({
96
96
  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"),
97
97
  method: "GET",
98
- headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.27", "User-Agent": "agentmail/0.0.27", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
98
+ headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.29", "User-Agent": "agentmail/0.0.29", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
99
99
  contentType: "application/json",
100
100
  queryParameters: _queryParams,
101
101
  requestType: "json",
@@ -148,7 +148,7 @@ class Inboxes {
148
148
  const _response = yield core.fetcher({
149
149
  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.inboxes.InboxId.jsonOrThrow(inboxId))}`),
150
150
  method: "GET",
151
- headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.27", "User-Agent": "agentmail/0.0.27", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
151
+ headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.29", "User-Agent": "agentmail/0.0.29", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
152
152
  contentType: "application/json",
153
153
  requestType: "json",
154
154
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -215,7 +215,7 @@ class Inboxes {
215
215
  const _response = yield core.fetcher({
216
216
  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"),
217
217
  method: "POST",
218
- headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.27", "User-Agent": "agentmail/0.0.27", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
218
+ headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.29", "User-Agent": "agentmail/0.0.29", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
219
219
  contentType: "application/json",
220
220
  requestType: "json",
221
221
  body: serializers.inboxes.CreateInboxRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -66,5 +66,21 @@ export declare class Drafts {
66
66
  * })
67
67
  */
68
68
  create(inboxId: AgentMail.inboxes.InboxId, request: AgentMail.inboxes.CreateDraftRequest, requestOptions?: Drafts.RequestOptions): Promise<AgentMail.inboxes.Draft>;
69
+ /**
70
+ * @param {AgentMail.inboxes.InboxId} inboxId
71
+ * @param {AgentMail.inboxes.DraftId} draftId
72
+ * @param {AgentMail.inboxes.SendDraftRequest} request
73
+ * @param {Drafts.RequestOptions} requestOptions - Request-specific configuration.
74
+ *
75
+ * @throws {@link AgentMail.NotFoundError}
76
+ * @throws {@link AgentMail.ValidationError}
77
+ * @throws {@link AgentMail.inboxes.MessageRejectedError}
78
+ *
79
+ * @example
80
+ * await client.inboxes.drafts.send("inbox_id", "draft_id", {
81
+ * labels: undefined
82
+ * })
83
+ */
84
+ send(inboxId: AgentMail.inboxes.InboxId, draftId: AgentMail.inboxes.DraftId, request: AgentMail.inboxes.SendDraftRequest, requestOptions?: Drafts.RequestOptions): Promise<AgentMail.inboxes.SendMessageResponse>;
69
85
  protected _getAuthorizationHeader(): Promise<string>;
70
86
  }
@@ -87,7 +87,7 @@ class Drafts {
87
87
  const _response = yield core.fetcher({
88
88
  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.inboxes.InboxId.jsonOrThrow(inboxId))}/drafts`),
89
89
  method: "GET",
90
- headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.27", "User-Agent": "agentmail/0.0.27", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
90
+ headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.29", "User-Agent": "agentmail/0.0.29", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
91
91
  contentType: "application/json",
92
92
  queryParameters: _queryParams,
93
93
  requestType: "json",
@@ -152,7 +152,7 @@ class Drafts {
152
152
  const _response = yield core.fetcher({
153
153
  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.inboxes.InboxId.jsonOrThrow(inboxId))}/drafts/${encodeURIComponent(serializers.inboxes.DraftId.jsonOrThrow(draftId))}`),
154
154
  method: "GET",
155
- headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.27", "User-Agent": "agentmail/0.0.27", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
155
+ headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.29", "User-Agent": "agentmail/0.0.29", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
156
156
  contentType: "application/json",
157
157
  requestType: "json",
158
158
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -224,7 +224,7 @@ class Drafts {
224
224
  const _response = yield core.fetcher({
225
225
  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.inboxes.InboxId.jsonOrThrow(inboxId))}/drafts`),
226
226
  method: "POST",
227
- headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.27", "User-Agent": "agentmail/0.0.27", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
227
+ headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.29", "User-Agent": "agentmail/0.0.29", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
228
228
  contentType: "application/json",
229
229
  requestType: "json",
230
230
  body: serializers.inboxes.CreateDraftRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -273,6 +273,92 @@ class Drafts {
273
273
  }
274
274
  });
275
275
  }
276
+ /**
277
+ * @param {AgentMail.inboxes.InboxId} inboxId
278
+ * @param {AgentMail.inboxes.DraftId} draftId
279
+ * @param {AgentMail.inboxes.SendDraftRequest} request
280
+ * @param {Drafts.RequestOptions} requestOptions - Request-specific configuration.
281
+ *
282
+ * @throws {@link AgentMail.NotFoundError}
283
+ * @throws {@link AgentMail.ValidationError}
284
+ * @throws {@link AgentMail.inboxes.MessageRejectedError}
285
+ *
286
+ * @example
287
+ * await client.inboxes.drafts.send("inbox_id", "draft_id", {
288
+ * labels: undefined
289
+ * })
290
+ */
291
+ send(inboxId, draftId, request, requestOptions) {
292
+ return __awaiter(this, void 0, void 0, function* () {
293
+ var _a, _b;
294
+ const _response = yield core.fetcher({
295
+ 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.inboxes.InboxId.jsonOrThrow(inboxId))}/drafts/${encodeURIComponent(serializers.inboxes.DraftId.jsonOrThrow(draftId))}/send`),
296
+ method: "POST",
297
+ headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.29", "User-Agent": "agentmail/0.0.29", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
298
+ contentType: "application/json",
299
+ requestType: "json",
300
+ body: serializers.inboxes.SendDraftRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
301
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
302
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
303
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
304
+ });
305
+ if (_response.ok) {
306
+ return serializers.inboxes.SendMessageResponse.parseOrThrow(_response.body, {
307
+ unrecognizedObjectKeys: "passthrough",
308
+ allowUnrecognizedUnionMembers: true,
309
+ allowUnrecognizedEnumValues: true,
310
+ skipValidation: true,
311
+ breadcrumbsPrefix: ["response"],
312
+ });
313
+ }
314
+ if (_response.error.reason === "status-code") {
315
+ switch (_response.error.statusCode) {
316
+ case 404:
317
+ throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
318
+ unrecognizedObjectKeys: "passthrough",
319
+ allowUnrecognizedUnionMembers: true,
320
+ allowUnrecognizedEnumValues: true,
321
+ skipValidation: true,
322
+ breadcrumbsPrefix: ["response"],
323
+ }));
324
+ case 400:
325
+ throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
326
+ unrecognizedObjectKeys: "passthrough",
327
+ allowUnrecognizedUnionMembers: true,
328
+ allowUnrecognizedEnumValues: true,
329
+ skipValidation: true,
330
+ breadcrumbsPrefix: ["response"],
331
+ }));
332
+ case 403:
333
+ throw new AgentMail.inboxes.MessageRejectedError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
334
+ unrecognizedObjectKeys: "passthrough",
335
+ allowUnrecognizedUnionMembers: true,
336
+ allowUnrecognizedEnumValues: true,
337
+ skipValidation: true,
338
+ breadcrumbsPrefix: ["response"],
339
+ }));
340
+ default:
341
+ throw new errors.AgentMailError({
342
+ statusCode: _response.error.statusCode,
343
+ body: _response.error.body,
344
+ });
345
+ }
346
+ }
347
+ switch (_response.error.reason) {
348
+ case "non-json":
349
+ throw new errors.AgentMailError({
350
+ statusCode: _response.error.statusCode,
351
+ body: _response.error.rawBody,
352
+ });
353
+ case "timeout":
354
+ throw new errors.AgentMailTimeoutError("Timeout exceeded when calling POST /v0/inboxes/{inbox_id}/drafts/{draft_id}/send.");
355
+ case "unknown":
356
+ throw new errors.AgentMailError({
357
+ message: _response.error.errorMessage,
358
+ });
359
+ }
360
+ });
361
+ }
276
362
  _getAuthorizationHeader() {
277
363
  return __awaiter(this, void 0, void 0, function* () {
278
364
  var _a;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as AgentMail from "../../../../../index";
5
+ export interface SendDraftRequest {
6
+ labels?: AgentMail.inboxes.DraftLabels;
7
+ }
@@ -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 });
@@ -17,3 +17,4 @@ export * from "./DraftItem";
17
17
  export * from "./Draft";
18
18
  export * from "./ListDraftsResponse";
19
19
  export * from "./CreateDraftRequest";
20
+ export * from "./SendDraftRequest";
@@ -33,3 +33,4 @@ __exportStar(require("./DraftItem"), exports);
33
33
  __exportStar(require("./Draft"), exports);
34
34
  __exportStar(require("./ListDraftsResponse"), exports);
35
35
  __exportStar(require("./CreateDraftRequest"), exports);
36
+ __exportStar(require("./SendDraftRequest"), exports);
@@ -57,13 +57,14 @@ export declare class Messages {
57
57
  * @param {AgentMail.inboxes.SendMessageRequest} request
58
58
  * @param {Messages.RequestOptions} requestOptions - Request-specific configuration.
59
59
  *
60
- * @throws {@link AgentMail.NotFoundError}
61
60
  * @throws {@link AgentMail.ValidationError}
61
+ * @throws {@link AgentMail.NotFoundError}
62
62
  * @throws {@link AgentMail.inboxes.MessageRejectedError}
63
63
  *
64
64
  * @example
65
65
  * await client.inboxes.messages.send("inbox_id", {
66
- * to: "to",
66
+ * labels: undefined,
67
+ * to: undefined,
67
68
  * cc: undefined,
68
69
  * bcc: undefined,
69
70
  * subject: undefined,
@@ -79,8 +80,8 @@ export declare class Messages {
79
80
  * @param {AgentMail.inboxes.ReplyToMessageRequest} request
80
81
  * @param {Messages.RequestOptions} requestOptions - Request-specific configuration.
81
82
  *
82
- * @throws {@link AgentMail.NotFoundError}
83
83
  * @throws {@link AgentMail.ValidationError}
84
+ * @throws {@link AgentMail.NotFoundError}
84
85
  * @throws {@link AgentMail.inboxes.MessageRejectedError}
85
86
  *
86
87
  * @example
@@ -94,5 +95,21 @@ export declare class Messages {
94
95
  * })
95
96
  */
96
97
  reply(inboxId: AgentMail.inboxes.InboxId, messageId: AgentMail.inboxes.MessageId, request: AgentMail.inboxes.ReplyToMessageRequest, requestOptions?: Messages.RequestOptions): Promise<AgentMail.inboxes.SendMessageResponse>;
98
+ /**
99
+ * @param {AgentMail.inboxes.InboxId} inboxId
100
+ * @param {AgentMail.inboxes.MessageId} messageId
101
+ * @param {AgentMail.inboxes.UpdateMessageRequest} request
102
+ * @param {Messages.RequestOptions} requestOptions - Request-specific configuration.
103
+ *
104
+ * @throws {@link AgentMail.ValidationError}
105
+ * @throws {@link AgentMail.NotFoundError}
106
+ *
107
+ * @example
108
+ * await client.inboxes.messages.update("inbox_id", "message_id", {
109
+ * addLabels: undefined,
110
+ * removeLabels: undefined
111
+ * })
112
+ */
113
+ update(inboxId: AgentMail.inboxes.InboxId, messageId: AgentMail.inboxes.MessageId, request: AgentMail.inboxes.UpdateMessageRequest, requestOptions?: Messages.RequestOptions): Promise<AgentMail.inboxes.Message>;
97
114
  protected _getAuthorizationHeader(): Promise<string>;
98
115
  }
@@ -87,7 +87,7 @@ class Messages {
87
87
  const _response = yield core.fetcher({
88
88
  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.inboxes.InboxId.jsonOrThrow(inboxId))}/messages`),
89
89
  method: "GET",
90
- headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.27", "User-Agent": "agentmail/0.0.27", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
90
+ headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.29", "User-Agent": "agentmail/0.0.29", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
91
91
  contentType: "application/json",
92
92
  queryParameters: _queryParams,
93
93
  requestType: "json",
@@ -152,7 +152,7 @@ class Messages {
152
152
  const _response = yield core.fetcher({
153
153
  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.inboxes.InboxId.jsonOrThrow(inboxId))}/messages/${encodeURIComponent(serializers.inboxes.MessageId.jsonOrThrow(messageId))}`),
154
154
  method: "GET",
155
- headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.27", "User-Agent": "agentmail/0.0.27", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
155
+ headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.29", "User-Agent": "agentmail/0.0.29", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
156
156
  contentType: "application/json",
157
157
  requestType: "json",
158
158
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -209,7 +209,7 @@ class Messages {
209
209
  const _response = yield core.fetcher({
210
210
  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.inboxes.InboxId.jsonOrThrow(inboxId))}/messages/${encodeURIComponent(serializers.inboxes.MessageId.jsonOrThrow(messageId))}/attachments/${encodeURIComponent(serializers.inboxes.AttachmentId.jsonOrThrow(attachmentId))}`),
211
211
  method: "GET",
212
- headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.27", "User-Agent": "agentmail/0.0.27", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
212
+ headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.29", "User-Agent": "agentmail/0.0.29", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
213
213
  contentType: "application/json",
214
214
  requestType: "json",
215
215
  responseType: "streaming",
@@ -257,13 +257,14 @@ class Messages {
257
257
  * @param {AgentMail.inboxes.SendMessageRequest} request
258
258
  * @param {Messages.RequestOptions} requestOptions - Request-specific configuration.
259
259
  *
260
- * @throws {@link AgentMail.NotFoundError}
261
260
  * @throws {@link AgentMail.ValidationError}
261
+ * @throws {@link AgentMail.NotFoundError}
262
262
  * @throws {@link AgentMail.inboxes.MessageRejectedError}
263
263
  *
264
264
  * @example
265
265
  * await client.inboxes.messages.send("inbox_id", {
266
- * to: "to",
266
+ * labels: undefined,
267
+ * to: undefined,
267
268
  * cc: undefined,
268
269
  * bcc: undefined,
269
270
  * subject: undefined,
@@ -278,7 +279,7 @@ class Messages {
278
279
  const _response = yield core.fetcher({
279
280
  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.inboxes.InboxId.jsonOrThrow(inboxId))}/messages/send`),
280
281
  method: "POST",
281
- headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.27", "User-Agent": "agentmail/0.0.27", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
282
+ headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.29", "User-Agent": "agentmail/0.0.29", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
282
283
  contentType: "application/json",
283
284
  requestType: "json",
284
285
  body: serializers.inboxes.SendMessageRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -297,16 +298,16 @@ class Messages {
297
298
  }
298
299
  if (_response.error.reason === "status-code") {
299
300
  switch (_response.error.statusCode) {
300
- case 404:
301
- throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
301
+ case 400:
302
+ throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
302
303
  unrecognizedObjectKeys: "passthrough",
303
304
  allowUnrecognizedUnionMembers: true,
304
305
  allowUnrecognizedEnumValues: true,
305
306
  skipValidation: true,
306
307
  breadcrumbsPrefix: ["response"],
307
308
  }));
308
- case 400:
309
- throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
309
+ case 404:
310
+ throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
310
311
  unrecognizedObjectKeys: "passthrough",
311
312
  allowUnrecognizedUnionMembers: true,
312
313
  allowUnrecognizedEnumValues: true,
@@ -349,8 +350,8 @@ class Messages {
349
350
  * @param {AgentMail.inboxes.ReplyToMessageRequest} request
350
351
  * @param {Messages.RequestOptions} requestOptions - Request-specific configuration.
351
352
  *
352
- * @throws {@link AgentMail.NotFoundError}
353
353
  * @throws {@link AgentMail.ValidationError}
354
+ * @throws {@link AgentMail.NotFoundError}
354
355
  * @throws {@link AgentMail.inboxes.MessageRejectedError}
355
356
  *
356
357
  * @example
@@ -369,7 +370,7 @@ class Messages {
369
370
  const _response = yield core.fetcher({
370
371
  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.inboxes.InboxId.jsonOrThrow(inboxId))}/messages/${encodeURIComponent(serializers.inboxes.MessageId.jsonOrThrow(messageId))}/reply`),
371
372
  method: "POST",
372
- headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.27", "User-Agent": "agentmail/0.0.27", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
373
+ headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.29", "User-Agent": "agentmail/0.0.29", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
373
374
  contentType: "application/json",
374
375
  requestType: "json",
375
376
  body: serializers.inboxes.ReplyToMessageRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -388,6 +389,14 @@ class Messages {
388
389
  }
389
390
  if (_response.error.reason === "status-code") {
390
391
  switch (_response.error.statusCode) {
392
+ case 400:
393
+ throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
394
+ unrecognizedObjectKeys: "passthrough",
395
+ allowUnrecognizedUnionMembers: true,
396
+ allowUnrecognizedEnumValues: true,
397
+ skipValidation: true,
398
+ breadcrumbsPrefix: ["response"],
399
+ }));
391
400
  case 404:
392
401
  throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
393
402
  unrecognizedObjectKeys: "passthrough",
@@ -396,6 +405,76 @@ class Messages {
396
405
  skipValidation: true,
397
406
  breadcrumbsPrefix: ["response"],
398
407
  }));
408
+ case 403:
409
+ throw new AgentMail.inboxes.MessageRejectedError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
410
+ unrecognizedObjectKeys: "passthrough",
411
+ allowUnrecognizedUnionMembers: true,
412
+ allowUnrecognizedEnumValues: true,
413
+ skipValidation: true,
414
+ breadcrumbsPrefix: ["response"],
415
+ }));
416
+ default:
417
+ throw new errors.AgentMailError({
418
+ statusCode: _response.error.statusCode,
419
+ body: _response.error.body,
420
+ });
421
+ }
422
+ }
423
+ switch (_response.error.reason) {
424
+ case "non-json":
425
+ throw new errors.AgentMailError({
426
+ statusCode: _response.error.statusCode,
427
+ body: _response.error.rawBody,
428
+ });
429
+ case "timeout":
430
+ throw new errors.AgentMailTimeoutError("Timeout exceeded when calling POST /v0/inboxes/{inbox_id}/messages/{message_id}/reply.");
431
+ case "unknown":
432
+ throw new errors.AgentMailError({
433
+ message: _response.error.errorMessage,
434
+ });
435
+ }
436
+ });
437
+ }
438
+ /**
439
+ * @param {AgentMail.inboxes.InboxId} inboxId
440
+ * @param {AgentMail.inboxes.MessageId} messageId
441
+ * @param {AgentMail.inboxes.UpdateMessageRequest} request
442
+ * @param {Messages.RequestOptions} requestOptions - Request-specific configuration.
443
+ *
444
+ * @throws {@link AgentMail.ValidationError}
445
+ * @throws {@link AgentMail.NotFoundError}
446
+ *
447
+ * @example
448
+ * await client.inboxes.messages.update("inbox_id", "message_id", {
449
+ * addLabels: undefined,
450
+ * removeLabels: undefined
451
+ * })
452
+ */
453
+ update(inboxId, messageId, request, requestOptions) {
454
+ return __awaiter(this, void 0, void 0, function* () {
455
+ var _a, _b;
456
+ const _response = yield core.fetcher({
457
+ 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.inboxes.InboxId.jsonOrThrow(inboxId))}/messages/${encodeURIComponent(serializers.inboxes.MessageId.jsonOrThrow(messageId))}`),
458
+ method: "PATCH",
459
+ headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.29", "User-Agent": "agentmail/0.0.29", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
460
+ contentType: "application/json",
461
+ requestType: "json",
462
+ body: serializers.inboxes.UpdateMessageRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
463
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
464
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
465
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
466
+ });
467
+ if (_response.ok) {
468
+ return serializers.inboxes.Message.parseOrThrow(_response.body, {
469
+ unrecognizedObjectKeys: "passthrough",
470
+ allowUnrecognizedUnionMembers: true,
471
+ allowUnrecognizedEnumValues: true,
472
+ skipValidation: true,
473
+ breadcrumbsPrefix: ["response"],
474
+ });
475
+ }
476
+ if (_response.error.reason === "status-code") {
477
+ switch (_response.error.statusCode) {
399
478
  case 400:
400
479
  throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
401
480
  unrecognizedObjectKeys: "passthrough",
@@ -404,8 +483,8 @@ class Messages {
404
483
  skipValidation: true,
405
484
  breadcrumbsPrefix: ["response"],
406
485
  }));
407
- case 403:
408
- throw new AgentMail.inboxes.MessageRejectedError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
486
+ case 404:
487
+ throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
409
488
  unrecognizedObjectKeys: "passthrough",
410
489
  allowUnrecognizedUnionMembers: true,
411
490
  allowUnrecognizedEnumValues: true,
@@ -426,7 +505,7 @@ class Messages {
426
505
  body: _response.error.rawBody,
427
506
  });
428
507
  case "timeout":
429
- throw new errors.AgentMailTimeoutError("Timeout exceeded when calling POST /v0/inboxes/{inbox_id}/messages/{message_id}/reply.");
508
+ throw new errors.AgentMailTimeoutError("Timeout exceeded when calling PATCH /v0/inboxes/{inbox_id}/messages/{message_id}.");
430
509
  case "unknown":
431
510
  throw new errors.AgentMailError({
432
511
  message: _response.error.errorMessage,
@@ -3,7 +3,8 @@
3
3
  */
4
4
  import * as AgentMail from "../../../../../index";
5
5
  export interface SendMessageRequest {
6
- to: AgentMail.inboxes.SendMessageTo;
6
+ labels?: AgentMail.inboxes.MessageLabels;
7
+ to?: AgentMail.inboxes.SendMessageTo;
7
8
  cc?: AgentMail.inboxes.SendMessageCc;
8
9
  bcc?: AgentMail.inboxes.SendMessageBcc;
9
10
  subject?: AgentMail.inboxes.MessageSubject;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export interface UpdateMessageRequest {
5
+ /** Labels to add to message. */
6
+ addLabels?: string[];
7
+ /** Labels to remove from message. */
8
+ removeLabels?: string[];
9
+ }
@@ -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 });
@@ -32,3 +32,4 @@ export * from "./SendMessageAttachments";
32
32
  export * from "./SendMessageRequest";
33
33
  export * from "./SendMessageResponse";
34
34
  export * from "./ReplyToMessageRequest";
35
+ export * from "./UpdateMessageRequest";
@@ -48,3 +48,4 @@ __exportStar(require("./SendMessageAttachments"), exports);
48
48
  __exportStar(require("./SendMessageRequest"), exports);
49
49
  __exportStar(require("./SendMessageResponse"), exports);
50
50
  __exportStar(require("./ReplyToMessageRequest"), exports);
51
+ __exportStar(require("./UpdateMessageRequest"), exports);
@@ -87,7 +87,7 @@ class Threads {
87
87
  const _response = yield core.fetcher({
88
88
  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.inboxes.InboxId.jsonOrThrow(inboxId))}/threads`),
89
89
  method: "GET",
90
- headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.27", "User-Agent": "agentmail/0.0.27", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
90
+ headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.29", "User-Agent": "agentmail/0.0.29", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
91
91
  contentType: "application/json",
92
92
  queryParameters: _queryParams,
93
93
  requestType: "json",
@@ -152,7 +152,7 @@ class Threads {
152
152
  const _response = yield core.fetcher({
153
153
  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.inboxes.InboxId.jsonOrThrow(inboxId))}/threads/${encodeURIComponent(serializers.inboxes.ThreadId.jsonOrThrow(threadId))}`),
154
154
  method: "GET",
155
- headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.27", "User-Agent": "agentmail/0.0.27", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
155
+ headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.29", "User-Agent": "agentmail/0.0.29", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
156
156
  contentType: "application/json",
157
157
  requestType: "json",
158
158
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -86,7 +86,7 @@ class Threads {
86
86
  const _response = yield core.fetcher({
87
87
  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/threads"),
88
88
  method: "GET",
89
- headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.27", "User-Agent": "agentmail/0.0.27", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
89
+ headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.29", "User-Agent": "agentmail/0.0.29", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
90
90
  contentType: "application/json",
91
91
  queryParameters: _queryParams,
92
92
  requestType: "json",
@@ -150,7 +150,7 @@ class Threads {
150
150
  const _response = yield core.fetcher({
151
151
  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/threads/${encodeURIComponent(serializers.inboxes.ThreadId.jsonOrThrow(threadId))}`),
152
152
  method: "GET",
153
- headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.27", "User-Agent": "agentmail/0.0.27", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
153
+ headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.29", "User-Agent": "agentmail/0.0.29", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
154
154
  contentType: "application/json",
155
155
  requestType: "json",
156
156
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -80,7 +80,7 @@ class Webhooks {
80
80
  const _response = yield core.fetcher({
81
81
  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/webhooks"),
82
82
  method: "GET",
83
- headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.27", "User-Agent": "agentmail/0.0.27", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
83
+ headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.29", "User-Agent": "agentmail/0.0.29", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
84
84
  contentType: "application/json",
85
85
  queryParameters: _queryParams,
86
86
  requestType: "json",
@@ -133,7 +133,7 @@ class Webhooks {
133
133
  const _response = yield core.fetcher({
134
134
  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/webhooks/${encodeURIComponent(serializers.WebhookId.jsonOrThrow(webhookId))}`),
135
135
  method: "GET",
136
- headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.27", "User-Agent": "agentmail/0.0.27", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
136
+ headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.29", "User-Agent": "agentmail/0.0.29", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
137
137
  contentType: "application/json",
138
138
  requestType: "json",
139
139
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -200,7 +200,7 @@ class Webhooks {
200
200
  const _response = yield core.fetcher({
201
201
  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/webhooks"),
202
202
  method: "POST",
203
- headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.27", "User-Agent": "agentmail/0.0.27", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
203
+ headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.29", "User-Agent": "agentmail/0.0.29", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
204
204
  contentType: "application/json",
205
205
  requestType: "json",
206
206
  body: serializers.CreateWebhookRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -264,7 +264,7 @@ class Webhooks {
264
264
  const _response = yield core.fetcher({
265
265
  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/webhooks/${encodeURIComponent(serializers.WebhookId.jsonOrThrow(webhookId))}`),
266
266
  method: "DELETE",
267
- headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.27", "User-Agent": "agentmail/0.0.27", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
267
+ headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.29", "User-Agent": "agentmail/0.0.29", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
268
268
  contentType: "application/json",
269
269
  requestType: "json",
270
270
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,