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/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.5.
|
|
10
|
-
"User-Agent": "agentmail/0.5.
|
|
9
|
+
"X-Fern-SDK-Version": "0.5.28",
|
|
10
|
+
"User-Agent": "agentmail/0.5.28",
|
|
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);
|
|
@@ -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
|
}
|
|
@@ -21,7 +21,9 @@ export class AccountsClient {
|
|
|
21
21
|
this._options = normalizeClientOptionsWithAuth(options);
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
|
-
* Lists accounts across all providers
|
|
24
|
+
* Lists accounts across all providers, scoped to the API key: an
|
|
25
|
+
* organization key sees every account, a pod key its pod's, an inbox key
|
|
26
|
+
* its inbox's. Requires `inbox_read`.
|
|
25
27
|
*
|
|
26
28
|
* @param {AgentMail.ListAccountsRequest} request
|
|
27
29
|
* @param {AccountsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -91,6 +93,9 @@ export class AccountsClient {
|
|
|
91
93
|
});
|
|
92
94
|
}
|
|
93
95
|
/**
|
|
96
|
+
* Returns one account by ID. An account outside the key's scope is a 404.
|
|
97
|
+
* Requires `inbox_read`.
|
|
98
|
+
*
|
|
94
99
|
* @param {AgentMail.AccountId} account_id
|
|
95
100
|
* @param {AccountsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
96
101
|
*
|
|
@@ -152,4 +157,109 @@ export class AccountsClient {
|
|
|
152
157
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v0/accounts/{account_id}");
|
|
153
158
|
});
|
|
154
159
|
}
|
|
160
|
+
/**
|
|
161
|
+
* Updates one account. Set `status` to `disabled` to stop the inbox from
|
|
162
|
+
* signing in at the provider again, or to `enabled` to re-enable it.
|
|
163
|
+
* Idempotent: disabling an already disabled account keeps its original
|
|
164
|
+
* `disabled_at`, and enabling an enabled account is a no-op.
|
|
165
|
+
*
|
|
166
|
+
* Find the `account_id` with List Accounts. An account exists only after an
|
|
167
|
+
* inbox's first sign-in at a provider, so it cannot be disabled in advance.
|
|
168
|
+
* A disable applies to that inbox at that provider whichever sign-in key is
|
|
169
|
+
* used: the provider's next authorization ends in `access_denied`, and a code
|
|
170
|
+
* issued earlier is refused with `invalid_grant`. Access tokens already
|
|
171
|
+
* issued stay valid until they expire, and the provider's own session is
|
|
172
|
+
* unaffected.
|
|
173
|
+
*
|
|
174
|
+
* Requires `account_update`, which sign-in keys (`type: public_key`) cannot
|
|
175
|
+
* hold, so call this with a bearer API key. An account outside the key's
|
|
176
|
+
* scope is a 404. A 409 means the account changed during the write; read it
|
|
177
|
+
* again and retry.
|
|
178
|
+
*
|
|
179
|
+
* @param {AgentMail.AccountId} account_id
|
|
180
|
+
* @param {AgentMail.UpdateAccountRequest} request
|
|
181
|
+
* @param {AccountsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
182
|
+
*
|
|
183
|
+
* @throws {@link AgentMail.ValidationError}
|
|
184
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
185
|
+
* @throws {@link AgentMail.ConflictError}
|
|
186
|
+
*
|
|
187
|
+
* @example
|
|
188
|
+
* await client.accounts.update("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", {})
|
|
189
|
+
*/
|
|
190
|
+
update(account_id, request, requestOptions) {
|
|
191
|
+
return core.HttpResponsePromise.fromPromise(this.__update(account_id, request, requestOptions));
|
|
192
|
+
}
|
|
193
|
+
__update(account_id, request, requestOptions) {
|
|
194
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
195
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
196
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
197
|
+
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);
|
|
198
|
+
const _response = yield core.fetcher({
|
|
199
|
+
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)
|
|
200
|
+
.http, `/v0/accounts/${core.url.encodePathParam(serializers.AccountId.jsonOrThrow(account_id, { omitUndefined: true }))}/update`),
|
|
201
|
+
method: "PATCH",
|
|
202
|
+
headers: _headers,
|
|
203
|
+
contentType: "application/json",
|
|
204
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
205
|
+
requestType: "json",
|
|
206
|
+
body: serializers.UpdateAccountRequest.jsonOrThrow(request, {
|
|
207
|
+
unrecognizedObjectKeys: "strip",
|
|
208
|
+
omitUndefined: true,
|
|
209
|
+
}),
|
|
210
|
+
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,
|
|
211
|
+
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,
|
|
212
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
213
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
214
|
+
logging: this._options.logging,
|
|
215
|
+
});
|
|
216
|
+
if (_response.ok) {
|
|
217
|
+
return {
|
|
218
|
+
data: serializers.Account.parseOrThrow(_response.body, {
|
|
219
|
+
unrecognizedObjectKeys: "passthrough",
|
|
220
|
+
allowUnrecognizedUnionMembers: true,
|
|
221
|
+
allowUnrecognizedEnumValues: true,
|
|
222
|
+
skipValidation: true,
|
|
223
|
+
breadcrumbsPrefix: ["response"],
|
|
224
|
+
}),
|
|
225
|
+
rawResponse: _response.rawResponse,
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
if (_response.error.reason === "status-code") {
|
|
229
|
+
switch (_response.error.statusCode) {
|
|
230
|
+
case 400:
|
|
231
|
+
throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
|
|
232
|
+
unrecognizedObjectKeys: "passthrough",
|
|
233
|
+
allowUnrecognizedUnionMembers: true,
|
|
234
|
+
allowUnrecognizedEnumValues: true,
|
|
235
|
+
skipValidation: true,
|
|
236
|
+
breadcrumbsPrefix: ["response"],
|
|
237
|
+
}), _response.rawResponse);
|
|
238
|
+
case 404:
|
|
239
|
+
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
240
|
+
unrecognizedObjectKeys: "passthrough",
|
|
241
|
+
allowUnrecognizedUnionMembers: true,
|
|
242
|
+
allowUnrecognizedEnumValues: true,
|
|
243
|
+
skipValidation: true,
|
|
244
|
+
breadcrumbsPrefix: ["response"],
|
|
245
|
+
}), _response.rawResponse);
|
|
246
|
+
case 409:
|
|
247
|
+
throw new AgentMail.ConflictError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
248
|
+
unrecognizedObjectKeys: "passthrough",
|
|
249
|
+
allowUnrecognizedUnionMembers: true,
|
|
250
|
+
allowUnrecognizedEnumValues: true,
|
|
251
|
+
skipValidation: true,
|
|
252
|
+
breadcrumbsPrefix: ["response"],
|
|
253
|
+
}), _response.rawResponse);
|
|
254
|
+
default:
|
|
255
|
+
throw new errors.AgentMailError({
|
|
256
|
+
statusCode: _response.error.statusCode,
|
|
257
|
+
body: _response.error.body,
|
|
258
|
+
rawResponse: _response.rawResponse,
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PATCH", "/v0/accounts/{account_id}/update");
|
|
263
|
+
});
|
|
264
|
+
}
|
|
155
265
|
}
|
|
@@ -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,8 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
/**
|
|
3
|
+
* `disabled` refuses every new sign-in for the account until it is
|
|
4
|
+
* re-enabled. Access tokens already issued are not revoked.
|
|
5
|
+
*/
|
|
6
|
+
export const AccountStatus = {
|
|
7
|
+
Disabled: "disabled",
|
|
8
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type * as AgentMail from "../../../index.mjs";
|
|
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,10 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
/**
|
|
3
|
+
* Status to set. `disabled` stops the inbox from signing in at the
|
|
4
|
+
* provider; `enabled` re-enables it. An enabled account reads back with no
|
|
5
|
+
* `status`.
|
|
6
|
+
*/
|
|
7
|
+
export const UpdateAccountStatus = {
|
|
8
|
+
Enabled: "enabled",
|
|
9
|
+
Disabled: "disabled",
|
|
10
|
+
};
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export * from "./Account.mjs";
|
|
2
2
|
export * from "./AccountId.mjs";
|
|
3
|
+
export * from "./AccountStatus.mjs";
|
|
3
4
|
export * from "./ListAccountsResponse.mjs";
|
|
4
5
|
export * from "./ProviderId.mjs";
|
|
6
|
+
export * from "./UpdateAccountRequest.mjs";
|
|
7
|
+
export * from "./UpdateAccountStatus.mjs";
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export * from "./Account.mjs";
|
|
2
2
|
export * from "./AccountId.mjs";
|
|
3
|
+
export * from "./AccountStatus.mjs";
|
|
3
4
|
export * from "./ListAccountsResponse.mjs";
|
|
4
5
|
export * from "./ProviderId.mjs";
|
|
6
|
+
export * from "./UpdateAccountRequest.mjs";
|
|
7
|
+
export * from "./UpdateAccountStatus.mjs";
|
|
@@ -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.mjs";
|
|
3
3
|
import * as core from "../../../../core/index.mjs";
|
|
4
4
|
import * as AgentMail from "../../../index.mjs";
|
|
5
|
+
import { AccountsClient } from "../resources/accounts/client/Client.mjs";
|
|
5
6
|
import { ApiKeysClient } from "../resources/apiKeys/client/Client.mjs";
|
|
6
7
|
import { DraftsClient } from "../resources/drafts/client/Client.mjs";
|
|
7
8
|
import { EventsClient } from "../resources/events/client/Client.mjs";
|
|
@@ -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
|
}
|
|
@@ -16,6 +16,7 @@ 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 { AccountsClient } from "../resources/accounts/client/Client.mjs";
|
|
19
20
|
import { ApiKeysClient } from "../resources/apiKeys/client/Client.mjs";
|
|
20
21
|
import { DraftsClient } from "../resources/drafts/client/Client.mjs";
|
|
21
22
|
import { EventsClient } from "../resources/events/client/Client.mjs";
|
|
@@ -60,6 +61,10 @@ export class InboxesClient {
|
|
|
60
61
|
var _a;
|
|
61
62
|
return ((_a = this._apiKeys) !== null && _a !== void 0 ? _a : (this._apiKeys = new ApiKeysClient(this._options)));
|
|
62
63
|
}
|
|
64
|
+
get accounts() {
|
|
65
|
+
var _a;
|
|
66
|
+
return ((_a = this._accounts) !== null && _a !== void 0 ? _a : (this._accounts = new AccountsClient(this._options)));
|
|
67
|
+
}
|
|
63
68
|
/**
|
|
64
69
|
* **CLI:**
|
|
65
70
|
* ```bash
|
|
@@ -489,8 +494,9 @@ export class InboxesClient {
|
|
|
489
494
|
}
|
|
490
495
|
/**
|
|
491
496
|
* Authorizes the AgentID sign-in a client is already waiting in, for the
|
|
492
|
-
* inbox in the path, and returns the pending public key it will
|
|
493
|
-
*
|
|
497
|
+
* inbox in the path, and returns the ID of the pending public key it will
|
|
498
|
+
* activate. Read the key with Get API Key. A repeat for the same token,
|
|
499
|
+
* inbox, and bearer returns the same key ID.
|
|
494
500
|
*
|
|
495
501
|
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
496
502
|
* @param {AgentMail.inboxes.AuthorizeInboxRequest} request
|
|
@@ -532,7 +538,7 @@ export class InboxesClient {
|
|
|
532
538
|
});
|
|
533
539
|
if (_response.ok) {
|
|
534
540
|
return {
|
|
535
|
-
data: serializers.
|
|
541
|
+
data: serializers.inboxes.AuthorizeInboxResponse.parseOrThrow(_response.body, {
|
|
536
542
|
unrecognizedObjectKeys: "passthrough",
|
|
537
543
|
allowUnrecognizedUnionMembers: true,
|
|
538
544
|
allowUnrecognizedEnumValues: true,
|
|
@@ -0,0 +1,42 @@
|
|
|
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 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
|
+
}
|
|
@@ -0,0 +1,160 @@
|
|
|
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 AccountsClient {
|
|
20
|
+
constructor(options = {}) {
|
|
21
|
+
this._options = normalizeClientOptionsWithAuth(options);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Lists accounts held by the inbox, across all providers. Requires `inbox_read`.
|
|
25
|
+
*
|
|
26
|
+
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
27
|
+
* @param {AgentMail.inboxes.ListAccountsRequest} request
|
|
28
|
+
* @param {AccountsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
29
|
+
*
|
|
30
|
+
* @throws {@link AgentMail.ValidationError}
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* await client.inboxes.accounts.list("inbox_id")
|
|
34
|
+
*/
|
|
35
|
+
list(inbox_id, request = {}, requestOptions) {
|
|
36
|
+
return core.HttpResponsePromise.fromPromise(this.__list(inbox_id, request, requestOptions));
|
|
37
|
+
}
|
|
38
|
+
__list(inbox_id_1) {
|
|
39
|
+
return __awaiter(this, arguments, void 0, function* (inbox_id, request = {}, requestOptions) {
|
|
40
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
41
|
+
const { limit, pageToken, ascending } = request;
|
|
42
|
+
const _queryParams = {
|
|
43
|
+
limit,
|
|
44
|
+
page_token: pageToken,
|
|
45
|
+
ascending,
|
|
46
|
+
};
|
|
47
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
48
|
+
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);
|
|
49
|
+
const _response = yield core.fetcher({
|
|
50
|
+
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)
|
|
51
|
+
.http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/accounts`),
|
|
52
|
+
method: "GET",
|
|
53
|
+
headers: _headers,
|
|
54
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
55
|
+
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,
|
|
56
|
+
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,
|
|
57
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
58
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
59
|
+
logging: this._options.logging,
|
|
60
|
+
});
|
|
61
|
+
if (_response.ok) {
|
|
62
|
+
return {
|
|
63
|
+
data: serializers.ListAccountsResponse.parseOrThrow(_response.body, {
|
|
64
|
+
unrecognizedObjectKeys: "passthrough",
|
|
65
|
+
allowUnrecognizedUnionMembers: true,
|
|
66
|
+
allowUnrecognizedEnumValues: true,
|
|
67
|
+
skipValidation: true,
|
|
68
|
+
breadcrumbsPrefix: ["response"],
|
|
69
|
+
}),
|
|
70
|
+
rawResponse: _response.rawResponse,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
if (_response.error.reason === "status-code") {
|
|
74
|
+
switch (_response.error.statusCode) {
|
|
75
|
+
case 400:
|
|
76
|
+
throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
|
|
77
|
+
unrecognizedObjectKeys: "passthrough",
|
|
78
|
+
allowUnrecognizedUnionMembers: true,
|
|
79
|
+
allowUnrecognizedEnumValues: true,
|
|
80
|
+
skipValidation: true,
|
|
81
|
+
breadcrumbsPrefix: ["response"],
|
|
82
|
+
}), _response.rawResponse);
|
|
83
|
+
default:
|
|
84
|
+
throw new errors.AgentMailError({
|
|
85
|
+
statusCode: _response.error.statusCode,
|
|
86
|
+
body: _response.error.body,
|
|
87
|
+
rawResponse: _response.rawResponse,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v0/inboxes/{inbox_id}/accounts");
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Returns one account held by the inbox. An account elsewhere is a 404. Requires
|
|
96
|
+
* `inbox_read`.
|
|
97
|
+
*
|
|
98
|
+
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
99
|
+
* @param {AgentMail.AccountId} account_id
|
|
100
|
+
* @param {AccountsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
101
|
+
*
|
|
102
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* await client.inboxes.accounts.get("inbox_id", "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32")
|
|
106
|
+
*/
|
|
107
|
+
get(inbox_id, account_id, requestOptions) {
|
|
108
|
+
return core.HttpResponsePromise.fromPromise(this.__get(inbox_id, account_id, requestOptions));
|
|
109
|
+
}
|
|
110
|
+
__get(inbox_id, account_id, requestOptions) {
|
|
111
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
112
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
113
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
114
|
+
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);
|
|
115
|
+
const _response = yield core.fetcher({
|
|
116
|
+
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)
|
|
117
|
+
.http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/accounts/${core.url.encodePathParam(serializers.AccountId.jsonOrThrow(account_id, { omitUndefined: true }))}`),
|
|
118
|
+
method: "GET",
|
|
119
|
+
headers: _headers,
|
|
120
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
121
|
+
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,
|
|
122
|
+
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,
|
|
123
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
124
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
125
|
+
logging: this._options.logging,
|
|
126
|
+
});
|
|
127
|
+
if (_response.ok) {
|
|
128
|
+
return {
|
|
129
|
+
data: serializers.Account.parseOrThrow(_response.body, {
|
|
130
|
+
unrecognizedObjectKeys: "passthrough",
|
|
131
|
+
allowUnrecognizedUnionMembers: true,
|
|
132
|
+
allowUnrecognizedEnumValues: true,
|
|
133
|
+
skipValidation: true,
|
|
134
|
+
breadcrumbsPrefix: ["response"],
|
|
135
|
+
}),
|
|
136
|
+
rawResponse: _response.rawResponse,
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
if (_response.error.reason === "status-code") {
|
|
140
|
+
switch (_response.error.statusCode) {
|
|
141
|
+
case 404:
|
|
142
|
+
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
143
|
+
unrecognizedObjectKeys: "passthrough",
|
|
144
|
+
allowUnrecognizedUnionMembers: true,
|
|
145
|
+
allowUnrecognizedEnumValues: true,
|
|
146
|
+
skipValidation: true,
|
|
147
|
+
breadcrumbsPrefix: ["response"],
|
|
148
|
+
}), _response.rawResponse);
|
|
149
|
+
default:
|
|
150
|
+
throw new errors.AgentMailError({
|
|
151
|
+
statusCode: _response.error.statusCode,
|
|
152
|
+
body: _response.error.body,
|
|
153
|
+
rawResponse: _response.rawResponse,
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v0/inboxes/{inbox_id}/accounts/{account_id}");
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests/index.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests/index.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { ListAccountsRequest } from "./ListAccountsRequest.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./client/index.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./client/index.mjs";
|