agentmail 0.5.13 → 0.5.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/dist/cjs/BaseClient.d.ts +3 -0
  2. package/dist/cjs/BaseClient.js +2 -2
  3. package/dist/cjs/api/errors/ConflictError.d.ts +6 -0
  4. package/dist/cjs/{serialization/resources/drafts/types/CreateDraftReplyAllRequest.js → api/errors/ConflictError.js} +18 -20
  5. package/dist/cjs/api/errors/index.d.ts +1 -0
  6. package/dist/cjs/api/errors/index.js +1 -0
  7. package/dist/cjs/api/resources/drafts/types/CreateDraftRequest.d.ts +17 -0
  8. package/dist/cjs/api/resources/drafts/types/UpdateDraftRequest.d.ts +22 -8
  9. package/dist/cjs/api/resources/drafts/types/index.d.ts +0 -3
  10. package/dist/cjs/api/resources/drafts/types/index.js +0 -3
  11. package/dist/cjs/api/resources/inboxes/resources/drafts/client/Client.d.ts +19 -3
  12. package/dist/cjs/api/resources/inboxes/resources/drafts/client/Client.js +48 -2
  13. package/dist/cjs/api/resources/inboxes/resources/messages/client/Client.d.ts +15 -78
  14. package/dist/cjs/api/resources/inboxes/resources/messages/client/Client.js +41 -269
  15. package/dist/cjs/api/types/ErrorCode.d.ts +4 -0
  16. package/dist/cjs/api/types/ErrorDocs.d.ts +4 -0
  17. package/dist/cjs/api/types/ErrorFix.d.ts +4 -0
  18. package/dist/cjs/api/types/ErrorResponse.d.ts +3 -0
  19. package/dist/cjs/api/types/ValidationErrorResponse.d.ts +5 -1
  20. package/dist/cjs/api/types/index.d.ts +3 -0
  21. package/dist/cjs/api/types/index.js +3 -0
  22. package/dist/cjs/serialization/resources/drafts/types/CreateDraftRequest.d.ts +4 -0
  23. package/dist/cjs/serialization/resources/drafts/types/CreateDraftRequest.js +4 -0
  24. package/dist/cjs/serialization/resources/drafts/types/UpdateDraftRequest.d.ts +15 -8
  25. package/dist/cjs/serialization/resources/drafts/types/UpdateDraftRequest.js +15 -8
  26. package/dist/cjs/serialization/resources/drafts/types/index.d.ts +0 -3
  27. package/dist/cjs/serialization/resources/drafts/types/index.js +0 -3
  28. package/dist/cjs/serialization/types/ErrorCode.d.ts +7 -0
  29. package/dist/cjs/serialization/{resources/drafts/types/CreateDraftForwardRequest.js → types/ErrorCode.js} +3 -26
  30. package/dist/cjs/serialization/types/ErrorDocs.d.ts +7 -0
  31. package/dist/cjs/serialization/types/ErrorDocs.js +39 -0
  32. package/dist/cjs/serialization/types/ErrorFix.d.ts +7 -0
  33. package/dist/cjs/serialization/types/ErrorFix.js +39 -0
  34. package/dist/cjs/serialization/types/ErrorResponse.d.ts +6 -0
  35. package/dist/cjs/serialization/types/ErrorResponse.js +6 -0
  36. package/dist/cjs/serialization/types/ValidationErrorResponse.d.ts +8 -0
  37. package/dist/cjs/serialization/types/ValidationErrorResponse.js +8 -0
  38. package/dist/cjs/serialization/types/index.d.ts +3 -0
  39. package/dist/cjs/serialization/types/index.js +3 -0
  40. package/dist/cjs/version.d.ts +1 -1
  41. package/dist/cjs/version.js +1 -1
  42. package/dist/esm/BaseClient.d.mts +3 -0
  43. package/dist/esm/BaseClient.mjs +2 -2
  44. package/dist/esm/api/errors/ConflictError.d.mts +6 -0
  45. package/dist/esm/api/errors/ConflictError.mjs +17 -0
  46. package/dist/esm/api/errors/index.d.mts +1 -0
  47. package/dist/esm/api/errors/index.mjs +1 -0
  48. package/dist/esm/api/resources/drafts/types/CreateDraftRequest.d.mts +17 -0
  49. package/dist/esm/api/resources/drafts/types/UpdateDraftRequest.d.mts +22 -8
  50. package/dist/esm/api/resources/drafts/types/index.d.mts +0 -3
  51. package/dist/esm/api/resources/drafts/types/index.mjs +0 -3
  52. package/dist/esm/api/resources/inboxes/resources/drafts/client/Client.d.mts +19 -3
  53. package/dist/esm/api/resources/inboxes/resources/drafts/client/Client.mjs +49 -3
  54. package/dist/esm/api/resources/inboxes/resources/messages/client/Client.d.mts +15 -78
  55. package/dist/esm/api/resources/inboxes/resources/messages/client/Client.mjs +42 -270
  56. package/dist/esm/api/types/ErrorCode.d.mts +4 -0
  57. package/dist/esm/api/types/ErrorDocs.d.mts +4 -0
  58. package/dist/esm/api/types/ErrorFix.d.mts +4 -0
  59. package/dist/esm/api/types/ErrorResponse.d.mts +3 -0
  60. package/dist/esm/api/types/ValidationErrorResponse.d.mts +5 -1
  61. package/dist/esm/api/types/index.d.mts +3 -0
  62. package/dist/esm/api/types/index.mjs +3 -0
  63. package/dist/esm/serialization/resources/drafts/types/CreateDraftRequest.d.mts +4 -0
  64. package/dist/esm/serialization/resources/drafts/types/CreateDraftRequest.mjs +4 -0
  65. package/dist/esm/serialization/resources/drafts/types/UpdateDraftRequest.d.mts +15 -8
  66. package/dist/esm/serialization/resources/drafts/types/UpdateDraftRequest.mjs +15 -8
  67. package/dist/esm/serialization/resources/drafts/types/index.d.mts +0 -3
  68. package/dist/esm/serialization/resources/drafts/types/index.mjs +0 -3
  69. package/dist/esm/serialization/types/ErrorCode.d.mts +7 -0
  70. package/dist/esm/serialization/types/ErrorCode.mjs +3 -0
  71. package/dist/esm/serialization/types/ErrorDocs.d.mts +7 -0
  72. package/dist/esm/serialization/types/ErrorDocs.mjs +3 -0
  73. package/dist/esm/serialization/types/ErrorFix.d.mts +7 -0
  74. package/dist/esm/serialization/types/ErrorFix.mjs +3 -0
  75. package/dist/esm/serialization/types/ErrorResponse.d.mts +6 -0
  76. package/dist/esm/serialization/types/ErrorResponse.mjs +6 -0
  77. package/dist/esm/serialization/types/ValidationErrorResponse.d.mts +8 -0
  78. package/dist/esm/serialization/types/ValidationErrorResponse.mjs +8 -0
  79. package/dist/esm/serialization/types/index.d.mts +3 -0
  80. package/dist/esm/serialization/types/index.mjs +3 -0
  81. package/dist/esm/version.d.mts +1 -1
  82. package/dist/esm/version.mjs +1 -1
  83. package/dist/llms.txt +13 -0
  84. package/package.json +1 -1
  85. package/reference.md +15 -263
  86. package/dist/cjs/api/resources/drafts/types/CreateDraftForwardRequest.d.ts +0 -21
  87. package/dist/cjs/api/resources/drafts/types/CreateDraftReplyAllRequest.d.ts +0 -17
  88. package/dist/cjs/api/resources/drafts/types/CreateDraftReplyRequest.d.ts +0 -22
  89. package/dist/cjs/serialization/resources/drafts/types/CreateDraftForwardRequest.d.ts +0 -30
  90. package/dist/cjs/serialization/resources/drafts/types/CreateDraftReplyAllRequest.d.ts +0 -24
  91. package/dist/cjs/serialization/resources/drafts/types/CreateDraftReplyRequest.d.ts +0 -32
  92. package/dist/cjs/serialization/resources/drafts/types/CreateDraftReplyRequest.js +0 -64
  93. package/dist/esm/api/resources/drafts/types/CreateDraftForwardRequest.d.mts +0 -21
  94. package/dist/esm/api/resources/drafts/types/CreateDraftReplyAllRequest.d.mts +0 -17
  95. package/dist/esm/api/resources/drafts/types/CreateDraftReplyRequest.d.mts +0 -22
  96. package/dist/esm/serialization/resources/drafts/types/CreateDraftForwardRequest.d.mts +0 -30
  97. package/dist/esm/serialization/resources/drafts/types/CreateDraftForwardRequest.mjs +0 -26
  98. package/dist/esm/serialization/resources/drafts/types/CreateDraftReplyAllRequest.d.mts +0 -24
  99. package/dist/esm/serialization/resources/drafts/types/CreateDraftReplyAllRequest.mjs +0 -20
  100. package/dist/esm/serialization/resources/drafts/types/CreateDraftReplyRequest.d.mts +0 -32
  101. package/dist/esm/serialization/resources/drafts/types/CreateDraftReplyRequest.mjs +0 -28
  102. /package/dist/cjs/api/{resources/drafts/types/CreateDraftForwardRequest.js → types/ErrorCode.js} +0 -0
  103. /package/dist/cjs/api/{resources/drafts/types/CreateDraftReplyAllRequest.js → types/ErrorDocs.js} +0 -0
  104. /package/dist/cjs/api/{resources/drafts/types/CreateDraftReplyRequest.js → types/ErrorFix.js} +0 -0
  105. /package/dist/esm/api/{resources/drafts/types/CreateDraftForwardRequest.mjs → types/ErrorCode.mjs} +0 -0
  106. /package/dist/esm/api/{resources/drafts/types/CreateDraftReplyAllRequest.mjs → types/ErrorDocs.mjs} +0 -0
  107. /package/dist/esm/api/{resources/drafts/types/CreateDraftReplyRequest.mjs → types/ErrorFix.mjs} +0 -0
