agentmail 0.5.22 → 0.5.24

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 (81) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/api/resources/inboxes/client/Client.d.ts +20 -0
  3. package/dist/cjs/api/resources/inboxes/client/Client.js +77 -0
  4. package/dist/cjs/api/resources/inboxes/client/requests/SearchInboxesRequest.d.ts +13 -0
  5. package/dist/cjs/api/resources/inboxes/client/requests/SearchInboxesRequest.js +3 -0
  6. package/dist/cjs/api/resources/inboxes/client/requests/index.d.ts +1 -0
  7. package/dist/cjs/api/resources/inboxes/resources/threads/client/Client.d.ts +2 -1
  8. package/dist/cjs/api/resources/inboxes/resources/threads/client/Client.js +11 -5
  9. package/dist/cjs/api/resources/inboxes/resources/threads/client/requests/GetInboxThreadRequest.d.ts +11 -0
  10. package/dist/cjs/api/resources/inboxes/resources/threads/client/requests/GetInboxThreadRequest.js +3 -0
  11. package/dist/cjs/api/resources/inboxes/resources/threads/client/requests/index.d.ts +1 -0
  12. package/dist/cjs/api/resources/inboxes/types/SearchInboxesResponse.d.ts +8 -0
  13. package/dist/cjs/api/resources/inboxes/types/SearchInboxesResponse.js +3 -0
  14. package/dist/cjs/api/resources/inboxes/types/index.d.ts +1 -0
  15. package/dist/cjs/api/resources/inboxes/types/index.js +1 -0
  16. package/dist/cjs/api/resources/pods/resources/inboxes/client/Client.d.ts +22 -0
  17. package/dist/cjs/api/resources/pods/resources/inboxes/client/Client.js +87 -0
  18. package/dist/cjs/api/resources/pods/resources/inboxes/client/requests/SearchInboxesRequest.d.ts +13 -0
  19. package/dist/cjs/api/resources/pods/resources/inboxes/client/requests/SearchInboxesRequest.js +3 -0
  20. package/dist/cjs/api/resources/pods/resources/inboxes/client/requests/index.d.ts +1 -0
  21. package/dist/cjs/api/resources/pods/resources/threads/client/Client.d.ts +2 -1
  22. package/dist/cjs/api/resources/pods/resources/threads/client/Client.js +11 -5
  23. package/dist/cjs/api/resources/pods/resources/threads/client/requests/GetPodThreadRequest.d.ts +11 -0
  24. package/dist/cjs/api/resources/pods/resources/threads/client/requests/GetPodThreadRequest.js +3 -0
  25. package/dist/cjs/api/resources/pods/resources/threads/client/requests/index.d.ts +1 -0
  26. package/dist/cjs/api/resources/threads/client/Client.d.ts +2 -1
  27. package/dist/cjs/api/resources/threads/client/Client.js +11 -5
  28. package/dist/cjs/api/resources/threads/client/requests/GetThreadRequest.d.ts +11 -0
  29. package/dist/cjs/api/resources/threads/client/requests/GetThreadRequest.js +3 -0
  30. package/dist/cjs/api/resources/threads/client/requests/index.d.ts +1 -0
  31. package/dist/cjs/api/resources/threads/types/Thread.d.ts +7 -1
  32. package/dist/cjs/serialization/resources/inboxes/types/SearchInboxesResponse.d.ts +16 -0
  33. package/dist/cjs/serialization/resources/inboxes/types/SearchInboxesResponse.js +48 -0
  34. package/dist/cjs/serialization/resources/inboxes/types/index.d.ts +1 -0
  35. package/dist/cjs/serialization/resources/inboxes/types/index.js +1 -0
  36. package/dist/cjs/serialization/resources/threads/types/Thread.d.ts +6 -0
  37. package/dist/cjs/serialization/resources/threads/types/Thread.js +6 -0
  38. package/dist/cjs/version.d.ts +1 -1
  39. package/dist/cjs/version.js +1 -1
  40. package/dist/esm/BaseClient.mjs +2 -2
  41. package/dist/esm/api/resources/inboxes/client/Client.d.mts +20 -0
  42. package/dist/esm/api/resources/inboxes/client/Client.mjs +77 -0
  43. package/dist/esm/api/resources/inboxes/client/requests/SearchInboxesRequest.d.mts +13 -0
  44. package/dist/esm/api/resources/inboxes/client/requests/SearchInboxesRequest.mjs +2 -0
  45. package/dist/esm/api/resources/inboxes/client/requests/index.d.mts +1 -0
  46. package/dist/esm/api/resources/inboxes/resources/threads/client/Client.d.mts +2 -1
  47. package/dist/esm/api/resources/inboxes/resources/threads/client/Client.mjs +11 -5
  48. package/dist/esm/api/resources/inboxes/resources/threads/client/requests/GetInboxThreadRequest.d.mts +11 -0
  49. package/dist/esm/api/resources/inboxes/resources/threads/client/requests/GetInboxThreadRequest.mjs +2 -0
  50. package/dist/esm/api/resources/inboxes/resources/threads/client/requests/index.d.mts +1 -0
  51. package/dist/esm/api/resources/inboxes/types/SearchInboxesResponse.d.mts +8 -0
  52. package/dist/esm/api/resources/inboxes/types/SearchInboxesResponse.mjs +2 -0
  53. package/dist/esm/api/resources/inboxes/types/index.d.mts +1 -0
  54. package/dist/esm/api/resources/inboxes/types/index.mjs +1 -0
  55. package/dist/esm/api/resources/pods/resources/inboxes/client/Client.d.mts +22 -0
  56. package/dist/esm/api/resources/pods/resources/inboxes/client/Client.mjs +87 -0
  57. package/dist/esm/api/resources/pods/resources/inboxes/client/requests/SearchInboxesRequest.d.mts +13 -0
  58. package/dist/esm/api/resources/pods/resources/inboxes/client/requests/SearchInboxesRequest.mjs +2 -0
  59. package/dist/esm/api/resources/pods/resources/inboxes/client/requests/index.d.mts +1 -0
  60. package/dist/esm/api/resources/pods/resources/threads/client/Client.d.mts +2 -1
  61. package/dist/esm/api/resources/pods/resources/threads/client/Client.mjs +11 -5
  62. package/dist/esm/api/resources/pods/resources/threads/client/requests/GetPodThreadRequest.d.mts +11 -0
  63. package/dist/esm/api/resources/pods/resources/threads/client/requests/GetPodThreadRequest.mjs +2 -0
  64. package/dist/esm/api/resources/pods/resources/threads/client/requests/index.d.mts +1 -0
  65. package/dist/esm/api/resources/threads/client/Client.d.mts +2 -1
  66. package/dist/esm/api/resources/threads/client/Client.mjs +11 -5
  67. package/dist/esm/api/resources/threads/client/requests/GetThreadRequest.d.mts +11 -0
  68. package/dist/esm/api/resources/threads/client/requests/GetThreadRequest.mjs +2 -0
  69. package/dist/esm/api/resources/threads/client/requests/index.d.mts +1 -0
  70. package/dist/esm/api/resources/threads/types/Thread.d.mts +7 -1
  71. package/dist/esm/serialization/resources/inboxes/types/SearchInboxesResponse.d.mts +16 -0
  72. package/dist/esm/serialization/resources/inboxes/types/SearchInboxesResponse.mjs +12 -0
  73. package/dist/esm/serialization/resources/inboxes/types/index.d.mts +1 -0
  74. package/dist/esm/serialization/resources/inboxes/types/index.mjs +1 -0
  75. package/dist/esm/serialization/resources/threads/types/Thread.d.mts +6 -0
  76. package/dist/esm/serialization/resources/threads/types/Thread.mjs +6 -0
  77. package/dist/esm/version.d.mts +1 -1
  78. package/dist/esm/version.mjs +1 -1
  79. package/dist/llms.txt +10 -0
  80. package/package.json +1 -1
  81. package/reference.md +175 -3
