agentmail 0.5.10 → 0.5.11

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 (46) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/api/resources/inboxes/resources/messages/client/Client.d.ts +26 -0
  3. package/dist/cjs/api/resources/inboxes/resources/messages/client/Client.js +83 -0
  4. package/dist/cjs/api/resources/messages/types/BatchUpdateMessagesMessageIds.d.ts +8 -0
  5. package/dist/cjs/api/resources/messages/types/BatchUpdateMessagesMessageIds.js +3 -0
  6. package/dist/cjs/api/resources/messages/types/BatchUpdateMessagesRequest.d.ts +8 -0
  7. package/dist/cjs/api/resources/messages/types/BatchUpdateMessagesRequest.js +3 -0
  8. package/dist/cjs/api/resources/messages/types/BatchUpdateMessagesResponse.d.ts +11 -0
  9. package/dist/cjs/api/resources/messages/types/BatchUpdateMessagesResponse.js +3 -0
  10. package/dist/cjs/api/resources/messages/types/index.d.ts +3 -0
  11. package/dist/cjs/api/resources/messages/types/index.js +3 -0
  12. package/dist/cjs/serialization/resources/messages/types/BatchUpdateMessagesMessageIds.d.ts +8 -0
  13. package/dist/cjs/serialization/resources/messages/types/BatchUpdateMessagesMessageIds.js +40 -0
  14. package/dist/cjs/serialization/resources/messages/types/BatchUpdateMessagesRequest.d.ts +13 -0
  15. package/dist/cjs/serialization/resources/messages/types/BatchUpdateMessagesRequest.js +45 -0
  16. package/dist/cjs/serialization/resources/messages/types/BatchUpdateMessagesResponse.d.ts +14 -0
  17. package/dist/cjs/serialization/resources/messages/types/BatchUpdateMessagesResponse.js +46 -0
  18. package/dist/cjs/serialization/resources/messages/types/index.d.ts +3 -0
  19. package/dist/cjs/serialization/resources/messages/types/index.js +3 -0
  20. package/dist/cjs/version.d.ts +1 -1
  21. package/dist/cjs/version.js +1 -1
  22. package/dist/esm/BaseClient.mjs +2 -2
  23. package/dist/esm/api/resources/inboxes/resources/messages/client/Client.d.mts +26 -0
  24. package/dist/esm/api/resources/inboxes/resources/messages/client/Client.mjs +83 -0
  25. package/dist/esm/api/resources/messages/types/BatchUpdateMessagesMessageIds.d.mts +8 -0
  26. package/dist/esm/api/resources/messages/types/BatchUpdateMessagesMessageIds.mjs +2 -0
  27. package/dist/esm/api/resources/messages/types/BatchUpdateMessagesRequest.d.mts +8 -0
  28. package/dist/esm/api/resources/messages/types/BatchUpdateMessagesRequest.mjs +2 -0
  29. package/dist/esm/api/resources/messages/types/BatchUpdateMessagesResponse.d.mts +11 -0
  30. package/dist/esm/api/resources/messages/types/BatchUpdateMessagesResponse.mjs +2 -0
  31. package/dist/esm/api/resources/messages/types/index.d.mts +3 -0
  32. package/dist/esm/api/resources/messages/types/index.mjs +3 -0
  33. package/dist/esm/serialization/resources/messages/types/BatchUpdateMessagesMessageIds.d.mts +8 -0
  34. package/dist/esm/serialization/resources/messages/types/BatchUpdateMessagesMessageIds.mjs +4 -0
  35. package/dist/esm/serialization/resources/messages/types/BatchUpdateMessagesRequest.d.mts +13 -0
  36. package/dist/esm/serialization/resources/messages/types/BatchUpdateMessagesRequest.mjs +9 -0
  37. package/dist/esm/serialization/resources/messages/types/BatchUpdateMessagesResponse.d.mts +14 -0
  38. package/dist/esm/serialization/resources/messages/types/BatchUpdateMessagesResponse.mjs +10 -0
  39. package/dist/esm/serialization/resources/messages/types/index.d.mts +3 -0
  40. package/dist/esm/serialization/resources/messages/types/index.mjs +3 -0
  41. package/dist/esm/version.d.mts +1 -1
  42. package/dist/esm/version.mjs +1 -1
  43. package/dist/llms-full.txt +1 -57014
  44. package/dist/llms.txt +0 -1
  45. package/package.json +1 -1
  46. package/reference.md +83 -0