@@ -1,4 +1,4 @@
1
- import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../BaseClient.mjs";
1
+ import type { BaseClientOptions, BaseIdempotentRequestOptions, BaseRequestOptions } from "../../../../../../BaseClient.mjs";
2
2
  import { type NormalizedClientOptionsWithAuth } from "../../../../../../BaseClient.mjs";
3
3
  import * as core from "../../../../../../core/index.mjs";
4
4
  import * as AgentMail from "../../../../../index.mjs";
@@ -6,6 +6,8 @@ export declare namespace MessagesClient {
6
6
  type Options = BaseClientOptions;
7
7
  interface RequestOptions extends BaseRequestOptions {
8
8
  }
9
+ interface IdempotentRequestOptions extends RequestOptions, BaseIdempotentRequestOptions {
10
+ }
9
11
  }
10
12
  export declare class MessagesClient {
11
13
  protected readonly _options: NormalizedClientOptionsWithAuth<MessagesClient.Options>;
@@ -200,16 +202,17 @@ export declare class MessagesClient {
200
202
  *
201
203
  * @param {AgentMail.inboxes.InboxId} inbox_id
202
204
  * @param {AgentMail.SendMessageRequest} request
203
- * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
205
+ * @param {MessagesClient.IdempotentRequestOptions} requestOptions - Request-specific configuration.
204
206
  *
205
207
  * @throws {@link AgentMail.ValidationError}
206
208
  * @throws {@link AgentMail.NotFoundError}
209
+ * @throws {@link AgentMail.ConflictError}
207
210
  * @throws {@link AgentMail.MessageRejectedError}
208
211
  *
209
212
  * @example
210
213
  * await client.inboxes.messages.send("inbox_id", {})
211
214
  */
212
- send(inbox_id: AgentMail.inboxes.InboxId, request: AgentMail.SendMessageRequest, requestOptions?: MessagesClient.RequestOptions): core.HttpResponsePromise<AgentMail.SendMessageResponse>;
215
+ send(inbox_id: AgentMail.inboxes.InboxId, request: AgentMail.SendMessageRequest, requestOptions?: MessagesClient.IdempotentRequestOptions): core.HttpResponsePromise<AgentMail.SendMessageResponse>;
213
216
  private __send;
214
217
  /**
215
218
  * **CLI:**
@@ -220,16 +223,17 @@ export declare class MessagesClient {
220
223
  * @param {AgentMail.inboxes.InboxId} inbox_id
221
224
  * @param {AgentMail.MessageId} message_id
222
225
  * @param {AgentMail.ReplyToMessageRequest} request
223
- * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
226
+ * @param {MessagesClient.IdempotentRequestOptions} requestOptions - Request-specific configuration.
224
227
  *
225
228
  * @throws {@link AgentMail.ValidationError}
226
229
  * @throws {@link AgentMail.NotFoundError}
230
+ * @throws {@link AgentMail.ConflictError}
227
231
  * @throws {@link AgentMail.MessageRejectedError}
228
232
  *
229
233
  * @example
230
234
  * await client.inboxes.messages.reply("inbox_id", "message_id", {})
231
235
  */
232
- reply(inbox_id: AgentMail.inboxes.InboxId, message_id: AgentMail.MessageId, request: AgentMail.ReplyToMessageRequest, requestOptions?: MessagesClient.RequestOptions): core.HttpResponsePromise<AgentMail.SendMessageResponse>;
236
+ reply(inbox_id: AgentMail.inboxes.InboxId, message_id: AgentMail.MessageId, request: AgentMail.ReplyToMessageRequest, requestOptions?: MessagesClient.IdempotentRequestOptions): core.HttpResponsePromise<AgentMail.SendMessageResponse>;
233
237
  private __reply;
234
238
  /**
235
239
  * **CLI:**
@@ -240,16 +244,17 @@ export declare class MessagesClient {
240
244
  * @param {AgentMail.inboxes.InboxId} inbox_id
241
245
  * @param {AgentMail.MessageId} message_id
242
246
  * @param {AgentMail.ReplyAllMessageRequest} request
243
- * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
247
+ * @param {MessagesClient.IdempotentRequestOptions} requestOptions - Request-specific configuration.
244
248
  *
245
249
  * @throws {@link AgentMail.ValidationError}
246
250
  * @throws {@link AgentMail.NotFoundError}
251
+ * @throws {@link AgentMail.ConflictError}
247
252
  * @throws {@link AgentMail.MessageRejectedError}
248
253
  *
249
254
  * @example
250
255
  * await client.inboxes.messages.replyAll("inbox_id", "message_id", {})
251
256
  */
252
- replyAll(inbox_id: AgentMail.inboxes.InboxId, message_id: AgentMail.MessageId, request: AgentMail.ReplyAllMessageRequest, requestOptions?: MessagesClient.RequestOptions): core.HttpResponsePromise<AgentMail.SendMessageResponse>;
257
+ replyAll(inbox_id: AgentMail.inboxes.InboxId, message_id: AgentMail.MessageId, request: AgentMail.ReplyAllMessageRequest, requestOptions?: MessagesClient.IdempotentRequestOptions): core.HttpResponsePromise<AgentMail.SendMessageResponse>;
253
258
  private __replyAll;
254
259
  /**
255
260
  * **CLI:**
@@ -260,84 +265,16 @@ export declare class MessagesClient {
260
265
  * @param {AgentMail.inboxes.InboxId} inbox_id
261
266
  * @param {AgentMail.MessageId} message_id
262
267
  * @param {AgentMail.SendMessageRequest} request
263
- * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
268
+ * @param {MessagesClient.IdempotentRequestOptions} requestOptions - Request-specific configuration.
264
269
  *
265
270
  * @throws {@link AgentMail.ValidationError}
266
271
  * @throws {@link AgentMail.NotFoundError}
272
+ * @throws {@link AgentMail.ConflictError}
267
273
  * @throws {@link AgentMail.MessageRejectedError}
268
274
  *
269
275
  * @example
270
276
  * await client.inboxes.messages.forward("inbox_id", "message_id", {})
271
277
  */
272
- forward(inbox_id: AgentMail.inboxes.InboxId, message_id: AgentMail.MessageId, request: AgentMail.SendMessageRequest, requestOptions?: MessagesClient.RequestOptions): core.HttpResponsePromise<AgentMail.SendMessageResponse>;
278
+ forward(inbox_id: AgentMail.inboxes.InboxId, message_id: AgentMail.MessageId, request: AgentMail.SendMessageRequest, requestOptions?: MessagesClient.IdempotentRequestOptions): core.HttpResponsePromise<AgentMail.SendMessageResponse>;
273
279
  private __forward;
274
- /**
275
- * Create a draft that replies to a message instead of sending it. The
276
- * recipients, subject, and threading are derived from the source message.
277
- * Send it later with `Send Draft`.
278
- *
279
- * **CLI:**
280
- * ```bash
281
- * agentmail inboxes:messages draft-reply --inbox-id <inbox_id> --message-id <message_id> --text "Reply text"
282
- * ```
283
- *
284
- * @param {AgentMail.inboxes.InboxId} inbox_id
285
- * @param {AgentMail.MessageId} message_id
286
- * @param {AgentMail.CreateDraftReplyRequest} request
287
- * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
288
- *
289
- * @throws {@link AgentMail.ValidationError}
290
- * @throws {@link AgentMail.NotFoundError}
291
- *
292
- * @example
293
- * await client.inboxes.messages.draftReply("inbox_id", "message_id", {})
294
- */
295
- draftReply(inbox_id: AgentMail.inboxes.InboxId, message_id: AgentMail.MessageId, request: AgentMail.CreateDraftReplyRequest, requestOptions?: MessagesClient.RequestOptions): core.HttpResponsePromise<AgentMail.Draft>;
296
- private __draftReply;
297
- /**
298
- * Create a draft that replies to every recipient of a message instead of
299
- * sending it. Recipients, subject, and threading are derived from the
300
- * source message. Send it later with `Send Draft`.
301
- *
302
- * **CLI:**
303
- * ```bash
304
- * agentmail inboxes:messages draft-reply-all --inbox-id <inbox_id> --message-id <message_id> --text "Reply text"
305
- * ```
306
- *
307
- * @param {AgentMail.inboxes.InboxId} inbox_id
308
- * @param {AgentMail.MessageId} message_id
309
- * @param {AgentMail.CreateDraftReplyAllRequest} request
310
- * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
311
- *
312
- * @throws {@link AgentMail.ValidationError}
313
- * @throws {@link AgentMail.NotFoundError}
314
- *
315
- * @example
316
- * await client.inboxes.messages.draftReplyAll("inbox_id", "message_id", {})
317
- */
318
- draftReplyAll(inbox_id: AgentMail.inboxes.InboxId, message_id: AgentMail.MessageId, request: AgentMail.CreateDraftReplyAllRequest, requestOptions?: MessagesClient.RequestOptions): core.HttpResponsePromise<AgentMail.Draft>;
319
- private __draftReplyAll;
320
- /**
321
- * Create a draft that forwards a message instead of sending it. The subject
322
- * and threading are derived from the source message, whose body and
323
- * attachments are merged in at send time. Send it later with `Send Draft`.
324
- *
325
- * **CLI:**
326
- * ```bash
327
- * agentmail inboxes:messages draft-forward --inbox-id <inbox_id> --message-id <message_id> --to recipient@example.com
328
- * ```
329
- *
330
- * @param {AgentMail.inboxes.InboxId} inbox_id
331
- * @param {AgentMail.MessageId} message_id
332
- * @param {AgentMail.CreateDraftForwardRequest} request
333
- * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
334
- *
335
- * @throws {@link AgentMail.ValidationError}
336
- * @throws {@link AgentMail.NotFoundError}
337
- *
338
- * @example
339
- * await client.inboxes.messages.draftForward("inbox_id", "message_id", {})
340
- */
341
- draftForward(inbox_id: AgentMail.inboxes.InboxId, message_id: AgentMail.MessageId, request: AgentMail.CreateDraftForwardRequest, requestOptions?: MessagesClient.RequestOptions): core.HttpResponsePromise<AgentMail.Draft>;
342
- private __draftForward;
343
280
  }
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  import { normalizeClientOptionsWithAuth } from "../../../../../../BaseClient.mjs";
12
- import { mergeHeaders } from "../../../../../../core/headers.mjs";
12
+ import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.mjs";
13
13
  import * as core from "../../../../../../core/index.mjs";
14
14
  import { toJson } from "../../../../../../core/json.mjs";
15
15
  import * as environments from "../../../../../../environments.mjs";
@@ -732,10 +732,11 @@ export class MessagesClient {
732
732
  *
733
733
  * @param {AgentMail.inboxes.InboxId} inbox_id
734
734
  * @param {AgentMail.SendMessageRequest} request
735
- * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
735
+ * @param {MessagesClient.IdempotentRequestOptions} requestOptions - Request-specific configuration.
736
736
  *
737
737
  * @throws {@link AgentMail.ValidationError}
738
738
  * @throws {@link AgentMail.NotFoundError}
739
+ * @throws {@link AgentMail.ConflictError}
739
740
  * @throws {@link AgentMail.MessageRejectedError}
740
741
  *
741
742
  * @example
@@ -748,7 +749,7 @@ export class MessagesClient {
748
749
  return __awaiter(this, void 0, void 0, function* () {
749
750
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
750
751
  const _authRequest = yield this._options.authProvider.getAuthRequest();
751
- const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
752
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ "Idempotency-Key": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
752
753
  const _response = yield core.fetcher({
753
754
  url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Prod)
754
755
  .http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages/send`),
@@ -797,6 +798,14 @@ export class MessagesClient {
797
798
  skipValidation: true,
798
799
  breadcrumbsPrefix: ["response"],
799
800
  }), _response.rawResponse);
801
+ case 409:
802
+ throw new AgentMail.ConflictError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
803
+ unrecognizedObjectKeys: "passthrough",
804
+ allowUnrecognizedUnionMembers: true,
805
+ allowUnrecognizedEnumValues: true,
806
+ skipValidation: true,
807
+ breadcrumbsPrefix: ["response"],
808
+ }), _response.rawResponse);
800
809
  case 403:
801
810
  throw new AgentMail.MessageRejectedError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
802
811
  unrecognizedObjectKeys: "passthrough",
@@ -825,10 +834,11 @@ export class MessagesClient {
825
834
  * @param {AgentMail.inboxes.InboxId} inbox_id
826
835
  * @param {AgentMail.MessageId} message_id
827
836
  * @param {AgentMail.ReplyToMessageRequest} request
828
- * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
837
+ * @param {MessagesClient.IdempotentRequestOptions} requestOptions - Request-specific configuration.
829
838
  *
830
839
  * @throws {@link AgentMail.ValidationError}
831
840
  * @throws {@link AgentMail.NotFoundError}
841
+ * @throws {@link AgentMail.ConflictError}
832
842
  * @throws {@link AgentMail.MessageRejectedError}
833
843
  *
834
844
  * @example
@@ -841,7 +851,7 @@ export class MessagesClient {
841
851
  return __awaiter(this, void 0, void 0, function* () {
842
852
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
843
853
  const _authRequest = yield this._options.authProvider.getAuthRequest();
844
- const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
854
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ "Idempotency-Key": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
845
855
  const _response = yield core.fetcher({
846
856
  url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Prod)
847
857
  .http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages/${core.url.encodePathParam(serializers.MessageId.jsonOrThrow(message_id, { omitUndefined: true }))}/reply`),
@@ -890,6 +900,14 @@ export class MessagesClient {
890
900
  skipValidation: true,
891
901
  breadcrumbsPrefix: ["response"],
892
902
  }), _response.rawResponse);
903
+ case 409:
904
+ throw new AgentMail.ConflictError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
905
+ unrecognizedObjectKeys: "passthrough",
906
+ allowUnrecognizedUnionMembers: true,
907
+ allowUnrecognizedEnumValues: true,
908
+ skipValidation: true,
909
+ breadcrumbsPrefix: ["response"],
910
+ }), _response.rawResponse);
893
911
  case 403:
