agentmail 0.5.29 → 0.5.31
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/agent/client/Client.d.ts +32 -2
- package/dist/cjs/api/resources/agent/client/Client.js +97 -2
- package/dist/cjs/api/resources/agent/types/AgentAttachHumanRequest.d.ts +7 -0
- package/dist/cjs/api/resources/agent/types/AgentAttachHumanRequest.js +3 -0
- package/dist/cjs/api/resources/agent/types/AgentAttachHumanResponse.d.ts +9 -0
- package/dist/cjs/api/resources/agent/types/AgentAttachHumanResponse.js +3 -0
- package/dist/cjs/api/resources/agent/types/AgentSignupRequest.d.ts +5 -2
- package/dist/cjs/api/resources/agent/types/index.d.ts +2 -0
- package/dist/cjs/api/resources/agent/types/index.js +2 -0
- package/dist/cjs/api/resources/apiKeys/types/ApiKeyPermissions.d.ts +2 -0
- package/dist/cjs/api/resources/inboxes/resources/metrics/client/Client.d.ts +28 -0
- package/dist/cjs/api/resources/inboxes/resources/metrics/client/Client.js +98 -0
- package/dist/cjs/api/resources/inboxes/resources/metrics/client/requests/QueryRatesRequest.d.ts +14 -0
- package/dist/cjs/api/resources/inboxes/resources/metrics/client/requests/QueryRatesRequest.js +3 -0
- package/dist/cjs/api/resources/inboxes/resources/metrics/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/metrics/client/Client.d.ts +28 -0
- package/dist/cjs/api/resources/metrics/client/Client.js +98 -0
- package/dist/cjs/api/resources/metrics/client/requests/QueryRatesRequest.d.ts +14 -0
- package/dist/cjs/api/resources/metrics/client/requests/QueryRatesRequest.js +3 -0
- package/dist/cjs/api/resources/metrics/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/metrics/types/QueryRatesResponse.d.ts +5 -0
- package/dist/cjs/api/resources/metrics/types/QueryRatesResponse.js +3 -0
- package/dist/cjs/api/resources/metrics/types/RatePeriod.d.ts +5 -0
- package/dist/cjs/api/resources/metrics/types/RatePeriod.js +3 -0
- package/dist/cjs/api/resources/metrics/types/RatePoint.d.ts +12 -0
- package/dist/cjs/api/resources/metrics/types/RatePoint.js +3 -0
- package/dist/cjs/api/resources/metrics/types/RateType.d.ts +10 -0
- package/dist/cjs/api/resources/metrics/types/RateType.js +13 -0
- package/dist/cjs/api/resources/metrics/types/RateTypes.d.ts +5 -0
- package/dist/cjs/api/resources/metrics/types/RateTypes.js +3 -0
- package/dist/cjs/api/resources/metrics/types/Window.d.ts +6 -0
- package/dist/cjs/api/resources/metrics/types/Window.js +3 -0
- package/dist/cjs/api/resources/metrics/types/index.d.ts +6 -0
- package/dist/cjs/api/resources/metrics/types/index.js +6 -0
- package/dist/cjs/api/resources/pods/resources/metrics/client/Client.d.ts +28 -0
- package/dist/cjs/api/resources/pods/resources/metrics/client/Client.js +98 -0
- package/dist/cjs/api/resources/pods/resources/metrics/client/requests/QueryRatesRequest.d.ts +14 -0
- package/dist/cjs/api/resources/pods/resources/metrics/client/requests/QueryRatesRequest.js +3 -0
- package/dist/cjs/api/resources/pods/resources/metrics/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/webhooks/types/UpdateInboxWebhookRequest.d.ts +10 -1
- package/dist/cjs/api/resources/webhooks/types/UpdatePodWebhookRequest.d.ts +2 -2
- package/dist/cjs/serialization/resources/agent/types/AgentAttachHumanRequest.d.ts +9 -0
- package/dist/cjs/serialization/resources/agent/types/AgentAttachHumanRequest.js +41 -0
- package/dist/cjs/serialization/resources/agent/types/AgentAttachHumanResponse.d.ts +10 -0
- package/dist/cjs/serialization/resources/agent/types/AgentAttachHumanResponse.js +42 -0
- package/dist/cjs/serialization/resources/agent/types/AgentSignupRequest.d.ts +1 -1
- package/dist/cjs/serialization/resources/agent/types/AgentSignupRequest.js +1 -1
- package/dist/cjs/serialization/resources/agent/types/index.d.ts +2 -0
- package/dist/cjs/serialization/resources/agent/types/index.js +2 -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/metrics/types/QueryRatesResponse.d.ts +9 -0
- package/dist/cjs/serialization/resources/metrics/types/QueryRatesResponse.js +41 -0
- package/dist/cjs/serialization/resources/metrics/types/RatePeriod.d.ts +7 -0
- package/dist/cjs/serialization/resources/metrics/types/RatePeriod.js +39 -0
- package/dist/cjs/serialization/resources/metrics/types/RatePoint.d.ts +11 -0
- package/dist/cjs/serialization/resources/metrics/types/RatePoint.js +43 -0
- package/dist/cjs/serialization/resources/metrics/types/RateType.d.ts +7 -0
- package/dist/cjs/serialization/resources/metrics/types/RateType.js +39 -0
- package/dist/cjs/serialization/resources/metrics/types/RateTypes.d.ts +8 -0
- package/dist/cjs/serialization/resources/metrics/types/RateTypes.js +40 -0
- package/dist/cjs/serialization/resources/metrics/types/Window.d.ts +7 -0
- package/dist/cjs/serialization/resources/metrics/types/Window.js +39 -0
- package/dist/cjs/serialization/resources/metrics/types/index.d.ts +6 -0
- package/dist/cjs/serialization/resources/metrics/types/index.js +6 -0
- package/dist/cjs/serialization/resources/webhooks/types/UpdateInboxWebhookRequest.d.ts +1 -0
- package/dist/cjs/serialization/resources/webhooks/types/UpdateInboxWebhookRequest.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/agent/client/Client.d.mts +32 -2
- package/dist/esm/api/resources/agent/client/Client.mjs +97 -2
- package/dist/esm/api/resources/agent/types/AgentAttachHumanRequest.d.mts +7 -0
- package/dist/esm/api/resources/agent/types/AgentAttachHumanRequest.mjs +2 -0
- package/dist/esm/api/resources/agent/types/AgentAttachHumanResponse.d.mts +9 -0
- package/dist/esm/api/resources/agent/types/AgentAttachHumanResponse.mjs +2 -0
- package/dist/esm/api/resources/agent/types/AgentSignupRequest.d.mts +5 -2
- package/dist/esm/api/resources/agent/types/index.d.mts +2 -0
- package/dist/esm/api/resources/agent/types/index.mjs +2 -0
- package/dist/esm/api/resources/apiKeys/types/ApiKeyPermissions.d.mts +2 -0
- package/dist/esm/api/resources/inboxes/resources/metrics/client/Client.d.mts +28 -0
- package/dist/esm/api/resources/inboxes/resources/metrics/client/Client.mjs +98 -0
- package/dist/esm/api/resources/inboxes/resources/metrics/client/requests/QueryRatesRequest.d.mts +14 -0
- package/dist/esm/api/resources/inboxes/resources/metrics/client/requests/QueryRatesRequest.mjs +2 -0
- package/dist/esm/api/resources/inboxes/resources/metrics/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/metrics/client/Client.d.mts +28 -0
- package/dist/esm/api/resources/metrics/client/Client.mjs +98 -0
- package/dist/esm/api/resources/metrics/client/requests/QueryRatesRequest.d.mts +14 -0
- package/dist/esm/api/resources/metrics/client/requests/QueryRatesRequest.mjs +2 -0
- package/dist/esm/api/resources/metrics/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/metrics/types/QueryRatesResponse.d.mts +5 -0
- package/dist/esm/api/resources/metrics/types/QueryRatesResponse.mjs +2 -0
- package/dist/esm/api/resources/metrics/types/RatePeriod.d.mts +5 -0
- package/dist/esm/api/resources/metrics/types/RatePeriod.mjs +2 -0
- package/dist/esm/api/resources/metrics/types/RatePoint.d.mts +12 -0
- package/dist/esm/api/resources/metrics/types/RatePoint.mjs +2 -0
- package/dist/esm/api/resources/metrics/types/RateType.d.mts +10 -0
- package/dist/esm/api/resources/metrics/types/RateType.mjs +10 -0
- package/dist/esm/api/resources/metrics/types/RateTypes.d.mts +5 -0
- package/dist/esm/api/resources/metrics/types/RateTypes.mjs +2 -0
- package/dist/esm/api/resources/metrics/types/Window.d.mts +6 -0
- package/dist/esm/api/resources/metrics/types/Window.mjs +2 -0
- package/dist/esm/api/resources/metrics/types/index.d.mts +6 -0
- package/dist/esm/api/resources/metrics/types/index.mjs +6 -0
- package/dist/esm/api/resources/pods/resources/metrics/client/Client.d.mts +28 -0
- package/dist/esm/api/resources/pods/resources/metrics/client/Client.mjs +98 -0
- package/dist/esm/api/resources/pods/resources/metrics/client/requests/QueryRatesRequest.d.mts +14 -0
- package/dist/esm/api/resources/pods/resources/metrics/client/requests/QueryRatesRequest.mjs +2 -0
- package/dist/esm/api/resources/pods/resources/metrics/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/webhooks/types/UpdateInboxWebhookRequest.d.mts +10 -1
- package/dist/esm/api/resources/webhooks/types/UpdatePodWebhookRequest.d.mts +2 -2
- package/dist/esm/serialization/resources/agent/types/AgentAttachHumanRequest.d.mts +9 -0
- package/dist/esm/serialization/resources/agent/types/AgentAttachHumanRequest.mjs +5 -0
- package/dist/esm/serialization/resources/agent/types/AgentAttachHumanResponse.d.mts +10 -0
- package/dist/esm/serialization/resources/agent/types/AgentAttachHumanResponse.mjs +6 -0
- package/dist/esm/serialization/resources/agent/types/AgentSignupRequest.d.mts +1 -1
- package/dist/esm/serialization/resources/agent/types/AgentSignupRequest.mjs +1 -1
- package/dist/esm/serialization/resources/agent/types/index.d.mts +2 -0
- package/dist/esm/serialization/resources/agent/types/index.mjs +2 -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/metrics/types/QueryRatesResponse.d.mts +9 -0
- package/dist/esm/serialization/resources/metrics/types/QueryRatesResponse.mjs +5 -0
- package/dist/esm/serialization/resources/metrics/types/RatePeriod.d.mts +7 -0
- package/dist/esm/serialization/resources/metrics/types/RatePeriod.mjs +3 -0
- package/dist/esm/serialization/resources/metrics/types/RatePoint.d.mts +11 -0
- package/dist/esm/serialization/resources/metrics/types/RatePoint.mjs +7 -0
- package/dist/esm/serialization/resources/metrics/types/RateType.d.mts +7 -0
- package/dist/esm/serialization/resources/metrics/types/RateType.mjs +3 -0
- package/dist/esm/serialization/resources/metrics/types/RateTypes.d.mts +8 -0
- package/dist/esm/serialization/resources/metrics/types/RateTypes.mjs +4 -0
- package/dist/esm/serialization/resources/metrics/types/Window.d.mts +7 -0
- package/dist/esm/serialization/resources/metrics/types/Window.mjs +3 -0
- package/dist/esm/serialization/resources/metrics/types/index.d.mts +6 -0
- package/dist/esm/serialization/resources/metrics/types/index.mjs +6 -0
- package/dist/esm/serialization/resources/webhooks/types/UpdateInboxWebhookRequest.d.mts +1 -0
- package/dist/esm/serialization/resources/webhooks/types/UpdateInboxWebhookRequest.mjs +1 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/dist/llms.txt +6 -1
- package/package.json +1 -1
- package/reference.md +329 -2
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.31",
|
|
47
|
+
"User-Agent": "agentmail/0.5.31",
|
|
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);
|
|
@@ -15,6 +15,8 @@ export declare class AgentClient {
|
|
|
15
15
|
*
|
|
16
16
|
* A 6-digit OTP is sent to the human's email for verification.
|
|
17
17
|
*
|
|
18
|
+
* `human_email` is optional. Without it, the inbox can receive email but cannot send to anyone until a human is attached with the attach human endpoint. There is also no way to recover the API key, so store it durably. Calling sign-up again without `human_email` creates a new organization, which needs a different `username`: the original username stays with the lost organization's inbox.
|
|
19
|
+
*
|
|
18
20
|
* This endpoint is idempotent. Calling it again with the same `human_email` will rotate the API key and resend the OTP if expired.
|
|
19
21
|
*
|
|
20
22
|
* The returned API key has limited permissions until the organization is verified via the verify endpoint.
|
|
@@ -31,18 +33,46 @@ export declare class AgentClient {
|
|
|
31
33
|
*
|
|
32
34
|
* @example
|
|
33
35
|
* await client.agent.signUp({
|
|
34
|
-
* humanEmail: "human_email",
|
|
35
36
|
* username: "username"
|
|
36
37
|
* })
|
|
37
38
|
*/
|
|
38
39
|
signUp(request: AgentMail.AgentSignupRequest, requestOptions?: AgentClient.RequestOptions): core.HttpResponsePromise<AgentMail.AgentSignupResponse>;
|
|
39
40
|
private __signUp;
|
|
41
|
+
/**
|
|
42
|
+
* Attach a human to an unverified agent organization. A 6-digit OTP is sent to the human's email, which you then submit to the verify endpoint.
|
|
43
|
+
*
|
|
44
|
+
* Use it after signing up without a `human_email`. Once the human is attached, the organization can send email to that human only, and verification lifts the remaining restrictions. For up to 5 minutes after attaching, sends to the human can still be rejected with a `429` daily send limit error while the API key's cached limits catch up. Wait and retry.
|
|
45
|
+
*
|
|
46
|
+
* Calling it again with the same `human_email` does not rotate the API key. It resends the OTP if it was never delivered, or issues a new one if it expired. While the current OTP is still valid, calling it again keeps that OTP and its attempt count. If all 10 attempts are used up, wait until the OTP expires, 24 hours after it was issued, then call it again for a new one.
|
|
47
|
+
*
|
|
48
|
+
* Calling it with a different `human_email` replaces the attached human and sends the new human an OTP. An organization can replace its human at most 2 times.
|
|
49
|
+
*
|
|
50
|
+
* Only available until the organization is verified.
|
|
51
|
+
*
|
|
52
|
+
* **CLI:**
|
|
53
|
+
* ```bash
|
|
54
|
+
* agentmail agent attach-human --human-email user@example.com
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* @param {AgentMail.AgentAttachHumanRequest} request
|
|
58
|
+
* @param {AgentClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
59
|
+
*
|
|
60
|
+
* @throws {@link AgentMail.ValidationError}
|
|
61
|
+
* @throws {@link AgentMail.ConflictError}
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* await client.agent.attachHuman({
|
|
65
|
+
* humanEmail: "human_email"
|
|
66
|
+
* })
|
|
67
|
+
*/
|
|
68
|
+
attachHuman(request: AgentMail.AgentAttachHumanRequest, requestOptions?: AgentClient.RequestOptions): core.HttpResponsePromise<AgentMail.AgentAttachHumanResponse>;
|
|
69
|
+
private __attachHuman;
|
|
40
70
|
/**
|
|
41
71
|
* Verify an agent organization using the 6-digit OTP sent to the human's email during sign-up.
|
|
42
72
|
*
|
|
43
73
|
* On success, the organization is upgraded from `agent_unverified` to `agent_verified`, the send allowlist is removed, and free plan entitlements are applied.
|
|
44
74
|
*
|
|
45
|
-
* The OTP expires after 24 hours and allows a maximum of 10 attempts. If you run into any difficulties receiving the OTP code, you can also create an account on [console.agentmail.to](https://console.agentmail.to) using the human email address you provided to verify your account.
|
|
75
|
+
* The OTP expires after 24 hours and allows a maximum of 10 attempts. If the OTP expired, call the attach human endpoint with the same `human_email` to get a new one without rotating the API key. Once all 10 attempts are used, even the correct OTP is rejected, and attach human keeps returning the same OTP until it expires, so wait for it to expire before asking for a new one. An organization that signed up without a `human_email` has no OTP until a human is attached. If you run into any difficulties receiving the OTP code, you can also create an account on [console.agentmail.to](https://console.agentmail.to) using the human email address you provided to verify your account.
|
|
46
76
|
*
|
|
47
77
|
* **CLI:**
|
|
48
78
|
* ```bash
|
|
@@ -61,6 +61,8 @@ class AgentClient {
|
|
|
61
61
|
*
|
|
62
62
|
* A 6-digit OTP is sent to the human's email for verification.
|
|
63
63
|
*
|
|
64
|
+
* `human_email` is optional. Without it, the inbox can receive email but cannot send to anyone until a human is attached with the attach human endpoint. There is also no way to recover the API key, so store it durably. Calling sign-up again without `human_email` creates a new organization, which needs a different `username`: the original username stays with the lost organization's inbox.
|
|
65
|
+
*
|
|
64
66
|
* This endpoint is idempotent. Calling it again with the same `human_email` will rotate the API key and resend the OTP if expired.
|
|
65
67
|
*
|
|
66
68
|
* The returned API key has limited permissions until the organization is verified via the verify endpoint.
|
|
@@ -77,7 +79,6 @@ class AgentClient {
|
|
|
77
79
|
*
|
|
78
80
|
* @example
|
|
79
81
|
* await client.agent.signUp({
|
|
80
|
-
* humanEmail: "human_email",
|
|
81
82
|
* username: "username"
|
|
82
83
|
* })
|
|
83
84
|
*/
|
|
@@ -139,12 +140,106 @@ class AgentClient {
|
|
|
139
140
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v0/agent/sign-up");
|
|
140
141
|
});
|
|
141
142
|
}
|
|
143
|
+
/**
|
|
144
|
+
* Attach a human to an unverified agent organization. A 6-digit OTP is sent to the human's email, which you then submit to the verify endpoint.
|
|
145
|
+
*
|
|
146
|
+
* Use it after signing up without a `human_email`. Once the human is attached, the organization can send email to that human only, and verification lifts the remaining restrictions. For up to 5 minutes after attaching, sends to the human can still be rejected with a `429` daily send limit error while the API key's cached limits catch up. Wait and retry.
|
|
147
|
+
*
|
|
148
|
+
* Calling it again with the same `human_email` does not rotate the API key. It resends the OTP if it was never delivered, or issues a new one if it expired. While the current OTP is still valid, calling it again keeps that OTP and its attempt count. If all 10 attempts are used up, wait until the OTP expires, 24 hours after it was issued, then call it again for a new one.
|
|
149
|
+
*
|
|
150
|
+
* Calling it with a different `human_email` replaces the attached human and sends the new human an OTP. An organization can replace its human at most 2 times.
|
|
151
|
+
*
|
|
152
|
+
* Only available until the organization is verified.
|
|
153
|
+
*
|
|
154
|
+
* **CLI:**
|
|
155
|
+
* ```bash
|
|
156
|
+
* agentmail agent attach-human --human-email user@example.com
|
|
157
|
+
* ```
|
|
158
|
+
*
|
|
159
|
+
* @param {AgentMail.AgentAttachHumanRequest} request
|
|
160
|
+
* @param {AgentClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
161
|
+
*
|
|
162
|
+
* @throws {@link AgentMail.ValidationError}
|
|
163
|
+
* @throws {@link AgentMail.ConflictError}
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
* await client.agent.attachHuman({
|
|
167
|
+
* humanEmail: "human_email"
|
|
168
|
+
* })
|
|
169
|
+
*/
|
|
170
|
+
attachHuman(request, requestOptions) {
|
|
171
|
+
return core.HttpResponsePromise.fromPromise(this.__attachHuman(request, requestOptions));
|
|
172
|
+
}
|
|
173
|
+
__attachHuman(request, requestOptions) {
|
|
174
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
175
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
176
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
177
|
+
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);
|
|
178
|
+
const _response = yield core.fetcher({
|
|
179
|
+
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)
|
|
180
|
+
.http, "/v0/agent/human"),
|
|
181
|
+
method: "POST",
|
|
182
|
+
headers: _headers,
|
|
183
|
+
contentType: "application/json",
|
|
184
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
185
|
+
requestType: "json",
|
|
186
|
+
body: serializers.AgentAttachHumanRequest.jsonOrThrow(request, {
|
|
187
|
+
unrecognizedObjectKeys: "strip",
|
|
188
|
+
omitUndefined: true,
|
|
189
|
+
}),
|
|
190
|
+
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,
|
|
191
|
+
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,
|
|
192
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
193
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
194
|
+
logging: this._options.logging,
|
|
195
|
+
});
|
|
196
|
+
if (_response.ok) {
|
|
197
|
+
return {
|
|
198
|
+
data: serializers.AgentAttachHumanResponse.parseOrThrow(_response.body, {
|
|
199
|
+
unrecognizedObjectKeys: "passthrough",
|
|
200
|
+
allowUnrecognizedUnionMembers: true,
|
|
201
|
+
allowUnrecognizedEnumValues: true,
|
|
202
|
+
skipValidation: true,
|
|
203
|
+
breadcrumbsPrefix: ["response"],
|
|
204
|
+
}),
|
|
205
|
+
rawResponse: _response.rawResponse,
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
if (_response.error.reason === "status-code") {
|
|
209
|
+
switch (_response.error.statusCode) {
|
|
210
|
+
case 400:
|
|
211
|
+
throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
|
|
212
|
+
unrecognizedObjectKeys: "passthrough",
|
|
213
|
+
allowUnrecognizedUnionMembers: true,
|
|
214
|
+
allowUnrecognizedEnumValues: true,
|
|
215
|
+
skipValidation: true,
|
|
216
|
+
breadcrumbsPrefix: ["response"],
|
|
217
|
+
}), _response.rawResponse);
|
|
218
|
+
case 409:
|
|
219
|
+
throw new AgentMail.ConflictError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
220
|
+
unrecognizedObjectKeys: "passthrough",
|
|
221
|
+
allowUnrecognizedUnionMembers: true,
|
|
222
|
+
allowUnrecognizedEnumValues: true,
|
|
223
|
+
skipValidation: true,
|
|
224
|
+
breadcrumbsPrefix: ["response"],
|
|
225
|
+
}), _response.rawResponse);
|
|
226
|
+
default:
|
|
227
|
+
throw new errors.AgentMailError({
|
|
228
|
+
statusCode: _response.error.statusCode,
|
|
229
|
+
body: _response.error.body,
|
|
230
|
+
rawResponse: _response.rawResponse,
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v0/agent/human");
|
|
235
|
+
});
|
|
236
|
+
}
|
|
142
237
|
/**
|
|
143
238
|
* Verify an agent organization using the 6-digit OTP sent to the human's email during sign-up.
|
|
144
239
|
*
|
|
145
240
|
* On success, the organization is upgraded from `agent_unverified` to `agent_verified`, the send allowlist is removed, and free plan entitlements are applied.
|
|
146
241
|
*
|
|
147
|
-
* The OTP expires after 24 hours and allows a maximum of 10 attempts. If you run into any difficulties receiving the OTP code, you can also create an account on [console.agentmail.to](https://console.agentmail.to) using the human email address you provided to verify your account.
|
|
242
|
+
* The OTP expires after 24 hours and allows a maximum of 10 attempts. If the OTP expired, call the attach human endpoint with the same `human_email` to get a new one without rotating the API key. Once all 10 attempts are used, even the correct OTP is rejected, and attach human keeps returning the same OTP until it expires, so wait for it to expire before asking for a new one. An organization that signed up without a `human_email` has no OTP until a human is attached. If you run into any difficulties receiving the OTP code, you can also create an account on [console.agentmail.to](https://console.agentmail.to) using the human email address you provided to verify your account.
|
|
148
243
|
*
|
|
149
244
|
* **CLI:**
|
|
150
245
|
* ```bash
|
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
* Request body to sign up an agent.
|
|
3
3
|
*/
|
|
4
4
|
export interface AgentSignupRequest {
|
|
5
|
-
/**
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Email address of the human who owns the agent. A 6-digit OTP will be sent to this address.
|
|
7
|
+
* Omit it to get a receive-only inbox: it can receive email but cannot send until a human is attached with the attach human endpoint.
|
|
8
|
+
*/
|
|
9
|
+
humanEmail?: string;
|
|
7
10
|
/** Username for the auto-created inbox (e.g. "my-agent" creates my-agent@agentmail.to). */
|
|
8
11
|
username: string;
|
|
9
12
|
/**
|
|
@@ -14,6 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./AgentAttachHumanRequest.js"), exports);
|
|
18
|
+
__exportStar(require("./AgentAttachHumanResponse.js"), exports);
|
|
17
19
|
__exportStar(require("./AgentSignupRequest.js"), exports);
|
|
18
20
|
__exportStar(require("./AgentSignupResponse.js"), exports);
|
|
19
21
|
__exportStar(require("./AgentVerifyRequest.js"), exports);
|
|
@@ -53,4 +53,32 @@ export declare class MetricsClient {
|
|
|
53
53
|
*/
|
|
54
54
|
queryUsage(inbox_id: AgentMail.inboxes.InboxId, request?: AgentMail.inboxes.QueryUsageRequest, requestOptions?: MetricsClient.RequestOptions): core.HttpResponsePromise<AgentMail.QueryUsageResponse>;
|
|
55
55
|
private __queryUsage;
|
|
56
|
+
/**
|
|
57
|
+
* Rolling bounce and complaint rates for the inbox. At each `period`
|
|
58
|
+
* grid point, the bounced (or complained) messages over the preceding
|
|
59
|
+
* `window` divided by the messages sent over the same window, with the
|
|
60
|
+
* send count alongside. Account moderation evaluates the organization-wide
|
|
61
|
+
* rate, so use the organization endpoint to see the number it acts on;
|
|
62
|
+
* the inbox view shows which inboxes contribute. Defaults to the rolling
|
|
63
|
+
* 24-hour rate sampled hourly over the last day; `start` must be within
|
|
64
|
+
* the last 90 days, `window` must be a whole multiple of `period`, and
|
|
65
|
+
* the range plus window divided by `period` must not exceed 1000
|
|
66
|
+
* buckets.
|
|
67
|
+
*
|
|
68
|
+
* **CLI:**
|
|
69
|
+
* ```bash
|
|
70
|
+
* agentmail inboxes metrics query-rates --inbox-id <inbox_id>
|
|
71
|
+
* ```
|
|
72
|
+
*
|
|
73
|
+
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
74
|
+
* @param {AgentMail.inboxes.QueryRatesRequest} request
|
|
75
|
+
* @param {MetricsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
76
|
+
*
|
|
77
|
+
* @throws {@link AgentMail.ValidationError}
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* await client.inboxes.metrics.queryRates("inbox_id")
|
|
81
|
+
*/
|
|
82
|
+
queryRates(inbox_id: AgentMail.inboxes.InboxId, request?: AgentMail.inboxes.QueryRatesRequest, requestOptions?: MetricsClient.RequestOptions): core.HttpResponsePromise<AgentMail.QueryRatesResponse>;
|
|
83
|
+
private __queryRates;
|
|
56
84
|
}
|
|
@@ -238,5 +238,103 @@ class MetricsClient {
|
|
|
238
238
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v0/inboxes/{inbox_id}/metrics/usage");
|
|
239
239
|
});
|
|
240
240
|
}
|
|
241
|
+
/**
|
|
242
|
+
* Rolling bounce and complaint rates for the inbox. At each `period`
|
|
243
|
+
* grid point, the bounced (or complained) messages over the preceding
|
|
244
|
+
* `window` divided by the messages sent over the same window, with the
|
|
245
|
+
* send count alongside. Account moderation evaluates the organization-wide
|
|
246
|
+
* rate, so use the organization endpoint to see the number it acts on;
|
|
247
|
+
* the inbox view shows which inboxes contribute. Defaults to the rolling
|
|
248
|
+
* 24-hour rate sampled hourly over the last day; `start` must be within
|
|
249
|
+
* the last 90 days, `window` must be a whole multiple of `period`, and
|
|
250
|
+
* the range plus window divided by `period` must not exceed 1000
|
|
251
|
+
* buckets.
|
|
252
|
+
*
|
|
253
|
+
* **CLI:**
|
|
254
|
+
* ```bash
|
|
255
|
+
* agentmail inboxes metrics query-rates --inbox-id <inbox_id>
|
|
256
|
+
* ```
|
|
257
|
+
*
|
|
258
|
+
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
259
|
+
* @param {AgentMail.inboxes.QueryRatesRequest} request
|
|
260
|
+
* @param {MetricsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
261
|
+
*
|
|
262
|
+
* @throws {@link AgentMail.ValidationError}
|
|
263
|
+
*
|
|
264
|
+
* @example
|
|
265
|
+
* await client.inboxes.metrics.queryRates("inbox_id")
|
|
266
|
+
*/
|
|
267
|
+
queryRates(inbox_id, request = {}, requestOptions) {
|
|
268
|
+
return core.HttpResponsePromise.fromPromise(this.__queryRates(inbox_id, request, requestOptions));
|
|
269
|
+
}
|
|
270
|
+
__queryRates(inbox_id_1) {
|
|
271
|
+
return __awaiter(this, arguments, void 0, function* (inbox_id, request = {}, requestOptions) {
|
|
272
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
273
|
+
const { rateTypes, start, end, period, window, limit, descending } = request;
|
|
274
|
+
const _queryParams = {
|
|
275
|
+
rate_types: rateTypes != null
|
|
276
|
+
? (0, json_js_1.toJson)(serializers.RateTypes.jsonOrThrow(rateTypes, {
|
|
277
|
+
unrecognizedObjectKeys: "strip",
|
|
278
|
+
omitUndefined: true,
|
|
279
|
+
}))
|
|
280
|
+
: undefined,
|
|
281
|
+
start: start != null
|
|
282
|
+
? serializers.Start.jsonOrThrow(start, { unrecognizedObjectKeys: "strip", omitUndefined: true })
|
|
283
|
+
: undefined,
|
|
284
|
+
end: end != null
|
|
285
|
+
? serializers.End.jsonOrThrow(end, { unrecognizedObjectKeys: "strip", omitUndefined: true })
|
|
286
|
+
: undefined,
|
|
287
|
+
period,
|
|
288
|
+
window,
|
|
289
|
+
limit,
|
|
290
|
+
descending,
|
|
291
|
+
};
|
|
292
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
293
|
+
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);
|
|
294
|
+
const _response = yield core.fetcher({
|
|
295
|
+
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)
|
|
296
|
+
.http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/metrics/rates`),
|
|
297
|
+
method: "GET",
|
|
298
|
+
headers: _headers,
|
|
299
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
300
|
+
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,
|
|
301
|
+
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,
|
|
302
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
303
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
304
|
+
logging: this._options.logging,
|
|
305
|
+
});
|
|
306
|
+
if (_response.ok) {
|
|
307
|
+
return {
|
|
308
|
+
data: serializers.QueryRatesResponse.parseOrThrow(_response.body, {
|
|
309
|
+
unrecognizedObjectKeys: "passthrough",
|
|
310
|
+
allowUnrecognizedUnionMembers: true,
|
|
311
|
+
allowUnrecognizedEnumValues: true,
|
|
312
|
+
skipValidation: true,
|
|
313
|
+
breadcrumbsPrefix: ["response"],
|
|
314
|
+
}),
|
|
315
|
+
rawResponse: _response.rawResponse,
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
if (_response.error.reason === "status-code") {
|
|
319
|
+
switch (_response.error.statusCode) {
|
|
320
|
+
case 400:
|
|
321
|
+
throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
|
|
322
|
+
unrecognizedObjectKeys: "passthrough",
|
|
323
|
+
allowUnrecognizedUnionMembers: true,
|
|
324
|
+
allowUnrecognizedEnumValues: true,
|
|
325
|
+
skipValidation: true,
|
|
326
|
+
breadcrumbsPrefix: ["response"],
|
|
327
|
+
}), _response.rawResponse);
|
|
328
|
+
default:
|
|
329
|
+
throw new errors.AgentMailError({
|
|
330
|
+
statusCode: _response.error.statusCode,
|
|
331
|
+
body: _response.error.body,
|
|
332
|
+
rawResponse: _response.rawResponse,
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v0/inboxes/{inbox_id}/metrics/rates");
|
|
337
|
+
});
|
|
338
|
+
}
|
|
241
339
|
}
|
|
242
340
|
exports.MetricsClient = MetricsClient;
|
package/dist/cjs/api/resources/inboxes/resources/metrics/client/requests/QueryRatesRequest.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type * as AgentMail from "../../../../../../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* @example
|
|
4
|
+
* {}
|
|
5
|
+
*/
|
|
6
|
+
export interface QueryRatesRequest {
|
|
7
|
+
rateTypes?: AgentMail.RateTypes;
|
|
8
|
+
start?: AgentMail.Start;
|
|
9
|
+
end?: AgentMail.End;
|
|
10
|
+
period?: AgentMail.RatePeriod;
|
|
11
|
+
window?: AgentMail.Window;
|
|
12
|
+
limit?: AgentMail.MetricLimit;
|
|
13
|
+
descending?: AgentMail.Descending;
|
|
14
|
+
}
|
|
@@ -49,4 +49,32 @@ export declare class MetricsClient {
|
|
|
49
49
|
*/
|
|
50
50
|
queryUsage(request?: AgentMail.QueryUsageRequest, requestOptions?: MetricsClient.RequestOptions): core.HttpResponsePromise<AgentMail.QueryUsageResponse>;
|
|
51
51
|
private __queryUsage;
|
|
52
|
+
/**
|
|
53
|
+
* Rolling bounce and complaint rates for the organization. At each
|
|
54
|
+
* `period` grid point, the bounced (or complained) messages over the
|
|
55
|
+
* preceding `window` divided by the messages sent over the same window,
|
|
56
|
+
* with the send count alongside so you can see the volume behind
|
|
57
|
+
* it. This is the number AgentMail's account moderation acts on: a
|
|
58
|
+
* warning at a 5% bounce rate and suspension at 10%, evaluated over a
|
|
59
|
+
* rolling 24 hours once at least 1,000 messages were sent in that
|
|
60
|
+
* window. Defaults to the rolling 24-hour rate sampled hourly over the
|
|
61
|
+
* last day; `start` must be within the last 90 days, `window` must be a
|
|
62
|
+
* whole multiple of `period`, and the range plus window divided by
|
|
63
|
+
* `period` must not exceed 1000 buckets.
|
|
64
|
+
*
|
|
65
|
+
* **CLI:**
|
|
66
|
+
* ```bash
|
|
67
|
+
* agentmail metrics query-rates
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
70
|
+
* @param {AgentMail.QueryRatesRequest} request
|
|
71
|
+
* @param {MetricsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
72
|
+
*
|
|
73
|
+
* @throws {@link AgentMail.ValidationError}
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* await client.metrics.queryRates()
|
|
77
|
+
*/
|
|
78
|
+
queryRates(request?: AgentMail.QueryRatesRequest, requestOptions?: MetricsClient.RequestOptions): core.HttpResponsePromise<AgentMail.QueryRatesResponse>;
|
|
79
|
+
private __queryRates;
|
|
52
80
|
}
|
|
@@ -234,5 +234,103 @@ class MetricsClient {
|
|
|
234
234
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v0/metrics/usage");
|
|
235
235
|
});
|
|
236
236
|
}
|
|
237
|
+
/**
|
|
238
|
+
* Rolling bounce and complaint rates for the organization. At each
|
|
239
|
+
* `period` grid point, the bounced (or complained) messages over the
|
|
240
|
+
* preceding `window` divided by the messages sent over the same window,
|
|
241
|
+
* with the send count alongside so you can see the volume behind
|
|
242
|
+
* it. This is the number AgentMail's account moderation acts on: a
|
|
243
|
+
* warning at a 5% bounce rate and suspension at 10%, evaluated over a
|
|
244
|
+
* rolling 24 hours once at least 1,000 messages were sent in that
|
|
245
|
+
* window. Defaults to the rolling 24-hour rate sampled hourly over the
|
|
246
|
+
* last day; `start` must be within the last 90 days, `window` must be a
|
|
247
|
+
* whole multiple of `period`, and the range plus window divided by
|
|
248
|
+
* `period` must not exceed 1000 buckets.
|
|
249
|
+
*
|
|
250
|
+
* **CLI:**
|
|
251
|
+
* ```bash
|
|
252
|
+
* agentmail metrics query-rates
|
|
253
|
+
* ```
|
|
254
|
+
*
|
|
255
|
+
* @param {AgentMail.QueryRatesRequest} request
|
|
256
|
+
* @param {MetricsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
257
|
+
*
|
|
258
|
+
* @throws {@link AgentMail.ValidationError}
|
|
259
|
+
*
|
|
260
|
+
* @example
|
|
261
|
+
* await client.metrics.queryRates()
|
|
262
|
+
*/
|
|
263
|
+
queryRates(request = {}, requestOptions) {
|
|
264
|
+
return core.HttpResponsePromise.fromPromise(this.__queryRates(request, requestOptions));
|
|
265
|
+
}
|
|
266
|
+
__queryRates() {
|
|
267
|
+
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
268
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
269
|
+
const { rateTypes, start, end, period, window, limit, descending } = request;
|
|
270
|
+
const _queryParams = {
|
|
271
|
+
rate_types: rateTypes != null
|
|
272
|
+
? (0, json_js_1.toJson)(serializers.RateTypes.jsonOrThrow(rateTypes, {
|
|
273
|
+
unrecognizedObjectKeys: "strip",
|
|
274
|
+
omitUndefined: true,
|
|
275
|
+
}))
|
|
276
|
+
: undefined,
|
|
277
|
+
start: start != null
|
|
278
|
+
? serializers.Start.jsonOrThrow(start, { unrecognizedObjectKeys: "strip", omitUndefined: true })
|
|
279
|
+
: undefined,
|
|
280
|
+
end: end != null
|
|
281
|
+
? serializers.End.jsonOrThrow(end, { unrecognizedObjectKeys: "strip", omitUndefined: true })
|
|
282
|
+
: undefined,
|
|
283
|
+
period,
|
|
284
|
+
window,
|
|
285
|
+
limit,
|
|
286
|
+
descending,
|
|
287
|
+
};
|
|
288
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
289
|
+
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);
|
|
290
|
+
const _response = yield core.fetcher({
|
|
291
|
+
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)
|
|
292
|
+
.http, "/v0/metrics/rates"),
|
|
293
|
+
method: "GET",
|
|
294
|
+
headers: _headers,
|
|
295
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
296
|
+
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,
|
|
297
|
+
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,
|
|
298
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
299
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
300
|
+
logging: this._options.logging,
|
|
301
|
+
});
|
|
302
|
+
if (_response.ok) {
|
|
303
|
+
return {
|
|
304
|
+
data: serializers.QueryRatesResponse.parseOrThrow(_response.body, {
|
|
305
|
+
unrecognizedObjectKeys: "passthrough",
|
|
306
|
+
allowUnrecognizedUnionMembers: true,
|
|
307
|
+
allowUnrecognizedEnumValues: true,
|
|
308
|
+
skipValidation: true,
|
|
309
|
+
breadcrumbsPrefix: ["response"],
|
|
310
|
+
}),
|
|
311
|
+
rawResponse: _response.rawResponse,
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
if (_response.error.reason === "status-code") {
|
|
315
|
+
switch (_response.error.statusCode) {
|
|
316
|
+
case 400:
|
|
317
|
+
throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
|
|
318
|
+
unrecognizedObjectKeys: "passthrough",
|
|
319
|
+
allowUnrecognizedUnionMembers: true,
|
|
320
|
+
allowUnrecognizedEnumValues: true,
|
|
321
|
+
skipValidation: true,
|
|
322
|
+
breadcrumbsPrefix: ["response"],
|
|
323
|
+
}), _response.rawResponse);
|
|
324
|
+
default:
|
|
325
|
+
throw new errors.AgentMailError({
|
|
326
|
+
statusCode: _response.error.statusCode,
|
|
327
|
+
body: _response.error.body,
|
|
328
|
+
rawResponse: _response.rawResponse,
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v0/metrics/rates");
|
|
333
|
+
});
|
|
334
|
+
}
|
|
237
335
|
}
|
|
238
336
|
exports.MetricsClient = MetricsClient;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type * as AgentMail from "../../../../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* @example
|
|
4
|
+
* {}
|
|
5
|
+
*/
|
|
6
|
+
export interface QueryRatesRequest {
|
|
7
|
+
rateTypes?: AgentMail.RateTypes;
|
|
8
|
+
start?: AgentMail.Start;
|
|
9
|
+
end?: AgentMail.End;
|
|
10
|
+
period?: AgentMail.RatePeriod;
|
|
11
|
+
window?: AgentMail.Window;
|
|
12
|
+
limit?: AgentMail.MetricLimit;
|
|
13
|
+
descending?: AgentMail.Descending;
|
|
14
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface RatePoint {
|
|
2
|
+
/** End of the window the point covers; the window is the `window` seconds before it. */
|
|
3
|
+
timestamp: Date;
|
|
4
|
+
/**
|
|
5
|
+
* Bounced or complained messages divided by messages sent over the
|
|
6
|
+
* window, as a fraction (0.05 is 5%). Null when nothing was sent in
|
|
7
|
+
* the window.
|
|
8
|
+
*/
|
|
9
|
+
rate?: number;
|
|
10
|
+
/** Messages sent in the window, counted per recipient. */
|
|
11
|
+
sent: number;
|
|
12
|
+
}
|