agentmail 0.5.13 → 0.5.14

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.
@@ -28,6 +28,9 @@ export interface BaseRequestOptions {
28
28
  /** Additional headers to include in the request. */
29
29
  headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
30
30
  }
31
+ export interface BaseIdempotentRequestOptions {
32
+ idempotencyKey?: string | undefined;
33
+ }
31
34
  export type NormalizedClientOptions<T extends BaseClientOptions = BaseClientOptions> = T & {
32
35
  logging: core.logging.Logger;
33
36
  authProvider?: core.AuthProvider;
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
43
43
  const headers = (0, headers_js_1.mergeHeaders)({
44
44
  "X-Fern-Language": "JavaScript",
45
45
  "X-Fern-SDK-Name": "agentmail",
46
- "X-Fern-SDK-Version": "0.5.13",
47
- "User-Agent": "agentmail/0.5.13",
46
+ "X-Fern-SDK-Version": "0.5.14",
47
+ "User-Agent": "agentmail/0.5.14",
48
48
  "X-Fern-Runtime": core.RUNTIME.type,
49
49
  "X-Fern-Runtime-Version": core.RUNTIME.version,
50
50
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -0,0 +1,6 @@
1
+ import type * as core from "../../core/index.js";
2
+ import * as errors from "../../errors/index.js";
3
+ import type * as AgentMail from "../index.js";
4
+ export declare class ConflictError extends errors.AgentMailError {
5
+ constructor(body: AgentMail.ErrorResponse, rawResponse?: core.RawResponse);
6
+ }
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.ConflictError = void 0;
38
+ const errors = __importStar(require("../../errors/index.js"));
39
+ class ConflictError extends errors.AgentMailError {
40
+ constructor(body, rawResponse) {
41
+ super({
42
+ message: "ConflictError",
43
+ statusCode: 409,
44
+ body: body,
45
+ rawResponse: rawResponse,
46
+ });
47
+ Object.setPrototypeOf(this, new.target.prototype);
48
+ if (Error.captureStackTrace) {
49
+ Error.captureStackTrace(this, this.constructor);
50
+ }
51
+ this.name = this.constructor.name;
52
+ }
53
+ }
54
+ exports.ConflictError = ConflictError;
@@ -1,3 +1,4 @@
1
+ export * from "./ConflictError.js";
1
2
  export * from "./IsTakenError.js";
2
3
  export * from "./NotFoundError.js";
3
4
  export * from "./UnprocessableError.js";
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./ConflictError.js"), exports);
17
18
  __exportStar(require("./IsTakenError.js"), exports);
18
19
  __exportStar(require("./NotFoundError.js"), exports);
19
20
  __exportStar(require("./UnprocessableError.js"), exports);
@@ -1,4 +1,4 @@
1
- import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../BaseClient.js";
1
+ import type { BaseClientOptions, BaseIdempotentRequestOptions, BaseRequestOptions } from "../../../../../../BaseClient.js";
2
2
  import { type NormalizedClientOptionsWithAuth } from "../../../../../../BaseClient.js";
3
3
  import * as core from "../../../../../../core/index.js";
4
4
  import * as AgentMail from "../../../../../index.js";
@@ -6,6 +6,8 @@ export declare namespace DraftsClient {
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 DraftsClient {
11
13
  protected readonly _options: NormalizedClientOptionsWithAuth<DraftsClient.Options>;
@@ -123,15 +125,16 @@ export declare class DraftsClient {
123
125
  * @param {AgentMail.inboxes.InboxId} inbox_id
124
126
  * @param {AgentMail.DraftId} draft_id
125
127
  * @param {AgentMail.UpdateMessageRequest} request
126
- * @param {DraftsClient.RequestOptions} requestOptions - Request-specific configuration.
128
+ * @param {DraftsClient.IdempotentRequestOptions} requestOptions - Request-specific configuration.
127
129
  *
128
130
  * @throws {@link AgentMail.NotFoundError}
129
131
  * @throws {@link AgentMail.ValidationError}
132
+ * @throws {@link AgentMail.ConflictError}
130
133
  * @throws {@link AgentMail.MessageRejectedError}
131
134
  *
132
135
  * @example
133
136
  * await client.inboxes.drafts.send("inbox_id", "draft_id", {})
134
137
  */
135
- send(inbox_id: AgentMail.inboxes.InboxId, draft_id: AgentMail.DraftId, request: AgentMail.UpdateMessageRequest, requestOptions?: DraftsClient.RequestOptions): core.HttpResponsePromise<AgentMail.SendMessageResponse>;
138
+ send(inbox_id: AgentMail.inboxes.InboxId, draft_id: AgentMail.DraftId, request: AgentMail.UpdateMessageRequest, requestOptions?: DraftsClient.IdempotentRequestOptions): core.HttpResponsePromise<AgentMail.SendMessageResponse>;
136
139
  private __send;
137
140
  }
@@ -497,10 +497,11 @@ class DraftsClient {
497
497
  * @param {AgentMail.inboxes.InboxId} inbox_id
498
498
  * @param {AgentMail.DraftId} draft_id
499
499
  * @param {AgentMail.UpdateMessageRequest} request
500
- * @param {DraftsClient.RequestOptions} requestOptions - Request-specific configuration.
500
+ * @param {DraftsClient.IdempotentRequestOptions} requestOptions - Request-specific configuration.
501
501
  *
502
502
  * @throws {@link AgentMail.NotFoundError}
503
503
  * @throws {@link AgentMail.ValidationError}
504
+ * @throws {@link AgentMail.ConflictError}
504
505
  * @throws {@link AgentMail.MessageRejectedError}
505
506
  *
506
507
  * @example
@@ -513,7 +514,7 @@ class DraftsClient {
513
514
  return __awaiter(this, void 0, void 0, function* () {
514
515
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
515
516
  const _authRequest = yield this._options.authProvider.getAuthRequest();
516
- const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
517
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "Idempotency-Key": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
517
518
  const _response = yield core.fetcher({
518
519
  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)
519
520
  .http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/drafts/${core.url.encodePathParam(serializers.DraftId.jsonOrThrow(draft_id, { omitUndefined: true }))}/send`),
@@ -562,6 +563,14 @@ class DraftsClient {
562
563
  skipValidation: true,
563
564
  breadcrumbsPrefix: ["response"],
564
565
  }), _response.rawResponse);
566
+ case 409:
567
+ throw new AgentMail.ConflictError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
568
+ unrecognizedObjectKeys: "passthrough",
569
+ allowUnrecognizedUnionMembers: true,
570
+ allowUnrecognizedEnumValues: true,
571
+ skipValidation: true,
572
+ breadcrumbsPrefix: ["response"],
573
+ }), _response.rawResponse);
565
574
  case 403:
566
575
  throw new AgentMail.MessageRejectedError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
567
576
  unrecognizedObjectKeys: "passthrough",
@@ -1,4 +1,4 @@
1
- import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../BaseClient.js";
1
+ import type { BaseClientOptions, BaseIdempotentRequestOptions, BaseRequestOptions } from "../../../../../../BaseClient.js";
2
2
  import { type NormalizedClientOptionsWithAuth } from "../../../../../../BaseClient.js";
3
3
  import * as core from "../../../../../../core/index.js";
4
4
  import * as AgentMail from "../../../../../index.js";
@@ -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,16 +265,17 @@ 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
280
  /**
275
281
  * Create a draft that replies to a message instead of sending it. The
@@ -768,10 +768,11 @@ class MessagesClient {
768
768
  *
769
769
  * @param {AgentMail.inboxes.InboxId} inbox_id
770
770
  * @param {AgentMail.SendMessageRequest} request
771
- * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
771
+ * @param {MessagesClient.IdempotentRequestOptions} requestOptions - Request-specific configuration.
772
772
  *
773
773
  * @throws {@link AgentMail.ValidationError}
774
774
  * @throws {@link AgentMail.NotFoundError}
775
+ * @throws {@link AgentMail.ConflictError}
775
776
  * @throws {@link AgentMail.MessageRejectedError}
776
777
  *
777
778
  * @example
@@ -784,7 +785,7 @@ class MessagesClient {
784
785
  return __awaiter(this, void 0, void 0, function* () {
785
786
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
786
787
  const _authRequest = yield this._options.authProvider.getAuthRequest();
787
- const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
788
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "Idempotency-Key": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
788
789
  const _response = yield core.fetcher({
789
790
  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)
790
791
  .http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages/send`),
@@ -833,6 +834,14 @@ class MessagesClient {
833
834
  skipValidation: true,
834
835
  breadcrumbsPrefix: ["response"],
835
836
  }), _response.rawResponse);
837
+ case 409:
838
+ throw new AgentMail.ConflictError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
839
+ unrecognizedObjectKeys: "passthrough",
840
+ allowUnrecognizedUnionMembers: true,
841
+ allowUnrecognizedEnumValues: true,
842
+ skipValidation: true,
843
+ breadcrumbsPrefix: ["response"],
844
+ }), _response.rawResponse);
836
845
  case 403:
837
846
  throw new AgentMail.MessageRejectedError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
838
847
  unrecognizedObjectKeys: "passthrough",
@@ -861,10 +870,11 @@ class MessagesClient {
861
870
  * @param {AgentMail.inboxes.InboxId} inbox_id
862
871
  * @param {AgentMail.MessageId} message_id
863
872
  * @param {AgentMail.ReplyToMessageRequest} request
864
- * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
873
+ * @param {MessagesClient.IdempotentRequestOptions} requestOptions - Request-specific configuration.
865
874
  *
866
875
  * @throws {@link AgentMail.ValidationError}
867
876
  * @throws {@link AgentMail.NotFoundError}
877
+ * @throws {@link AgentMail.ConflictError}
868
878
  * @throws {@link AgentMail.MessageRejectedError}
869
879
  *
870
880
  * @example
@@ -877,7 +887,7 @@ class MessagesClient {
877
887
  return __awaiter(this, void 0, void 0, function* () {
878
888
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
879
889
  const _authRequest = yield this._options.authProvider.getAuthRequest();
880
- const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
890
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "Idempotency-Key": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
881
891
  const _response = yield core.fetcher({
882
892
  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)
883
893
  .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`),
@@ -926,6 +936,14 @@ class MessagesClient {
926
936
  skipValidation: true,
927
937
  breadcrumbsPrefix: ["response"],
928
938
  }), _response.rawResponse);
939
+ case 409:
940
+ throw new AgentMail.ConflictError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
941
+ unrecognizedObjectKeys: "passthrough",
942
+ allowUnrecognizedUnionMembers: true,
943
+ allowUnrecognizedEnumValues: true,
944
+ skipValidation: true,
945
+ breadcrumbsPrefix: ["response"],
946
+ }), _response.rawResponse);
929
947
  case 403:
930
948
  throw new AgentMail.MessageRejectedError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
931
949
  unrecognizedObjectKeys: "passthrough",
@@ -954,10 +972,11 @@ class MessagesClient {
954
972
  * @param {AgentMail.inboxes.InboxId} inbox_id
955
973
  * @param {AgentMail.MessageId} message_id
956
974
  * @param {AgentMail.ReplyAllMessageRequest} request
957
- * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
975
+ * @param {MessagesClient.IdempotentRequestOptions} requestOptions - Request-specific configuration.
958
976
  *
959
977
  * @throws {@link AgentMail.ValidationError}
960
978
  * @throws {@link AgentMail.NotFoundError}
979
+ * @throws {@link AgentMail.ConflictError}
961
980
  * @throws {@link AgentMail.MessageRejectedError}
962
981
  *
963
982
  * @example
@@ -970,7 +989,7 @@ class MessagesClient {
970
989
  return __awaiter(this, void 0, void 0, function* () {
971
990
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
972
991
  const _authRequest = yield this._options.authProvider.getAuthRequest();
973
- const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
992
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "Idempotency-Key": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
974
993
  const _response = yield core.fetcher({
975
994
  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)
976
995
  .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`),
@@ -1019,6 +1038,14 @@ class MessagesClient {
1019
1038
  skipValidation: true,
1020
1039
  breadcrumbsPrefix: ["response"],
1021
1040
  }), _response.rawResponse);
1041
+ case 409:
1042
+ throw new AgentMail.ConflictError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
1043
+ unrecognizedObjectKeys: "passthrough",
1044
+ allowUnrecognizedUnionMembers: true,
1045
+ allowUnrecognizedEnumValues: true,
1046
+ skipValidation: true,
1047
+ breadcrumbsPrefix: ["response"],
1048
+ }), _response.rawResponse);
1022
1049
  case 403:
1023
1050
  throw new AgentMail.MessageRejectedError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
1024
1051
  unrecognizedObjectKeys: "passthrough",
@@ -1047,10 +1074,11 @@ class MessagesClient {
1047
1074
  * @param {AgentMail.inboxes.InboxId} inbox_id
1048
1075
  * @param {AgentMail.MessageId} message_id
1049
1076
  * @param {AgentMail.SendMessageRequest} request
1050
- * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
1077
+ * @param {MessagesClient.IdempotentRequestOptions} requestOptions - Request-specific configuration.
1051
1078
  *
1052
1079
  * @throws {@link AgentMail.ValidationError}
1053
1080
  * @throws {@link AgentMail.NotFoundError}
1081
+ * @throws {@link AgentMail.ConflictError}
1054
1082
  * @throws {@link AgentMail.MessageRejectedError}
1055
1083
  *
1056
1084
  * @example
@@ -1063,7 +1091,7 @@ class MessagesClient {
1063
1091
  return __awaiter(this, void 0, void 0, function* () {
1064
1092
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1065
1093
  const _authRequest = yield this._options.authProvider.getAuthRequest();
1066
- const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1094
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "Idempotency-Key": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1067
1095
  const _response = yield core.fetcher({
1068
1096
  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)
1069
1097
  .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`),
@@ -1112,6 +1140,14 @@ class MessagesClient {
1112
1140
  skipValidation: true,
1113
1141
  breadcrumbsPrefix: ["response"],
1114
1142
  }), _response.rawResponse);
1143
+ case 409:
1144
+ throw new AgentMail.ConflictError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
1145
+ unrecognizedObjectKeys: "passthrough",
1146
+ allowUnrecognizedUnionMembers: true,
1147
+ allowUnrecognizedEnumValues: true,
1148
+ skipValidation: true,
1149
+ breadcrumbsPrefix: ["response"],
1150
+ }), _response.rawResponse);
1115
1151
  case 403:
1116
1152
  throw new AgentMail.MessageRejectedError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
1117
1153
  unrecognizedObjectKeys: "passthrough",
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.5.13";
1
+ export declare const SDK_VERSION = "0.5.14";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "0.5.13";
4
+ exports.SDK_VERSION = "0.5.14";
@@ -28,6 +28,9 @@ export interface BaseRequestOptions {
28
28
  /** Additional headers to include in the request. */
29
29
  headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
30
30
  }
31
+ export interface BaseIdempotentRequestOptions {
32
+ idempotencyKey?: string | undefined;
33
+ }
31
34
  export type NormalizedClientOptions<T extends BaseClientOptions = BaseClientOptions> = T & {
32
35
  logging: core.logging.Logger;
33
36
  authProvider?: core.AuthProvider;
@@ -6,8 +6,8 @@ export function normalizeClientOptions(options) {
6
6
  const headers = mergeHeaders({
7
7
  "X-Fern-Language": "JavaScript",
8
8
  "X-Fern-SDK-Name": "agentmail",
9
- "X-Fern-SDK-Version": "0.5.13",
10
- "User-Agent": "agentmail/0.5.13",
9
+ "X-Fern-SDK-Version": "0.5.14",
10
+ "User-Agent": "agentmail/0.5.14",
11
11
  "X-Fern-Runtime": core.RUNTIME.type,
12
12
  "X-Fern-Runtime-Version": core.RUNTIME.version,
13
13
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -0,0 +1,6 @@
1
+ import type * as core from "../../core/index.mjs";
2
+ import * as errors from "../../errors/index.mjs";
3
+ import type * as AgentMail from "../index.mjs";
4
+ export declare class ConflictError extends errors.AgentMailError {
5
+ constructor(body: AgentMail.ErrorResponse, rawResponse?: core.RawResponse);
6
+ }
@@ -0,0 +1,17 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ import * as errors from "../../errors/index.mjs";
3
+ export class ConflictError extends errors.AgentMailError {
4
+ constructor(body, rawResponse) {
5
+ super({
6
+ message: "ConflictError",
7
+ statusCode: 409,
8
+ body: body,
9
+ rawResponse: rawResponse,
10
+ });
11
+ Object.setPrototypeOf(this, new.target.prototype);
12
+ if (Error.captureStackTrace) {
13
+ Error.captureStackTrace(this, this.constructor);
14
+ }
15
+ this.name = this.constructor.name;
16
+ }
17
+ }
@@ -1,3 +1,4 @@
1
+ export * from "./ConflictError.mjs";
1
2
  export * from "./IsTakenError.mjs";
2
3
  export * from "./NotFoundError.mjs";
3
4
  export * from "./UnprocessableError.mjs";
@@ -1,3 +1,4 @@
1
+ export * from "./ConflictError.mjs";
1
2
  export * from "./IsTakenError.mjs";
2
3
  export * from "./NotFoundError.mjs";
3
4
  export * from "./UnprocessableError.mjs";
@@ -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 DraftsClient {
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 DraftsClient {
11
13
  protected readonly _options: NormalizedClientOptionsWithAuth<DraftsClient.Options>;
@@ -123,15 +125,16 @@ export declare class DraftsClient {
123
125
  * @param {AgentMail.inboxes.InboxId} inbox_id
124
126
  * @param {AgentMail.DraftId} draft_id
125
127
  * @param {AgentMail.UpdateMessageRequest} request
126
- * @param {DraftsClient.RequestOptions} requestOptions - Request-specific configuration.
128
+ * @param {DraftsClient.IdempotentRequestOptions} requestOptions - Request-specific configuration.
127
129
  *
128
130
  * @throws {@link AgentMail.NotFoundError}
129
131
  * @throws {@link AgentMail.ValidationError}
132
+ * @throws {@link AgentMail.ConflictError}
130
133
  * @throws {@link AgentMail.MessageRejectedError}
131
134
  *
132
135
  * @example
133
136
  * await client.inboxes.drafts.send("inbox_id", "draft_id", {})
134
137
  */
135
- send(inbox_id: AgentMail.inboxes.InboxId, draft_id: AgentMail.DraftId, request: AgentMail.UpdateMessageRequest, requestOptions?: DraftsClient.RequestOptions): core.HttpResponsePromise<AgentMail.SendMessageResponse>;
138
+ send(inbox_id: AgentMail.inboxes.InboxId, draft_id: AgentMail.DraftId, request: AgentMail.UpdateMessageRequest, requestOptions?: DraftsClient.IdempotentRequestOptions): core.HttpResponsePromise<AgentMail.SendMessageResponse>;
136
139
  private __send;
137
140
  }
@@ -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";
@@ -461,10 +461,11 @@ export class DraftsClient {
461
461
  * @param {AgentMail.inboxes.InboxId} inbox_id
462
462
  * @param {AgentMail.DraftId} draft_id
463
463
  * @param {AgentMail.UpdateMessageRequest} request
464
- * @param {DraftsClient.RequestOptions} requestOptions - Request-specific configuration.
464
+ * @param {DraftsClient.IdempotentRequestOptions} requestOptions - Request-specific configuration.
465
465
  *
466
466
  * @throws {@link AgentMail.NotFoundError}
467
467
  * @throws {@link AgentMail.ValidationError}
468
+ * @throws {@link AgentMail.ConflictError}
468
469
  * @throws {@link AgentMail.MessageRejectedError}
469
470
  *
470
471
  * @example
@@ -477,7 +478,7 @@ export class DraftsClient {
477
478
  return __awaiter(this, void 0, void 0, function* () {
478
479
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
479
480
  const _authRequest = yield this._options.authProvider.getAuthRequest();
480
- 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);
481
+ 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);
481
482
  const _response = yield core.fetcher({
482
483
  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)
483
484
  .http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/drafts/${core.url.encodePathParam(serializers.DraftId.jsonOrThrow(draft_id, { omitUndefined: true }))}/send`),
@@ -526,6 +527,14 @@ export class DraftsClient {
526
527
  skipValidation: true,
527
528
  breadcrumbsPrefix: ["response"],
528
529
  }), _response.rawResponse);
530
+ case 409:
531
+ throw new AgentMail.ConflictError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
532
+ unrecognizedObjectKeys: "passthrough",
533
+ allowUnrecognizedUnionMembers: true,
534
+ allowUnrecognizedEnumValues: true,
535
+ skipValidation: true,
536
+ breadcrumbsPrefix: ["response"],
537
+ }), _response.rawResponse);
529
538
  case 403:
530
539
  throw new AgentMail.MessageRejectedError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
531
540
  unrecognizedObjectKeys: "passthrough",
@@ -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,16 +265,17 @@ 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
280
  /**
275
281
  * Create a draft that replies to a message instead of sending it. The
@@ -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,6 +1104,14 @@ export class MessagesClient {
1076
1104
  skipValidation: true,
1077
1105
  breadcrumbsPrefix: ["response"],
1078
1106
  }), _response.rawResponse);
1107
+ case 409:
1108
+ throw new AgentMail.ConflictError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
1109
+ unrecognizedObjectKeys: "passthrough",
1110
+ allowUnrecognizedUnionMembers: true,
1111
+ allowUnrecognizedEnumValues: true,
1112
+ skipValidation: true,
1113
+ breadcrumbsPrefix: ["response"],
1114
+ }), _response.rawResponse);
1079
1115
  case 403:
1080
1116
  throw new AgentMail.MessageRejectedError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
1081
1117
  unrecognizedObjectKeys: "passthrough",
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.5.13";
1
+ export declare const SDK_VERSION = "0.5.14";
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.5.13";
1
+ export const SDK_VERSION = "0.5.14";
package/dist/llms.txt CHANGED
@@ -116,6 +116,9 @@
116
116
  - API Reference > Inboxes > Messages [Reply To Message](https://docs.agentmail.to/api-reference/inboxes/messages/reply.md)
117
117
  - API Reference > Inboxes > Messages [Reply All Message](https://docs.agentmail.to/api-reference/inboxes/messages/reply-all.md)
118
118
  - API Reference > Inboxes > Messages [Forward Message](https://docs.agentmail.to/api-reference/inboxes/messages/forward.md)
119
+ - API Reference > Inboxes > Messages [Create Draft Reply](https://docs.agentmail.to/api-reference/inboxes/messages/draft-reply.md)
120
+ - API Reference > Inboxes > Messages [Create Draft Reply All](https://docs.agentmail.to/api-reference/inboxes/messages/draft-reply-all.md)
121
+ - API Reference > Inboxes > Messages [Create Draft Forward](https://docs.agentmail.to/api-reference/inboxes/messages/draft-forward.md)
119
122
  - API Reference > Inboxes > Drafts [List Drafts](https://docs.agentmail.to/api-reference/inboxes/drafts/list.md)
120
123
  - API Reference > Inboxes > Drafts [Get Draft](https://docs.agentmail.to/api-reference/inboxes/drafts/get.md)
121
124
  - API Reference > Inboxes > Drafts [Get Attachment](https://docs.agentmail.to/api-reference/inboxes/drafts/get-attachment.md)
@@ -123,6 +126,11 @@
123
126
  - API Reference > Inboxes > Drafts [Update Draft](https://docs.agentmail.to/api-reference/inboxes/drafts/update.md)
124
127
  - API Reference > Inboxes > Drafts [Delete Draft](https://docs.agentmail.to/api-reference/inboxes/drafts/delete.md)
125
128
  - API Reference > Inboxes > Drafts [Send Draft](https://docs.agentmail.to/api-reference/inboxes/drafts/send.md)
129
+ - API Reference > Inboxes > Webhooks [List Webhooks](https://docs.agentmail.to/api-reference/inboxes/webhooks/list.md)
130
+ - API Reference > Inboxes > Webhooks [Get Webhook](https://docs.agentmail.to/api-reference/inboxes/webhooks/get.md)
131
+ - API Reference > Inboxes > Webhooks [Create Webhook](https://docs.agentmail.to/api-reference/inboxes/webhooks/create.md)
132
+ - API Reference > Inboxes > Webhooks [Update Webhook](https://docs.agentmail.to/api-reference/inboxes/webhooks/update.md)
133
+ - API Reference > Inboxes > Webhooks [Delete Webhook](https://docs.agentmail.to/api-reference/inboxes/webhooks/delete.md)
126
134
  - API Reference > Inboxes > Lists [List Entries](https://docs.agentmail.to/api-reference/inboxes/lists/list.md)
127
135
  - API Reference > Inboxes > Lists [Get List Entry](https://docs.agentmail.to/api-reference/inboxes/lists/get.md)
128
136
  - API Reference > Inboxes > Lists [Create List Entry](https://docs.agentmail.to/api-reference/inboxes/lists/create.md)
@@ -189,6 +197,11 @@
189
197
  - API Reference > Pods > Drafts [List Drafts](https://docs.agentmail.to/api-reference/pods/drafts/list.md)
190
198
  - API Reference > Pods > Drafts [Get Draft](https://docs.agentmail.to/api-reference/pods/drafts/get.md)
191
199
  - API Reference > Pods > Drafts [Get Attachment](https://docs.agentmail.to/api-reference/pods/drafts/get-attachment.md)
200
+ - API Reference > Pods > Webhooks [List Webhooks](https://docs.agentmail.to/api-reference/pods/webhooks/list.md)
201
+ - API Reference > Pods > Webhooks [Get Webhook](https://docs.agentmail.to/api-reference/pods/webhooks/get.md)
202
+ - API Reference > Pods > Webhooks [Create Webhook](https://docs.agentmail.to/api-reference/pods/webhooks/create.md)
203
+ - API Reference > Pods > Webhooks [Update Webhook](https://docs.agentmail.to/api-reference/pods/webhooks/update.md)
204
+ - API Reference > Pods > Webhooks [Delete Webhook](https://docs.agentmail.to/api-reference/pods/webhooks/delete.md)
192
205
  - API Reference > Pods > Domains [List Domains](https://docs.agentmail.to/api-reference/pods/domains/list.md)
193
206
  - API Reference > Pods > Domains [Get Domain](https://docs.agentmail.to/api-reference/pods/domains/get.md)
194
207
  - API Reference > Pods > Domains [Get Zone File](https://docs.agentmail.to/api-reference/pods/domains/get-zone-file.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentmail",
3
- "version": "0.5.13",
3
+ "version": "0.5.14",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
package/reference.md CHANGED
@@ -2794,7 +2794,7 @@ await client.inboxes.drafts.send("inbox_id", "draft_id", {});
2794
2794
  <dl>
2795
2795
  <dd>
2796
2796
 
2797
- **requestOptions:** `DraftsClient.RequestOptions`
2797
+ **requestOptions:** `DraftsClient.IdempotentRequestOptions`
2798
2798
 
2799
2799
  </dd>
2800
2800
  </dl>
@@ -4016,7 +4016,7 @@ await client.inboxes.messages.send("inbox_id", {});
4016
4016
  <dl>
4017
4017
  <dd>
4018
4018
 
4019
- **requestOptions:** `MessagesClient.RequestOptions`
4019
+ **requestOptions:** `MessagesClient.IdempotentRequestOptions`
4020
4020
 
4021
4021
  </dd>
4022
4022
  </dl>
@@ -4098,7 +4098,7 @@ await client.inboxes.messages.reply("inbox_id", "message_id", {});
4098
4098
  <dl>
4099
4099
  <dd>
4100
4100
 
4101
- **requestOptions:** `MessagesClient.RequestOptions`
4101
+ **requestOptions:** `MessagesClient.IdempotentRequestOptions`
4102
4102
 
4103
4103
  </dd>
4104
4104
  </dl>
@@ -4180,7 +4180,7 @@ await client.inboxes.messages.replyAll("inbox_id", "message_id", {});
4180
4180
  <dl>
4181
4181
  <dd>
4182
4182
 
4183
- **requestOptions:** `MessagesClient.RequestOptions`
4183
+ **requestOptions:** `MessagesClient.IdempotentRequestOptions`
4184
4184
 
4185
4185
  </dd>
4186
4186
  </dl>
@@ -4262,7 +4262,7 @@ await client.inboxes.messages.forward("inbox_id", "message_id", {});
4262
4262
  <dl>
4263
4263
  <dd>
4264
4264
 
4265
- **requestOptions:** `MessagesClient.RequestOptions`
4265
+ **requestOptions:** `MessagesClient.IdempotentRequestOptions`
4266
4266
 
4267
4267
  </dd>
4268
4268
  </dl>