agentmail 0.4.7 → 0.4.9

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 (78) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/api/resources/apiKeys/types/ApiKey.d.ts +2 -0
  3. package/dist/cjs/api/resources/apiKeys/types/CreateApiKeyResponse.d.ts +2 -0
  4. package/dist/cjs/api/resources/inboxes/client/Client.d.ts +6 -0
  5. package/dist/cjs/api/resources/inboxes/client/Client.js +18 -8
  6. package/dist/cjs/api/resources/inboxes/resources/apiKeys/client/Client.d.ts +52 -0
  7. package/dist/cjs/api/resources/inboxes/resources/apiKeys/client/Client.js +262 -0
  8. package/dist/cjs/api/resources/inboxes/resources/apiKeys/client/index.d.ts +1 -0
  9. package/dist/cjs/api/resources/inboxes/resources/apiKeys/client/index.js +17 -0
  10. package/dist/cjs/api/resources/inboxes/resources/apiKeys/client/requests/ListApiKeysRequest.d.ts +9 -0
  11. package/dist/cjs/api/resources/inboxes/resources/apiKeys/client/requests/ListApiKeysRequest.js +3 -0
  12. package/dist/cjs/api/resources/inboxes/resources/apiKeys/client/requests/index.d.ts +1 -0
  13. package/dist/cjs/api/resources/inboxes/resources/apiKeys/client/requests/index.js +2 -0
  14. package/dist/cjs/api/resources/inboxes/resources/apiKeys/index.d.ts +1 -0
  15. package/dist/cjs/api/resources/inboxes/resources/apiKeys/index.js +17 -0
  16. package/dist/cjs/api/resources/inboxes/resources/index.d.ts +4 -0
  17. package/dist/cjs/api/resources/inboxes/resources/index.js +5 -1
  18. package/dist/cjs/api/resources/inboxes/resources/lists/client/Client.d.ts +69 -0
  19. package/dist/cjs/api/resources/inboxes/resources/lists/client/Client.js +311 -0
  20. package/dist/cjs/api/resources/inboxes/resources/lists/client/index.d.ts +1 -0
  21. package/dist/cjs/api/resources/inboxes/resources/lists/client/index.js +17 -0
  22. package/dist/cjs/api/resources/inboxes/resources/lists/client/requests/InboxListListEntriesRequest.d.ts +9 -0
  23. package/dist/cjs/api/resources/inboxes/resources/lists/client/requests/InboxListListEntriesRequest.js +3 -0
  24. package/dist/cjs/api/resources/inboxes/resources/lists/client/requests/index.d.ts +1 -0
  25. package/dist/cjs/api/resources/inboxes/resources/lists/client/requests/index.js +2 -0
  26. package/dist/cjs/api/resources/inboxes/resources/lists/index.d.ts +1 -0
  27. package/dist/cjs/api/resources/inboxes/resources/lists/index.js +17 -0
  28. package/dist/cjs/api/resources/lists/types/Direction.d.ts +1 -0
  29. package/dist/cjs/api/resources/lists/types/Direction.js +1 -0
  30. package/dist/cjs/serialization/resources/apiKeys/types/ApiKey.d.ts +1 -0
  31. package/dist/cjs/serialization/resources/apiKeys/types/ApiKey.js +1 -0
  32. package/dist/cjs/serialization/resources/apiKeys/types/CreateApiKeyResponse.d.ts +1 -0
  33. package/dist/cjs/serialization/resources/apiKeys/types/CreateApiKeyResponse.js +1 -0
  34. package/dist/cjs/serialization/resources/lists/types/Direction.d.ts +1 -1
  35. package/dist/cjs/serialization/resources/lists/types/Direction.js +1 -1
  36. package/dist/cjs/version.d.ts +1 -1
  37. package/dist/cjs/version.js +1 -1
  38. package/dist/esm/BaseClient.mjs +2 -2
  39. package/dist/esm/api/resources/apiKeys/types/ApiKey.d.mts +2 -0
  40. package/dist/esm/api/resources/apiKeys/types/CreateApiKeyResponse.d.mts +2 -0
  41. package/dist/esm/api/resources/inboxes/client/Client.d.mts +6 -0
  42. package/dist/esm/api/resources/inboxes/client/Client.mjs +10 -0
  43. package/dist/esm/api/resources/inboxes/resources/apiKeys/client/Client.d.mts +52 -0
  44. package/dist/esm/api/resources/inboxes/resources/apiKeys/client/Client.mjs +225 -0
  45. package/dist/esm/api/resources/inboxes/resources/apiKeys/client/index.d.mts +1 -0
  46. package/dist/esm/api/resources/inboxes/resources/apiKeys/client/index.mjs +1 -0
  47. package/dist/esm/api/resources/inboxes/resources/apiKeys/client/requests/ListApiKeysRequest.d.mts +9 -0
  48. package/dist/esm/api/resources/inboxes/resources/apiKeys/client/requests/ListApiKeysRequest.mjs +2 -0
  49. package/dist/esm/api/resources/inboxes/resources/apiKeys/client/requests/index.d.mts +1 -0
  50. package/dist/esm/api/resources/inboxes/resources/apiKeys/client/requests/index.mjs +1 -0
  51. package/dist/esm/api/resources/inboxes/resources/apiKeys/index.d.mts +1 -0
  52. package/dist/esm/api/resources/inboxes/resources/apiKeys/index.mjs +1 -0
  53. package/dist/esm/api/resources/inboxes/resources/index.d.mts +4 -0
  54. package/dist/esm/api/resources/inboxes/resources/index.mjs +4 -0
  55. package/dist/esm/api/resources/inboxes/resources/lists/client/Client.d.mts +69 -0
  56. package/dist/esm/api/resources/inboxes/resources/lists/client/Client.mjs +274 -0
  57. package/dist/esm/api/resources/inboxes/resources/lists/client/index.d.mts +1 -0
  58. package/dist/esm/api/resources/inboxes/resources/lists/client/index.mjs +1 -0
  59. package/dist/esm/api/resources/inboxes/resources/lists/client/requests/InboxListListEntriesRequest.d.mts +9 -0
  60. package/dist/esm/api/resources/inboxes/resources/lists/client/requests/InboxListListEntriesRequest.mjs +2 -0
  61. package/dist/esm/api/resources/inboxes/resources/lists/client/requests/index.d.mts +1 -0
  62. package/dist/esm/api/resources/inboxes/resources/lists/client/requests/index.mjs +1 -0
  63. package/dist/esm/api/resources/inboxes/resources/lists/index.d.mts +1 -0
  64. package/dist/esm/api/resources/inboxes/resources/lists/index.mjs +1 -0
  65. package/dist/esm/api/resources/lists/types/Direction.d.mts +1 -0
  66. package/dist/esm/api/resources/lists/types/Direction.mjs +1 -0
  67. package/dist/esm/serialization/resources/apiKeys/types/ApiKey.d.mts +1 -0
  68. package/dist/esm/serialization/resources/apiKeys/types/ApiKey.mjs +1 -0
  69. package/dist/esm/serialization/resources/apiKeys/types/CreateApiKeyResponse.d.mts +1 -0
  70. package/dist/esm/serialization/resources/apiKeys/types/CreateApiKeyResponse.mjs +1 -0
  71. package/dist/esm/serialization/resources/lists/types/Direction.d.mts +1 -1
  72. package/dist/esm/serialization/resources/lists/types/Direction.mjs +1 -1
  73. package/dist/esm/version.d.mts +1 -1
  74. package/dist/esm/version.mjs +1 -1
  75. package/dist/llms-full.txt +1365 -57
  76. package/dist/llms.txt +5 -1
  77. package/package.json +1 -1
  78. package/reference.md +469 -0
