agentmail 0.5.26 → 0.5.28
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/accounts/client/Client.d.ts +38 -1
- package/dist/cjs/api/resources/accounts/client/Client.js +111 -1
- package/dist/cjs/api/resources/accounts/types/Account.d.ts +4 -0
- package/dist/cjs/api/resources/accounts/types/AccountStatus.d.ts +8 -0
- package/dist/cjs/api/resources/accounts/types/AccountStatus.js +11 -0
- package/dist/cjs/api/resources/accounts/types/UpdateAccountRequest.d.ts +9 -0
- package/dist/cjs/api/resources/accounts/types/UpdateAccountRequest.js +3 -0
- package/dist/cjs/api/resources/accounts/types/UpdateAccountStatus.d.ts +10 -0
- package/dist/cjs/api/resources/accounts/types/UpdateAccountStatus.js +13 -0
- package/dist/cjs/api/resources/accounts/types/index.d.ts +3 -0
- package/dist/cjs/api/resources/accounts/types/index.js +3 -0
- package/dist/cjs/api/resources/apiKeys/types/ApiKeyPermissions.d.ts +5 -0
- package/dist/cjs/api/resources/inboxes/client/Client.d.ts +7 -3
- package/dist/cjs/api/resources/inboxes/client/Client.js +25 -19
- package/dist/cjs/api/resources/inboxes/resources/accounts/client/Client.d.ts +42 -0
- package/dist/cjs/api/resources/inboxes/resources/accounts/client/Client.js +197 -0
- package/dist/cjs/api/resources/inboxes/resources/accounts/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/inboxes/resources/accounts/client/index.js +17 -0
- package/dist/cjs/api/resources/inboxes/resources/accounts/client/requests/ListAccountsRequest.d.ts +10 -0
- package/dist/cjs/api/resources/inboxes/resources/accounts/client/requests/ListAccountsRequest.js +3 -0
- package/dist/cjs/api/resources/inboxes/resources/accounts/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/inboxes/resources/accounts/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/inboxes/resources/accounts/exports.d.ts +2 -0
- package/dist/cjs/api/resources/inboxes/resources/accounts/exports.js +21 -0
- package/dist/cjs/api/resources/inboxes/resources/accounts/index.d.ts +1 -0
- package/dist/cjs/api/resources/inboxes/resources/accounts/index.js +17 -0
- package/dist/cjs/api/resources/inboxes/resources/index.d.ts +2 -0
- package/dist/cjs/api/resources/inboxes/resources/index.js +3 -1
- package/dist/cjs/api/resources/inboxes/types/AuthorizeInboxResponse.d.ts +11 -0
- package/dist/cjs/api/resources/inboxes/types/AuthorizeInboxResponse.js +3 -0
- package/dist/cjs/api/resources/inboxes/types/index.d.ts +1 -0
- package/dist/cjs/api/resources/inboxes/types/index.js +1 -0
- package/dist/cjs/api/resources/pods/client/Client.d.ts +3 -0
- package/dist/cjs/api/resources/pods/client/Client.js +21 -16
- package/dist/cjs/api/resources/pods/resources/accounts/client/Client.d.ts +42 -0
- package/dist/cjs/api/resources/pods/resources/accounts/client/Client.js +197 -0
- package/dist/cjs/api/resources/pods/resources/accounts/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/pods/resources/accounts/client/index.js +17 -0
- package/dist/cjs/api/resources/pods/resources/accounts/client/requests/ListAccountsRequest.d.ts +10 -0
- package/dist/cjs/api/resources/pods/resources/accounts/client/requests/ListAccountsRequest.js +3 -0
- package/dist/cjs/api/resources/pods/resources/accounts/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/pods/resources/accounts/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/pods/resources/accounts/exports.d.ts +2 -0
- package/dist/cjs/api/resources/pods/resources/accounts/exports.js +21 -0
- package/dist/cjs/api/resources/pods/resources/accounts/index.d.ts +1 -0
- package/dist/cjs/api/resources/pods/resources/accounts/index.js +17 -0
- package/dist/cjs/api/resources/pods/resources/index.d.ts +2 -0
- package/dist/cjs/api/resources/pods/resources/index.js +3 -1
- package/dist/cjs/api/resources/webhooks/types/CreateWebhookRequest.d.ts +4 -0
- package/dist/cjs/api/resources/webhooks/types/UpdatePodWebhookRequest.d.ts +5 -1
- package/dist/cjs/serialization/resources/accounts/types/Account.d.ts +3 -0
- package/dist/cjs/serialization/resources/accounts/types/Account.js +3 -0
- package/dist/cjs/serialization/resources/accounts/types/AccountStatus.d.ts +7 -0
- package/dist/cjs/serialization/resources/accounts/types/AccountStatus.js +39 -0
- package/dist/cjs/serialization/resources/accounts/types/UpdateAccountRequest.d.ts +10 -0
- package/dist/cjs/serialization/resources/accounts/types/UpdateAccountRequest.js +42 -0
- package/dist/cjs/serialization/resources/accounts/types/UpdateAccountStatus.d.ts +7 -0
- package/dist/cjs/serialization/resources/accounts/types/UpdateAccountStatus.js +39 -0
- package/dist/cjs/serialization/resources/accounts/types/index.d.ts +3 -0
- package/dist/cjs/serialization/resources/accounts/types/index.js +3 -0
- package/dist/cjs/serialization/resources/apiKeys/types/ApiKeyPermissions.d.ts +1 -0
- package/dist/cjs/serialization/resources/apiKeys/types/ApiKeyPermissions.js +1 -0
- package/dist/cjs/serialization/resources/inboxes/types/AuthorizeInboxResponse.d.ts +11 -0
- package/dist/cjs/serialization/resources/inboxes/types/AuthorizeInboxResponse.js +43 -0
- package/dist/cjs/serialization/resources/inboxes/types/index.d.ts +1 -0
- package/dist/cjs/serialization/resources/inboxes/types/index.js +1 -0
- 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/accounts/client/Client.d.mts +38 -1
- package/dist/esm/api/resources/accounts/client/Client.mjs +111 -1
- package/dist/esm/api/resources/accounts/types/Account.d.mts +4 -0
- package/dist/esm/api/resources/accounts/types/AccountStatus.d.mts +8 -0
- package/dist/esm/api/resources/accounts/types/AccountStatus.mjs +8 -0
- package/dist/esm/api/resources/accounts/types/UpdateAccountRequest.d.mts +9 -0
- package/dist/esm/api/resources/accounts/types/UpdateAccountRequest.mjs +2 -0
- package/dist/esm/api/resources/accounts/types/UpdateAccountStatus.d.mts +10 -0
- package/dist/esm/api/resources/accounts/types/UpdateAccountStatus.mjs +10 -0
- package/dist/esm/api/resources/accounts/types/index.d.mts +3 -0
- package/dist/esm/api/resources/accounts/types/index.mjs +3 -0
- package/dist/esm/api/resources/apiKeys/types/ApiKeyPermissions.d.mts +5 -0
- package/dist/esm/api/resources/inboxes/client/Client.d.mts +7 -3
- package/dist/esm/api/resources/inboxes/client/Client.mjs +9 -3
- package/dist/esm/api/resources/inboxes/resources/accounts/client/Client.d.mts +42 -0
- package/dist/esm/api/resources/inboxes/resources/accounts/client/Client.mjs +160 -0
- package/dist/esm/api/resources/inboxes/resources/accounts/client/index.d.mts +1 -0
- package/dist/esm/api/resources/inboxes/resources/accounts/client/index.mjs +1 -0
- package/dist/esm/api/resources/inboxes/resources/accounts/client/requests/ListAccountsRequest.d.mts +10 -0
- package/dist/esm/api/resources/inboxes/resources/accounts/client/requests/ListAccountsRequest.mjs +2 -0
- package/dist/esm/api/resources/inboxes/resources/accounts/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/inboxes/resources/accounts/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/inboxes/resources/accounts/exports.d.mts +2 -0
- package/dist/esm/api/resources/inboxes/resources/accounts/exports.mjs +3 -0
- package/dist/esm/api/resources/inboxes/resources/accounts/index.d.mts +1 -0
- package/dist/esm/api/resources/inboxes/resources/accounts/index.mjs +1 -0
- package/dist/esm/api/resources/inboxes/resources/index.d.mts +2 -0
- package/dist/esm/api/resources/inboxes/resources/index.mjs +2 -0
- package/dist/esm/api/resources/inboxes/types/AuthorizeInboxResponse.d.mts +11 -0
- package/dist/esm/api/resources/inboxes/types/AuthorizeInboxResponse.mjs +2 -0
- package/dist/esm/api/resources/inboxes/types/index.d.mts +1 -0
- package/dist/esm/api/resources/inboxes/types/index.mjs +1 -0
- package/dist/esm/api/resources/pods/client/Client.d.mts +3 -0
- package/dist/esm/api/resources/pods/client/Client.mjs +5 -0
- package/dist/esm/api/resources/pods/resources/accounts/client/Client.d.mts +42 -0
- package/dist/esm/api/resources/pods/resources/accounts/client/Client.mjs +160 -0
- package/dist/esm/api/resources/pods/resources/accounts/client/index.d.mts +1 -0
- package/dist/esm/api/resources/pods/resources/accounts/client/index.mjs +1 -0
- package/dist/esm/api/resources/pods/resources/accounts/client/requests/ListAccountsRequest.d.mts +10 -0
- package/dist/esm/api/resources/pods/resources/accounts/client/requests/ListAccountsRequest.mjs +2 -0
- package/dist/esm/api/resources/pods/resources/accounts/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/pods/resources/accounts/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/pods/resources/accounts/exports.d.mts +2 -0
- package/dist/esm/api/resources/pods/resources/accounts/exports.mjs +3 -0
- package/dist/esm/api/resources/pods/resources/accounts/index.d.mts +1 -0
- package/dist/esm/api/resources/pods/resources/accounts/index.mjs +1 -0
- package/dist/esm/api/resources/pods/resources/index.d.mts +2 -0
- package/dist/esm/api/resources/pods/resources/index.mjs +2 -0
- package/dist/esm/api/resources/webhooks/types/CreateWebhookRequest.d.mts +4 -0
- package/dist/esm/api/resources/webhooks/types/UpdatePodWebhookRequest.d.mts +5 -1
- package/dist/esm/serialization/resources/accounts/types/Account.d.mts +3 -0
- package/dist/esm/serialization/resources/accounts/types/Account.mjs +3 -0
- package/dist/esm/serialization/resources/accounts/types/AccountStatus.d.mts +7 -0
- package/dist/esm/serialization/resources/accounts/types/AccountStatus.mjs +3 -0
- package/dist/esm/serialization/resources/accounts/types/UpdateAccountRequest.d.mts +10 -0
- package/dist/esm/serialization/resources/accounts/types/UpdateAccountRequest.mjs +6 -0
- package/dist/esm/serialization/resources/accounts/types/UpdateAccountStatus.d.mts +7 -0
- package/dist/esm/serialization/resources/accounts/types/UpdateAccountStatus.mjs +3 -0
- package/dist/esm/serialization/resources/accounts/types/index.d.mts +3 -0
- package/dist/esm/serialization/resources/accounts/types/index.mjs +3 -0
- package/dist/esm/serialization/resources/apiKeys/types/ApiKeyPermissions.d.mts +1 -0
- package/dist/esm/serialization/resources/apiKeys/types/ApiKeyPermissions.mjs +1 -0
- package/dist/esm/serialization/resources/inboxes/types/AuthorizeInboxResponse.d.mts +11 -0
- package/dist/esm/serialization/resources/inboxes/types/AuthorizeInboxResponse.mjs +7 -0
- package/dist/esm/serialization/resources/inboxes/types/index.d.mts +1 -0
- package/dist/esm/serialization/resources/inboxes/types/index.mjs +1 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/dist/llms.txt +8 -2
- package/package.json +23 -1
- package/reference.md +397 -4
package/dist/cjs/BaseClient.js
CHANGED
|
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
|
|
|
43
43
|
const headers = (0, headers_js_1.mergeHeaders)({
|
|
44
44
|
"X-Fern-Language": "JavaScript",
|
|
45
45
|
"X-Fern-SDK-Name": "agentmail",
|
|
46
|
-
"X-Fern-SDK-Version": "0.5.
|
|
47
|
-
"User-Agent": "agentmail/0.5.
|
|
46
|
+
"X-Fern-SDK-Version": "0.5.28",
|
|
47
|
+
"User-Agent": "agentmail/0.5.28",
|
|
48
48
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
49
49
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
50
50
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
@@ -11,7 +11,9 @@ export declare class AccountsClient {
|
|
|
11
11
|
protected readonly _options: NormalizedClientOptionsWithAuth<AccountsClient.Options>;
|
|
12
12
|
constructor(options?: AccountsClient.Options);
|
|
13
13
|
/**
|
|
14
|
-
* Lists accounts across all providers
|
|
14
|
+
* Lists accounts across all providers, scoped to the API key: an
|
|
15
|
+
* organization key sees every account, a pod key its pod's, an inbox key
|
|
16
|
+
* its inbox's. Requires `inbox_read`.
|
|
15
17
|
*
|
|
16
18
|
* @param {AgentMail.ListAccountsRequest} request
|
|
17
19
|
* @param {AccountsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -24,6 +26,9 @@ export declare class AccountsClient {
|
|
|
24
26
|
list(request?: AgentMail.ListAccountsRequest, requestOptions?: AccountsClient.RequestOptions): core.HttpResponsePromise<AgentMail.ListAccountsResponse>;
|
|
25
27
|
private __list;
|
|
26
28
|
/**
|
|
29
|
+
* Returns one account by ID. An account outside the key's scope is a 404.
|
|
30
|
+
* Requires `inbox_read`.
|
|
31
|
+
*
|
|
27
32
|
* @param {AgentMail.AccountId} account_id
|
|
28
33
|
* @param {AccountsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
29
34
|
*
|
|
@@ -34,4 +39,36 @@ export declare class AccountsClient {
|
|
|
34
39
|
*/
|
|
35
40
|
get(account_id: AgentMail.AccountId, requestOptions?: AccountsClient.RequestOptions): core.HttpResponsePromise<AgentMail.Account>;
|
|
36
41
|
private __get;
|
|
42
|
+
/**
|
|
43
|
+
* Updates one account. Set `status` to `disabled` to stop the inbox from
|
|
44
|
+
* signing in at the provider again, or to `enabled` to re-enable it.
|
|
45
|
+
* Idempotent: disabling an already disabled account keeps its original
|
|
46
|
+
* `disabled_at`, and enabling an enabled account is a no-op.
|
|
47
|
+
*
|
|
48
|
+
* Find the `account_id` with List Accounts. An account exists only after an
|
|
49
|
+
* inbox's first sign-in at a provider, so it cannot be disabled in advance.
|
|
50
|
+
* A disable applies to that inbox at that provider whichever sign-in key is
|
|
51
|
+
* used: the provider's next authorization ends in `access_denied`, and a code
|
|
52
|
+
* issued earlier is refused with `invalid_grant`. Access tokens already
|
|
53
|
+
* issued stay valid until they expire, and the provider's own session is
|
|
54
|
+
* unaffected.
|
|
55
|
+
*
|
|
56
|
+
* Requires `account_update`, which sign-in keys (`type: public_key`) cannot
|
|
57
|
+
* hold, so call this with a bearer API key. An account outside the key's
|
|
58
|
+
* scope is a 404. A 409 means the account changed during the write; read it
|
|
59
|
+
* again and retry.
|
|
60
|
+
*
|
|
61
|
+
* @param {AgentMail.AccountId} account_id
|
|
62
|
+
* @param {AgentMail.UpdateAccountRequest} request
|
|
63
|
+
* @param {AccountsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
64
|
+
*
|
|
65
|
+
* @throws {@link AgentMail.ValidationError}
|
|
66
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
67
|
+
* @throws {@link AgentMail.ConflictError}
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* await client.accounts.update("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", {})
|
|
71
|
+
*/
|
|
72
|
+
update(account_id: AgentMail.AccountId, request: AgentMail.UpdateAccountRequest, requestOptions?: AccountsClient.RequestOptions): core.HttpResponsePromise<AgentMail.Account>;
|
|
73
|
+
private __update;
|
|
37
74
|
}
|
|
@@ -57,7 +57,9 @@ class AccountsClient {
|
|
|
57
57
|
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
58
58
|
}
|
|
59
59
|
/**
|
|
60
|
-
* Lists accounts across all providers
|
|
60
|
+
* Lists accounts across all providers, scoped to the API key: an
|
|
61
|
+
* organization key sees every account, a pod key its pod's, an inbox key
|
|
62
|
+
* its inbox's. Requires `inbox_read`.
|
|
61
63
|
*
|
|
62
64
|
* @param {AgentMail.ListAccountsRequest} request
|
|
63
65
|
* @param {AccountsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -127,6 +129,9 @@ class AccountsClient {
|
|
|
127
129
|
});
|
|
128
130
|
}
|
|
129
131
|
/**
|
|
132
|
+
* Returns one account by ID. An account outside the key's scope is a 404.
|
|
133
|
+
* Requires `inbox_read`.
|
|
134
|
+
*
|
|
130
135
|
* @param {AgentMail.AccountId} account_id
|
|
131
136
|
* @param {AccountsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
132
137
|
*
|
|
@@ -188,5 +193,110 @@ class AccountsClient {
|
|
|
188
193
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v0/accounts/{account_id}");
|
|
189
194
|
});
|
|
190
195
|
}
|
|
196
|
+
/**
|
|
197
|
+
* Updates one account. Set `status` to `disabled` to stop the inbox from
|
|
198
|
+
* signing in at the provider again, or to `enabled` to re-enable it.
|
|
199
|
+
* Idempotent: disabling an already disabled account keeps its original
|
|
200
|
+
* `disabled_at`, and enabling an enabled account is a no-op.
|
|
201
|
+
*
|
|
202
|
+
* Find the `account_id` with List Accounts. An account exists only after an
|
|
203
|
+
* inbox's first sign-in at a provider, so it cannot be disabled in advance.
|
|
204
|
+
* A disable applies to that inbox at that provider whichever sign-in key is
|
|
205
|
+
* used: the provider's next authorization ends in `access_denied`, and a code
|
|
206
|
+
* issued earlier is refused with `invalid_grant`. Access tokens already
|
|
207
|
+
* issued stay valid until they expire, and the provider's own session is
|
|
208
|
+
* unaffected.
|
|
209
|
+
*
|
|
210
|
+
* Requires `account_update`, which sign-in keys (`type: public_key`) cannot
|
|
211
|
+
* hold, so call this with a bearer API key. An account outside the key's
|
|
212
|
+
* scope is a 404. A 409 means the account changed during the write; read it
|
|
213
|
+
* again and retry.
|
|
214
|
+
*
|
|
215
|
+
* @param {AgentMail.AccountId} account_id
|
|
216
|
+
* @param {AgentMail.UpdateAccountRequest} request
|
|
217
|
+
* @param {AccountsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
218
|
+
*
|
|
219
|
+
* @throws {@link AgentMail.ValidationError}
|
|
220
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
221
|
+
* @throws {@link AgentMail.ConflictError}
|
|
222
|
+
*
|
|
223
|
+
* @example
|
|
224
|
+
* await client.accounts.update("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", {})
|
|
225
|
+
*/
|
|
226
|
+
update(account_id, request, requestOptions) {
|
|
227
|
+
return core.HttpResponsePromise.fromPromise(this.__update(account_id, request, requestOptions));
|
|
228
|
+
}
|
|
229
|
+
__update(account_id, request, requestOptions) {
|
|
230
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
231
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
232
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
233
|
+
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);
|
|
234
|
+
const _response = yield core.fetcher({
|
|
235
|
+
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)
|
|
236
|
+
.http, `/v0/accounts/${core.url.encodePathParam(serializers.AccountId.jsonOrThrow(account_id, { omitUndefined: true }))}/update`),
|
|
237
|
+
method: "PATCH",
|
|
238
|
+
headers: _headers,
|
|
239
|
+
contentType: "application/json",
|
|
240
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
241
|
+
requestType: "json",
|
|
242
|
+
body: serializers.UpdateAccountRequest.jsonOrThrow(request, {
|
|
243
|
+
unrecognizedObjectKeys: "strip",
|
|
244
|
+
omitUndefined: true,
|
|
245
|
+
}),
|
|
246
|
+
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,
|
|
247
|
+
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,
|
|
248
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
249
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
250
|
+
logging: this._options.logging,
|
|
251
|
+
});
|
|
252
|
+
if (_response.ok) {
|
|
253
|
+
return {
|
|
254
|
+
data: serializers.Account.parseOrThrow(_response.body, {
|
|
255
|
+
unrecognizedObjectKeys: "passthrough",
|
|
256
|
+
allowUnrecognizedUnionMembers: true,
|
|
257
|
+
allowUnrecognizedEnumValues: true,
|
|
258
|
+
skipValidation: true,
|
|
259
|
+
breadcrumbsPrefix: ["response"],
|
|
260
|
+
}),
|
|
261
|
+
rawResponse: _response.rawResponse,
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
if (_response.error.reason === "status-code") {
|
|
265
|
+
switch (_response.error.statusCode) {
|
|
266
|
+
case 400:
|
|
267
|
+
throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
|
|
268
|
+
unrecognizedObjectKeys: "passthrough",
|
|
269
|
+
allowUnrecognizedUnionMembers: true,
|
|
270
|
+
allowUnrecognizedEnumValues: true,
|
|
271
|
+
skipValidation: true,
|
|
272
|
+
breadcrumbsPrefix: ["response"],
|
|
273
|
+
}), _response.rawResponse);
|
|
274
|
+
case 404:
|
|
275
|
+
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
276
|
+
unrecognizedObjectKeys: "passthrough",
|
|
277
|
+
allowUnrecognizedUnionMembers: true,
|
|
278
|
+
allowUnrecognizedEnumValues: true,
|
|
279
|
+
skipValidation: true,
|
|
280
|
+
breadcrumbsPrefix: ["response"],
|
|
281
|
+
}), _response.rawResponse);
|
|
282
|
+
case 409:
|
|
283
|
+
throw new AgentMail.ConflictError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
284
|
+
unrecognizedObjectKeys: "passthrough",
|
|
285
|
+
allowUnrecognizedUnionMembers: true,
|
|
286
|
+
allowUnrecognizedEnumValues: true,
|
|
287
|
+
skipValidation: true,
|
|
288
|
+
breadcrumbsPrefix: ["response"],
|
|
289
|
+
}), _response.rawResponse);
|
|
290
|
+
default:
|
|
291
|
+
throw new errors.AgentMailError({
|
|
292
|
+
statusCode: _response.error.statusCode,
|
|
293
|
+
body: _response.error.body,
|
|
294
|
+
rawResponse: _response.rawResponse,
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PATCH", "/v0/accounts/{account_id}/update");
|
|
299
|
+
});
|
|
300
|
+
}
|
|
191
301
|
}
|
|
192
302
|
exports.AccountsClient = AccountsClient;
|
|
@@ -16,4 +16,8 @@ export interface Account {
|
|
|
16
16
|
lastSignedInAt: Date;
|
|
17
17
|
/** Number of sign-ins at provider. */
|
|
18
18
|
signInCount: number;
|
|
19
|
+
/** Present only while the account is disabled. Absent means the inbox may sign in. */
|
|
20
|
+
status?: AgentMail.AccountStatus;
|
|
21
|
+
/** Time at which the account was disabled. Present only while `status` is `disabled`. */
|
|
22
|
+
disabledAt?: Date;
|
|
19
23
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `disabled` refuses every new sign-in for the account until it is
|
|
3
|
+
* re-enabled. Access tokens already issued are not revoked.
|
|
4
|
+
*/
|
|
5
|
+
export declare const AccountStatus: {
|
|
6
|
+
readonly Disabled: "disabled";
|
|
7
|
+
};
|
|
8
|
+
export type AccountStatus = (typeof AccountStatus)[keyof typeof AccountStatus];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.AccountStatus = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* `disabled` refuses every new sign-in for the account until it is
|
|
7
|
+
* re-enabled. Access tokens already issued are not revoked.
|
|
8
|
+
*/
|
|
9
|
+
exports.AccountStatus = {
|
|
10
|
+
Disabled: "disabled",
|
|
11
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type * as AgentMail from "../../../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Fields to change on the account. Fields you omit are left unchanged and
|
|
4
|
+
* unknown fields are rejected. Expects at least one field; today that is
|
|
5
|
+
* `status`.
|
|
6
|
+
*/
|
|
7
|
+
export interface UpdateAccountRequest {
|
|
8
|
+
status?: AgentMail.UpdateAccountStatus;
|
|
9
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Status to set. `disabled` stops the inbox from signing in at the
|
|
3
|
+
* provider; `enabled` re-enables it. An enabled account reads back with no
|
|
4
|
+
* `status`.
|
|
5
|
+
*/
|
|
6
|
+
export declare const UpdateAccountStatus: {
|
|
7
|
+
readonly Enabled: "enabled";
|
|
8
|
+
readonly Disabled: "disabled";
|
|
9
|
+
};
|
|
10
|
+
export type UpdateAccountStatus = (typeof UpdateAccountStatus)[keyof typeof UpdateAccountStatus];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.UpdateAccountStatus = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* Status to set. `disabled` stops the inbox from signing in at the
|
|
7
|
+
* provider; `enabled` re-enables it. An enabled account reads back with no
|
|
8
|
+
* `status`.
|
|
9
|
+
*/
|
|
10
|
+
exports.UpdateAccountStatus = {
|
|
11
|
+
Enabled: "enabled",
|
|
12
|
+
Disabled: "disabled",
|
|
13
|
+
};
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export * from "./Account.js";
|
|
2
2
|
export * from "./AccountId.js";
|
|
3
|
+
export * from "./AccountStatus.js";
|
|
3
4
|
export * from "./ListAccountsResponse.js";
|
|
4
5
|
export * from "./ProviderId.js";
|
|
6
|
+
export * from "./UpdateAccountRequest.js";
|
|
7
|
+
export * from "./UpdateAccountStatus.js";
|
|
@@ -16,5 +16,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./Account.js"), exports);
|
|
18
18
|
__exportStar(require("./AccountId.js"), exports);
|
|
19
|
+
__exportStar(require("./AccountStatus.js"), exports);
|
|
19
20
|
__exportStar(require("./ListAccountsResponse.js"), exports);
|
|
20
21
|
__exportStar(require("./ProviderId.js"), exports);
|
|
22
|
+
__exportStar(require("./UpdateAccountRequest.js"), exports);
|
|
23
|
+
__exportStar(require("./UpdateAccountStatus.js"), exports);
|
|
@@ -78,6 +78,11 @@ export interface ApiKeyPermissions {
|
|
|
78
78
|
* for both values.
|
|
79
79
|
*/
|
|
80
80
|
providerShareOwner?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Update accounts: disable or re-enable an inbox's sign-in at a provider. Reading accounts
|
|
83
|
+
* needs only `inbox_read`.
|
|
84
|
+
*/
|
|
85
|
+
accountUpdate?: boolean;
|
|
81
86
|
/** Read pods. */
|
|
82
87
|
podRead?: boolean;
|
|
83
88
|
/** Create pods. */
|
|
@@ -2,6 +2,7 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClie
|
|
|
2
2
|
import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.js";
|
|
3
3
|
import * as core from "../../../../core/index.js";
|
|
4
4
|
import * as AgentMail from "../../../index.js";
|
|
5
|
+
import { AccountsClient } from "../resources/accounts/client/Client.js";
|
|
5
6
|
import { ApiKeysClient } from "../resources/apiKeys/client/Client.js";
|
|
6
7
|
import { DraftsClient } from "../resources/drafts/client/Client.js";
|
|
7
8
|
import { EventsClient } from "../resources/events/client/Client.js";
|
|
@@ -25,6 +26,7 @@ export declare class InboxesClient {
|
|
|
25
26
|
protected _metrics: MetricsClient | undefined;
|
|
26
27
|
protected _events: EventsClient | undefined;
|
|
27
28
|
protected _apiKeys: ApiKeysClient | undefined;
|
|
29
|
+
protected _accounts: AccountsClient | undefined;
|
|
28
30
|
constructor(options?: InboxesClient.Options);
|
|
29
31
|
get threads(): ThreadsClient;
|
|
30
32
|
get messages(): MessagesClient;
|
|
@@ -34,6 +36,7 @@ export declare class InboxesClient {
|
|
|
34
36
|
get metrics(): MetricsClient;
|
|
35
37
|
get events(): EventsClient;
|
|
36
38
|
get apiKeys(): ApiKeysClient;
|
|
39
|
+
get accounts(): AccountsClient;
|
|
37
40
|
/**
|
|
38
41
|
* **CLI:**
|
|
39
42
|
* ```bash
|
|
@@ -137,8 +140,9 @@ export declare class InboxesClient {
|
|
|
137
140
|
private __delete;
|
|
138
141
|
/**
|
|
139
142
|
* Authorizes the AgentID sign-in a client is already waiting in, for the
|
|
140
|
-
* inbox in the path, and returns the pending public key it will
|
|
141
|
-
*
|
|
143
|
+
* inbox in the path, and returns the ID of the pending public key it will
|
|
144
|
+
* activate. Read the key with Get API Key. A repeat for the same token,
|
|
145
|
+
* inbox, and bearer returns the same key ID.
|
|
142
146
|
*
|
|
143
147
|
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
144
148
|
* @param {AgentMail.inboxes.AuthorizeInboxRequest} request
|
|
@@ -152,6 +156,6 @@ export declare class InboxesClient {
|
|
|
152
156
|
* authToken: "blackcurrant.........."
|
|
153
157
|
* })
|
|
154
158
|
*/
|
|
155
|
-
authorize(inbox_id: AgentMail.inboxes.InboxId, request: AgentMail.inboxes.AuthorizeInboxRequest, requestOptions?: InboxesClient.RequestOptions): core.HttpResponsePromise<AgentMail.
|
|
159
|
+
authorize(inbox_id: AgentMail.inboxes.InboxId, request: AgentMail.inboxes.AuthorizeInboxRequest, requestOptions?: InboxesClient.RequestOptions): core.HttpResponsePromise<AgentMail.inboxes.AuthorizeInboxResponse>;
|
|
156
160
|
private __authorize;
|
|
157
161
|
}
|
|
@@ -52,49 +52,54 @@ const handleNonStatusCodeError_js_1 = require("../../../../errors/handleNonStatu
|
|
|
52
52
|
const errors = __importStar(require("../../../../errors/index.js"));
|
|
53
53
|
const serializers = __importStar(require("../../../../serialization/index.js"));
|
|
54
54
|
const AgentMail = __importStar(require("../../../index.js"));
|
|
55
|
-
const Client_js_1 = require("../resources/
|
|
56
|
-
const Client_js_2 = require("../resources/
|
|
57
|
-
const Client_js_3 = require("../resources/
|
|
58
|
-
const Client_js_4 = require("../resources/
|
|
59
|
-
const Client_js_5 = require("../resources/
|
|
60
|
-
const Client_js_6 = require("../resources/
|
|
61
|
-
const Client_js_7 = require("../resources/
|
|
62
|
-
const Client_js_8 = require("../resources/
|
|
55
|
+
const Client_js_1 = require("../resources/accounts/client/Client.js");
|
|
56
|
+
const Client_js_2 = require("../resources/apiKeys/client/Client.js");
|
|
57
|
+
const Client_js_3 = require("../resources/drafts/client/Client.js");
|
|
58
|
+
const Client_js_4 = require("../resources/events/client/Client.js");
|
|
59
|
+
const Client_js_5 = require("../resources/lists/client/Client.js");
|
|
60
|
+
const Client_js_6 = require("../resources/messages/client/Client.js");
|
|
61
|
+
const Client_js_7 = require("../resources/metrics/client/Client.js");
|
|
62
|
+
const Client_js_8 = require("../resources/threads/client/Client.js");
|
|
63
|
+
const Client_js_9 = require("../resources/webhooks/client/Client.js");
|
|
63
64
|
class InboxesClient {
|
|
64
65
|
constructor(options = {}) {
|
|
65
66
|
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
66
67
|
}
|
|
67
68
|
get threads() {
|
|
68
69
|
var _a;
|
|
69
|
-
return ((_a = this._threads) !== null && _a !== void 0 ? _a : (this._threads = new
|
|
70
|
+
return ((_a = this._threads) !== null && _a !== void 0 ? _a : (this._threads = new Client_js_8.ThreadsClient(this._options)));
|
|
70
71
|
}
|
|
71
72
|
get messages() {
|
|
72
73
|
var _a;
|
|
73
|
-
return ((_a = this._messages) !== null && _a !== void 0 ? _a : (this._messages = new
|
|
74
|
+
return ((_a = this._messages) !== null && _a !== void 0 ? _a : (this._messages = new Client_js_6.MessagesClient(this._options)));
|
|
74
75
|
}
|
|
75
76
|
get drafts() {
|
|
76
77
|
var _a;
|
|
77
|
-
return ((_a = this._drafts) !== null && _a !== void 0 ? _a : (this._drafts = new
|
|
78
|
+
return ((_a = this._drafts) !== null && _a !== void 0 ? _a : (this._drafts = new Client_js_3.DraftsClient(this._options)));
|
|
78
79
|
}
|
|
79
80
|
get webhooks() {
|
|
80
81
|
var _a;
|
|
81
|
-
return ((_a = this._webhooks) !== null && _a !== void 0 ? _a : (this._webhooks = new
|
|
82
|
+
return ((_a = this._webhooks) !== null && _a !== void 0 ? _a : (this._webhooks = new Client_js_9.WebhooksClient(this._options)));
|
|
82
83
|
}
|
|
83
84
|
get lists() {
|
|
84
85
|
var _a;
|
|
85
|
-
return ((_a = this._lists) !== null && _a !== void 0 ? _a : (this._lists = new
|
|
86
|
+
return ((_a = this._lists) !== null && _a !== void 0 ? _a : (this._lists = new Client_js_5.ListsClient(this._options)));
|
|
86
87
|
}
|
|
87
88
|
get metrics() {
|
|
88
89
|
var _a;
|
|
89
|
-
return ((_a = this._metrics) !== null && _a !== void 0 ? _a : (this._metrics = new
|
|
90
|
+
return ((_a = this._metrics) !== null && _a !== void 0 ? _a : (this._metrics = new Client_js_7.MetricsClient(this._options)));
|
|
90
91
|
}
|
|
91
92
|
get events() {
|
|
92
93
|
var _a;
|
|
93
|
-
return ((_a = this._events) !== null && _a !== void 0 ? _a : (this._events = new
|
|
94
|
+
return ((_a = this._events) !== null && _a !== void 0 ? _a : (this._events = new Client_js_4.EventsClient(this._options)));
|
|
94
95
|
}
|
|
95
96
|
get apiKeys() {
|
|
96
97
|
var _a;
|
|
97
|
-
return ((_a = this._apiKeys) !== null && _a !== void 0 ? _a : (this._apiKeys = new
|
|
98
|
+
return ((_a = this._apiKeys) !== null && _a !== void 0 ? _a : (this._apiKeys = new Client_js_2.ApiKeysClient(this._options)));
|
|
99
|
+
}
|
|
100
|
+
get accounts() {
|
|
101
|
+
var _a;
|
|
102
|
+
return ((_a = this._accounts) !== null && _a !== void 0 ? _a : (this._accounts = new Client_js_1.AccountsClient(this._options)));
|
|
98
103
|
}
|
|
99
104
|
/**
|
|
100
105
|
* **CLI:**
|
|
@@ -525,8 +530,9 @@ class InboxesClient {
|
|
|
525
530
|
}
|
|
526
531
|
/**
|
|
527
532
|
* Authorizes the AgentID sign-in a client is already waiting in, for the
|
|
528
|
-
* inbox in the path, and returns the pending public key it will
|
|
529
|
-
*
|
|
533
|
+
* inbox in the path, and returns the ID of the pending public key it will
|
|
534
|
+
* activate. Read the key with Get API Key. A repeat for the same token,
|
|
535
|
+
* inbox, and bearer returns the same key ID.
|
|
530
536
|
*
|
|
531
537
|
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
532
538
|
* @param {AgentMail.inboxes.AuthorizeInboxRequest} request
|
|
@@ -568,7 +574,7 @@ class InboxesClient {
|
|
|
568
574
|
});
|
|
569
575
|
if (_response.ok) {
|
|
570
576
|
return {
|
|
571
|
-
data: serializers.
|
|
577
|
+
data: serializers.inboxes.AuthorizeInboxResponse.parseOrThrow(_response.body, {
|
|
572
578
|
unrecognizedObjectKeys: "passthrough",
|
|
573
579
|
allowUnrecognizedUnionMembers: true,
|
|
574
580
|
allowUnrecognizedEnumValues: true,
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../BaseClient.js";
|
|
2
|
+
import { type NormalizedClientOptionsWithAuth } from "../../../../../../BaseClient.js";
|
|
3
|
+
import * as core from "../../../../../../core/index.js";
|
|
4
|
+
import * as AgentMail from "../../../../../index.js";
|
|
5
|
+
export declare namespace AccountsClient {
|
|
6
|
+
type Options = BaseClientOptions;
|
|
7
|
+
interface RequestOptions extends BaseRequestOptions {
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export declare class AccountsClient {
|
|
11
|
+
protected readonly _options: NormalizedClientOptionsWithAuth<AccountsClient.Options>;
|
|
12
|
+
constructor(options?: AccountsClient.Options);
|
|
13
|
+
/**
|
|
14
|
+
* Lists accounts held by the inbox, across all providers. Requires `inbox_read`.
|
|
15
|
+
*
|
|
16
|
+
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
17
|
+
* @param {AgentMail.inboxes.ListAccountsRequest} request
|
|
18
|
+
* @param {AccountsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
19
|
+
*
|
|
20
|
+
* @throws {@link AgentMail.ValidationError}
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* await client.inboxes.accounts.list("inbox_id")
|
|
24
|
+
*/
|
|
25
|
+
list(inbox_id: AgentMail.inboxes.InboxId, request?: AgentMail.inboxes.ListAccountsRequest, requestOptions?: AccountsClient.RequestOptions): core.HttpResponsePromise<AgentMail.ListAccountsResponse>;
|
|
26
|
+
private __list;
|
|
27
|
+
/**
|
|
28
|
+
* Returns one account held by the inbox. An account elsewhere is a 404. Requires
|
|
29
|
+
* `inbox_read`.
|
|
30
|
+
*
|
|
31
|
+
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
32
|
+
* @param {AgentMail.AccountId} account_id
|
|
33
|
+
* @param {AccountsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
34
|
+
*
|
|
35
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* await client.inboxes.accounts.get("inbox_id", "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32")
|
|
39
|
+
*/
|
|
40
|
+
get(inbox_id: AgentMail.inboxes.InboxId, account_id: AgentMail.AccountId, requestOptions?: AccountsClient.RequestOptions): core.HttpResponsePromise<AgentMail.Account>;
|
|
41
|
+
private __get;
|
|
42
|
+
}
|