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.
Files changed (143) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/api/resources/agent/client/Client.d.ts +32 -2
  3. package/dist/cjs/api/resources/agent/client/Client.js +97 -2
  4. package/dist/cjs/api/resources/agent/types/AgentAttachHumanRequest.d.ts +7 -0
  5. package/dist/cjs/api/resources/agent/types/AgentAttachHumanRequest.js +3 -0
  6. package/dist/cjs/api/resources/agent/types/AgentAttachHumanResponse.d.ts +9 -0
  7. package/dist/cjs/api/resources/agent/types/AgentAttachHumanResponse.js +3 -0
  8. package/dist/cjs/api/resources/agent/types/AgentSignupRequest.d.ts +5 -2
  9. package/dist/cjs/api/resources/agent/types/index.d.ts +2 -0
  10. package/dist/cjs/api/resources/agent/types/index.js +2 -0
  11. package/dist/cjs/api/resources/apiKeys/types/ApiKeyPermissions.d.ts +2 -0
  12. package/dist/cjs/api/resources/inboxes/resources/metrics/client/Client.d.ts +28 -0
  13. package/dist/cjs/api/resources/inboxes/resources/metrics/client/Client.js +98 -0
  14. package/dist/cjs/api/resources/inboxes/resources/metrics/client/requests/QueryRatesRequest.d.ts +14 -0
  15. package/dist/cjs/api/resources/inboxes/resources/metrics/client/requests/QueryRatesRequest.js +3 -0
  16. package/dist/cjs/api/resources/inboxes/resources/metrics/client/requests/index.d.ts +1 -0
  17. package/dist/cjs/api/resources/metrics/client/Client.d.ts +28 -0
  18. package/dist/cjs/api/resources/metrics/client/Client.js +98 -0
  19. package/dist/cjs/api/resources/metrics/client/requests/QueryRatesRequest.d.ts +14 -0
  20. package/dist/cjs/api/resources/metrics/client/requests/QueryRatesRequest.js +3 -0
  21. package/dist/cjs/api/resources/metrics/client/requests/index.d.ts +1 -0
  22. package/dist/cjs/api/resources/metrics/types/QueryRatesResponse.d.ts +5 -0
  23. package/dist/cjs/api/resources/metrics/types/QueryRatesResponse.js +3 -0
  24. package/dist/cjs/api/resources/metrics/types/RatePeriod.d.ts +5 -0
  25. package/dist/cjs/api/resources/metrics/types/RatePeriod.js +3 -0
  26. package/dist/cjs/api/resources/metrics/types/RatePoint.d.ts +12 -0
  27. package/dist/cjs/api/resources/metrics/types/RatePoint.js +3 -0
  28. package/dist/cjs/api/resources/metrics/types/RateType.d.ts +10 -0
  29. package/dist/cjs/api/resources/metrics/types/RateType.js +13 -0
  30. package/dist/cjs/api/resources/metrics/types/RateTypes.d.ts +5 -0
  31. package/dist/cjs/api/resources/metrics/types/RateTypes.js +3 -0
  32. package/dist/cjs/api/resources/metrics/types/Window.d.ts +6 -0
  33. package/dist/cjs/api/resources/metrics/types/Window.js +3 -0
  34. package/dist/cjs/api/resources/metrics/types/index.d.ts +6 -0
  35. package/dist/cjs/api/resources/metrics/types/index.js +6 -0
  36. package/dist/cjs/api/resources/pods/resources/metrics/client/Client.d.ts +28 -0
  37. package/dist/cjs/api/resources/pods/resources/metrics/client/Client.js +98 -0
  38. package/dist/cjs/api/resources/pods/resources/metrics/client/requests/QueryRatesRequest.d.ts +14 -0
  39. package/dist/cjs/api/resources/pods/resources/metrics/client/requests/QueryRatesRequest.js +3 -0
  40. package/dist/cjs/api/resources/pods/resources/metrics/client/requests/index.d.ts +1 -0
  41. package/dist/cjs/api/resources/webhooks/types/UpdateInboxWebhookRequest.d.ts +10 -1
  42. package/dist/cjs/api/resources/webhooks/types/UpdatePodWebhookRequest.d.ts +2 -2
  43. package/dist/cjs/serialization/resources/agent/types/AgentAttachHumanRequest.d.ts +9 -0
  44. package/dist/cjs/serialization/resources/agent/types/AgentAttachHumanRequest.js +41 -0
  45. package/dist/cjs/serialization/resources/agent/types/AgentAttachHumanResponse.d.ts +10 -0
  46. package/dist/cjs/serialization/resources/agent/types/AgentAttachHumanResponse.js +42 -0
  47. package/dist/cjs/serialization/resources/agent/types/AgentSignupRequest.d.ts +1 -1
  48. package/dist/cjs/serialization/resources/agent/types/AgentSignupRequest.js +1 -1
  49. package/dist/cjs/serialization/resources/agent/types/index.d.ts +2 -0
  50. package/dist/cjs/serialization/resources/agent/types/index.js +2 -0
  51. package/dist/cjs/serialization/resources/apiKeys/types/ApiKeyPermissions.d.ts +1 -0
  52. package/dist/cjs/serialization/resources/apiKeys/types/ApiKeyPermissions.js +1 -0
  53. package/dist/cjs/serialization/resources/metrics/types/QueryRatesResponse.d.ts +9 -0
  54. package/dist/cjs/serialization/resources/metrics/types/QueryRatesResponse.js +41 -0
  55. package/dist/cjs/serialization/resources/metrics/types/RatePeriod.d.ts +7 -0
  56. package/dist/cjs/serialization/resources/metrics/types/RatePeriod.js +39 -0
  57. package/dist/cjs/serialization/resources/metrics/types/RatePoint.d.ts +11 -0
  58. package/dist/cjs/serialization/resources/metrics/types/RatePoint.js +43 -0
  59. package/dist/cjs/serialization/resources/metrics/types/RateType.d.ts +7 -0
  60. package/dist/cjs/serialization/resources/metrics/types/RateType.js +39 -0
  61. package/dist/cjs/serialization/resources/metrics/types/RateTypes.d.ts +8 -0
  62. package/dist/cjs/serialization/resources/metrics/types/RateTypes.js +40 -0
  63. package/dist/cjs/serialization/resources/metrics/types/Window.d.ts +7 -0
  64. package/dist/cjs/serialization/resources/metrics/types/Window.js +39 -0
  65. package/dist/cjs/serialization/resources/metrics/types/index.d.ts +6 -0
  66. package/dist/cjs/serialization/resources/metrics/types/index.js +6 -0
  67. package/dist/cjs/serialization/resources/webhooks/types/UpdateInboxWebhookRequest.d.ts +1 -0
  68. package/dist/cjs/serialization/resources/webhooks/types/UpdateInboxWebhookRequest.js +1 -0
  69. package/dist/cjs/version.d.ts +1 -1
  70. package/dist/cjs/version.js +1 -1
  71. package/dist/esm/BaseClient.mjs +2 -2
  72. package/dist/esm/api/resources/agent/client/Client.d.mts +32 -2
  73. package/dist/esm/api/resources/agent/client/Client.mjs +97 -2
  74. package/dist/esm/api/resources/agent/types/AgentAttachHumanRequest.d.mts +7 -0
  75. package/dist/esm/api/resources/agent/types/AgentAttachHumanRequest.mjs +2 -0
  76. package/dist/esm/api/resources/agent/types/AgentAttachHumanResponse.d.mts +9 -0
  77. package/dist/esm/api/resources/agent/types/AgentAttachHumanResponse.mjs +2 -0
  78. package/dist/esm/api/resources/agent/types/AgentSignupRequest.d.mts +5 -2
  79. package/dist/esm/api/resources/agent/types/index.d.mts +2 -0
  80. package/dist/esm/api/resources/agent/types/index.mjs +2 -0
  81. package/dist/esm/api/resources/apiKeys/types/ApiKeyPermissions.d.mts +2 -0
  82. package/dist/esm/api/resources/inboxes/resources/metrics/client/Client.d.mts +28 -0
  83. package/dist/esm/api/resources/inboxes/resources/metrics/client/Client.mjs +98 -0
  84. package/dist/esm/api/resources/inboxes/resources/metrics/client/requests/QueryRatesRequest.d.mts +14 -0
  85. package/dist/esm/api/resources/inboxes/resources/metrics/client/requests/QueryRatesRequest.mjs +2 -0
  86. package/dist/esm/api/resources/inboxes/resources/metrics/client/requests/index.d.mts +1 -0
  87. package/dist/esm/api/resources/metrics/client/Client.d.mts +28 -0
  88. package/dist/esm/api/resources/metrics/client/Client.mjs +98 -0
  89. package/dist/esm/api/resources/metrics/client/requests/QueryRatesRequest.d.mts +14 -0
  90. package/dist/esm/api/resources/metrics/client/requests/QueryRatesRequest.mjs +2 -0
  91. package/dist/esm/api/resources/metrics/client/requests/index.d.mts +1 -0
  92. package/dist/esm/api/resources/metrics/types/QueryRatesResponse.d.mts +5 -0
  93. package/dist/esm/api/resources/metrics/types/QueryRatesResponse.mjs +2 -0
  94. package/dist/esm/api/resources/metrics/types/RatePeriod.d.mts +5 -0
  95. package/dist/esm/api/resources/metrics/types/RatePeriod.mjs +2 -0
  96. package/dist/esm/api/resources/metrics/types/RatePoint.d.mts +12 -0
  97. package/dist/esm/api/resources/metrics/types/RatePoint.mjs +2 -0
  98. package/dist/esm/api/resources/metrics/types/RateType.d.mts +10 -0
  99. package/dist/esm/api/resources/metrics/types/RateType.mjs +10 -0
  100. package/dist/esm/api/resources/metrics/types/RateTypes.d.mts +5 -0
  101. package/dist/esm/api/resources/metrics/types/RateTypes.mjs +2 -0
  102. package/dist/esm/api/resources/metrics/types/Window.d.mts +6 -0
  103. package/dist/esm/api/resources/metrics/types/Window.mjs +2 -0
  104. package/dist/esm/api/resources/metrics/types/index.d.mts +6 -0
  105. package/dist/esm/api/resources/metrics/types/index.mjs +6 -0
  106. package/dist/esm/api/resources/pods/resources/metrics/client/Client.d.mts +28 -0
  107. package/dist/esm/api/resources/pods/resources/metrics/client/Client.mjs +98 -0
  108. package/dist/esm/api/resources/pods/resources/metrics/client/requests/QueryRatesRequest.d.mts +14 -0
  109. package/dist/esm/api/resources/pods/resources/metrics/client/requests/QueryRatesRequest.mjs +2 -0
  110. package/dist/esm/api/resources/pods/resources/metrics/client/requests/index.d.mts +1 -0
  111. package/dist/esm/api/resources/webhooks/types/UpdateInboxWebhookRequest.d.mts +10 -1
  112. package/dist/esm/api/resources/webhooks/types/UpdatePodWebhookRequest.d.mts +2 -2
  113. package/dist/esm/serialization/resources/agent/types/AgentAttachHumanRequest.d.mts +9 -0
  114. package/dist/esm/serialization/resources/agent/types/AgentAttachHumanRequest.mjs +5 -0
  115. package/dist/esm/serialization/resources/agent/types/AgentAttachHumanResponse.d.mts +10 -0
  116. package/dist/esm/serialization/resources/agent/types/AgentAttachHumanResponse.mjs +6 -0
  117. package/dist/esm/serialization/resources/agent/types/AgentSignupRequest.d.mts +1 -1
  118. package/dist/esm/serialization/resources/agent/types/AgentSignupRequest.mjs +1 -1
  119. package/dist/esm/serialization/resources/agent/types/index.d.mts +2 -0
  120. package/dist/esm/serialization/resources/agent/types/index.mjs +2 -0
  121. package/dist/esm/serialization/resources/apiKeys/types/ApiKeyPermissions.d.mts +1 -0
  122. package/dist/esm/serialization/resources/apiKeys/types/ApiKeyPermissions.mjs +1 -0
  123. package/dist/esm/serialization/resources/metrics/types/QueryRatesResponse.d.mts +9 -0
  124. package/dist/esm/serialization/resources/metrics/types/QueryRatesResponse.mjs +5 -0
  125. package/dist/esm/serialization/resources/metrics/types/RatePeriod.d.mts +7 -0
  126. package/dist/esm/serialization/resources/metrics/types/RatePeriod.mjs +3 -0
  127. package/dist/esm/serialization/resources/metrics/types/RatePoint.d.mts +11 -0
  128. package/dist/esm/serialization/resources/metrics/types/RatePoint.mjs +7 -0
  129. package/dist/esm/serialization/resources/metrics/types/RateType.d.mts +7 -0
  130. package/dist/esm/serialization/resources/metrics/types/RateType.mjs +3 -0
  131. package/dist/esm/serialization/resources/metrics/types/RateTypes.d.mts +8 -0
  132. package/dist/esm/serialization/resources/metrics/types/RateTypes.mjs +4 -0
  133. package/dist/esm/serialization/resources/metrics/types/Window.d.mts +7 -0
  134. package/dist/esm/serialization/resources/metrics/types/Window.mjs +3 -0
  135. package/dist/esm/serialization/resources/metrics/types/index.d.mts +6 -0
  136. package/dist/esm/serialization/resources/metrics/types/index.mjs +6 -0
  137. package/dist/esm/serialization/resources/webhooks/types/UpdateInboxWebhookRequest.d.mts +1 -0
  138. package/dist/esm/serialization/resources/webhooks/types/UpdateInboxWebhookRequest.mjs +1 -0
  139. package/dist/esm/version.d.mts +1 -1
  140. package/dist/esm/version.mjs +1 -1
  141. package/dist/llms.txt +6 -1
  142. package/package.json +1 -1
  143. package/reference.md +329 -2
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Type of rate. `bounce` is bounced messages divided by messages sent,
3
+ * counting permanent and transient bounces; `complaint` is spam complaints
4
+ * divided by messages sent.
5
+ */
6
+ export declare const RateType: {
7
+ readonly Bounce: "bounce";
8
+ readonly Complaint: "complaint";
9
+ };
10
+ export type RateType = (typeof RateType)[keyof typeof RateType];
@@ -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.RateType = void 0;
5
+ /**
6
+ * Type of rate. `bounce` is bounced messages divided by messages sent,
7
+ * counting permanent and transient bounces; `complaint` is spam complaints
8
+ * divided by messages sent.
9
+ */
10
+ exports.RateType = {
11
+ Bounce: "bounce",
12
+ Complaint: "complaint",
13
+ };
@@ -0,0 +1,5 @@
1
+ import type * as AgentMail from "../../../index.js";
2
+ /**
3
+ * List of rate types to query. Omit to query both.
4
+ */
5
+ export type RateTypes = AgentMail.RateType[];
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ /**
2
+ * How far back each point looks, as a whole number of seconds. Must be a
3
+ * whole multiple of `period`, at most 30 days (2592000). Defaults to 86400
4
+ * (a rolling 24-hour rate).
5
+ */
6
+ export type Window = number;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -6,8 +6,14 @@ export * from "./MetricEventTypes.js";
6
6
  export * from "./MetricLimit.js";
