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.
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/api/resources/apiKeys/types/ApiKey.d.ts +2 -0
- package/dist/cjs/api/resources/apiKeys/types/CreateApiKeyResponse.d.ts +2 -0
- package/dist/cjs/api/resources/inboxes/client/Client.d.ts +6 -0
- package/dist/cjs/api/resources/inboxes/client/Client.js +18 -8
- package/dist/cjs/api/resources/inboxes/resources/apiKeys/client/Client.d.ts +52 -0
- package/dist/cjs/api/resources/inboxes/resources/apiKeys/client/Client.js +262 -0
- package/dist/cjs/api/resources/inboxes/resources/apiKeys/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/inboxes/resources/apiKeys/client/index.js +17 -0
- package/dist/cjs/api/resources/inboxes/resources/apiKeys/client/requests/ListApiKeysRequest.d.ts +9 -0
- package/dist/cjs/api/resources/inboxes/resources/apiKeys/client/requests/ListApiKeysRequest.js +3 -0
- package/dist/cjs/api/resources/inboxes/resources/apiKeys/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/inboxes/resources/apiKeys/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/inboxes/resources/apiKeys/index.d.ts +1 -0
- package/dist/cjs/api/resources/inboxes/resources/apiKeys/index.js +17 -0
- package/dist/cjs/api/resources/inboxes/resources/index.d.ts +4 -0
- package/dist/cjs/api/resources/inboxes/resources/index.js +5 -1
- package/dist/cjs/api/resources/inboxes/resources/lists/client/Client.d.ts +69 -0
- package/dist/cjs/api/resources/inboxes/resources/lists/client/Client.js +311 -0
- package/dist/cjs/api/resources/inboxes/resources/lists/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/inboxes/resources/lists/client/index.js +17 -0
- package/dist/cjs/api/resources/inboxes/resources/lists/client/requests/InboxListListEntriesRequest.d.ts +9 -0
- package/dist/cjs/api/resources/inboxes/resources/lists/client/requests/InboxListListEntriesRequest.js +3 -0
- package/dist/cjs/api/resources/inboxes/resources/lists/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/inboxes/resources/lists/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/inboxes/resources/lists/index.d.ts +1 -0
- package/dist/cjs/api/resources/inboxes/resources/lists/index.js +17 -0
- package/dist/cjs/api/resources/lists/types/Direction.d.ts +1 -0
- package/dist/cjs/api/resources/lists/types/Direction.js +1 -0
- package/dist/cjs/serialization/resources/apiKeys/types/ApiKey.d.ts +1 -0
- package/dist/cjs/serialization/resources/apiKeys/types/ApiKey.js +1 -0
- package/dist/cjs/serialization/resources/apiKeys/types/CreateApiKeyResponse.d.ts +1 -0
- package/dist/cjs/serialization/resources/apiKeys/types/CreateApiKeyResponse.js +1 -0
- package/dist/cjs/serialization/resources/lists/types/Direction.d.ts +1 -1
- package/dist/cjs/serialization/resources/lists/types/Direction.js +1 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/api/resources/apiKeys/types/ApiKey.d.mts +2 -0
- package/dist/esm/api/resources/apiKeys/types/CreateApiKeyResponse.d.mts +2 -0
- package/dist/esm/api/resources/inboxes/client/Client.d.mts +6 -0
- package/dist/esm/api/resources/inboxes/client/Client.mjs +10 -0
- package/dist/esm/api/resources/inboxes/resources/apiKeys/client/Client.d.mts +52 -0
- package/dist/esm/api/resources/inboxes/resources/apiKeys/client/Client.mjs +225 -0
- package/dist/esm/api/resources/inboxes/resources/apiKeys/client/index.d.mts +1 -0
- package/dist/esm/api/resources/inboxes/resources/apiKeys/client/index.mjs +1 -0
- package/dist/esm/api/resources/inboxes/resources/apiKeys/client/requests/ListApiKeysRequest.d.mts +9 -0
- package/dist/esm/api/resources/inboxes/resources/apiKeys/client/requests/ListApiKeysRequest.mjs +2 -0
- package/dist/esm/api/resources/inboxes/resources/apiKeys/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/inboxes/resources/apiKeys/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/inboxes/resources/apiKeys/index.d.mts +1 -0
- package/dist/esm/api/resources/inboxes/resources/apiKeys/index.mjs +1 -0
- package/dist/esm/api/resources/inboxes/resources/index.d.mts +4 -0
- package/dist/esm/api/resources/inboxes/resources/index.mjs +4 -0
- package/dist/esm/api/resources/inboxes/resources/lists/client/Client.d.mts +69 -0
- package/dist/esm/api/resources/inboxes/resources/lists/client/Client.mjs +274 -0
- package/dist/esm/api/resources/inboxes/resources/lists/client/index.d.mts +1 -0
- package/dist/esm/api/resources/inboxes/resources/lists/client/index.mjs +1 -0
- package/dist/esm/api/resources/inboxes/resources/lists/client/requests/InboxListListEntriesRequest.d.mts +9 -0
- package/dist/esm/api/resources/inboxes/resources/lists/client/requests/InboxListListEntriesRequest.mjs +2 -0
- package/dist/esm/api/resources/inboxes/resources/lists/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/inboxes/resources/lists/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/inboxes/resources/lists/index.d.mts +1 -0
- package/dist/esm/api/resources/inboxes/resources/lists/index.mjs +1 -0
- package/dist/esm/api/resources/lists/types/Direction.d.mts +1 -0
- package/dist/esm/api/resources/lists/types/Direction.mjs +1 -0
- package/dist/esm/serialization/resources/apiKeys/types/ApiKey.d.mts +1 -0
- package/dist/esm/serialization/resources/apiKeys/types/ApiKey.mjs +1 -0
- package/dist/esm/serialization/resources/apiKeys/types/CreateApiKeyResponse.d.mts +1 -0
- package/dist/esm/serialization/resources/apiKeys/types/CreateApiKeyResponse.mjs +1 -0
- package/dist/esm/serialization/resources/lists/types/Direction.d.mts +1 -1
- package/dist/esm/serialization/resources/lists/types/Direction.mjs +1 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/dist/llms-full.txt +1365 -57
- package/dist/llms.txt +5 -1
- package/package.json +1 -1
- package/reference.md +469 -0
|
@@ -0,0 +1,311 @@
|
|
|
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
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
37
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
38
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
39
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
40
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
41
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
42
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
+
exports.ListsClient = void 0;
|
|
47
|
+
const BaseClient_js_1 = require("../../../../../../BaseClient.js");
|
|
48
|
+
const headers_js_1 = require("../../../../../../core/headers.js");
|
|
49
|
+
const core = __importStar(require("../../../../../../core/index.js"));
|
|
50
|
+
const environments = __importStar(require("../../../../../../environments.js"));
|
|
51
|
+
const handleNonStatusCodeError_js_1 = require("../../../../../../errors/handleNonStatusCodeError.js");
|
|
52
|
+
const errors = __importStar(require("../../../../../../errors/index.js"));
|
|
53
|
+
const serializers = __importStar(require("../../../../../../serialization/index.js"));
|
|
54
|
+
const AgentMail = __importStar(require("../../../../../index.js"));
|
|
55
|
+
class ListsClient {
|
|
56
|
+
constructor(options = {}) {
|
|
57
|
+
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
61
|
+
* @param {AgentMail.Direction} direction
|
|
62
|
+
* @param {AgentMail.ListType} type
|
|
63
|
+
* @param {AgentMail.inboxes.InboxListListEntriesRequest} request
|
|
64
|
+
* @param {ListsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* await client.inboxes.lists.list("inbox_id", "send", "allow")
|
|
68
|
+
*/
|
|
69
|
+
list(inbox_id, direction, type, request = {}, requestOptions) {
|
|
70
|
+
return core.HttpResponsePromise.fromPromise(this.__list(inbox_id, direction, type, request, requestOptions));
|
|
71
|
+
}
|
|
72
|
+
__list(inbox_id_1, direction_1, type_1) {
|
|
73
|
+
return __awaiter(this, arguments, void 0, function* (inbox_id, direction, type, request = {}, requestOptions) {
|
|
74
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
75
|
+
const { limit, pageToken } = request;
|
|
76
|
+
const _queryParams = {
|
|
77
|
+
limit,
|
|
78
|
+
page_token: pageToken,
|
|
79
|
+
};
|
|
80
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
81
|
+
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);
|
|
82
|
+
const _response = yield core.fetcher({
|
|
83
|
+
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)
|
|
84
|
+
.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 }))}`),
|
|
85
|
+
method: "GET",
|
|
86
|
+
headers: _headers,
|
|
87
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
88
|
+
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,
|
|
89
|
+
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,
|
|
90
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
91
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
92
|
+
logging: this._options.logging,
|
|
93
|
+
});
|
|
94
|
+
if (_response.ok) {
|
|
95
|
+
return {
|
|
96
|
+
data: serializers.PodListListEntriesResponse.parseOrThrow(_response.body, {
|
|
97
|
+
unrecognizedObjectKeys: "passthrough",
|
|
98
|
+
allowUnrecognizedUnionMembers: true,
|
|
99
|
+
allowUnrecognizedEnumValues: true,
|
|
100
|
+
skipValidation: true,
|
|
101
|
+
breadcrumbsPrefix: ["response"],
|
|
102
|
+
}),
|
|
103
|
+
rawResponse: _response.rawResponse,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
if (_response.error.reason === "status-code") {
|
|
107
|
+
throw new errors.AgentMailError({
|
|
108
|
+
statusCode: _response.error.statusCode,
|
|
109
|
+
body: _response.error.body,
|
|
110
|
+
rawResponse: _response.rawResponse,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v0/inboxes/{inbox_id}/lists/{direction}/{type}");
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
118
|
+
* @param {AgentMail.Direction} direction
|
|
119
|
+
* @param {AgentMail.ListType} type
|
|
120
|
+
* @param {string} entry - Email address or domain.
|
|
121
|
+
* @param {ListsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
122
|
+
*
|
|
123
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* await client.inboxes.lists.get("inbox_id", "send", "allow", "entry")
|
|
127
|
+
*/
|
|
128
|
+
get(inbox_id, direction, type, entry, requestOptions) {
|
|
129
|
+
return core.HttpResponsePromise.fromPromise(this.__get(inbox_id, direction, type, entry, requestOptions));
|
|
130
|
+
}
|
|
131
|
+
__get(inbox_id, direction, type, entry, requestOptions) {
|
|
132
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
133
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
134
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
135
|
+
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);
|
|
136
|
+
const _response = yield core.fetcher({
|
|
137
|
+
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)
|
|
138
|
+
.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)}`),
|
|
139
|
+
method: "GET",
|
|
140
|
+
headers: _headers,
|
|
141
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
142
|
+
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,
|
|
143
|
+
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,
|
|
144
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
145
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
146
|
+
logging: this._options.logging,
|
|
147
|
+
});
|
|
148
|
+
if (_response.ok) {
|
|
149
|
+
return {
|
|
150
|
+
data: serializers.PodListEntry.parseOrThrow(_response.body, {
|
|
151
|
+
unrecognizedObjectKeys: "passthrough",
|
|
152
|
+
allowUnrecognizedUnionMembers: true,
|
|
153
|
+
allowUnrecognizedEnumValues: true,
|
|
154
|
+
skipValidation: true,
|
|
155
|
+
breadcrumbsPrefix: ["response"],
|
|
156
|
+
}),
|
|
157
|
+
rawResponse: _response.rawResponse,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
if (_response.error.reason === "status-code") {
|
|
161
|
+
switch (_response.error.statusCode) {
|
|
162
|
+
case 404:
|
|
163
|
+
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
164
|
+
unrecognizedObjectKeys: "passthrough",
|
|
165
|
+
allowUnrecognizedUnionMembers: true,
|
|
166
|
+
allowUnrecognizedEnumValues: true,
|
|
167
|
+
skipValidation: true,
|
|
168
|
+
breadcrumbsPrefix: ["response"],
|
|
169
|
+
}), _response.rawResponse);
|
|
170
|
+
default:
|
|
171
|
+
throw new errors.AgentMailError({
|
|
172
|
+
statusCode: _response.error.statusCode,
|
|
173
|
+
body: _response.error.body,
|
|
174
|
+
rawResponse: _response.rawResponse,
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v0/inboxes/{inbox_id}/lists/{direction}/{type}/{entry}");
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
183
|
+
* @param {AgentMail.Direction} direction
|
|
184
|
+
* @param {AgentMail.ListType} type
|
|
185
|
+
* @param {AgentMail.CreateListEntryRequest} request
|
|
186
|
+
* @param {ListsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
187
|
+
*
|
|
188
|
+
* @throws {@link AgentMail.ValidationError}
|
|
189
|
+
*
|
|
190
|
+
* @example
|
|
191
|
+
* await client.inboxes.lists.create("inbox_id", "send", "allow", {
|
|
192
|
+
* entry: "entry"
|
|
193
|
+
* })
|
|
194
|
+
*/
|
|
195
|
+
create(inbox_id, direction, type, request, requestOptions) {
|
|
196
|
+
return core.HttpResponsePromise.fromPromise(this.__create(inbox_id, direction, type, request, requestOptions));
|
|
197
|
+
}
|
|
198
|
+
__create(inbox_id, direction, type, request, requestOptions) {
|
|
199
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
200
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
201
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
202
|
+
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);
|
|
203
|
+
const _response = yield core.fetcher({
|
|
204
|
+
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)
|
|
205
|
+
.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 }))}`),
|
|
206
|
+
method: "POST",
|
|
207
|
+
headers: _headers,
|
|
208
|
+
contentType: "application/json",
|
|
209
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
210
|
+
requestType: "json",
|
|
211
|
+
body: serializers.CreateListEntryRequest.jsonOrThrow(request, {
|
|
212
|
+
unrecognizedObjectKeys: "strip",
|
|
213
|
+
omitUndefined: true,
|
|
214
|
+
}),
|
|
215
|
+
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,
|
|
216
|
+
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,
|
|
217
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
218
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
219
|
+
logging: this._options.logging,
|
|
220
|
+
});
|
|
221
|
+
if (_response.ok) {
|
|
222
|
+
return {
|
|
223
|
+
data: serializers.PodListEntry.parseOrThrow(_response.body, {
|
|
224
|
+
unrecognizedObjectKeys: "passthrough",
|
|
225
|
+
allowUnrecognizedUnionMembers: true,
|
|
226
|
+
allowUnrecognizedEnumValues: true,
|
|
227
|
+
skipValidation: true,
|
|
228
|
+
breadcrumbsPrefix: ["response"],
|
|
229
|
+
}),
|
|
230
|
+
rawResponse: _response.rawResponse,
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
if (_response.error.reason === "status-code") {
|
|
234
|
+
switch (_response.error.statusCode) {
|
|
235
|
+
case 400:
|
|
236
|
+
throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
|
|
237
|
+
unrecognizedObjectKeys: "passthrough",
|
|
238
|
+
allowUnrecognizedUnionMembers: true,
|
|
239
|
+
allowUnrecognizedEnumValues: true,
|
|
240
|
+
skipValidation: true,
|
|
241
|
+
breadcrumbsPrefix: ["response"],
|
|
242
|
+
}), _response.rawResponse);
|
|
243
|
+
default:
|
|
244
|
+
throw new errors.AgentMailError({
|
|
245
|
+
statusCode: _response.error.statusCode,
|
|
246
|
+
body: _response.error.body,
|
|
247
|
+
rawResponse: _response.rawResponse,
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v0/inboxes/{inbox_id}/lists/{direction}/{type}");
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
256
|
+
* @param {AgentMail.Direction} direction
|
|
257
|
+
* @param {AgentMail.ListType} type
|
|
258
|
+
* @param {string} entry - Email address or domain.
|
|
259
|
+
* @param {ListsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
260
|
+
*
|
|
261
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
262
|
+
*
|
|
263
|
+
* @example
|
|
264
|
+
* await client.inboxes.lists.delete("inbox_id", "send", "allow", "entry")
|
|
265
|
+
*/
|
|
266
|
+
delete(inbox_id, direction, type, entry, requestOptions) {
|
|
267
|
+
return core.HttpResponsePromise.fromPromise(this.__delete(inbox_id, direction, type, entry, requestOptions));
|
|
268
|
+
}
|
|
269
|
+
__delete(inbox_id, direction, type, entry, requestOptions) {
|
|
270
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
271
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
272
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
273
|
+
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);
|
|
274
|
+
const _response = yield core.fetcher({
|
|
275
|
+
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)
|
|
276
|
+
.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)}`),
|
|
277
|
+
method: "DELETE",
|
|
278
|
+
headers: _headers,
|
|
279
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
280
|
+
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,
|
|
281
|
+
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,
|
|
282
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
283
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
284
|
+
logging: this._options.logging,
|
|
285
|
+
});
|
|
286
|
+
if (_response.ok) {
|
|
287
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
288
|
+
}
|
|
289
|
+
if (_response.error.reason === "status-code") {
|
|
290
|
+
switch (_response.error.statusCode) {
|
|
291
|
+
case 404:
|
|
292
|
+
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
293
|
+
unrecognizedObjectKeys: "passthrough",
|
|
294
|
+
allowUnrecognizedUnionMembers: true,
|
|
295
|
+
allowUnrecognizedEnumValues: true,
|
|
296
|
+
skipValidation: true,
|
|
297
|
+
breadcrumbsPrefix: ["response"],
|
|
298
|
+
}), _response.rawResponse);
|
|
299
|
+
default:
|
|
300
|
+
throw new errors.AgentMailError({
|
|
301
|
+
statusCode: _response.error.statusCode,
|
|
302
|
+
body: _response.error.body,
|
|
303
|
+
rawResponse: _response.rawResponse,
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/v0/inboxes/{inbox_id}/lists/{direction}/{type}/{entry}");
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
exports.ListsClient = ListsClient;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests/index.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./requests/index.js"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { InboxListListEntriesRequest } from "./InboxListListEntriesRequest.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./client/index.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./client/index.js"), exports);
|
|
@@ -45,6 +45,7 @@ exports.ApiKey = core.serialization.object({
|
|
|
45
45
|
prefix: Prefix_js_1.Prefix,
|
|
46
46
|
name: Name_js_1.Name,
|
|
47
47
|
podId: core.serialization.property("pod_id", core.serialization.string().optional()),
|
|
48
|
+
inboxId: core.serialization.property("inbox_id", core.serialization.string().optional()),
|
|
48
49
|
usedAt: core.serialization.property("used_at", core.serialization.date().optional()),
|
|
49
50
|
createdAt: core.serialization.property("created_at", CreatedAt_js_1.CreatedAt),
|
|
50
51
|
});
|
|
@@ -46,5 +46,6 @@ exports.CreateApiKeyResponse = core.serialization.object({
|
|
|
46
46
|
prefix: Prefix_js_1.Prefix,
|
|
47
47
|
name: Name_js_1.Name,
|
|
48
48
|
podId: core.serialization.property("pod_id", core.serialization.string().optional()),
|
|
49
|
+
inboxId: core.serialization.property("inbox_id", core.serialization.string().optional()),
|
|
49
50
|
createdAt: core.serialization.property("created_at", CreatedAt_js_1.CreatedAt),
|
|
50
51
|
});
|
|
@@ -3,5 +3,5 @@ import * as core from "../../../../core/index.js";
|
|
|
3
3
|
import type * as serializers from "../../../index.js";
|
|
4
4
|
export declare const Direction: core.serialization.Schema<serializers.Direction.Raw, AgentMail.Direction>;
|
|
5
5
|
export declare namespace Direction {
|
|
6
|
-
type Raw = "send" | "receive";
|
|
6
|
+
type Raw = "send" | "receive" | "reply";
|
|
7
7
|
}
|
|
@@ -36,4 +36,4 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
36
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
37
|
exports.Direction = void 0;
|
|
38
38
|
const core = __importStar(require("../../../../core/index.js"));
|
|
39
|
-
exports.Direction = core.serialization.enum_(["send", "receive"]);
|
|
39
|
+
exports.Direction = core.serialization.enum_(["send", "receive", "reply"]);
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.4.
|
|
1
|
+
export declare const SDK_VERSION = "0.4.9";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/BaseClient.mjs
CHANGED
|
@@ -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.4.
|
|
10
|
-
"User-Agent": "agentmail/0.4.
|
|
9
|
+
"X-Fern-SDK-Version": "0.4.9",
|
|
10
|
+
"User-Agent": "agentmail/0.4.9",
|
|
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);
|
|
@@ -5,6 +5,8 @@ export interface ApiKey {
|
|
|
5
5
|
name: AgentMail.Name;
|
|
6
6
|
/** Pod ID the api key is scoped to. If set, the key can only access resources within this pod. */
|
|
7
7
|
podId?: string;
|
|
8
|
+
/** Inbox ID the api key is scoped to. If set, the key can only access resources within this inbox. */
|
|
9
|
+
inboxId?: string;
|
|
8
10
|
/** Time at which api key was last used. */
|
|
9
11
|
usedAt?: Date;
|
|
10
12
|
createdAt: AgentMail.CreatedAt;
|
|
@@ -2,7 +2,9 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClie
|
|
|
2
2
|
import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.mjs";
|
|
3
3
|
import * as core from "../../../../core/index.mjs";
|
|
4
4
|
import * as AgentMail from "../../../index.mjs";
|
|
5
|
+
import { ApiKeysClient } from "../resources/apiKeys/client/Client.mjs";
|
|
5
6
|
import { DraftsClient } from "../resources/drafts/client/Client.mjs";
|
|
7
|
+
import { ListsClient } from "../resources/lists/client/Client.mjs";
|
|
6
8
|
import { MessagesClient } from "../resources/messages/client/Client.mjs";
|
|
7
9
|
import { MetricsClient } from "../resources/metrics/client/Client.mjs";
|
|
8
10
|
import { ThreadsClient } from "../resources/threads/client/Client.mjs";
|
|
@@ -16,12 +18,16 @@ export declare class InboxesClient {
|
|
|
16
18
|
protected _threads: ThreadsClient | undefined;
|
|
17
19
|
protected _messages: MessagesClient | undefined;
|
|
18
20
|
protected _drafts: DraftsClient | undefined;
|
|
21
|
+
protected _lists: ListsClient | undefined;
|
|
19
22
|
protected _metrics: MetricsClient | undefined;
|
|
23
|
+
protected _apiKeys: ApiKeysClient | undefined;
|
|
20
24
|
constructor(options?: InboxesClient.Options);
|
|
21
25
|
get threads(): ThreadsClient;
|
|
22
26
|
get messages(): MessagesClient;
|
|
23
27
|
get drafts(): DraftsClient;
|
|
28
|
+
get lists(): ListsClient;
|
|
24
29
|
get metrics(): MetricsClient;
|
|
30
|
+
get apiKeys(): ApiKeysClient;
|
|
25
31
|
/**
|
|
26
32
|
* @param {AgentMail.inboxes.ListInboxesRequest} request
|
|
27
33
|
* @param {InboxesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -16,7 +16,9 @@ import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCode
|
|
|
16
16
|
import * as errors from "../../../../errors/index.mjs";
|
|
17
17
|
import * as serializers from "../../../../serialization/index.mjs";
|
|
18
18
|
import * as AgentMail from "../../../index.mjs";
|
|
19
|
+
import { ApiKeysClient } from "../resources/apiKeys/client/Client.mjs";
|
|
19
20
|
import { DraftsClient } from "../resources/drafts/client/Client.mjs";
|
|
21
|
+
import { ListsClient } from "../resources/lists/client/Client.mjs";
|
|
20
22
|
import { MessagesClient } from "../resources/messages/client/Client.mjs";
|
|
21
23
|
import { MetricsClient } from "../resources/metrics/client/Client.mjs";
|
|
22
24
|
import { ThreadsClient } from "../resources/threads/client/Client.mjs";
|
|
@@ -36,10 +38,18 @@ export class InboxesClient {
|
|
|
36
38
|
var _a;
|
|
37
39
|
return ((_a = this._drafts) !== null && _a !== void 0 ? _a : (this._drafts = new DraftsClient(this._options)));
|
|
38
40
|
}
|
|
41
|
+
get lists() {
|
|
42
|
+
var _a;
|
|
43
|
+
return ((_a = this._lists) !== null && _a !== void 0 ? _a : (this._lists = new ListsClient(this._options)));
|
|
44
|
+
}
|
|
39
45
|
get metrics() {
|
|
40
46
|
var _a;
|
|
41
47
|
return ((_a = this._metrics) !== null && _a !== void 0 ? _a : (this._metrics = new MetricsClient(this._options)));
|
|
42
48
|
}
|
|
49
|
+
get apiKeys() {
|
|
50
|
+
var _a;
|
|
51
|
+
return ((_a = this._apiKeys) !== null && _a !== void 0 ? _a : (this._apiKeys = new ApiKeysClient(this._options)));
|
|
52
|
+
}
|
|
43
53
|
/**
|
|
44
54
|
* @param {AgentMail.inboxes.ListInboxesRequest} request
|
|
45
55
|
* @param {InboxesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -0,0 +1,52 @@
|
|
|
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 ApiKeysClient {
|
|
6
|
+
type Options = BaseClientOptions;
|
|
7
|
+
interface RequestOptions extends BaseRequestOptions {
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export declare class ApiKeysClient {
|
|
11
|
+
protected readonly _options: NormalizedClientOptionsWithAuth<ApiKeysClient.Options>;
|
|
12
|
+
constructor(options?: ApiKeysClient.Options);
|
|
13
|
+
/**
|
|
14
|
+
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
15
|
+
* @param {AgentMail.inboxes.ListApiKeysRequest} request
|
|
16
|
+
* @param {ApiKeysClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
17
|
+
*
|
|
18
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* await client.inboxes.apiKeys.list("inbox_id")
|
|
22
|
+
*/
|
|
23
|
+
list(inbox_id: AgentMail.inboxes.InboxId, request?: AgentMail.inboxes.ListApiKeysRequest, requestOptions?: ApiKeysClient.RequestOptions): core.HttpResponsePromise<AgentMail.ListApiKeysResponse>;
|
|
24
|
+
private __list;
|
|
25
|
+
/**
|
|
26
|
+
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
27
|
+
* @param {AgentMail.CreateApiKeyRequest} request
|
|
28
|
+
* @param {ApiKeysClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
29
|
+
*
|
|
30
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
31
|
+
* @throws {@link AgentMail.ValidationError}
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* await client.inboxes.apiKeys.create("inbox_id", {
|
|
35
|
+
* name: "name"
|
|
36
|
+
* })
|
|
37
|
+
*/
|
|
38
|
+
create(inbox_id: AgentMail.inboxes.InboxId, request: AgentMail.CreateApiKeyRequest, requestOptions?: ApiKeysClient.RequestOptions): core.HttpResponsePromise<AgentMail.CreateApiKeyResponse>;
|
|
39
|
+
private __create;
|
|
40
|
+
/**
|
|
41
|
+
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
42
|
+
* @param {AgentMail.ApiKeyId} api_key
|
|
43
|
+
* @param {ApiKeysClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
44
|
+
*
|
|
45
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* await client.inboxes.apiKeys.delete("inbox_id", "api_key")
|
|
49
|
+
*/
|
|
50
|
+
delete(inbox_id: AgentMail.inboxes.InboxId, api_key: AgentMail.ApiKeyId, requestOptions?: ApiKeysClient.RequestOptions): core.HttpResponsePromise<void>;
|
|
51
|
+
private __delete;
|
|
52
|
+
}
|