@@ -0,0 +1,48 @@
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.SearchInboxesResponse = 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 PageToken_js_1 = require("../../../types/PageToken.js");
42
+ const Inbox_js_1 = require("./Inbox.js");
43
+ exports.SearchInboxesResponse = core.serialization.object({
44
+ count: Count_js_1.Count,
45
+ limit: Limit_js_1.Limit.optional(),
46
+ nextPageToken: core.serialization.property("next_page_token", PageToken_js_1.PageToken.optional()),
47
+ inboxes: core.serialization.list(Inbox_js_1.Inbox),
48
+ });
@@ -7,5 +7,6 @@ export * from "./InboxId.js";
7
7
  export * from "./ListInboxesResponse.js";
8
8
  export * from "./Metadata.js";
9
9
  export * from "./MetadataValue.js";
10
+ export * from "./SearchInboxesResponse.js";
10
11
  export * from "./UpdateInboxRequest.js";
11
12
  export * from "./UpdateMetadata.js";
@@ -23,5 +23,6 @@ __exportStar(require("./InboxId.js"), exports);
23
23
  __exportStar(require("./ListInboxesResponse.js"), exports);
24
24
  __exportStar(require("./Metadata.js"), exports);
25
25
  __exportStar(require("./MetadataValue.js"), exports);
