agentmail 0.5.1 → 0.5.2

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 (44) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/api/resources/inboxes/resources/messages/client/Client.d.ts +23 -0
  3. package/dist/cjs/api/resources/inboxes/resources/messages/client/Client.js +80 -0
  4. package/dist/cjs/api/resources/messages/types/BatchGetMessagesMessageIds.d.ts +8 -0
  5. package/dist/cjs/api/resources/messages/types/BatchGetMessagesMessageIds.js +3 -0
  6. package/dist/cjs/api/resources/messages/types/BatchGetMessagesRequest.d.ts +4 -0
  7. package/dist/cjs/api/resources/messages/types/BatchGetMessagesRequest.js +3 -0
  8. package/dist/cjs/api/resources/messages/types/BatchGetMessagesResponse.d.ts +11 -0
  9. package/dist/cjs/api/resources/messages/types/BatchGetMessagesResponse.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/BatchGetMessagesMessageIds.d.ts +8 -0
  13. package/dist/cjs/serialization/resources/messages/types/BatchGetMessagesMessageIds.js +40 -0
  14. package/dist/cjs/serialization/resources/messages/types/BatchGetMessagesRequest.d.ts +10 -0
  15. package/dist/cjs/serialization/resources/messages/types/BatchGetMessagesRequest.js +42 -0
  16. package/dist/cjs/serialization/resources/messages/types/BatchGetMessagesResponse.d.ts +14 -0
  17. package/dist/cjs/serialization/resources/messages/types/BatchGetMessagesResponse.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 +23 -0
  24. package/dist/esm/api/resources/inboxes/resources/messages/client/Client.mjs +80 -0
  25. package/dist/esm/api/resources/messages/types/BatchGetMessagesMessageIds.d.mts +8 -0
  26. package/dist/esm/api/resources/messages/types/BatchGetMessagesMessageIds.mjs +2 -0
  27. package/dist/esm/api/resources/messages/types/BatchGetMessagesRequest.d.mts +4 -0
  28. package/dist/esm/api/resources/messages/types/BatchGetMessagesRequest.mjs +2 -0
  29. package/dist/esm/api/resources/messages/types/BatchGetMessagesResponse.d.mts +11 -0
  30. package/dist/esm/api/resources/messages/types/BatchGetMessagesResponse.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/BatchGetMessagesMessageIds.d.mts +8 -0
  34. package/dist/esm/serialization/resources/messages/types/BatchGetMessagesMessageIds.mjs +4 -0
  35. package/dist/esm/serialization/resources/messages/types/BatchGetMessagesRequest.d.mts +10 -0
  36. package/dist/esm/serialization/resources/messages/types/BatchGetMessagesRequest.mjs +6 -0
  37. package/dist/esm/serialization/resources/messages/types/BatchGetMessagesResponse.d.mts +14 -0
  38. package/dist/esm/serialization/resources/messages/types/BatchGetMessagesResponse.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/package.json +1 -1
  44. package/reference.md +80 -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.1",