894
912
  throw new AgentMail.MessageRejectedError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
895
913
  unrecognizedObjectKeys: "passthrough",
@@ -918,10 +936,11 @@ export class MessagesClient {
918
936
  * @param {AgentMail.inboxes.InboxId} inbox_id
919
937
  * @param {AgentMail.MessageId} message_id
920
938
  * @param {AgentMail.ReplyAllMessageRequest} request
921
- * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
939
+ * @param {MessagesClient.IdempotentRequestOptions} requestOptions - Request-specific configuration.
922
940
  *
923
941
  * @throws {@link AgentMail.ValidationError}
924
942
  * @throws {@link AgentMail.NotFoundError}
943
+ * @throws {@link AgentMail.ConflictError}
925
944
  * @throws {@link AgentMail.MessageRejectedError}
926
945
  *
927
946
  * @example
@@ -934,7 +953,7 @@ export class MessagesClient {
934
953
  return __awaiter(this, void 0, void 0, function* () {
935
954
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
936
955
  const _authRequest = yield this._options.authProvider.getAuthRequest();
937
- const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
956
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ "Idempotency-Key": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
938
957
  const _response = yield core.fetcher({
939
958
  url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Prod)
940
959
  .http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages/${core.url.encodePathParam(serializers.MessageId.jsonOrThrow(message_id, { omitUndefined: true }))}/reply-all`),
@@ -983,6 +1002,14 @@ export class MessagesClient {
983
1002
  skipValidation: true,
984
1003
  breadcrumbsPrefix: ["response"],
985
1004
  }), _response.rawResponse);
1005
+ case 409:
1006
+ throw new AgentMail.ConflictError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
1007
+ unrecognizedObjectKeys: "passthrough",
1008
+ allowUnrecognizedUnionMembers: true,
1009
+ allowUnrecognizedEnumValues: true,
1010
+ skipValidation: true,
1011
+ breadcrumbsPrefix: ["response"],
1012
+ }), _response.rawResponse);
986
1013
  case 403:
987
1014
  throw new AgentMail.MessageRejectedError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
988
1015
  unrecognizedObjectKeys: "passthrough",
@@ -1011,10 +1038,11 @@ export class MessagesClient {
1011
1038
  * @param {AgentMail.inboxes.InboxId} inbox_id
1012
1039
  * @param {AgentMail.MessageId} message_id
1013
1040
  * @param {AgentMail.SendMessageRequest} request
1014
- * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
1041
+ * @param {MessagesClient.IdempotentRequestOptions} requestOptions - Request-specific configuration.
1015
1042
  *
1016
1043
  * @throws {@link AgentMail.ValidationError}
1017
1044
  * @throws {@link AgentMail.NotFoundError}
1045
+ * @throws {@link AgentMail.ConflictError}
1018
1046
  * @throws {@link AgentMail.MessageRejectedError}
1019
1047
  *
1020
1048
  * @example
@@ -1027,7 +1055,7 @@ export class MessagesClient {
1027
1055
  return __awaiter(this, void 0, void 0, function* () {
1028
1056
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1029
1057
  const _authRequest = yield this._options.authProvider.getAuthRequest();
1030
- const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1058
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ "Idempotency-Key": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1031
1059
  const _response = yield core.fetcher({
1032
1060
  url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Prod)
1033
1061
  .http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages/${core.url.encodePathParam(serializers.MessageId.jsonOrThrow(message_id, { omitUndefined: true }))}/forward`),
@@ -1076,272 +1104,16 @@ export class MessagesClient {
1076
1104
  skipValidation: true,
1077
1105
  breadcrumbsPrefix: ["response"],
1078
1106
  }), _response.rawResponse);
1079
- case 403:
1080
- throw new AgentMail.MessageRejectedError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
1081
- unrecognizedObjectKeys: "passthrough",
1082
- allowUnrecognizedUnionMembers: true,
1083
- allowUnrecognizedEnumValues: true,
1084
- skipValidation: true,
1085
- breadcrumbsPrefix: ["response"],
1086
- }), _response.rawResponse);
1087
- default:
1088
- throw new errors.AgentMailError({
1089
- statusCode: _response.error.statusCode,
1090
- body: _response.error.body,
1091
- rawResponse: _response.rawResponse,
1092
- });
1093
- }
1094
- }
1095
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v0/inboxes/{inbox_id}/messages/{message_id}/forward");
1096
- });
1097
- }
1098
- /**
1099
- * Create a draft that replies to a message instead of sending it. The
1100
- * recipients, subject, and threading are derived from the source message.
1101
- * Send it later with `Send Draft`.
1102
- *
1103
- * **CLI:**
1104
- * ```bash
1105
- * agentmail inboxes:messages draft-reply --inbox-id <inbox_id> --message-id <message_id> --text "Reply text"
1106
- * ```
1107
- *
1108
- * @param {AgentMail.inboxes.InboxId} inbox_id
1109
- * @param {AgentMail.MessageId} message_id
1110
- * @param {AgentMail.CreateDraftReplyRequest} request
1111
- * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
1112
- *
1113
- * @throws {@link AgentMail.ValidationError}
1114
- * @throws {@link AgentMail.NotFoundError}
1115
- *
1116
- * @example
1117
- * await client.inboxes.messages.draftReply("inbox_id", "message_id", {})
1118
- */
1119
- draftReply(inbox_id, message_id, request, requestOptions) {
1120
- return core.HttpResponsePromise.fromPromise(this.__draftReply(inbox_id, message_id, request, requestOptions));
1121
- }
1122
- __draftReply(inbox_id, message_id, request, requestOptions) {
1123
- return __awaiter(this, void 0, void 0, function* () {
1124
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1125
- const _authRequest = yield this._options.authProvider.getAuthRequest();
1126
- const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1127
- const _response = yield core.fetcher({
1128
- url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Prod)
1129
- .http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages/${core.url.encodePathParam(serializers.MessageId.jsonOrThrow(message_id, { omitUndefined: true }))}/draft-reply`),
1130
- method: "POST",
1131
- headers: _headers,
1132
- contentType: "application/json",
1133
- queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
1134
- requestType: "json",
1135
- body: serializers.CreateDraftReplyRequest.jsonOrThrow(request, {
1136
- unrecognizedObjectKeys: "strip",
1137
- omitUndefined: true,
1138
- }),
1139
- timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
1140
- maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
1141
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
1142
- fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
1143
- logging: this._options.logging,
1144
- });
1145
- if (_response.ok) {
1146
- return {
1147
- data: serializers.Draft.parseOrThrow(_response.body, {
1148
- unrecognizedObjectKeys: "passthrough",
1149
- allowUnrecognizedUnionMembers: true,
1150
- allowUnrecognizedEnumValues: true,
1151
- skipValidation: true,
1152
- breadcrumbsPrefix: ["response"],
1153
- }),
1154
- rawResponse: _response.rawResponse,
1155
- };
1156
- }
1157
- if (_response.error.reason === "status-code") {
1158
- switch (_response.error.statusCode) {
1159
- case 400:
1160
- throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
1161
- unrecognizedObjectKeys: "passthrough",
1162
- allowUnrecognizedUnionMembers: true,
1163
- allowUnrecognizedEnumValues: true,
1164
- skipValidation: true,
1165
- breadcrumbsPrefix: ["response"],
1166
- }), _response.rawResponse);
1167
- case 404:
1168
- throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
1107
+ case 409:
1108
+ throw new AgentMail.ConflictError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
1169
1109
  unrecognizedObjectKeys: "passthrough",
1170
1110
  allowUnrecognizedUnionMembers: true,
1171
1111
  allowUnrecognizedEnumValues: true,
1172
1112
  skipValidation: true,
1173
1113
  breadcrumbsPrefix: ["response"],
1174
1114
  }), _response.rawResponse);
1175
- default:
1176
- throw new errors.AgentMailError({
1177
- statusCode: _response.error.statusCode,
1178
- body: _response.error.body,
1179
- rawResponse: _response.rawResponse,
1180
- });
1181
- }
1182
- }
1183
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v0/inboxes/{inbox_id}/messages/{message_id}/draft-reply");
1184
- });
1185
- }
1186
- /**
1187
- * Create a draft that replies to every recipient of a message instead of
1188
- * sending it. Recipients, subject, and threading are derived from the
1189
- * source message. Send it later with `Send Draft`.
1190
- *
1191
- * **CLI:**
1192
- * ```bash
1193
- * agentmail inboxes:messages draft-reply-all --inbox-id <inbox_id> --message-id <message_id> --text "Reply text"
1194
- * ```
1195
- *
1196
- * @param {AgentMail.inboxes.InboxId} inbox_id
1197
- * @param {AgentMail.MessageId} message_id
1198
- * @param {AgentMail.CreateDraftReplyAllRequest} request
1199
- * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
1200
- *
1201
- * @throws {@link AgentMail.ValidationError}
1202
- * @throws {@link AgentMail.NotFoundError}
1203
- *
1204
- * @example
1205
- * await client.inboxes.messages.draftReplyAll("inbox_id", "message_id", {})
1206
- */
1207
- draftReplyAll(inbox_id, message_id, request, requestOptions) {
1208
- return core.HttpResponsePromise.fromPromise(this.__draftReplyAll(inbox_id, message_id, request, requestOptions));
1209
- }
1210
- __draftReplyAll(inbox_id, message_id, request, requestOptions) {
1211
- return __awaiter(this, void 0, void 0, function* () {
1212
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1213
- const _authRequest = yield this._options.authProvider.getAuthRequest();
1214
- const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1215
- const _response = yield core.fetcher({
1216
- url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Prod)
1217
- .http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages/${core.url.encodePathParam(serializers.MessageId.jsonOrThrow(message_id, { omitUndefined: true }))}/draft-reply-all`),
1218
- method: "POST",
1219
- headers: _headers,
1220
- contentType: "application/json",
1221
- queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
1222
- requestType: "json",
1223
- body: serializers.CreateDraftReplyAllRequest.jsonOrThrow(request, {
1224
- unrecognizedObjectKeys: "strip",
1225
- omitUndefined: true,
1226
- }),
1227
- timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
1228
- maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
1229
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
1230
- fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
1231
- logging: this._options.logging,
1232
- });
1233
- if (_response.ok) {
1234
- return {
1235
- data: serializers.Draft.parseOrThrow(_response.body, {
1236
- unrecognizedObjectKeys: "passthrough",
1237
- allowUnrecognizedUnionMembers: true,
1238
- allowUnrecognizedEnumValues: true,
1239
- skipValidation: true,
1240
- breadcrumbsPrefix: ["response"],
1241
- }),
1242
- rawResponse: _response.rawResponse,
1243
- };
1244
- }
1245
- if (_response.error.reason === "status-code") {
1246
- switch (_response.error.statusCode) {
1247
- case 400:
1248
- throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
1249
- unrecognizedObjectKeys: "passthrough",
1250
- allowUnrecognizedUnionMembers: true,
1251
- allowUnrecognizedEnumValues: true,
1252
- skipValidation: true,
1253
- breadcrumbsPrefix: ["response"],
1254
- }), _response.rawResponse);
1255
- case 404:
1256
- throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
1257
- unrecognizedObjectKeys: "passthrough",
1258
- allowUnrecognizedUnionMembers: true,
1259
- allowUnrecognizedEnumValues: true,
1260
- skipValidation: true,
1261
- breadcrumbsPrefix: ["response"],
1262
- }), _response.rawResponse);
1263
- default:
1264
- throw new errors.AgentMailError({
1265
- statusCode: _response.error.statusCode,
1266
- body: _response.error.body,
1267
- rawResponse: _response.rawResponse,
1268
- });
1269
- }
1270
- }
1271
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v0/inboxes/{inbox_id}/messages/{message_id}/draft-reply-all");
1272
- });
1273
- }
1274
- /**
1275
- * Create a draft that forwards a message instead of sending it. The subject
1276
- * and threading are derived from the source message, whose body and
1277
- * attachments are merged in at send time. Send it later with `Send Draft`.
1278
- *
1279
- * **CLI:**
1280
- * ```bash
1281
- * agentmail inboxes:messages draft-forward --inbox-id <inbox_id> --message-id <message_id> --to recipient@example.com
1282
- * ```
1283
- *
1284
- * @param {AgentMail.inboxes.InboxId} inbox_id
1285
- * @param {AgentMail.MessageId} message_id
1286
- * @param {AgentMail.CreateDraftForwardRequest} request
1287
- * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
1288
- *
1289
- * @throws {@link AgentMail.ValidationError}
1290
- * @throws {@link AgentMail.NotFoundError}
1291
- *
1292
- * @example
1293
- * await client.inboxes.messages.draftForward("inbox_id", "message_id", {})
1294
- */
1295
- draftForward(inbox_id, message_id, request, requestOptions) {
1296
- return core.HttpResponsePromise.fromPromise(this.__draftForward(inbox_id, message_id, request, requestOptions));
1297
- }
1298
- __draftForward(inbox_id, message_id, request, requestOptions) {
1299
- return __awaiter(this, void 0, void 0, function* () {
1300
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1301
- const _authRequest = yield this._options.authProvider.getAuthRequest();
1302
- const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1303
- const _response = yield core.fetcher({
1304
- url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Prod)
1305
- .http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages/${core.url.encodePathParam(serializers.MessageId.jsonOrThrow(message_id, { omitUndefined: true }))}/draft-forward`),
1306
- method: "POST",
1307
- headers: _headers,
1308
- contentType: "application/json",
1309
- queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
1310
- requestType: "json",
1311
- body: serializers.CreateDraftForwardRequest.jsonOrThrow(request, {
1312
- unrecognizedObjectKeys: "strip",
1313
- omitUndefined: true,
1314
- }),
1315
- timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
1316
- maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
1317
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
1318
- fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
1319
- logging: this._options.logging,
1320
- });
1321
- if (_response.ok) {
1322
- return {
1323
- data: serializers.Draft.parseOrThrow(_response.body, {
1324
- unrecognizedObjectKeys: "passthrough",
1325
- allowUnrecognizedUnionMembers: true,
1326
- allowUnrecognizedEnumValues: true,
1327
- skipValidation: true,
1328
- breadcrumbsPrefix: ["response"],
1329
- }),
1330
- rawResponse: _response.rawResponse,
1331
- };
1332
- }
1333
- if (_response.error.reason === "status-code") {
1334
- switch (_response.error.statusCode) {
1335
- case 400:
1336
- throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
1337
- unrecognizedObjectKeys: "passthrough",
1338
- allowUnrecognizedUnionMembers: true,
1339
- allowUnrecognizedEnumValues: true,
1340
- skipValidation: true,
1341
- breadcrumbsPrefix: ["response"],
1342
- }), _response.rawResponse);
1343
- case 404:
1344
- throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
1115
+ case 403:
1116
+ throw new AgentMail.MessageRejectedError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
1345
1117
  unrecognizedObjectKeys: "passthrough",
1346
1118
  allowUnrecognizedUnionMembers: true,
1347
1119
  allowUnrecognizedEnumValues: true,
@@ -1356,7 +1128,7 @@ export class MessagesClient {
1356
1128
  });
1357
1129
  }
1358
1130
  }
1359
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v0/inboxes/{inbox_id}/messages/{message_id}/draft-forward");
1131
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v0/inboxes/{inbox_id}/messages/{message_id}/forward");
1360
1132
  });
1361
1133
  }
1362
1134
  }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Stable, machine-readable error code in snake_case (for example, not_found or missing_permission). Branch on this rather than the message text.
3
+ */
4
+ export type ErrorCode = string;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Link to the error reference entry for this code.
3
+ */
4
+ export type ErrorDocs = string;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * The concrete next action that resolves the error.
3
+ */
4
+ export type ErrorFix = string;
@@ -1,5 +1,8 @@
1
1
  import type * as AgentMail from "../index.mjs";
2
2
  export interface ErrorResponse {
3
3
  name: AgentMail.ErrorName;
4
+ code?: AgentMail.ErrorCode;
4
5
  message: AgentMail.ErrorMessage;
6
+ fix?: AgentMail.ErrorFix;
7
+ docs?: AgentMail.ErrorDocs;
5
8
  }
@@ -1,6 +1,10 @@
1
1
  import type * as AgentMail from "../index.mjs";
2
2
  export interface ValidationErrorResponse {
3
3
  name: AgentMail.ErrorName;
4
- /** Validation errors. */
4
+ code?: AgentMail.ErrorCode;
5
+ message?: AgentMail.ErrorMessage;
6
+ /** Validation errors. Each entry has a path and a message identifying the invalid field. */
5
7
  errors?: unknown;
8
+ fix?: AgentMail.ErrorFix;
9
+ docs?: AgentMail.ErrorDocs;
6
10
  }
@@ -2,6 +2,9 @@ export * from "./After.mjs";
2
2
  export * from "./Ascending.mjs";
3
3
  export * from "./Before.mjs";
4
4
  export * from "./Count.mjs";
5
+ export * from "./ErrorCode.mjs";
6
+ export * from "./ErrorDocs.mjs";
7
+ export * from "./ErrorFix.mjs";
5
8
  export * from "./ErrorMessage.mjs";
6
9
  export * from "./ErrorName.mjs";
7
10
  export * from "./ErrorResponse.mjs";
@@ -2,6 +2,9 @@ export * from "./After.mjs";
2
2
  export * from "./Ascending.mjs";
3
3
  export * from "./Before.mjs";
4
4
  export * from "./Count.mjs";
5
+ export * from "./ErrorCode.mjs";
6
+ export * from "./ErrorDocs.mjs";
7
+ export * from "./ErrorFix.mjs";
5
8
  export * from "./ErrorMessage.mjs";
6
9
  export * from "./ErrorName.mjs";
7
10
  export * from "./ErrorResponse.mjs";