26
+ __exportStar(require("./SearchInboxesResponse.js"), exports);
26
27
  __exportStar(require("./UpdateInboxRequest.js"), exports);
27
28
  __exportStar(require("./UpdateMetadata.js"), exports);
@@ -1,6 +1,9 @@
1
1
  import type * as AgentMail from "../../../../api/index.js";
2
2
  import * as core from "../../../../core/index.js";
3
3
  import type * as serializers from "../../../index.js";
4
+ import { Count } from "../../../types/Count.js";
5
+ import { Limit } from "../../../types/Limit.js";
6
+ import { PageToken } from "../../../types/PageToken.js";
4
7
  import { InboxId } from "../../inboxes/types/InboxId.js";
5
8
  import { Message } from "../../messages/types/Message.js";
6
9
  import { ThreadAttachments } from "./ThreadAttachments.js";
@@ -37,6 +40,9 @@ export declare namespace Thread {
37
40
  size: ThreadSize.Raw;
38
41
  updated_at: ThreadUpdatedAt.Raw;
39
42
  created_at: ThreadCreatedAt.Raw;
43
+ count: Count.Raw;
44
+ limit?: Limit.Raw | null;
45
+ next_page_token?: PageToken.Raw | null;
40
46
  messages: Message.Raw[];
41
47
  }
42
48
  }