47
- "User-Agent": "agentmail/0.5.1",
46
+ "X-Fern-SDK-Version": "0.5.2",
47
+ "User-Agent": "agentmail/0.5.2",
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);
@@ -44,6 +44,29 @@ export declare class MessagesClient {
44
44
  */
45
45
  get(inbox_id: AgentMail.inboxes.InboxId, message_id: AgentMail.MessageId, requestOptions?: MessagesClient.RequestOptions): core.HttpResponsePromise<AgentMail.Message>;
46
46
  private __get;
47
+ /**
48
+ * Fetch metadata for up to 500 messages in one request. Missing or
49
+ * restricted IDs are silently omitted; compare `count` against `limit`
50
+ * to detect misses.
51
+ *
52
+ * **CLI:**
53
+ * ```bash
54
+ * agentmail inboxes:messages batch-get --inbox-id <inbox_id> --message-id <id1> --message-id <id2>
55
+ * ```
56
+ *
57
+ * @param {AgentMail.inboxes.InboxId} inbox_id
58
+ * @param {AgentMail.BatchGetMessagesRequest} request
59
+ * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
60
+ *
61
+ * @throws {@link AgentMail.ValidationError}
62
+ *
63
+ * @example
64
+ * await client.inboxes.messages.batchGet("inbox_id", {
65
+ * messageIds: ["message_ids", "message_ids"]
66
+ * })
67
+ */
68
+ batchGet(inbox_id: AgentMail.inboxes.InboxId, request: AgentMail.BatchGetMessagesRequest, requestOptions?: MessagesClient.RequestOptions): core.HttpResponsePromise<AgentMail.BatchGetMessagesResponse>;
69
+ private __batchGet;
47
70
  /**
48
71
  * **CLI:**
49
72
  * ```bash
@@ -215,6 +215,86 @@ class MessagesClient {
215
215
  return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v0/inboxes/{inbox_id}/messages/{message_id}");
216
216
  });
217
217
  }
218
+ /**
219
+ * Fetch metadata for up to 500 messages in one request. Missing or
220
+ * restricted IDs are silently omitted; compare `count` against `limit`
221
+ * to detect misses.
222
+ *
223
+ * **CLI:**
224
+ * ```bash
225
+ * agentmail inboxes:messages batch-get --inbox-id <inbox_id> --message-id <id1> --message-id <id2>
226
+ * ```
227
+ *
228
+ * @param {AgentMail.inboxes.InboxId} inbox_id
229
+ * @param {AgentMail.BatchGetMessagesRequest} request
230
+ * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
231
+ *
232
+ * @throws {@link AgentMail.ValidationError}
233
+ *
234
+ * @example
235
+ * await client.inboxes.messages.batchGet("inbox_id", {
236
+ * messageIds: ["message_ids", "message_ids"]
237
+ * })
238
+ */
239
+ batchGet(inbox_id, request, requestOptions) {
240
+ return core.HttpResponsePromise.fromPromise(this.__batchGet(inbox_id, request, requestOptions));
241
+ }
242
+ __batchGet(inbox_id, request, requestOptions) {
243
+ return __awaiter(this, void 0, void 0, function* () {
244
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
245
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
246
+ 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);
247
+ const _response = yield core.fetcher({
248
+ 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)
249
+ .http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages/batch-get`),
250
+ method: "POST",
251
+ headers: _headers,
252
+ contentType: "application/json",
253
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
254
+ requestType: "json",
255
+ body: serializers.BatchGetMessagesRequest.jsonOrThrow(request, {
256
+ unrecognizedObjectKeys: "strip",
257
+ omitUndefined: true,
258
+ }),
259
+ 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,
260
+ 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,
261
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
262
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
263
+ logging: this._options.logging,
264
+ });
265
+ if (_response.ok) {
266
+ return {
267
+ data: serializers.BatchGetMessagesResponse.parseOrThrow(_response.body, {
268
+ unrecognizedObjectKeys: "passthrough",
269
+ allowUnrecognizedUnionMembers: true,
270
+ allowUnrecognizedEnumValues: true,
271
+ skipValidation: true,
272
+ breadcrumbsPrefix: ["response"],
273
+ }),
274
+ rawResponse: _response.rawResponse,
275
+ };
276
+ }
277
+ if (_response.error.reason === "status-code") {
278
+ switch (_response.error.statusCode) {
279
+ case 400:
280
+ throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
281
+ unrecognizedObjectKeys: "passthrough",
282
+ allowUnrecognizedUnionMembers: true,
283
+ allowUnrecognizedEnumValues: true,
284
+ skipValidation: true,
285
+ breadcrumbsPrefix: ["response"],
286
+ }), _response.rawResponse);
287
+ default:
288
+ throw new errors.AgentMailError({
289
+ statusCode: _response.error.statusCode,
290
+ body: _response.error.body,
291
+ rawResponse: _response.rawResponse,
292
+ });
293
+ }
294
+ }
295
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v0/inboxes/{inbox_id}/messages/batch-get");
296
+ });
297
+ }
218
298
  /**
219
299
  * **CLI:**
220
300
  * ```bash
@@ -0,0 +1,8 @@
1
+ import type * as AgentMail from "../../../index.js";
2
+ /**
3
+ * IDs of messages to fetch. Maximum 500 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 omitted from the
6
+ * response; callers detect misses by comparing `count` against `limit`.
7
+ */
8
+ export type BatchGetMessagesMessageIds = 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,4 @@
1
+ import type * as AgentMail from "../../../index.js";
2
+ export interface BatchGetMessagesRequest {
3
+ messageIds: AgentMail.BatchGetMessagesMessageIds;
4
+ }
@@ -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 BatchGetMessagesResponse {
3
+ limit: AgentMail.Limit;
4
+ count: AgentMail.Count;
5
+ /**
6
+ * Found messages. Order matches `message_ids` in the request. Body
7
+ * fields (`text`, `html`, `extracted_text`, `extracted_html`) are
8
+ * never populated; use the single-message endpoint to retrieve bodies.
9
+ */
10
+ messages: AgentMail.Message[];
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 });
@@ -1,4 +1,7 @@
1
1
  export * from "./Addresses.js";
2
+ export * from "./BatchGetMessagesMessageIds.js";
3
+ export * from "./BatchGetMessagesRequest.js";
4
+ export * from "./BatchGetMessagesResponse.js";
2
5
  export * from "./ListMessagesResponse.js";
3
6
  export * from "./Message.js";
4
7
  export * from "./MessageAttachments.js";
@@ -15,6 +15,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./Addresses.js"), exports);
18
+ __exportStar(require("./BatchGetMessagesMessageIds.js"), exports);
19
+ __exportStar(require("./BatchGetMessagesRequest.js"), exports);
20
+ __exportStar(require("./BatchGetMessagesResponse.js"), exports);
18
21
  __exportStar(require("./ListMessagesResponse.js"), exports);
19
22
  __exportStar(require("./Message.js"), exports);
20
23
  __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 BatchGetMessagesMessageIds: core.serialization.Schema<serializers.BatchGetMessagesMessageIds.Raw, AgentMail.BatchGetMessagesMessageIds>;
6
+ export declare namespace BatchGetMessagesMessageIds {
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.BatchGetMessagesMessageIds = void 0;
38
+ const core = __importStar(require("../../../../core/index.js"));
39
+ const MessageId_js_1 = require("./MessageId.js");
40
+ exports.BatchGetMessagesMessageIds = core.serialization.list(MessageId_js_1.MessageId);
@@ -0,0 +1,10 @@
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 { BatchGetMessagesMessageIds } from "./BatchGetMessagesMessageIds.js";
5
+ export declare const BatchGetMessagesRequest: core.serialization.ObjectSchema<serializers.BatchGetMessagesRequest.Raw, AgentMail.BatchGetMessagesRequest>;
6
+ export declare namespace BatchGetMessagesRequest {
7
+ interface Raw {
8
+ message_ids: BatchGetMessagesMessageIds.Raw;
9
+ }
10
+ }
@@ -0,0 +1,42 @@
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.BatchGetMessagesRequest = void 0;
38
+ const core = __importStar(require("../../../../core/index.js"));
39
+ const BatchGetMessagesMessageIds_js_1 = require("./BatchGetMessagesMessageIds.js");
40
+ exports.BatchGetMessagesRequest = core.serialization.object({
41
+ messageIds: core.serialization.property("message_ids", BatchGetMessagesMessageIds_js_1.BatchGetMessagesMessageIds),
42
+ });
@@ -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 { Message } from "./Message.js";
7
+ export declare const BatchGetMessagesResponse: core.serialization.ObjectSchema<serializers.BatchGetMessagesResponse.Raw, AgentMail.BatchGetMessagesResponse>;
8
+ export declare namespace BatchGetMessagesResponse {
9
+ interface Raw {
10
+ limit: Limit.Raw;
11
+ count: Count.Raw;
12
+ messages: Message.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.BatchGetMessagesResponse = 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 Message_js_1 = require("./Message.js");
42
+ exports.BatchGetMessagesResponse = core.serialization.object({
43
+ limit: Limit_js_1.Limit,
44
+ count: Count_js_1.Count,
45
+ messages: core.serialization.list(Message_js_1.Message),
46
+ });
@@ -1,4 +1,7 @@
1
1
  export * from "./Addresses.js";
2
+ export * from "./BatchGetMessagesMessageIds.js";
3
+ export * from "./BatchGetMessagesRequest.js";
4
+ export * from "./BatchGetMessagesResponse.js";
2
5
  export * from "./ListMessagesResponse.js";
3
6
  export * from "./Message.js";
4
7
  export * from "./MessageAttachments.js";
@@ -15,6 +15,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./Addresses.js"), exports);
18
+ __exportStar(require("./BatchGetMessagesMessageIds.js"), exports);
19
+ __exportStar(require("./BatchGetMessagesRequest.js"), exports);
20
+ __exportStar(require("./BatchGetMessagesResponse.js"), exports);
18
21
  __exportStar(require("./ListMessagesResponse.js"), exports);
19
22
  __exportStar(require("./Message.js"), exports);
20
23
  __exportStar(require("./MessageAttachments.js"), exports);
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.5.1";
1
+ export declare const SDK_VERSION = "0.5.2";
@@ -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.1";
4
+ exports.SDK_VERSION = "0.5.2";
@@ -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.1",
10
- "User-Agent": "agentmail/0.5.1",
9
+ "X-Fern-SDK-Version": "0.5.2",
10
+ "User-Agent": "agentmail/0.5.2",
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);
@@ -44,6 +44,29 @@ export declare class MessagesClient {
44
44
  */
45
45
  get(inbox_id: AgentMail.inboxes.InboxId, message_id: AgentMail.MessageId, requestOptions?: MessagesClient.RequestOptions): core.HttpResponsePromise<AgentMail.Message>;
46
46
  private __get;
47
+ /**
48
+ * Fetch metadata for up to 500 messages in one request. Missing or
49
+ * restricted IDs are silently omitted; compare `count` against `limit`
50
+ * to detect misses.
51
+ *
52
+ * **CLI:**
53
+ * ```bash
54
+ * agentmail inboxes:messages batch-get --inbox-id <inbox_id> --message-id <id1> --message-id <id2>
55
+ * ```
56
+ *
57
+ * @param {AgentMail.inboxes.InboxId} inbox_id
58
+ * @param {AgentMail.BatchGetMessagesRequest} request
59
+ * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
60
+ *
61
+ * @throws {@link AgentMail.ValidationError}
62
+ *
63
+ * @example
64
+ * await client.inboxes.messages.batchGet("inbox_id", {
65
+ * messageIds: ["message_ids", "message_ids"]
66
+ * })
67
+ */
68
+ batchGet(inbox_id: AgentMail.inboxes.InboxId, request: AgentMail.BatchGetMessagesRequest, requestOptions?: MessagesClient.RequestOptions): core.HttpResponsePromise<AgentMail.BatchGetMessagesResponse>;
69
+ private __batchGet;
47
70
  /**
48
71
  * **CLI:**
49
72
  * ```bash
@@ -179,6 +179,86 @@ export class MessagesClient {
179
179
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v0/inboxes/{inbox_id}/messages/{message_id}");
180
180
  });
181
181
  }
182
+ /**
183
+ * Fetch metadata for up to 500 messages in one request. Missing or
184
+ * restricted IDs are silently omitted; compare `count` against `limit`
185
+ * to detect misses.
186
+ *
187
+ * **CLI:**
188
+ * ```bash
189
+ * agentmail inboxes:messages batch-get --inbox-id <inbox_id> --message-id <id1> --message-id <id2>
190
+ * ```
191
+ *
192
+ * @param {AgentMail.inboxes.InboxId} inbox_id
193
+ * @param {AgentMail.BatchGetMessagesRequest} request
194
+ * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
195
+ *
196
+ * @throws {@link AgentMail.ValidationError}
197
+ *
198
+ * @example
199
+ * await client.inboxes.messages.batchGet("inbox_id", {
200
+ * messageIds: ["message_ids", "message_ids"]
201
+ * })
202
+ */
203
+ batchGet(inbox_id, request, requestOptions) {
204
+ return core.HttpResponsePromise.fromPromise(this.__batchGet(inbox_id, request, requestOptions));
205
+ }
206
+ __batchGet(inbox_id, request, requestOptions) {
207
+ return __awaiter(this, void 0, void 0, function* () {
208
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
209
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
210
+ 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);
211
+ const _response = yield core.fetcher({
212
+ 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)
213
+ .http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages/batch-get`),
214
+ method: "POST",
215
+ headers: _headers,
216
+ contentType: "application/json",
217
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
218
+ requestType: "json",
219
+ body: serializers.BatchGetMessagesRequest.jsonOrThrow(request, {
220
+ unrecognizedObjectKeys: "strip",
221
+ omitUndefined: true,
222
+ }),
223
+ 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,
224
+ 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,
225
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
226
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
227
+ logging: this._options.logging,
228
+ });
229
+ if (_response.ok) {
230
+ return {
231
+ data: serializers.BatchGetMessagesResponse.parseOrThrow(_response.body, {
232
+ unrecognizedObjectKeys: "passthrough",
233
+ allowUnrecognizedUnionMembers: true,
234
+ allowUnrecognizedEnumValues: true,
235
+ skipValidation: true,
236
+ breadcrumbsPrefix: ["response"],
237
+ }),
238
+ rawResponse: _response.rawResponse,
239
+ };
240
+ }
241
+ if (_response.error.reason === "status-code") {
242
+ switch (_response.error.statusCode) {
243
+ case 400:
244
+ throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
245
+ unrecognizedObjectKeys: "passthrough",
246
+ allowUnrecognizedUnionMembers: true,
247
+ allowUnrecognizedEnumValues: true,
248
+ skipValidation: true,
249
+ breadcrumbsPrefix: ["response"],
250
+ }), _response.rawResponse);
251
+ default:
252
+ throw new errors.AgentMailError({
253
+ statusCode: _response.error.statusCode,
254
+ body: _response.error.body,
255
+ rawResponse: _response.rawResponse,
256
+ });
257
+ }
258
+ }
259
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v0/inboxes/{inbox_id}/messages/batch-get");
260
+ });
261
+ }
182
262
  /**
183
263
  * **CLI:**
184
264
  * ```bash
@@ -0,0 +1,8 @@
1
+ import type * as AgentMail from "../../../index.mjs";
2
+ /**
3
+ * IDs of messages to fetch. Maximum 500 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 omitted from the
6
+ * response; callers detect misses by comparing `count` against `limit`.
7
+ */
8
+ export type BatchGetMessagesMessageIds = AgentMail.MessageId[];
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,4 @@
1
+ import type * as AgentMail from "../../../index.mjs";
2
+ export interface BatchGetMessagesRequest {
3
+ messageIds: AgentMail.BatchGetMessagesMessageIds;
4
+ }
@@ -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 BatchGetMessagesResponse {
3
+ limit: AgentMail.Limit;
4
+ count: AgentMail.Count;
5
+ /**
6
+ * Found messages. Order matches `message_ids` in the request. Body
7
+ * fields (`text`, `html`, `extracted_text`, `extracted_html`) are
8
+ * never populated; use the single-message endpoint to retrieve bodies.
9
+ */
10
+ messages: AgentMail.Message[];
11
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -1,4 +1,7 @@
1
1
  export * from "./Addresses.mjs";
2
+ export * from "./BatchGetMessagesMessageIds.mjs";
3
+ export * from "./BatchGetMessagesRequest.mjs";
4
+ export * from "./BatchGetMessagesResponse.mjs";
2
5
  export * from "./ListMessagesResponse.mjs";
3
6
  export * from "./Message.mjs";
4
7
  export * from "./MessageAttachments.mjs";
@@ -1,4 +1,7 @@
1
1
  export * from "./Addresses.mjs";
2
+ export * from "./BatchGetMessagesMessageIds.mjs";
3
+ export * from "./BatchGetMessagesRequest.mjs";
4
+ export * from "./BatchGetMessagesResponse.mjs";
2
5
  export * from "./ListMessagesResponse.mjs";
3
6
  export * from "./Message.mjs";
4
7
  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 BatchGetMessagesMessageIds: core.serialization.Schema<serializers.BatchGetMessagesMessageIds.Raw, AgentMail.BatchGetMessagesMessageIds>;
6
+ export declare namespace BatchGetMessagesMessageIds {
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 BatchGetMessagesMessageIds = core.serialization.list(MessageId);
@@ -0,0 +1,10 @@
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 { BatchGetMessagesMessageIds } from "./BatchGetMessagesMessageIds.mjs";
5
+ export declare const BatchGetMessagesRequest: core.serialization.ObjectSchema<serializers.BatchGetMessagesRequest.Raw, AgentMail.BatchGetMessagesRequest>;
6
+ export declare namespace BatchGetMessagesRequest {
7
+ interface Raw {
8
+ message_ids: BatchGetMessagesMessageIds.Raw;
9
+ }
10
+ }
@@ -0,0 +1,6 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ import * as core from "../../../../core/index.mjs";
3
+ import { BatchGetMessagesMessageIds } from "./BatchGetMessagesMessageIds.mjs";
4
+ export const BatchGetMessagesRequest = core.serialization.object({
5
+ messageIds: core.serialization.property("message_ids", BatchGetMessagesMessageIds),
6
+ });
@@ -0,0 +1,14 @@
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 { Count } from "../../../types/Count.mjs";
5
+ import { Limit } from "../../../types/Limit.mjs";
6
+ import { Message } from "./Message.mjs";
7
+ export declare const BatchGetMessagesResponse: core.serialization.ObjectSchema<serializers.BatchGetMessagesResponse.Raw, AgentMail.BatchGetMessagesResponse>;
8
+ export declare namespace BatchGetMessagesResponse {
9
+ interface Raw {
10
+ limit: Limit.Raw;
11
+ count: Count.Raw;
12
+ messages: Message.Raw[];
13
+ }
14
+ }
@@ -0,0 +1,10 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ import * as core from "../../../../core/index.mjs";
3
+ import { Count } from "../../../types/Count.mjs";
4
+ import { Limit } from "../../../types/Limit.mjs";
5
+ import { Message } from "./Message.mjs";
6
+ export const BatchGetMessagesResponse = core.serialization.object({
7
+ limit: Limit,
8
+ count: Count,
9
+ messages: core.serialization.list(Message),
10
+ });
@@ -1,4 +1,7 @@
1
1
  export * from "./Addresses.mjs";
2
+ export * from "./BatchGetMessagesMessageIds.mjs";
3
+ export * from "./BatchGetMessagesRequest.mjs";
4
+ export * from "./BatchGetMessagesResponse.mjs";
2
5
  export * from "./ListMessagesResponse.mjs";
3
6
  export * from "./Message.mjs";
4
7
  export * from "./MessageAttachments.mjs";
@@ -1,4 +1,7 @@
1
1
  export * from "./Addresses.mjs";
2
+ export * from "./BatchGetMessagesMessageIds.mjs";
3
+ export * from "./BatchGetMessagesRequest.mjs";
4
+ export * from "./BatchGetMessagesResponse.mjs";
2
5
  export * from "./ListMessagesResponse.mjs";
3
6
  export * from "./Message.mjs";
4
7
  export * from "./MessageAttachments.mjs";
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.5.1";
1
+ export declare const SDK_VERSION = "0.5.2";
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.5.1";
1
+ export const SDK_VERSION = "0.5.2";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentmail",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
package/reference.md CHANGED
@@ -3330,6 +3330,86 @@ await client.inboxes.messages.get("inbox_id", "message_id");
3330
3330
  </dl>
3331
3331
 
3332
3332
 
3333
+ </dd>
3334
+ </dl>
3335
+ </details>
3336
+
3337
+ <details><summary><code>client.inboxes.messages.<a href="/src/api/resources/inboxes/resources/messages/client/Client.ts">batchGet</a>(inbox_id, { ...params }) -> AgentMail.BatchGetMessagesResponse</code></summary>
3338
+ <dl>
3339
+ <dd>
3340
+
3341
+ #### 📝 Description
3342
+
3343
+ <dl>
3344
+ <dd>
3345
+
3346
+ <dl>
3347
+ <dd>
3348
+
3349
+ Fetch metadata for up to 500 messages in one request. Missing or
3350
+ restricted IDs are silently omitted; compare `count` against `limit`
3351
+ to detect misses.
3352
+
3353
+ **CLI:**
3354
+ ```bash
3355
+ agentmail inboxes:messages batch-get --inbox-id <inbox_id> --message-id <id1> --message-id <id2>
3356
+ ```
3357
+ </dd>
3358
+ </dl>
3359
+ </dd>
3360
+ </dl>
3361
+
3362
+ #### 🔌 Usage
3363
+
3364
+ <dl>
3365
+ <dd>
3366
+
3367
+ <dl>
3368
+ <dd>
3369
+
3370
+ ```typescript
3371
+ await client.inboxes.messages.batchGet("inbox_id", {
3372
+ messageIds: ["message_ids", "message_ids"]
3373
+ });
3374
+
3375
+ ```
3376
+ </dd>
3377
+ </dl>
3378
+ </dd>
3379
+ </dl>
3380
+
3381
+ #### ⚙️ Parameters
3382
+
3383
+ <dl>
3384
+ <dd>
3385
+
3386
+ <dl>
3387
+ <dd>
3388
+
3389
+ **inbox_id:** `AgentMail.InboxId`
3390
+
3391
+ </dd>
3392
+ </dl>
3393
+
3394
+ <dl>
3395
+ <dd>
3396
+
3397
+ **request:** `AgentMail.BatchGetMessagesRequest`
3398
+
3399
+ </dd>
3400
+ </dl>
3401
+
3402
+ <dl>
3403
+ <dd>
3404
+
3405
+ **requestOptions:** `MessagesClient.RequestOptions`
3406
+
3407
+ </dd>
3408
+ </dl>
3409
+ </dd>
3410
+ </dl>
3411
+
3412
+
3333
3413
  </dd>
3334
3414
  </dl>
3335
3415
  </details>