7
7
  export * from "./Period.js";
8
8
  export * from "./QueryMetricsResponse.js";
9
+ export * from "./QueryRatesResponse.js";
9
10
  export * from "./QueryUsageResponse.js";
11
+ export * from "./RatePeriod.js";
12
+ export * from "./RatePoint.js";
13
+ export * from "./RateType.js";
14
+ export * from "./RateTypes.js";
10
15
  export * from "./Start.js";
11
16
  export * from "./UsagePoint.js";
12
17
  export * from "./UsageType.js";
13
18
  export * from "./UsageTypes.js";
19
+ export * from "./Window.js";
@@ -22,8 +22,14 @@ __exportStar(require("./MetricEventTypes.js"), exports);
22
22
  __exportStar(require("./MetricLimit.js"), exports);
23
23
  __exportStar(require("./Period.js"), exports);
24
24
  __exportStar(require("./QueryMetricsResponse.js"), exports);
25
+ __exportStar(require("./QueryRatesResponse.js"), exports);
25
26
  __exportStar(require("./QueryUsageResponse.js"), exports);
27
+ __exportStar(require("./RatePeriod.js"), exports);
28
+ __exportStar(require("./RatePoint.js"), exports);
29
+ __exportStar(require("./RateType.js"), exports);
30
+ __exportStar(require("./RateTypes.js"), exports);
26
31
  __exportStar(require("./Start.js"), exports);