@@ -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.10",
47
- "User-Agent": "agentmail/0.5.10",
46
+ "X-Fern-SDK-Version": "0.5.11",
47
+ "User-Agent": "agentmail/0.5.11",
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);
@@ -93,6 +93,32 @@ export declare class MessagesClient {
93
93
  */
94
94
  batchGet(inbox_id: AgentMail.inboxes.InboxId, request: AgentMail.BatchGetMessagesRequest, requestOptions?: MessagesClient.RequestOptions): core.HttpResponsePromise<AgentMail.BatchGetMessagesResponse>;
95
95
  private __batchGet;
96
+ /**
97
+ * Apply one label change to up to 50 messages in a single request. The
98
+ * same add_labels and remove_labels apply to every message id, and at
99
+ * least one of them must be provided. The update is atomic: either all
100
+ * resolved messages are updated or none are. Missing or restricted ids
101
+ * are silently excluded; compare `count` against `limit` to detect
102
+ * exclusions.
103
+ *
104
+ * **CLI:**
105
+ * ```bash
106
+ * agentmail inboxes:messages batch-update --inbox-id <inbox_id> --message-id <id1> --message-id <id2> --add-label read --remove-label unread
107
+ * ```
108
+ *
109
+ * @param {AgentMail.inboxes.InboxId} inbox_id
110
+ * @param {AgentMail.BatchUpdateMessagesRequest} request
111
+ * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
112
+ *
113
+ * @throws {@link AgentMail.ValidationError}
114
+ *
115
+ * @example
116
+ * await client.inboxes.messages.batchUpdate("inbox_id", {
117
+ * messageIds: ["message_ids", "message_ids"]
118
+ * })
119
+ */
120
+ batchUpdate(inbox_id: AgentMail.inboxes.InboxId, request: AgentMail.BatchUpdateMessagesRequest, requestOptions?: MessagesClient.RequestOptions): core.HttpResponsePromise<AgentMail.BatchUpdateMessagesResponse>;
121
+ private __batchUpdate;
96
122
  /**
97
123
  * **CLI:**
98
124
  * ```bash
@@ -395,6 +395,89 @@ class MessagesClient {
395
395
  return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v0/inboxes/{inbox_id}/messages/batch-get");
396
396
  });
397
397
  }
398
+ /**
399
+ * Apply one label change to up to 50 messages in a single request. The
400
+ * same add_labels and remove_labels apply to every message id, and at
401
+ * least one of them must be provided. The update is atomic: either all
402
+ * resolved messages are updated or none are. Missing or restricted ids
403
+ * are silently excluded; compare `count` against `limit` to detect
404
+ * exclusions.
405
+ *
406
+ * **CLI:**
407
+ * ```bash
408
+ * agentmail inboxes:messages batch-update --inbox-id <inbox_id> --message-id <id1> --message-id <id2> --add-label read --remove-label unread
409
+ * ```
410
+ *
411
+ * @param {AgentMail.inboxes.InboxId} inbox_id
412
+ * @param {AgentMail.BatchUpdateMessagesRequest} request
413
+ * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
414
+ *
415
+ * @throws {@link AgentMail.ValidationError}
416
+ *
417
+ * @example
418
+ * await client.inboxes.messages.batchUpdate("inbox_id", {
419
+ * messageIds: ["message_ids", "message_ids"]
420
+ * })
421
+ */
422
+ batchUpdate(inbox_id, request, requestOptions) {
423
+ return core.HttpResponsePromise.fromPromise(this.__batchUpdate(inbox_id, request, requestOptions));
424
+ }
425
+ __batchUpdate(inbox_id, request, requestOptions) {
426
+ return __awaiter(this, void 0, void 0, function* () {
427
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
428
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
429
+ 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);
430
+ const _response = yield core.fetcher({
431
+ 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)
432
+ .http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages/batch-update`),
433
+ method: "POST",
434
+ headers: _headers,
435
+ contentType: "application/json",
436
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
437
+ requestType: "json",
438
+ body: serializers.BatchUpdateMessagesRequest.jsonOrThrow(request, {
439
+ unrecognizedObjectKeys: "strip",
440
+ omitUndefined: true,
441
+ }),
442
+ 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,
443
+ 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,
444
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
445
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
446
+ logging: this._options.logging,
447
+ });
448
+ if (_response.ok) {
449
+ return {
450
+ data: serializers.BatchUpdateMessagesResponse.parseOrThrow(_response.body, {
451
+ unrecognizedObjectKeys: "passthrough",
452
+ allowUnrecognizedUnionMembers: true,
453
+ allowUnrecognizedEnumValues: true,
454
+ skipValidation: true,
455
+ breadcrumbsPrefix: ["response"],
456
+ }),
457
+ rawResponse: _response.rawResponse,
458
+ };
459
+ }
460
+ if (_response.error.reason === "status-code") {
461
+ switch (_response.error.statusCode) {
462
+ case 400:
463
+ throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
464
+ unrecognizedObjectKeys: "passthrough",
465
+ allowUnrecognizedUnionMembers: true,
466
+ allowUnrecognizedEnumValues: true,
467
+ skipValidation: true,
468
+ breadcrumbsPrefix: ["response"],
469
+ }), _response.rawResponse);
470
+ default:
471
+ throw new errors.AgentMailError({
472
+ statusCode: _response.error.statusCode,
473
+ body: _response.error.body,
474
+ rawResponse: _response.rawResponse,
475
+ });
476
+ }
477
+ }
478
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v0/inboxes/{inbox_id}/messages/batch-update");
479
+ });
480
+ }
398
481
  /**
399
482
  * **CLI:**
400
483
  * ```bash
@@ -0,0 +1,8 @@
1
+ import type * as AgentMail from "../../../index.js";
2
+ /**
3
+ * IDs of messages to update. Maximum 50 ids per request. Duplicates are
4
+ * rejected with a validation error. IDs not found in the inbox (including
5
+ * cross-inbox or permission-restricted) are silently excluded from the
6
+ * update; callers detect exclusions by comparing `count` against `limit`.
7
+ */
8
+ export type BatchUpdateMessagesMessageIds = AgentMail.MessageId[];
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ import type * as AgentMail from "../../../index.js";
2
+ export interface BatchUpdateMessagesRequest {
3
+ messageIds: AgentMail.BatchUpdateMessagesMessageIds;
4
+ /** Label or labels to add to every message. */
5
+ addLabels?: AgentMail.UpdateMessageLabels;
6
+ /** Label or labels to remove from every message. */
7
+ removeLabels?: AgentMail.UpdateMessageLabels;
8
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,11 @@
1
+ import type * as AgentMail from "../../../index.js";
2
+ export interface BatchUpdateMessagesResponse {
3
+ limit: AgentMail.Limit;
4
+ count: AgentMail.Count;
5
+ /**
6
+ * Updated messages with their new labels. Order matches `message_ids`
7
+ * in the request. Excluded ids are omitted, so `count` may be less than
8
+ * `limit`.
9
+ */
10
+ updates: AgentMail.UpdateMessageResponse[];
11
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -2,6 +2,9 @@ export * from "./Addresses.js";
2
2
  export * from "./BatchGetMessagesMessageIds.js";
3
3
  export * from "./BatchGetMessagesRequest.js";
4
4
  export * from "./BatchGetMessagesResponse.js";
5
+ export * from "./BatchUpdateMessagesMessageIds.js";
6
+ export * from "./BatchUpdateMessagesRequest.js";
7
+ export * from "./BatchUpdateMessagesResponse.js";
5
8
  export * from "./ListMessagesResponse.js";
6
9
  export * from "./Message.js";
7
10
  export * from "./MessageAttachments.js";
@@ -18,6 +18,9 @@ __exportStar(require("./Addresses.js"), exports);
18
18
  __exportStar(require("./BatchGetMessagesMessageIds.js"), exports);
19
19
  __exportStar(require("./BatchGetMessagesRequest.js"), exports);
20
20
  __exportStar(require("./BatchGetMessagesResponse.js"), exports);
21
+ __exportStar(require("./BatchUpdateMessagesMessageIds.js"), exports);
22
+ __exportStar(require("./BatchUpdateMessagesRequest.js"), exports);
23
+ __exportStar(require("./BatchUpdateMessagesResponse.js"), exports);
21
24
  __exportStar(require("./ListMessagesResponse.js"), exports);
22
25
  __exportStar(require("./Message.js"), exports);
23
26
  __exportStar(require("./MessageAttachments.js"), exports);
@@ -0,0 +1,8 @@
1
+ import type * as AgentMail from "../../../../api/index.js";
2
+ import * as core from "../../../../core/index.js";
3
+ import type * as serializers from "../../../index.js";
4
+ import { MessageId } from "./MessageId.js";
5
+ export declare const BatchUpdateMessagesMessageIds: core.serialization.Schema<serializers.BatchUpdateMessagesMessageIds.Raw, AgentMail.BatchUpdateMessagesMessageIds>;
6
+ export declare namespace BatchUpdateMessagesMessageIds {
7
+ type Raw = MessageId.Raw[];
8
+ }
@@ -0,0 +1,40 @@
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.BatchUpdateMessagesMessageIds = void 0;
38
+ const core = __importStar(require("../../../../core/index.js"));
39
+ const MessageId_js_1 = require("./MessageId.js");
40
+ exports.BatchUpdateMessagesMessageIds = core.serialization.list(MessageId_js_1.MessageId);
@@ -0,0 +1,13 @@
1
+ import type * as AgentMail from "../../../../api/index.js";
2
+ import * as core from "../../../../core/index.js";
3
+ import type * as serializers from "../../../index.js";
4
+ import { BatchUpdateMessagesMessageIds } from "./BatchUpdateMessagesMessageIds.js";
5
+ import { UpdateMessageLabels } from "./UpdateMessageLabels.js";
6
+ export declare const BatchUpdateMessagesRequest: core.serialization.ObjectSchema<serializers.BatchUpdateMessagesRequest.Raw, AgentMail.BatchUpdateMessagesRequest>;
7
+ export declare namespace BatchUpdateMessagesRequest {
8
+ interface Raw {
9
+ message_ids: BatchUpdateMessagesMessageIds.Raw;
10
+ add_labels?: UpdateMessageLabels.Raw | null;
11
+ remove_labels?: UpdateMessageLabels.Raw | null;
12
+ }
13
+ }
@@ -0,0 +1,45 @@
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.BatchUpdateMessagesRequest = void 0;
38
+ const core = __importStar(require("../../../../core/index.js"));
39
+ const BatchUpdateMessagesMessageIds_js_1 = require("./BatchUpdateMessagesMessageIds.js");
40
+ const UpdateMessageLabels_js_1 = require("./UpdateMessageLabels.js");
41
+ exports.BatchUpdateMessagesRequest = core.serialization.object({
42
+ messageIds: core.serialization.property("message_ids", BatchUpdateMessagesMessageIds_js_1.BatchUpdateMessagesMessageIds),
43
+ addLabels: core.serialization.property("add_labels", UpdateMessageLabels_js_1.UpdateMessageLabels.optional()),
44
+ removeLabels: core.serialization.property("remove_labels", UpdateMessageLabels_js_1.UpdateMessageLabels.optional()),
45
+ });
@@ -0,0 +1,14 @@
1
+ import type * as AgentMail from "../../../../api/index.js";
2
+ import * as core from "../../../../core/index.js";
3
+ import type * as serializers from "../../../index.js";
4
+ import { Count } from "../../../types/Count.js";
5
+ import { Limit } from "../../../types/Limit.js";
6
+ import { UpdateMessageResponse } from "./UpdateMessageResponse.js";
7
+ export declare const BatchUpdateMessagesResponse: core.serialization.ObjectSchema<serializers.BatchUpdateMessagesResponse.Raw, AgentMail.BatchUpdateMessagesResponse>;
8
+ export declare namespace BatchUpdateMessagesResponse {
9
+ interface Raw {
10
+ limit: Limit.Raw;
11
+ count: Count.Raw;
12
+ updates: UpdateMessageResponse.Raw[];
13
+ }
14
+ }
@@ -0,0 +1,46 @@
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.BatchUpdateMessagesResponse = void 0;
38
+ const core = __importStar(require("../../../../core/index.js"));
39
+ const Count_js_1 = require("../../../types/Count.js");
40
+ const Limit_js_1 = require("../../../types/Limit.js");
41
+ const UpdateMessageResponse_js_1 = require("./UpdateMessageResponse.js");
42
+ exports.BatchUpdateMessagesResponse = core.serialization.object({
43
+ limit: Limit_js_1.Limit,
44
+ count: Count_js_1.Count,
45
+ updates: core.serialization.list(UpdateMessageResponse_js_1.UpdateMessageResponse),
46
+ });
@@ -2,6 +2,9 @@ export * from "./Addresses.js";
2
2
  export * from "./BatchGetMessagesMessageIds.js";
3
3
  export * from "./BatchGetMessagesRequest.js";
4
4
  export * from "./BatchGetMessagesResponse.js";
5
+ export * from "./BatchUpdateMessagesMessageIds.js";
6
+ export * from "./BatchUpdateMessagesRequest.js";
7
+ export * from "./BatchUpdateMessagesResponse.js";
5
8
  export * from "./ListMessagesResponse.js";
6
9
  export * from "./Message.js";
7
10
  export * from "./MessageAttachments.js";
@@ -18,6 +18,9 @@ __exportStar(require("./Addresses.js"), exports);
18
18
  __exportStar(require("./BatchGetMessagesMessageIds.js"), exports);
19
19
  __exportStar(require("./BatchGetMessagesRequest.js"), exports);
20
20
  __exportStar(require("./BatchGetMessagesResponse.js"), exports);
21
+ __exportStar(require("./BatchUpdateMessagesMessageIds.js"), exports);
22
+ __exportStar(require("./BatchUpdateMessagesRequest.js"), exports);
23
+ __exportStar(require("./BatchUpdateMessagesResponse.js"), exports);
21
24
  __exportStar(require("./ListMessagesResponse.js"), exports);
22
25
  __exportStar(require("./Message.js"), exports);
23
26
  __exportStar(require("./MessageAttachments.js"), exports);
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.5.10";
1
+ export declare const SDK_VERSION = "0.5.11";
@@ -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.10";
4
+ exports.SDK_VERSION = "0.5.11";
@@ -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.10",
10
- "User-Agent": "agentmail/0.5.10",
9
+ "X-Fern-SDK-Version": "0.5.11",
10
+ "User-Agent": "agentmail/0.5.11",
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);
@@ -93,6 +93,32 @@ export declare class MessagesClient {
93
93
  */
94
94
  batchGet(inbox_id: AgentMail.inboxes.InboxId, request: AgentMail.BatchGetMessagesRequest, requestOptions?: MessagesClient.RequestOptions): core.HttpResponsePromise<AgentMail.BatchGetMessagesResponse>;
95
95
  private __batchGet;
96
+ /**
97
+ * Apply one label change to up to 50 messages in a single request. The
98
+ * same add_labels and remove_labels apply to every message id, and at
99
+ * least one of them must be provided. The update is atomic: either all
100
+ * resolved messages are updated or none are. Missing or restricted ids
101
+ * are silently excluded; compare `count` against `limit` to detect
102
+ * exclusions.
103
+ *
104
+ * **CLI:**
105
+ * ```bash
106
+ * agentmail inboxes:messages batch-update --inbox-id <inbox_id> --message-id <id1> --message-id <id2> --add-label read --remove-label unread
107
+ * ```
108
+ *
109
+ * @param {AgentMail.inboxes.InboxId} inbox_id
110
+ * @param {AgentMail.BatchUpdateMessagesRequest} request
111
+ * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
112
+ *
113
+ * @throws {@link AgentMail.ValidationError}
114
+ *
115
+ * @example
116
+ * await client.inboxes.messages.batchUpdate("inbox_id", {
117
+ * messageIds: ["message_ids", "message_ids"]
118
+ * })
119
+ */
120
+ batchUpdate(inbox_id: AgentMail.inboxes.InboxId, request: AgentMail.BatchUpdateMessagesRequest, requestOptions?: MessagesClient.RequestOptions): core.HttpResponsePromise<AgentMail.BatchUpdateMessagesResponse>;
121
+ private __batchUpdate;
96
122
  /**
97
123
  * **CLI:**
98
124
  * ```bash
@@ -359,6 +359,89 @@ export class MessagesClient {
359
359
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v0/inboxes/{inbox_id}/messages/batch-get");
360
360
  });
361
361
  }
362
+ /**
363
+ * Apply one label change to up to 50 messages in a single request. The
364
+ * same add_labels and remove_labels apply to every message id, and at
365
+ * least one of them must be provided. The update is atomic: either all
366
+ * resolved messages are updated or none are. Missing or restricted ids
367
+ * are silently excluded; compare `count` against `limit` to detect
368
+ * exclusions.
369
+ *
370
+ * **CLI:**
371
+ * ```bash
372
+ * agentmail inboxes:messages batch-update --inbox-id <inbox_id> --message-id <id1> --message-id <id2> --add-label read --remove-label unread
373
+ * ```
374
+ *
375
+ * @param {AgentMail.inboxes.InboxId} inbox_id
376
+ * @param {AgentMail.BatchUpdateMessagesRequest} request
377
+ * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
378
+ *
379
+ * @throws {@link AgentMail.ValidationError}
380
+ *
381
+ * @example
382
+ * await client.inboxes.messages.batchUpdate("inbox_id", {
383
+ * messageIds: ["message_ids", "message_ids"]
384
+ * })
385
+ */
386
+ batchUpdate(inbox_id, request, requestOptions) {
387
+ return core.HttpResponsePromise.fromPromise(this.__batchUpdate(inbox_id, request, requestOptions));
388
+ }
389
+ __batchUpdate(inbox_id, request, requestOptions) {
390
+ return __awaiter(this, void 0, void 0, function* () {
391
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
392
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
393
+ 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);
394
+ const _response = yield core.fetcher({
395
+ 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)
396
+ .http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages/batch-update`),
397
+ method: "POST",
398
+ headers: _headers,
399
+ contentType: "application/json",
400
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
401
+ requestType: "json",
402
+ body: serializers.BatchUpdateMessagesRequest.jsonOrThrow(request, {
403
+ unrecognizedObjectKeys: "strip",
404
+ omitUndefined: true,
405
+ }),
406
+ 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,
407
+ 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,
408
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
409
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
410
+ logging: this._options.logging,
411
+ });
412
+ if (_response.ok) {
413
+ return {
414
+ data: serializers.BatchUpdateMessagesResponse.parseOrThrow(_response.body, {
415
+ unrecognizedObjectKeys: "passthrough",
416
+ allowUnrecognizedUnionMembers: true,
417
+ allowUnrecognizedEnumValues: true,
418
+ skipValidation: true,
419
+ breadcrumbsPrefix: ["response"],
420
+ }),
421
+ rawResponse: _response.rawResponse,
422
+ };
423
+ }
424
+ if (_response.error.reason === "status-code") {
425
+ switch (_response.error.statusCode) {
426
+ case 400:
427
+ throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
428
+ unrecognizedObjectKeys: "passthrough",
429
+ allowUnrecognizedUnionMembers: true,
430
+ allowUnrecognizedEnumValues: true,
431
+ skipValidation: true,
432
+ breadcrumbsPrefix: ["response"],
433
+ }), _response.rawResponse);
434
+ default:
435
+ throw new errors.AgentMailError({
436
+ statusCode: _response.error.statusCode,
437
+ body: _response.error.body,
438
+ rawResponse: _response.rawResponse,
439
+ });
440
+ }
441
+ }
442
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v0/inboxes/{inbox_id}/messages/batch-update");
443
+ });
444
+ }
362
445
  /**
363
446
  * **CLI:**
364
447
  * ```bash
@@ -0,0 +1,8 @@
1
+ import type * as AgentMail from "../../../index.mjs";
2
+ /**
3
+ * IDs of messages to update. Maximum 50 ids per request. Duplicates are
4
+ * rejected with a validation error. IDs not found in the inbox (including
5
+ * cross-inbox or permission-restricted) are silently excluded from the
6
+ * update; callers detect exclusions by comparing `count` against `limit`.
7
+ */
8
+ export type BatchUpdateMessagesMessageIds = AgentMail.MessageId[];
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,8 @@
1
+ import type * as AgentMail from "../../../index.mjs";
2
+ export interface BatchUpdateMessagesRequest {
3
+ messageIds: AgentMail.BatchUpdateMessagesMessageIds;
4
+ /** Label or labels to add to every message. */
5
+ addLabels?: AgentMail.UpdateMessageLabels;
6
+ /** Label or labels to remove from every message. */
7
+ removeLabels?: AgentMail.UpdateMessageLabels;
8
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,11 @@
1
+ import type * as AgentMail from "../../../index.mjs";
2
+ export interface BatchUpdateMessagesResponse {
3
+ limit: AgentMail.Limit;
4
+ count: AgentMail.Count;
5
+ /**
6
+ * Updated messages with their new labels. Order matches `message_ids`
7
+ * in the request. Excluded ids are omitted, so `count` may be less than
8
+ * `limit`.
9
+ */
10
+ updates: AgentMail.UpdateMessageResponse[];
11
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -2,6 +2,9 @@ export * from "./Addresses.mjs";
2
2
  export * from "./BatchGetMessagesMessageIds.mjs";
3
3
  export * from "./BatchGetMessagesRequest.mjs";
4
4
  export * from "./BatchGetMessagesResponse.mjs";
5
+ export * from "./BatchUpdateMessagesMessageIds.mjs";
6
+ export * from "./BatchUpdateMessagesRequest.mjs";
7
+ export * from "./BatchUpdateMessagesResponse.mjs";
5
8
  export * from "./ListMessagesResponse.mjs";
6
9
  export * from "./Message.mjs";
7
10
  export * from "./MessageAttachments.mjs";
@@ -2,6 +2,9 @@ export * from "./Addresses.mjs";
2
2
  export * from "./BatchGetMessagesMessageIds.mjs";
3
3
  export * from "./BatchGetMessagesRequest.mjs";
4
4
  export * from "./BatchGetMessagesResponse.mjs";
5
+ export * from "./BatchUpdateMessagesMessageIds.mjs";
6
+ export * from "./BatchUpdateMessagesRequest.mjs";
7
+ export * from "./BatchUpdateMessagesResponse.mjs";
5
8
  export * from "./ListMessagesResponse.mjs";
6
9
  export * from "./Message.mjs";
7
10
  export * from "./MessageAttachments.mjs";
@@ -0,0 +1,8 @@
1
+ import type * as AgentMail from "../../../../api/index.mjs";
2
+ import * as core from "../../../../core/index.mjs";
3
+ import type * as serializers from "../../../index.mjs";
4
+ import { MessageId } from "./MessageId.mjs";
5
+ export declare const BatchUpdateMessagesMessageIds: core.serialization.Schema<serializers.BatchUpdateMessagesMessageIds.Raw, AgentMail.BatchUpdateMessagesMessageIds>;
6
+ export declare namespace BatchUpdateMessagesMessageIds {
7
+ type Raw = MessageId.Raw[];
8
+ }
@@ -0,0 +1,4 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ import * as core from "../../../../core/index.mjs";
3
+ import { MessageId } from "./MessageId.mjs";
4
+ export const BatchUpdateMessagesMessageIds = core.serialization.list(MessageId);