@@ -36,6 +36,9 @@ var __importStar = (this && this.__importStar) || (function () {
36
36
  Object.defineProperty(exports, "__esModule", { value: true });
37
37
  exports.Thread = void 0;
38
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 PageToken_js_1 = require("../../../types/PageToken.js");
39
42
  const InboxId_js_1 = require("../../inboxes/types/InboxId.js");
40
43
  const Message_js_1 = require("../../messages/types/Message.js");
41
44
  const ThreadAttachments_js_1 = require("./ThreadAttachments.js");
@@ -70,5 +73,8 @@ exports.Thread = core.serialization.object({
70
73
  size: ThreadSize_js_1.ThreadSize,
71
74
  updatedAt: core.serialization.property("updated_at", ThreadUpdatedAt_js_1.ThreadUpdatedAt),
72
75
  createdAt: core.serialization.property("created_at", ThreadCreatedAt_js_1.ThreadCreatedAt),
76
+ count: Count_js_1.Count,
77
+ limit: Limit_js_1.Limit.optional(),
78
+ nextPageToken: core.serialization.property("next_page_token", PageToken_js_1.PageToken.optional()),
73
79
  messages: core.serialization.list(Message_js_1.Message),
74
80
  });
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.5.22";
1
+ export declare const SDK_VERSION = "0.5.24";
@@ -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.22";
4
+ exports.SDK_VERSION = "0.5.24";
@@ -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.22",
10
- "User-Agent": "agentmail/0.5.22",
9
+ "X-Fern-SDK-Version": "0.5.24",
10
+ "User-Agent": "agentmail/0.5.24",
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);
@@ -51,6 +51,26 @@ export declare class InboxesClient {
51
51
  */
52
52
  list(request?: AgentMail.inboxes.ListInboxesRequest, requestOptions?: InboxesClient.RequestOptions): core.HttpResponsePromise<AgentMail.inboxes.ListInboxesResponse>;
53
53
  private __list;
54
+ /**
55
+ * Searches inboxes in the organization by address or display name, ranked
56
+ * by relevance. Each word in the query matches the start of a word in the
57
+ * address or display name, so `sup` matches `support@example.com` but
58
+ * `port` does not. An exact address match always ranks first. `limit`
59
+ * cannot exceed 100. A page can be empty and still carry a
60
+ * `next_page_token`; keep paging until the token is absent.
61
+ *
62
+ * @param {AgentMail.inboxes.SearchInboxesRequest} request
63
+ * @param {InboxesClient.RequestOptions} requestOptions - Request-specific configuration.
64
+ *
65
+ * @throws {@link AgentMail.ValidationError}
66
+ *
67
+ * @example
68
+ * await client.inboxes.search({
69
+ * q: "q"
70
+ * })
71
+ */
72
+ search(request: AgentMail.inboxes.SearchInboxesRequest, requestOptions?: InboxesClient.RequestOptions): core.HttpResponsePromise<AgentMail.inboxes.SearchInboxesResponse>;
73
+ private __search;
54
74
  /**
55
75
  * **CLI:**
56
76
  * ```bash
@@ -125,6 +125,83 @@ export class InboxesClient {
125
125
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v0/inboxes");
126
126
  });
127
127
  }
128
+ /**
129
+ * Searches inboxes in the organization by address or display name, ranked
130
+ * by relevance. Each word in the query matches the start of a word in the
131
+ * address or display name, so `sup` matches `support@example.com` but
132
+ * `port` does not. An exact address match always ranks first. `limit`
133
+ * cannot exceed 100. A page can be empty and still carry a
134
+ * `next_page_token`; keep paging until the token is absent.
135
+ *
136
+ * @param {AgentMail.inboxes.SearchInboxesRequest} request
137
+ * @param {InboxesClient.RequestOptions} requestOptions - Request-specific configuration.
138
+ *
139
+ * @throws {@link AgentMail.ValidationError}
140
+ *
141
+ * @example
142
+ * await client.inboxes.search({
143
+ * q: "q"
144
+ * })
145
+ */
146
+ search(request, requestOptions) {
147
+ return core.HttpResponsePromise.fromPromise(this.__search(request, requestOptions));
148
+ }
149
+ __search(request, requestOptions) {
150
+ return __awaiter(this, void 0, void 0, function* () {
151
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
152
+ const { q, limit, pageToken } = request;
153
+ const _queryParams = {
154
+ q,
155
+ limit,
156
+ page_token: pageToken,
157
+ };
158
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
159
+ 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);
160
+ const _response = yield core.fetcher({
161
+ 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)
162
+ .http, "/v0/inboxes/search"),
163
+ method: "GET",
164
+ headers: _headers,
165
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
166
+ 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,
167
+ 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,
168
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
169
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
170
+ logging: this._options.logging,
171
+ });
172
+ if (_response.ok) {
173
+ return {
174
+ data: serializers.inboxes.SearchInboxesResponse.parseOrThrow(_response.body, {
175
+ unrecognizedObjectKeys: "passthrough",
176
+ allowUnrecognizedUnionMembers: true,
177
+ allowUnrecognizedEnumValues: true,
178
+ skipValidation: true,
179
+ breadcrumbsPrefix: ["response"],
180
+ }),
181
+ rawResponse: _response.rawResponse,
182
+ };
183
+ }
184
+ if (_response.error.reason === "status-code") {
185
+ switch (_response.error.statusCode) {
186
+ case 400:
187
+ throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
188
+ unrecognizedObjectKeys: "passthrough",
189
+ allowUnrecognizedUnionMembers: true,
190
+ allowUnrecognizedEnumValues: true,
191
+ skipValidation: true,
192
+ breadcrumbsPrefix: ["response"],
193
+ }), _response.rawResponse);
194
+ default:
195
+ throw new errors.AgentMailError({
196
+ statusCode: _response.error.statusCode,
197
+ body: _response.error.body,
198
+ rawResponse: _response.rawResponse,
199
+ });
200
+ }
201
+ }
202
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v0/inboxes/search");
203
+ });
204
+ }
128
205
  /**
129
206
  * **CLI:**
130
207
  * ```bash
@@ -0,0 +1,13 @@
1
+ import type * as AgentMail from "../../../../index.mjs";
2
+ /**
3
+ * @example
4
+ * {
5
+ * q: "q"
6
+ * }
7
+ */
8
+ export interface SearchInboxesRequest {
9
+ /** Address or display name to search for. Matches word prefixes. Must be 2 to 256 characters. */
10
+ q: string;
11
+ limit?: AgentMail.Limit;
12
+ pageToken?: AgentMail.PageToken;
13
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -1 +1,2 @@
1
1
  export type { ListInboxesRequest } from "./ListInboxesRequest.mjs";
2
+ export type { SearchInboxesRequest } from "./SearchInboxesRequest.mjs";
@@ -60,6 +60,7 @@ export declare class ThreadsClient {
60
60
  *
61
61
  * @param {AgentMail.inboxes.InboxId} inbox_id
62
62
  * @param {AgentMail.ThreadId} thread_id
63
+ * @param {AgentMail.inboxes.GetInboxThreadRequest} request
63
64
  * @param {ThreadsClient.RequestOptions} requestOptions - Request-specific configuration.
64
65
  *
65
66
  * @throws {@link AgentMail.NotFoundError}
@@ -67,7 +68,7 @@ export declare class ThreadsClient {
67
68
  * @example
68
69
  * await client.inboxes.threads.get("inbox_id", "thread_id")
69
70
  */
70
- get(inbox_id: AgentMail.inboxes.InboxId, thread_id: AgentMail.ThreadId, requestOptions?: ThreadsClient.RequestOptions): core.HttpResponsePromise<AgentMail.Thread>;
71
+ get(inbox_id: AgentMail.inboxes.InboxId, thread_id: AgentMail.ThreadId, request?: AgentMail.inboxes.GetInboxThreadRequest, requestOptions?: ThreadsClient.RequestOptions): core.HttpResponsePromise<AgentMail.Thread>;
71
72
  private __get;
72
73
  /**
73
74
  * **CLI:**
@@ -218,6 +218,7 @@ export class ThreadsClient {
218
218
  *
219
219
  * @param {AgentMail.inboxes.InboxId} inbox_id
220
220
  * @param {AgentMail.ThreadId} thread_id
221
+ * @param {AgentMail.inboxes.GetInboxThreadRequest} request
221
222
  * @param {ThreadsClient.RequestOptions} requestOptions - Request-specific configuration.
222
223
  *
223
224
  * @throws {@link AgentMail.NotFoundError}
@@ -225,12 +226,17 @@ export class ThreadsClient {
225
226
  * @example
226
227
  * await client.inboxes.threads.get("inbox_id", "thread_id")
227
228
  */
228
- get(inbox_id, thread_id, requestOptions) {
229
- return core.HttpResponsePromise.fromPromise(this.__get(inbox_id, thread_id, requestOptions));
229
+ get(inbox_id, thread_id, request = {}, requestOptions) {
230
+ return core.HttpResponsePromise.fromPromise(this.__get(inbox_id, thread_id, request, requestOptions));
230
231
  }
231
- __get(inbox_id, thread_id, requestOptions) {
232
- return __awaiter(this, void 0, void 0, function* () {
232
+ __get(inbox_id_1, thread_id_1) {
233
+ return __awaiter(this, arguments, void 0, function* (inbox_id, thread_id, request = {}, requestOptions) {
233
234
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
235
+ const { limit, pageToken } = request;
236
+ const _queryParams = {
237
+ limit,
238
+ page_token: pageToken,
239
+ };
234
240
  const _authRequest = yield this._options.authProvider.getAuthRequest();
235
241
  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);
236
242
  const _response = yield core.fetcher({
@@ -238,7 +244,7 @@ export class ThreadsClient {
238
244
  .http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/threads/${core.url.encodePathParam(serializers.ThreadId.jsonOrThrow(thread_id, { omitUndefined: true }))}`),
239
245
  method: "GET",
240
246
  headers: _headers,
241
- queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
247
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
242
248
  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,
243
249
  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,
244
250
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -0,0 +1,11 @@
1
+ import type * as AgentMail from "../../../../../../index.mjs";
2
+ /**
3
+ * @example
4
+ * {}
5
+ */
6
+ export interface GetInboxThreadRequest {
7
+ /** Maximum number of messages to return. Cannot exceed 100. */
8
+ limit?: AgentMail.Limit;
9
+ /** Token returned by the previous response for retrieving the next, older page. */
10
+ pageToken?: AgentMail.PageToken;
11
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -1,2 +1,3 @@
1
+ export type { GetInboxThreadRequest } from "./GetInboxThreadRequest.mjs";
1
2
  export type { ListThreadsRequest } from "./ListThreadsRequest.mjs";
2
3
  export type { SearchThreadsRequest } from "./SearchThreadsRequest.mjs";
@@ -0,0 +1,8 @@
1
+ import type * as AgentMail from "../../../index.mjs";
2
+ export interface SearchInboxesResponse {
3
+ count: AgentMail.Count;
4
+ limit?: AgentMail.Limit;
5
+ nextPageToken?: AgentMail.PageToken;
6
+ /** Ordered by relevance, best match first. */
7
+ inboxes: AgentMail.inboxes.Inbox[];
8
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -7,5 +7,6 @@ export * from "./InboxId.mjs";
7
7
  export * from "./ListInboxesResponse.mjs";
8
8
  export * from "./Metadata.mjs";
9
9
  export * from "./MetadataValue.mjs";
10
+ export * from "./SearchInboxesResponse.mjs";
10
11
  export * from "./UpdateInboxRequest.mjs";
11
12
  export * from "./UpdateMetadata.mjs";
@@ -7,5 +7,6 @@ export * from "./InboxId.mjs";
7
7
  export * from "./ListInboxesResponse.mjs";
8
8
  export * from "./Metadata.mjs";
9
9
  export * from "./MetadataValue.mjs";
10
+ export * from "./SearchInboxesResponse.mjs";
10
11
  export * from "./UpdateInboxRequest.mjs";
11
12
  export * from "./UpdateMetadata.mjs";
@@ -27,6 +27,28 @@ export declare class InboxesClient {
27
27
  */
28
28
  list(pod_id: AgentMail.pods.PodId, request?: AgentMail.pods.ListInboxesRequest, requestOptions?: InboxesClient.RequestOptions): core.HttpResponsePromise<AgentMail.inboxes.ListInboxesResponse>;
29
29
  private __list;
30
+ /**
31
+ * Searches inboxes in the pod by address or display name, ranked by
32
+ * relevance. Each word in the query matches the start of a word in the
33
+ * address or display name, so `sup` matches `support@example.com` but
34
+ * `port` does not. An exact address match always ranks first. `limit`
35
+ * cannot exceed 100. A page can be empty and still carry a
36
+ * `next_page_token`; keep paging until the token is absent.
37
+ *
38
+ * @param {AgentMail.pods.PodId} pod_id
39
+ * @param {AgentMail.pods.SearchInboxesRequest} request
40
+ * @param {InboxesClient.RequestOptions} requestOptions - Request-specific configuration.
41
+ *
42
+ * @throws {@link AgentMail.ValidationError}
43
+ * @throws {@link AgentMail.NotFoundError}
44
+ *
45
+ * @example
46
+ * await client.pods.inboxes.search("pod_id", {
47
+ * q: "q"
48
+ * })
49
+ */
50
+ search(pod_id: AgentMail.pods.PodId, request: AgentMail.pods.SearchInboxesRequest, requestOptions?: InboxesClient.RequestOptions): core.HttpResponsePromise<AgentMail.inboxes.SearchInboxesResponse>;
51
+ private __search;
30
52
  /**
31
53
  * **CLI:**
32
54
  * ```bash
@@ -94,6 +94,93 @@ export class InboxesClient {
94
94
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v0/pods/{pod_id}/inboxes");
95
95
  });
96
96
  }
97
+ /**
98
+ * Searches inboxes in the pod by address or display name, ranked by
99
+ * relevance. Each word in the query matches the start of a word in the
100
+ * address or display name, so `sup` matches `support@example.com` but
101
+ * `port` does not. An exact address match always ranks first. `limit`
102
+ * cannot exceed 100. A page can be empty and still carry a
103
+ * `next_page_token`; keep paging until the token is absent.
104
+ *
105
+ * @param {AgentMail.pods.PodId} pod_id
106
+ * @param {AgentMail.pods.SearchInboxesRequest} request
107
+ * @param {InboxesClient.RequestOptions} requestOptions - Request-specific configuration.
108
+ *
109
+ * @throws {@link AgentMail.ValidationError}
110
+ * @throws {@link AgentMail.NotFoundError}
111
+ *
112
+ * @example
113
+ * await client.pods.inboxes.search("pod_id", {
114
+ * q: "q"
115
+ * })
116
+ */
117
+ search(pod_id, request, requestOptions) {
118
+ return core.HttpResponsePromise.fromPromise(this.__search(pod_id, request, requestOptions));
119
+ }
120
+ __search(pod_id, request, requestOptions) {
121
+ return __awaiter(this, void 0, void 0, function* () {
122
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
123
+ const { q, limit, pageToken } = request;
124
+ const _queryParams = {
125
+ q,
126
+ limit,
127
+ page_token: pageToken,
128
+ };
129
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
130
+ 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);
131
+ const _response = yield core.fetcher({
132
+ 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)
133
+ .http, `/v0/pods/${core.url.encodePathParam(serializers.pods.PodId.jsonOrThrow(pod_id, { omitUndefined: true }))}/inboxes/search`),
134
+ method: "GET",
135
+ headers: _headers,
136
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
137
+ 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,
138
+ 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,
139
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
140
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
141
+ logging: this._options.logging,
142
+ });
143
+ if (_response.ok) {
144
+ return {
145
+ data: serializers.inboxes.SearchInboxesResponse.parseOrThrow(_response.body, {
146
+ unrecognizedObjectKeys: "passthrough",
147
+ allowUnrecognizedUnionMembers: true,
148
+ allowUnrecognizedEnumValues: true,
149
+ skipValidation: true,
150
+ breadcrumbsPrefix: ["response"],
151
+ }),
152
+ rawResponse: _response.rawResponse,
153
+ };
154
+ }
155
+ if (_response.error.reason === "status-code") {
156
+ switch (_response.error.statusCode) {
157
+ case 400:
158
+ throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
159
+ unrecognizedObjectKeys: "passthrough",
160
+ allowUnrecognizedUnionMembers: true,
161
+ allowUnrecognizedEnumValues: true,
162
+ skipValidation: true,
163
+ breadcrumbsPrefix: ["response"],
164
+ }), _response.rawResponse);
165
+ case 404:
166
+ throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
167
+ unrecognizedObjectKeys: "passthrough",
168
+ allowUnrecognizedUnionMembers: true,
169
+ allowUnrecognizedEnumValues: true,
170
+ skipValidation: true,
171
+ breadcrumbsPrefix: ["response"],
172
+ }), _response.rawResponse);
173
+ default:
174
+ throw new errors.AgentMailError({
175
+ statusCode: _response.error.statusCode,
176
+ body: _response.error.body,
177
+ rawResponse: _response.rawResponse,
178
+ });
179
+ }
180
+ }
181
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v0/pods/{pod_id}/inboxes/search");
182
+ });
183
+ }
97
184
  /**
98
185
  * **CLI:**
99
186
  * ```bash
@@ -0,0 +1,13 @@
1
+ import type * as AgentMail from "../../../../../../index.mjs";
2
+ /**
3
+ * @example
4
+ * {
5
+ * q: "q"
6
+ * }
7
+ */
8
+ export interface SearchInboxesRequest {
9
+ /** Address or display name to search for. Matches word prefixes. Must be 2 to 256 characters. */
10
+ q: string;
11
+ limit?: AgentMail.Limit;
12
+ pageToken?: AgentMail.PageToken;
13
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -1 +1,2 @@
1
1
  export type { ListInboxesRequest } from "./ListInboxesRequest.mjs";
2
+ export type { SearchInboxesRequest } from "./SearchInboxesRequest.mjs";
@@ -60,6 +60,7 @@ export declare class ThreadsClient {
60
60
  *
61
61
  * @param {AgentMail.pods.PodId} pod_id
62
62
  * @param {AgentMail.ThreadId} thread_id
63
+ * @param {AgentMail.pods.GetPodThreadRequest} request
63
64
  * @param {ThreadsClient.RequestOptions} requestOptions - Request-specific configuration.
64
65
  *
65
66
  * @throws {@link AgentMail.NotFoundError}
@@ -67,7 +68,7 @@ export declare class ThreadsClient {
67
68
  * @example
68
69
  * await client.pods.threads.get("pod_id", "thread_id")
69
70
  */
70
- get(pod_id: AgentMail.pods.PodId, thread_id: AgentMail.ThreadId, requestOptions?: ThreadsClient.RequestOptions): core.HttpResponsePromise<AgentMail.Thread>;
71
+ get(pod_id: AgentMail.pods.PodId, thread_id: AgentMail.ThreadId, request?: AgentMail.pods.GetPodThreadRequest, requestOptions?: ThreadsClient.RequestOptions): core.HttpResponsePromise<AgentMail.Thread>;
71
72
  private __get;
72
73
  /**
73
74
  * **CLI:**
@@ -218,6 +218,7 @@ export class ThreadsClient {
218
218
  *
219
219
  * @param {AgentMail.pods.PodId} pod_id
220
220
  * @param {AgentMail.ThreadId} thread_id
221
+ * @param {AgentMail.pods.GetPodThreadRequest} request
221
222
  * @param {ThreadsClient.RequestOptions} requestOptions - Request-specific configuration.
222
223
  *
223
224
  * @throws {@link AgentMail.NotFoundError}
@@ -225,12 +226,17 @@ export class ThreadsClient {
225
226
  * @example
226
227
  * await client.pods.threads.get("pod_id", "thread_id")
227
228
  */
228
- get(pod_id, thread_id, requestOptions) {
229
- return core.HttpResponsePromise.fromPromise(this.__get(pod_id, thread_id, requestOptions));
229
+ get(pod_id, thread_id, request = {}, requestOptions) {
230
+ return core.HttpResponsePromise.fromPromise(this.__get(pod_id, thread_id, request, requestOptions));
230
231
  }
231
- __get(pod_id, thread_id, requestOptions) {
232
- return __awaiter(this, void 0, void 0, function* () {
232
+ __get(pod_id_1, thread_id_1) {
233
+ return __awaiter(this, arguments, void 0, function* (pod_id, thread_id, request = {}, requestOptions) {
233
234
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
235
+ const { limit, pageToken } = request;
236
+ const _queryParams = {
237
+ limit,
238
+ page_token: pageToken,
239
+ };
234
240
  const _authRequest = yield this._options.authProvider.getAuthRequest();
235
241
  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);
236
242
  const _response = yield core.fetcher({
@@ -238,7 +244,7 @@ export class ThreadsClient {
238
244
  .http, `/v0/pods/${core.url.encodePathParam(serializers.pods.PodId.jsonOrThrow(pod_id, { omitUndefined: true }))}/threads/${core.url.encodePathParam(serializers.ThreadId.jsonOrThrow(thread_id, { omitUndefined: true }))}`),
239
245
  method: "GET",
240
246
  headers: _headers,
241
- queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
247
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
242
248
  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,
243
249
  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,
244
250
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -0,0 +1,11 @@
1
+ import type * as AgentMail from "../../../../../../index.mjs";
2
+ /**
3
+ * @example
4
+ * {}
5
+ */
6
+ export interface GetPodThreadRequest {
7
+ /** Maximum number of messages to return. Cannot exceed 100. */
8
+ limit?: AgentMail.Limit;
9
+ /** Token returned by the previous response for retrieving the next, older page. */
10
+ pageToken?: AgentMail.PageToken;
11
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -1,2 +1,3 @@
1
+ export type { GetPodThreadRequest } from "./GetPodThreadRequest.mjs";
1
2
  export type { ListThreadsRequest } from "./ListThreadsRequest.mjs";
2
3
  export type { SearchThreadsRequest } from "./SearchThreadsRequest.mjs";
@@ -59,6 +59,7 @@ export declare class ThreadsClient {
59
59
  * ```
60
60
  *
61
61
  * @param {AgentMail.ThreadId} thread_id
62
+ * @param {AgentMail.GetThreadRequest} request
62
63
  * @param {ThreadsClient.RequestOptions} requestOptions - Request-specific configuration.
63
64
  *
64
65
  * @throws {@link AgentMail.NotFoundError}
@@ -66,7 +67,7 @@ export declare class ThreadsClient {
66
67
  * @example
67
68
  * await client.threads.get("thread_id")
68
69
  */
69
- get(thread_id: AgentMail.ThreadId, requestOptions?: ThreadsClient.RequestOptions): core.HttpResponsePromise<AgentMail.Thread>;
70
+ get(thread_id: AgentMail.ThreadId, request?: AgentMail.GetThreadRequest, requestOptions?: ThreadsClient.RequestOptions): core.HttpResponsePromise<AgentMail.Thread>;
70
71
  private __get;
71
72
  /**
72
73
  * **CLI:**