27
32
  __exportStar(require("./UsagePoint.js"), exports);
28
33
  __exportStar(require("./UsageType.js"), exports);
29
34
  __exportStar(require("./UsageTypes.js"), exports);
35
+ __exportStar(require("./Window.js"), exports);
@@ -53,4 +53,32 @@ export declare class MetricsClient {
53
53
  */
54
54
  queryUsage(pod_id: AgentMail.pods.PodId, request?: AgentMail.pods.QueryUsageRequest, requestOptions?: MetricsClient.RequestOptions): core.HttpResponsePromise<AgentMail.QueryUsageResponse>;
55
55
  private __queryUsage;
56
+ /**
57
+ * Rolling bounce and complaint rates for the pod. At each `period` grid
58
+ * 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 pod view shows which pods 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 pods metrics query-rates --pod-id <pod_id>
71
+ * ```
72
+ *
73
+ * @param {AgentMail.pods.PodId} pod_id
74
+ * @param {AgentMail.pods.QueryRatesRequest} request
75
+ * @param {MetricsClient.RequestOptions} requestOptions - Request-specific configuration.
76
+ *
77
+ * @throws {@link AgentMail.ValidationError}
78
+ *
79
+ * @example
80
+ * await client.pods.metrics.queryRates("pod_id")
81
+ */
82
+ queryRates(pod_id: AgentMail.pods.PodId, request?: AgentMail.pods.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/pods/{pod_id}/metrics/usage");
239
239
  });