@@ -0,0 +1,225 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ import { normalizeClientOptionsWithAuth } from "../../../../../../BaseClient.mjs";
12
+ import { mergeHeaders } from "../../../../../../core/headers.mjs";
13
+ import * as core from "../../../../../../core/index.mjs";
14
+ import * as environments from "../../../../../../environments.mjs";
15
+ import { handleNonStatusCodeError } from "../../../../../../errors/handleNonStatusCodeError.mjs";
16
+ import * as errors from "../../../../../../errors/index.mjs";
17
+ import * as serializers from "../../../../../../serialization/index.mjs";
18
+ import * as AgentMail from "../../../../../index.mjs";
19
+ export class ApiKeysClient {
20
+ constructor(options = {}) {
21
+ this._options = normalizeClientOptionsWithAuth(options);
22
+ }
23
+ /**
24
+ * @param {AgentMail.inboxes.InboxId} inbox_id
25
+ * @param {AgentMail.inboxes.ListApiKeysRequest} request
26
+ * @param {ApiKeysClient.RequestOptions} requestOptions - Request-specific configuration.
27
+ *
28
+ * @throws {@link AgentMail.NotFoundError}
29
+ *
30
+ * @example
31
+ * await client.inboxes.apiKeys.list("inbox_id")
32
+ */
33
+ list(inbox_id, request = {}, requestOptions) {
34
+ return core.HttpResponsePromise.fromPromise(this.__list(inbox_id, request, requestOptions));
35
+ }
36
+ __list(inbox_id_1) {
37
+ return __awaiter(this, arguments, void 0, function* (inbox_id, request = {}, requestOptions) {
38
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
39
+ const { limit, pageToken } = request;
40
+ const _queryParams = {
41
+ limit,
42
+ page_token: pageToken,
43
+ };
44
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
45
+ 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);
46
+ const _response = yield core.fetcher({
47
+ 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)
48
+ .http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/api-keys`),
49
+ method: "GET",
50
+ headers: _headers,
51
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
52
+ 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,
53
+ 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,
54
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
55
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
56
+ logging: this._options.logging,
57
+ });
58
+ if (_response.ok) {
59
+ return {
60
+ data: serializers.ListApiKeysResponse.parseOrThrow(_response.body, {
61
+ unrecognizedObjectKeys: "passthrough",
62
+ allowUnrecognizedUnionMembers: true,
63
+ allowUnrecognizedEnumValues: true,
64
+ skipValidation: true,
65
+ breadcrumbsPrefix: ["response"],
66
+ }),
67
+ rawResponse: _response.rawResponse,
68
+ };
69
+ }
70
+ if (_response.error.reason === "status-code") {
71
+ switch (_response.error.statusCode) {
72
+ case 404:
73
+ throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
74
+ unrecognizedObjectKeys: "passthrough",
75
+ allowUnrecognizedUnionMembers: true,
76
+ allowUnrecognizedEnumValues: true,
77
+ skipValidation: true,
78
+ breadcrumbsPrefix: ["response"],
79
+ }), _response.rawResponse);
80
+ default:
81
+ throw new errors.AgentMailError({
82
+ statusCode: _response.error.statusCode,
83
+ body: _response.error.body,
84
+ rawResponse: _response.rawResponse,
85
+ });
86
+ }
87
+ }
88
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v0/inboxes/{inbox_id}/api-keys");
89
+ });
90
+ }
91
+ /**
92
+ * @param {AgentMail.inboxes.InboxId} inbox_id
93
+ * @param {AgentMail.CreateApiKeyRequest} request
94
+ * @param {ApiKeysClient.RequestOptions} requestOptions - Request-specific configuration.
95
+ *
96
+ * @throws {@link AgentMail.NotFoundError}
97
+ * @throws {@link AgentMail.ValidationError}
98
+ *
99
+ * @example
100
+ * await client.inboxes.apiKeys.create("inbox_id", {
101
+ * name: "name"
102
+ * })
103
+ */
104
+ create(inbox_id, request, requestOptions) {
105
+ return core.HttpResponsePromise.fromPromise(this.__create(inbox_id, request, requestOptions));
106
+ }
107
+ __create(inbox_id, request, requestOptions) {
108
+ return __awaiter(this, void 0, void 0, function* () {
109
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
110
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
111
+ 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);
112
+ const _response = yield core.fetcher({
113
+ 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)
114
+ .http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/api-keys`),
115
+ method: "POST",
116
+ headers: _headers,
117
+ contentType: "application/json",
118
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
119
+ requestType: "json",
120
+ body: serializers.CreateApiKeyRequest.jsonOrThrow(request, {
121
+ unrecognizedObjectKeys: "strip",
122
+ omitUndefined: true,
123
+ }),
124
+ 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,
125
+ 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,
126
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
127
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
128
+ logging: this._options.logging,
129
+ });
130
+ if (_response.ok) {
131
+ return {
132
+ data: serializers.CreateApiKeyResponse.parseOrThrow(_response.body, {
133
+ unrecognizedObjectKeys: "passthrough",
134
+ allowUnrecognizedUnionMembers: true,
135
+ allowUnrecognizedEnumValues: true,
136
+ skipValidation: true,
137
+ breadcrumbsPrefix: ["response"],
138
+ }),
139
+ rawResponse: _response.rawResponse,
140
+ };
141
+ }
142
+ if (_response.error.reason === "status-code") {
143
+ switch (_response.error.statusCode) {
144
+ case 404:
145
+ throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
146
+ unrecognizedObjectKeys: "passthrough",
147
+ allowUnrecognizedUnionMembers: true,
148
+ allowUnrecognizedEnumValues: true,
149
+ skipValidation: true,
150
+ breadcrumbsPrefix: ["response"],
151
+ }), _response.rawResponse);
152
+ case 400:
153
+ throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
154
+ unrecognizedObjectKeys: "passthrough",
155
+ allowUnrecognizedUnionMembers: true,
156
+ allowUnrecognizedEnumValues: true,
157
+ skipValidation: true,
158
+ breadcrumbsPrefix: ["response"],
159
+ }), _response.rawResponse);
160
+ default:
161
+ throw new errors.AgentMailError({
162
+ statusCode: _response.error.statusCode,
163
+ body: _response.error.body,
164
+ rawResponse: _response.rawResponse,
165
+ });
166
+ }
167
+ }
168
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v0/inboxes/{inbox_id}/api-keys");
169
+ });
170
+ }
171
+ /**
172
+ * @param {AgentMail.inboxes.InboxId} inbox_id
173
+ * @param {AgentMail.ApiKeyId} api_key
174
+ * @param {ApiKeysClient.RequestOptions} requestOptions - Request-specific configuration.
175
+ *
176
+ * @throws {@link AgentMail.NotFoundError}
177
+ *
178
+ * @example
179
+ * await client.inboxes.apiKeys.delete("inbox_id", "api_key")
180
+ */
181
+ delete(inbox_id, api_key, requestOptions) {
182
+ return core.HttpResponsePromise.fromPromise(this.__delete(inbox_id, api_key, requestOptions));
183
+ }
184
+ __delete(inbox_id, api_key, requestOptions) {
185
+ return __awaiter(this, void 0, void 0, function* () {
186
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
187
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
188
+ 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);
189
+ const _response = yield core.fetcher({
190
+ 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)
191
+ .http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/api-keys/${core.url.encodePathParam(serializers.ApiKeyId.jsonOrThrow(api_key, { omitUndefined: true }))}`),
192
+ method: "DELETE",
193
+ headers: _headers,
194
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
195
+ 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,
196
+ 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,
197
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
198
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
199
+ logging: this._options.logging,
200
+ });
201
+ if (_response.ok) {
202
+ return { data: undefined, rawResponse: _response.rawResponse };
203
+ }
204
+ if (_response.error.reason === "status-code") {
205
+ switch (_response.error.statusCode) {
206
+ case 404:
207
+ throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
208
+ unrecognizedObjectKeys: "passthrough",
209
+ allowUnrecognizedUnionMembers: true,
210
+ allowUnrecognizedEnumValues: true,
211
+ skipValidation: true,
212
+ breadcrumbsPrefix: ["response"],
213
+ }), _response.rawResponse);
214
+ default:
215
+ throw new errors.AgentMailError({
216
+ statusCode: _response.error.statusCode,
217
+ body: _response.error.body,
218
+ rawResponse: _response.rawResponse,
219
+ });
220
+ }
221
+ }
222
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v0/inboxes/{inbox_id}/api-keys/{api_key}");
223
+ });
224
+ }
225
+ }
@@ -0,0 +1 @@
1
+ export * from "./requests/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./requests/index.mjs";
@@ -0,0 +1,9 @@
1
+ import type * as AgentMail from "../../../../../../index.mjs";
2
+ /**
3
+ * @example
4
+ * {}
5
+ */
6
+ export interface ListApiKeysRequest {
7
+ limit?: AgentMail.Limit;
8
+ pageToken?: AgentMail.PageToken;
9
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1 @@
1
+ export type { ListApiKeysRequest } from "./ListApiKeysRequest.mjs";
@@ -0,0 +1 @@
1
+ export * from "./client/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./client/index.mjs";
@@ -1,5 +1,9 @@
1
+ export * from "./apiKeys/client/requests/index.mjs";
2
+ export * as apiKeys from "./apiKeys/index.mjs";
1
3
  export * from "./drafts/client/requests/index.mjs";
2
4
  export * as drafts from "./drafts/index.mjs";
5
+ export * from "./lists/client/requests/index.mjs";
6
+ export * as lists from "./lists/index.mjs";
3
7
  export * from "./messages/client/requests/index.mjs";
4
8
  export * as messages from "./messages/index.mjs";
5
9
  export * from "./metrics/client/requests/index.mjs";
@@ -1,5 +1,9 @@
1
+ export * from "./apiKeys/client/requests/index.mjs";
2
+ export * as apiKeys from "./apiKeys/index.mjs";
1
3
  export * from "./drafts/client/requests/index.mjs";
2
4
  export * as drafts from "./drafts/index.mjs";
5
+ export * from "./lists/client/requests/index.mjs";
6
+ export * as lists from "./lists/index.mjs";
3
7
  export * from "./messages/client/requests/index.mjs";
4
8
  export * as messages from "./messages/index.mjs";
5
9
  export * from "./metrics/client/requests/index.mjs";
@@ -0,0 +1,69 @@
1
+ import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../BaseClient.mjs";
2
+ import { type NormalizedClientOptionsWithAuth } from "../../../../../../BaseClient.mjs";
3
+ import * as core from "../../../../../../core/index.mjs";
4
+ import * as AgentMail from "../../../../../index.mjs";
5
+ export declare namespace ListsClient {
6
+ type Options = BaseClientOptions;
7
+ interface RequestOptions extends BaseRequestOptions {
8
+ }
9
+ }
10
+ export declare class ListsClient {
11
+ protected readonly _options: NormalizedClientOptionsWithAuth<ListsClient.Options>;
12
+ constructor(options?: ListsClient.Options);
13
+ /**
14
+ * @param {AgentMail.inboxes.InboxId} inbox_id
15
+ * @param {AgentMail.Direction} direction
16
+ * @param {AgentMail.ListType} type
17
+ * @param {AgentMail.inboxes.InboxListListEntriesRequest} request
18
+ * @param {ListsClient.RequestOptions} requestOptions - Request-specific configuration.
19
+ *
20
+ * @example
21
+ * await client.inboxes.lists.list("inbox_id", "send", "allow")
22
+ */
23
+ list(inbox_id: AgentMail.inboxes.InboxId, direction: AgentMail.Direction, type: AgentMail.ListType, request?: AgentMail.inboxes.InboxListListEntriesRequest, requestOptions?: ListsClient.RequestOptions): core.HttpResponsePromise<AgentMail.PodListListEntriesResponse>;
24
+ private __list;
25
+ /**
26
+ * @param {AgentMail.inboxes.InboxId} inbox_id
27
+ * @param {AgentMail.Direction} direction
28
+ * @param {AgentMail.ListType} type
29
+ * @param {string} entry - Email address or domain.
30
+ * @param {ListsClient.RequestOptions} requestOptions - Request-specific configuration.
31
+ *
32
+ * @throws {@link AgentMail.NotFoundError}
33
+ *
34
+ * @example
35
+ * await client.inboxes.lists.get("inbox_id", "send", "allow", "entry")
36
+ */
37
+ get(inbox_id: AgentMail.inboxes.InboxId, direction: AgentMail.Direction, type: AgentMail.ListType, entry: string, requestOptions?: ListsClient.RequestOptions): core.HttpResponsePromise<AgentMail.PodListEntry>;
38
+ private __get;
39
+ /**
40
+ * @param {AgentMail.inboxes.InboxId} inbox_id
41
+ * @param {AgentMail.Direction} direction
42
+ * @param {AgentMail.ListType} type
43
+ * @param {AgentMail.CreateListEntryRequest} request
44
+ * @param {ListsClient.RequestOptions} requestOptions - Request-specific configuration.
45
+ *
46
+ * @throws {@link AgentMail.ValidationError}
47
+ *
48
+ * @example
49
+ * await client.inboxes.lists.create("inbox_id", "send", "allow", {
50
+ * entry: "entry"
51
+ * })
52
+ */
53
+ create(inbox_id: AgentMail.inboxes.InboxId, direction: AgentMail.Direction, type: AgentMail.ListType, request: AgentMail.CreateListEntryRequest, requestOptions?: ListsClient.RequestOptions): core.HttpResponsePromise<AgentMail.PodListEntry>;
54
+ private __create;
55
+ /**
56
+ * @param {AgentMail.inboxes.InboxId} inbox_id
57
+ * @param {AgentMail.Direction} direction
58
+ * @param {AgentMail.ListType} type
59
+ * @param {string} entry - Email address or domain.
60
+ * @param {ListsClient.RequestOptions} requestOptions - Request-specific configuration.
61
+ *
62
+ * @throws {@link AgentMail.NotFoundError}
63
+ *
64
+ * @example
65
+ * await client.inboxes.lists.delete("inbox_id", "send", "allow", "entry")
66
+ */
67
+ delete(inbox_id: AgentMail.inboxes.InboxId, direction: AgentMail.Direction, type: AgentMail.ListType, entry: string, requestOptions?: ListsClient.RequestOptions): core.HttpResponsePromise<void>;
68
+ private __delete;
69
+ }
@@ -0,0 +1,274 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ import { normalizeClientOptionsWithAuth } from "../../../../../../BaseClient.mjs";
12
+ import { mergeHeaders } from "../../../../../../core/headers.mjs";
13
+ import * as core from "../../../../../../core/index.mjs";
14
+ import * as environments from "../../../../../../environments.mjs";
15
+ import { handleNonStatusCodeError } from "../../../../../../errors/handleNonStatusCodeError.mjs";
16
+ import * as errors from "../../../../../../errors/index.mjs";
17
+ import * as serializers from "../../../../../../serialization/index.mjs";
18
+ import * as AgentMail from "../../../../../index.mjs";
19
+ export class ListsClient {
20
+ constructor(options = {}) {
21
+ this._options = normalizeClientOptionsWithAuth(options);
22
+ }
23
+ /**
24
+ * @param {AgentMail.inboxes.InboxId} inbox_id
25
+ * @param {AgentMail.Direction} direction
26
+ * @param {AgentMail.ListType} type
27
+ * @param {AgentMail.inboxes.InboxListListEntriesRequest} request
28
+ * @param {ListsClient.RequestOptions} requestOptions - Request-specific configuration.
29
+ *
30
+ * @example
31
+ * await client.inboxes.lists.list("inbox_id", "send", "allow")
32
+ */
33
+ list(inbox_id, direction, type, request = {}, requestOptions) {
34
+ return core.HttpResponsePromise.fromPromise(this.__list(inbox_id, direction, type, request, requestOptions));
35
+ }
36
+ __list(inbox_id_1, direction_1, type_1) {
37
+ return __awaiter(this, arguments, void 0, function* (inbox_id, direction, type, request = {}, requestOptions) {
38
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
39
+ const { limit, pageToken } = request;
40
+ const _queryParams = {
41
+ limit,
42
+ page_token: pageToken,
43
+ };
44
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
45
+ 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);
46
+ const _response = yield core.fetcher({
47
+ 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)
48
+ .http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/lists/${core.url.encodePathParam(serializers.Direction.jsonOrThrow(direction, { omitUndefined: true }))}/${core.url.encodePathParam(serializers.ListType.jsonOrThrow(type, { omitUndefined: true }))}`),
49
+ method: "GET",
50
+ headers: _headers,
51
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
52
+ 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,
53
+ 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,
54
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
55
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
56
+ logging: this._options.logging,
57
+ });
58
+ if (_response.ok) {
59
+ return {
60
+ data: serializers.PodListListEntriesResponse.parseOrThrow(_response.body, {
61
+ unrecognizedObjectKeys: "passthrough",
62
+ allowUnrecognizedUnionMembers: true,
63
+ allowUnrecognizedEnumValues: true,
64
+ skipValidation: true,
65
+ breadcrumbsPrefix: ["response"],
66
+ }),
67
+ rawResponse: _response.rawResponse,
68
+ };
69
+ }
70
+ if (_response.error.reason === "status-code") {
71
+ throw new errors.AgentMailError({
72
+ statusCode: _response.error.statusCode,
73
+ body: _response.error.body,
74
+ rawResponse: _response.rawResponse,
75
+ });
76
+ }
77
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v0/inboxes/{inbox_id}/lists/{direction}/{type}");
78
+ });
79
+ }
80
+ /**
81
+ * @param {AgentMail.inboxes.InboxId} inbox_id
82
+ * @param {AgentMail.Direction} direction
83
+ * @param {AgentMail.ListType} type
84
+ * @param {string} entry - Email address or domain.
85
+ * @param {ListsClient.RequestOptions} requestOptions - Request-specific configuration.
86
+ *
87
+ * @throws {@link AgentMail.NotFoundError}
88
+ *
89
+ * @example
90
+ * await client.inboxes.lists.get("inbox_id", "send", "allow", "entry")
91
+ */
92
+ get(inbox_id, direction, type, entry, requestOptions) {
93
+ return core.HttpResponsePromise.fromPromise(this.__get(inbox_id, direction, type, entry, requestOptions));
94
+ }
95
+ __get(inbox_id, direction, type, entry, requestOptions) {
96
+ return __awaiter(this, void 0, void 0, function* () {
97
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
98
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
99
+ 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);
100
+ const _response = yield core.fetcher({
101
+ 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)
102
+ .http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/lists/${core.url.encodePathParam(serializers.Direction.jsonOrThrow(direction, { omitUndefined: true }))}/${core.url.encodePathParam(serializers.ListType.jsonOrThrow(type, { omitUndefined: true }))}/${core.url.encodePathParam(entry)}`),
103
+ method: "GET",
104
+ headers: _headers,
105
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
106
+ 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,
107
+ 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,
108
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
109
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
110
+ logging: this._options.logging,
111
+ });
112
+ if (_response.ok) {
113
+ return {
114
+ data: serializers.PodListEntry.parseOrThrow(_response.body, {
115
+ unrecognizedObjectKeys: "passthrough",
116
+ allowUnrecognizedUnionMembers: true,
117
+ allowUnrecognizedEnumValues: true,
118
+ skipValidation: true,
119
+ breadcrumbsPrefix: ["response"],
120
+ }),
121
+ rawResponse: _response.rawResponse,
122
+ };
123
+ }
124
+ if (_response.error.reason === "status-code") {
125
+ switch (_response.error.statusCode) {
126
+ case 404:
127
+ throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
128
+ unrecognizedObjectKeys: "passthrough",
129
+ allowUnrecognizedUnionMembers: true,
130
+ allowUnrecognizedEnumValues: true,
131
+ skipValidation: true,
132
+ breadcrumbsPrefix: ["response"],
133
+ }), _response.rawResponse);
134
+ default:
135
+ throw new errors.AgentMailError({
136
+ statusCode: _response.error.statusCode,
137
+ body: _response.error.body,
138
+ rawResponse: _response.rawResponse,
139
+ });
140
+ }
141
+ }
142
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v0/inboxes/{inbox_id}/lists/{direction}/{type}/{entry}");
143
+ });
144
+ }
145
+ /**
146
+ * @param {AgentMail.inboxes.InboxId} inbox_id
147
+ * @param {AgentMail.Direction} direction
148
+ * @param {AgentMail.ListType} type
149
+ * @param {AgentMail.CreateListEntryRequest} request
150
+ * @param {ListsClient.RequestOptions} requestOptions - Request-specific configuration.
151
+ *
152
+ * @throws {@link AgentMail.ValidationError}
153
+ *
154
+ * @example
155
+ * await client.inboxes.lists.create("inbox_id", "send", "allow", {
156
+ * entry: "entry"
157
+ * })
158
+ */
159
+ create(inbox_id, direction, type, request, requestOptions) {
160
+ return core.HttpResponsePromise.fromPromise(this.__create(inbox_id, direction, type, request, requestOptions));
161
+ }
162
+ __create(inbox_id, direction, type, request, requestOptions) {
163
+ return __awaiter(this, void 0, void 0, function* () {
164
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
165
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
166
+ 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);
167
+ const _response = yield core.fetcher({
168
+ 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)
169
+ .http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/lists/${core.url.encodePathParam(serializers.Direction.jsonOrThrow(direction, { omitUndefined: true }))}/${core.url.encodePathParam(serializers.ListType.jsonOrThrow(type, { omitUndefined: true }))}`),
170
+ method: "POST",
171
+ headers: _headers,
172
+ contentType: "application/json",
173
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
174
+ requestType: "json",
175
+ body: serializers.CreateListEntryRequest.jsonOrThrow(request, {
176
+ unrecognizedObjectKeys: "strip",
177
+ omitUndefined: true,
178
+ }),
179
+ 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,
180
+ 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,
181
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
182
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
183
+ logging: this._options.logging,
184
+ });
185
+ if (_response.ok) {
186
+ return {
187
+ data: serializers.PodListEntry.parseOrThrow(_response.body, {
188
+ unrecognizedObjectKeys: "passthrough",
189
+ allowUnrecognizedUnionMembers: true,
190
+ allowUnrecognizedEnumValues: true,
191
+ skipValidation: true,
192
+ breadcrumbsPrefix: ["response"],
193
+ }),
194
+ rawResponse: _response.rawResponse,
195
+ };
196
+ }
197
+ if (_response.error.reason === "status-code") {
198
+ switch (_response.error.statusCode) {
199
+ case 400:
200
+ throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
201
+ unrecognizedObjectKeys: "passthrough",
202
+ allowUnrecognizedUnionMembers: true,
203
+ allowUnrecognizedEnumValues: true,
204
+ skipValidation: true,
205
+ breadcrumbsPrefix: ["response"],
206
+ }), _response.rawResponse);
207
+ default:
208
+ throw new errors.AgentMailError({
209
+ statusCode: _response.error.statusCode,
210
+ body: _response.error.body,
211
+ rawResponse: _response.rawResponse,
212
+ });
213
+ }
214
+ }
215
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v0/inboxes/{inbox_id}/lists/{direction}/{type}");
216
+ });
217
+ }
218
+ /**
219
+ * @param {AgentMail.inboxes.InboxId} inbox_id
220
+ * @param {AgentMail.Direction} direction
221
+ * @param {AgentMail.ListType} type
222
+ * @param {string} entry - Email address or domain.
223
+ * @param {ListsClient.RequestOptions} requestOptions - Request-specific configuration.
224
+ *
225
+ * @throws {@link AgentMail.NotFoundError}
226
+ *
227
+ * @example
228
+ * await client.inboxes.lists.delete("inbox_id", "send", "allow", "entry")
229
+ */
230
+ delete(inbox_id, direction, type, entry, requestOptions) {
231
+ return core.HttpResponsePromise.fromPromise(this.__delete(inbox_id, direction, type, entry, requestOptions));
232
+ }
233
+ __delete(inbox_id, direction, type, entry, requestOptions) {
234
+ return __awaiter(this, void 0, void 0, function* () {
235
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
236
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
237
+ 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);
238
+ const _response = yield core.fetcher({
239
+ 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)
240
+ .http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/lists/${core.url.encodePathParam(serializers.Direction.jsonOrThrow(direction, { omitUndefined: true }))}/${core.url.encodePathParam(serializers.ListType.jsonOrThrow(type, { omitUndefined: true }))}/${core.url.encodePathParam(entry)}`),
241
+ method: "DELETE",
242
+ headers: _headers,
243
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
244
+ 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,
245
+ 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,
246
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
247
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
248
+ logging: this._options.logging,
249
+ });
250
+ if (_response.ok) {
251
+ return { data: undefined, rawResponse: _response.rawResponse };
252
+ }
253
+ if (_response.error.reason === "status-code") {
254
+ switch (_response.error.statusCode) {
255
+ case 404:
256
+ throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
257
+ unrecognizedObjectKeys: "passthrough",
258
+ allowUnrecognizedUnionMembers: true,
259
+ allowUnrecognizedEnumValues: true,
260
+ skipValidation: true,
261
+ breadcrumbsPrefix: ["response"],
262
+ }), _response.rawResponse);
263
+ default:
264
+ throw new errors.AgentMailError({
265
+ statusCode: _response.error.statusCode,
266
+ body: _response.error.body,
267
+ rawResponse: _response.rawResponse,
268
+ });
269
+ }
270
+ }
271
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v0/inboxes/{inbox_id}/lists/{direction}/{type}/{entry}");
272
+ });
273
+ }
274
+ }
@@ -0,0 +1 @@
1
+ export * from "./requests/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./requests/index.mjs";
@@ -0,0 +1,9 @@
1
+ import type * as AgentMail from "../../../../../../index.mjs";
2
+ /**
3
+ * @example
4
+ * {}
5
+ */
6
+ export interface InboxListListEntriesRequest {
7
+ limit?: AgentMail.Limit;
8
+ pageToken?: AgentMail.PageToken;
9
+ }