240
240
  }
241
+ /**
242
+ * Rolling bounce and complaint rates for the pod. At each `period` grid
243
+ * 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 pod view shows which pods 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 pods metrics query-rates --pod-id <pod_id>
256
+ * ```
257
+ *
258
+ * @param {AgentMail.pods.PodId} pod_id
259
+ * @param {AgentMail.pods.QueryRatesRequest} request
260
+ * @param {MetricsClient.RequestOptions} requestOptions - Request-specific configuration.
261
+ *
262
+ * @throws {@link AgentMail.ValidationError}
263
+ *
264
+ * @example
265
+ * await client.pods.metrics.queryRates("pod_id")
266
+ */
267
+ queryRates(pod_id, request = {}, requestOptions) {
268
+ return core.HttpResponsePromise.fromPromise(this.__queryRates(pod_id, request, requestOptions));
269
+ }
270
+ __queryRates(pod_id_1) {
271
+ return __awaiter(this, arguments, void 0, function* (pod_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/pods/${core.url.encodePathParam(serializers.pods.PodId.jsonOrThrow(pod_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/pods/{pod_id}/metrics/rates");
337
+ });
338
+ }
241
339
  }
242
340
  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,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +1,3 @@
1
1
  export type { QueryEventsRequest } from "./QueryEventsRequest.js";
2
+ export type { QueryRatesRequest } from "./QueryRatesRequest.js";
2
3
  export type { QueryUsageRequest } from "./QueryUsageRequest.js";
@@ -1,7 +1,16 @@
1
1
  import type * as AgentMail from "../../../index.js";
2
2
  /**
3
- * Update an inbox-scoped webhook. It is fixed to its inbox, so only `event_types` can change.
3
+ * Update an inbox-scoped webhook. It is fixed to its inbox, so only `event_types` and `enabled` can
4
+ * change.
4
5
  */
5
6
  export interface UpdateInboxWebhookRequest {
6
7
  eventTypes?: AgentMail.webhooks.UpdateWebhookEventTypes;
8
+ /**
9
+ * Set to true to re-enable a webhook that was disabled after repeated failed deliveries, or false
10
+ * to disable it. Events that occurred while the webhook was disabled are not redelivered.
11
+ * Re-enabling a webhook subscribed to `message.received.spam`, `message.received.blocked`, or
12
+ * `message.received.unauthenticated` (or to every event type, with no filter) requires the
13
+ * matching label permissions on the API key.
14
+ */
15
+ enabled?: boolean;
7
16
  }
@@ -1,7 +1,7 @@
1
1
  import type * as AgentMail from "../../../index.js";
2
2
  /**
3
- * Update a pod-scoped webhook. You can adjust which inboxes within the pod it listens to and replace
4
- * its `event_types`, but not the pod scope itself.
3
+ * Update a pod-scoped webhook. You can adjust which inboxes within the pod it listens to, replace
4
+ * its `event_types`, and set `enabled`, but not change the pod scope itself.
5
5
  */
6
6
  export interface UpdatePodWebhookRequest extends AgentMail.webhooks.UpdateInboxWebhookRequest {
7
7
  /**
@@ -0,0 +1,9 @@
1
+ import type * as AgentMail from "../../../../api/index.js";
2
+ import * as core from "../../../../core/index.js";
3
+ import type * as serializers from "../../../index.js";
4
+ export declare const AgentAttachHumanRequest: core.serialization.ObjectSchema<serializers.AgentAttachHumanRequest.Raw, AgentMail.AgentAttachHumanRequest>;
5
+ export declare namespace AgentAttachHumanRequest {
6
+ interface Raw {
7
+ human_email: string;
8
+ }
9
+ }
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.AgentAttachHumanRequest = void 0;
38
+ const core = __importStar(require("../../../../core/index.js"));
39
+ exports.AgentAttachHumanRequest = core.serialization.object({
40
+ humanEmail: core.serialization.property("human_email", core.serialization.string()),
41
+ });
@@ -0,0 +1,10 @@
1
+ import type * as AgentMail from "../../../../api/index.js";
2
+ import * as core from "../../../../core/index.js";
3
+ import type * as serializers from "../../../index.js";
4
+ export declare const AgentAttachHumanResponse: core.serialization.ObjectSchema<serializers.AgentAttachHumanResponse.Raw, AgentMail.AgentAttachHumanResponse>;
5
+ export declare namespace AgentAttachHumanResponse {
6
+ interface Raw {
7
+ human_email: string;
8
+ instructions: string;
9
+ }
10
+ }
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.AgentAttachHumanResponse = void 0;
38
+ const core = __importStar(require("../../../../core/index.js"));
39
+ exports.AgentAttachHumanResponse = core.serialization.object({
40
+ humanEmail: core.serialization.property("human_email", core.serialization.string()),
41
+ instructions: core.serialization.string(),
42
+ });
@@ -4,7 +4,7 @@ import type * as serializers from "../../../index.js";
4
4
  export declare const AgentSignupRequest: core.serialization.ObjectSchema<serializers.AgentSignupRequest.Raw, AgentMail.AgentSignupRequest>;
5
5
  export declare namespace AgentSignupRequest {
6
6
  interface Raw {
7
- human_email: string;
7
+ human_email?: string | null;
8
8
  username: string;
9
9
  source?: string | null;
10
10
  referrer?: string | null;
@@ -37,7 +37,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
37
37
  exports.AgentSignupRequest = void 0;
38
38
  const core = __importStar(require("../../../../core/index.js"));
39
39
  exports.AgentSignupRequest = core.serialization.object({
40
- humanEmail: core.serialization.property("human_email", core.serialization.string()),
40
+ humanEmail: core.serialization.property("human_email", core.serialization.string().optional()),
41
41
  username: core.serialization.string(),
42
42
  source: core.serialization.string().optional(),
43
43
  referrer: core.serialization.string().optional(),
@@ -1,3 +1,5 @@
1
+ export * from "./AgentAttachHumanRequest.js";
2
+ export * from "./AgentAttachHumanResponse.js";
1
3
  export * from "./AgentSignupRequest.js";
2
4
  export * from "./AgentSignupResponse.js";
3
5
  export * from "./AgentVerifyRequest.js";
@@ -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);
@@ -42,6 +42,7 @@ export declare namespace ApiKeyPermissions {
42
42
  account_update?: boolean | null;
43
43
  pod_read?: boolean | null;
44
44
  pod_create?: boolean | null;
45
+ pod_update?: boolean | null;
45
46
  pod_delete?: boolean | null;
46
47
  }
47
48
  }
@@ -75,5 +75,6 @@ exports.ApiKeyPermissions = core.serialization.object({
75
75
  accountUpdate: core.serialization.property("account_update", core.serialization.boolean().optional()),
76
76
  podRead: core.serialization.property("pod_read", core.serialization.boolean().optional()),
77
77
  podCreate: core.serialization.property("pod_create", core.serialization.boolean().optional()),
78
+ podUpdate: core.serialization.property("pod_update", core.serialization.boolean().optional()),
78
79
  podDelete: core.serialization.property("pod_delete", core.serialization.boolean().optional()),
79
80
  });
@@ -0,0 +1,9 @@
1
+ import type * as AgentMail from "../../../../api/index.js";
2
+ import * as core from "../../../../core/index.js";
3
+ import type * as serializers from "../../../index.js";
4
+ import { RatePoint } from "./RatePoint.js";
5
+ import { RateType } from "./RateType.js";
6
+ export declare const QueryRatesResponse: core.serialization.Schema<serializers.QueryRatesResponse.Raw, AgentMail.QueryRatesResponse>;
7
+ export declare namespace QueryRatesResponse {
8
+ type Raw = Record<RateType.Raw, RatePoint.Raw[] | null | undefined>;
9
+ }
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.QueryRatesResponse = void 0;
38
+ const core = __importStar(require("../../../../core/index.js"));
39
+ const RatePoint_js_1 = require("./RatePoint.js");
40
+ const RateType_js_1 = require("./RateType.js");
41
+ exports.QueryRatesResponse = core.serialization.partialRecord(RateType_js_1.RateType, core.serialization.list(RatePoint_js_1.RatePoint).optional());
@@ -0,0 +1,7 @@
1
+ import type * as AgentMail from "../../../../api/index.js";
2
+ import * as core from "../../../../core/index.js";
3
+ import type * as serializers from "../../../index.js";
4
+ export declare const RatePeriod: core.serialization.Schema<serializers.RatePeriod.Raw, AgentMail.RatePeriod>;
5
+ export declare namespace RatePeriod {
6
+ type Raw = number;
7
+ }
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.RatePeriod = void 0;
38
+ const core = __importStar(require("../../../../core/index.js"));
39
+ exports.RatePeriod = core.serialization.number();
@@ -0,0 +1,11 @@
1
+ import type * as AgentMail from "../../../../api/index.js";
2
+ import * as core from "../../../../core/index.js";
3
+ import type * as serializers from "../../../index.js";
4
+ export declare const RatePoint: core.serialization.ObjectSchema<serializers.RatePoint.Raw, AgentMail.RatePoint>;
5
+ export declare namespace RatePoint {
6
+ interface Raw {
7
+ timestamp: string;
8
+ rate?: number | null;
9
+ sent: number;
10
+ }
11
+ }
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.RatePoint = void 0;
38
+ const core = __importStar(require("../../../../core/index.js"));
39
+ exports.RatePoint = core.serialization.object({
40
+ timestamp: core.serialization.date(),
41
+ rate: core.serialization.number().optional(),
42
+ sent: core.serialization.number(),
43
+ });
@@ -0,0 +1,7 @@
1
+ import type * as AgentMail from "../../../../api/index.js";
2
+ import * as core from "../../../../core/index.js";
3
+ import type * as serializers from "../../../index.js";
4
+ export declare const RateType: core.serialization.Schema<serializers.RateType.Raw, AgentMail.RateType>;
5
+ export declare namespace RateType {
6
+ type Raw = "bounce" | "complaint";
7
+ }