agentmail 0.0.46 → 0.0.49

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 (98) hide show
  1. package/dist/cjs/Client.d.ts +3 -0
  2. package/dist/cjs/Client.js +11 -6
  3. package/dist/cjs/api/resources/inboxes/client/Client.d.ts +3 -0
  4. package/dist/cjs/api/resources/inboxes/client/Client.js +5 -0
  5. package/dist/cjs/api/resources/inboxes/resources/index.d.ts +2 -0
  6. package/dist/cjs/api/resources/inboxes/resources/index.js +3 -1
  7. package/dist/cjs/api/resources/inboxes/resources/messages/client/Client.d.ts +2 -2
  8. package/dist/cjs/api/resources/inboxes/resources/messages/client/Client.js +3 -3
  9. package/dist/cjs/api/resources/inboxes/resources/metrics/client/Client.d.ts +47 -0
  10. package/dist/cjs/api/resources/inboxes/resources/metrics/client/Client.js +142 -0
  11. package/dist/cjs/api/resources/inboxes/resources/metrics/client/index.d.ts +2 -0
  12. package/dist/cjs/api/resources/inboxes/resources/metrics/client/index.js +17 -0
  13. package/dist/cjs/api/resources/inboxes/resources/metrics/client/requests/ListInboxMetricsRequest.d.ts +16 -0
  14. package/dist/cjs/api/resources/inboxes/resources/metrics/client/requests/ListInboxMetricsRequest.js +5 -0
  15. package/dist/cjs/api/resources/inboxes/resources/metrics/client/requests/index.d.ts +1 -0
  16. package/dist/cjs/api/resources/inboxes/resources/metrics/client/requests/index.js +2 -0
  17. package/dist/cjs/api/resources/inboxes/resources/metrics/index.d.ts +1 -0
  18. package/dist/cjs/api/resources/inboxes/resources/metrics/index.js +17 -0
  19. package/dist/cjs/api/resources/index.d.ts +3 -0
  20. package/dist/cjs/api/resources/index.js +4 -1
  21. package/dist/cjs/api/resources/metrics/client/Client.d.ts +45 -0
  22. package/dist/cjs/api/resources/metrics/client/Client.js +138 -0
  23. package/dist/cjs/api/resources/metrics/client/index.d.ts +2 -0
  24. package/dist/cjs/api/resources/metrics/client/index.js +17 -0
  25. package/dist/cjs/api/resources/metrics/client/requests/ListMetricsRequest.d.ts +16 -0
  26. package/dist/cjs/api/resources/metrics/client/requests/ListMetricsRequest.js +5 -0
  27. package/dist/cjs/api/resources/metrics/client/requests/index.d.ts +1 -0
  28. package/dist/cjs/api/resources/metrics/client/requests/index.js +2 -0
  29. package/dist/cjs/api/resources/metrics/index.d.ts +2 -0
  30. package/dist/cjs/api/resources/metrics/index.js +18 -0
  31. package/dist/cjs/api/resources/metrics/types/ListMetricsResponse.d.ts +8 -0
  32. package/dist/cjs/api/resources/metrics/types/ListMetricsResponse.js +5 -0
  33. package/dist/cjs/api/resources/metrics/types/MessageMetrics.d.ts +20 -0
  34. package/dist/cjs/api/resources/metrics/types/MessageMetrics.js +5 -0
  35. package/dist/cjs/api/resources/metrics/types/MetricEndTimestamp.d.ts +7 -0
  36. package/dist/cjs/api/resources/metrics/types/MetricEndTimestamp.js +5 -0
  37. package/dist/cjs/api/resources/metrics/types/MetricEventType.d.ts +16 -0
  38. package/dist/cjs/api/resources/metrics/types/MetricEventType.js +15 -0
  39. package/dist/cjs/api/resources/metrics/types/MetricEventTypes.d.ts +8 -0
  40. package/dist/cjs/api/resources/metrics/types/MetricEventTypes.js +5 -0
  41. package/dist/cjs/api/resources/metrics/types/MetricStartTimestamp.d.ts +7 -0
  42. package/dist/cjs/api/resources/metrics/types/MetricStartTimestamp.js +5 -0
  43. package/dist/cjs/api/resources/metrics/types/MetricTimestamp.d.ts +7 -0
  44. package/dist/cjs/api/resources/metrics/types/MetricTimestamp.js +5 -0
  45. package/dist/cjs/api/resources/metrics/types/index.d.ts +7 -0
  46. package/dist/cjs/api/resources/metrics/types/index.js +23 -0
  47. package/dist/cjs/version.d.ts +1 -1
  48. package/dist/cjs/version.js +1 -1
  49. package/dist/esm/Client.d.mts +3 -0
  50. package/dist/esm/Client.mjs +7 -2
  51. package/dist/esm/api/resources/inboxes/client/Client.d.mts +3 -0
  52. package/dist/esm/api/resources/inboxes/client/Client.mjs +5 -0
  53. package/dist/esm/api/resources/inboxes/resources/index.d.mts +2 -0
  54. package/dist/esm/api/resources/inboxes/resources/index.mjs +2 -0
  55. package/dist/esm/api/resources/inboxes/resources/messages/client/Client.d.mts +2 -2
  56. package/dist/esm/api/resources/inboxes/resources/messages/client/Client.mjs +3 -3
  57. package/dist/esm/api/resources/inboxes/resources/metrics/client/Client.d.mts +47 -0
  58. package/dist/esm/api/resources/inboxes/resources/metrics/client/Client.mjs +105 -0
  59. package/dist/esm/api/resources/inboxes/resources/metrics/client/index.d.mts +2 -0
  60. package/dist/esm/api/resources/inboxes/resources/metrics/client/index.mjs +1 -0
  61. package/dist/esm/api/resources/inboxes/resources/metrics/client/requests/ListInboxMetricsRequest.d.mts +16 -0
  62. package/dist/esm/api/resources/inboxes/resources/metrics/client/requests/ListInboxMetricsRequest.mjs +4 -0
  63. package/dist/esm/api/resources/inboxes/resources/metrics/client/requests/index.d.mts +1 -0
  64. package/dist/esm/api/resources/inboxes/resources/metrics/client/requests/index.mjs +1 -0
  65. package/dist/esm/api/resources/inboxes/resources/metrics/index.d.mts +1 -0
  66. package/dist/esm/api/resources/inboxes/resources/metrics/index.mjs +1 -0
  67. package/dist/esm/api/resources/index.d.mts +3 -0
  68. package/dist/esm/api/resources/index.mjs +3 -0
  69. package/dist/esm/api/resources/metrics/client/Client.d.mts +45 -0
  70. package/dist/esm/api/resources/metrics/client/Client.mjs +101 -0
  71. package/dist/esm/api/resources/metrics/client/index.d.mts +2 -0
  72. package/dist/esm/api/resources/metrics/client/index.mjs +1 -0
  73. package/dist/esm/api/resources/metrics/client/requests/ListMetricsRequest.d.mts +16 -0
  74. package/dist/esm/api/resources/metrics/client/requests/ListMetricsRequest.mjs +4 -0
  75. package/dist/esm/api/resources/metrics/client/requests/index.d.mts +1 -0
  76. package/dist/esm/api/resources/metrics/client/requests/index.mjs +1 -0
  77. package/dist/esm/api/resources/metrics/index.d.mts +2 -0
  78. package/dist/esm/api/resources/metrics/index.mjs +2 -0
  79. package/dist/esm/api/resources/metrics/types/ListMetricsResponse.d.mts +8 -0
  80. package/dist/esm/api/resources/metrics/types/ListMetricsResponse.mjs +4 -0
  81. package/dist/esm/api/resources/metrics/types/MessageMetrics.d.mts +20 -0
  82. package/dist/esm/api/resources/metrics/types/MessageMetrics.mjs +4 -0
  83. package/dist/esm/api/resources/metrics/types/MetricEndTimestamp.d.mts +7 -0
  84. package/dist/esm/api/resources/metrics/types/MetricEndTimestamp.mjs +4 -0
  85. package/dist/esm/api/resources/metrics/types/MetricEventType.d.mts +16 -0
  86. package/dist/esm/api/resources/metrics/types/MetricEventType.mjs +12 -0
  87. package/dist/esm/api/resources/metrics/types/MetricEventTypes.d.mts +8 -0
  88. package/dist/esm/api/resources/metrics/types/MetricEventTypes.mjs +4 -0
  89. package/dist/esm/api/resources/metrics/types/MetricStartTimestamp.d.mts +7 -0
  90. package/dist/esm/api/resources/metrics/types/MetricStartTimestamp.mjs +4 -0
  91. package/dist/esm/api/resources/metrics/types/MetricTimestamp.d.mts +7 -0
  92. package/dist/esm/api/resources/metrics/types/MetricTimestamp.mjs +4 -0
  93. package/dist/esm/api/resources/metrics/types/index.d.mts +7 -0
  94. package/dist/esm/api/resources/metrics/types/index.mjs +7 -0
  95. package/dist/esm/version.d.mts +1 -1
  96. package/dist/esm/version.mjs +1 -1
  97. package/package.json +1 -1
  98. package/reference.md +114 -0
@@ -0,0 +1,138 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
39
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
40
+ return new (P || (P = Promise))(function (resolve, reject) {
41
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
42
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
43
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
44
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
45
+ });
46
+ };
47
+ Object.defineProperty(exports, "__esModule", { value: true });
48
+ exports.Metrics = void 0;
49
+ const environments = __importStar(require("../../../../environments.js"));
50
+ const core = __importStar(require("../../../../core/index.js"));
51
+ const AgentMail = __importStar(require("../../../index.js"));
52
+ const json_js_1 = require("../../../../core/json.js");
53
+ const headers_js_1 = require("../../../../core/headers.js");
54
+ const errors = __importStar(require("../../../../errors/index.js"));
55
+ class Metrics {
56
+ constructor(_options = {}) {
57
+ this._options = _options;
58
+ }
59
+ /**
60
+ * @param {AgentMail.ListMetricsRequest} request
61
+ * @param {Metrics.RequestOptions} requestOptions - Request-specific configuration.
62
+ *
63
+ * @throws {@link AgentMail.NotFoundError}
64
+ *
65
+ * @example
66
+ * await client.metrics.list({
67
+ * start_timestamp: "2024-01-15T09:30:00Z",
68
+ * end_timestamp: "2024-01-15T09:30:00Z"
69
+ * })
70
+ */
71
+ list(request, requestOptions) {
72
+ return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions));
73
+ }
74
+ __list(request, requestOptions) {
75
+ return __awaiter(this, void 0, void 0, function* () {
76
+ var _a, _b, _c;
77
+ const { event_types: eventTypes, start_timestamp: startTimestamp, end_timestamp: endTimestamp } = request;
78
+ const _queryParams = {};
79
+ if (eventTypes != null) {
80
+ _queryParams["event_types"] = (0, json_js_1.toJson)(eventTypes);
81
+ }
82
+ _queryParams["start_timestamp"] = startTimestamp;
83
+ _queryParams["end_timestamp"] = endTimestamp;
84
+ const _response = yield core.fetcher({
85
+ url: core.url.join((_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : ((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.AgentMailEnvironment.Production).http, "/v0/metrics"),
86
+ method: "GET",
87
+ headers: (0, headers_js_1.mergeHeaders)((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
88
+ queryParameters: _queryParams,
89
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
90
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
91
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
92
+ });
93
+ if (_response.ok) {
94
+ return { data: _response.body, rawResponse: _response.rawResponse };
95
+ }
96
+ if (_response.error.reason === "status-code") {
97
+ switch (_response.error.statusCode) {
98
+ case 404:
99
+ throw new AgentMail.NotFoundError(_response.error.body, _response.rawResponse);
100
+ default:
101
+ throw new errors.AgentMailError({
102
+ statusCode: _response.error.statusCode,
103
+ body: _response.error.body,
104
+ rawResponse: _response.rawResponse,
105
+ });
106
+ }
107
+ }
108
+ switch (_response.error.reason) {
109
+ case "non-json":
110
+ throw new errors.AgentMailError({
111
+ statusCode: _response.error.statusCode,
112
+ body: _response.error.rawBody,
113
+ rawResponse: _response.rawResponse,
114
+ });
115
+ case "timeout":
116
+ throw new errors.AgentMailTimeoutError("Timeout exceeded when calling GET /v0/metrics.");
117
+ case "unknown":
118
+ throw new errors.AgentMailError({
119
+ message: _response.error.errorMessage,
120
+ rawResponse: _response.rawResponse,
121
+ });
122
+ }
123
+ });
124
+ }
125
+ _getAuthorizationHeader() {
126
+ return __awaiter(this, void 0, void 0, function* () {
127
+ var _a;
128
+ const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["AGENTMAIL_API_KEY"];
129
+ if (bearer == null) {
130
+ throw new errors.AgentMailError({
131
+ message: "Please specify a bearer by either passing it in to the constructor or initializing a AGENTMAIL_API_KEY environment variable",
132
+ });
133
+ }
134
+ return `Bearer ${bearer}`;
135
+ });
136
+ }
137
+ }
138
+ exports.Metrics = Metrics;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ export * from "./requests/index.js";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./requests/index.js"), exports);
@@ -0,0 +1,16 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as AgentMail from "../../../../index.js";
5
+ /**
6
+ * @example
7
+ * {
8
+ * start_timestamp: "2024-01-15T09:30:00Z",
9
+ * end_timestamp: "2024-01-15T09:30:00Z"
10
+ * }
11
+ */
12
+ export interface ListMetricsRequest {
13
+ event_types?: AgentMail.MetricEventTypes;
14
+ start_timestamp: AgentMail.MetricStartTimestamp;
15
+ end_timestamp: AgentMail.MetricEndTimestamp;
16
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export { type ListMetricsRequest } from "./ListMetricsRequest.js";
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ export * from "./types/index.js";
2
+ export * from "./client/index.js";
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./types/index.js"), exports);
18
+ __exportStar(require("./client/index.js"), exports);
@@ -0,0 +1,8 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as AgentMail from "../../../index.js";
5
+ export interface ListMetricsResponse {
6
+ /** Message metrics grouped by event type. */
7
+ message?: AgentMail.MessageMetrics;
8
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,20 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as AgentMail from "../../../index.js";
5
+ export interface MessageMetrics {
6
+ /** Timestamps when messages were sent. */
7
+ sent?: AgentMail.MetricTimestamp[];
8
+ /** Timestamps when messages were delivered. */
9
+ delivered?: AgentMail.MetricTimestamp[];
10
+ /** Timestamps when messages bounced. */
11
+ bounced?: AgentMail.MetricTimestamp[];
12
+ /** Timestamps when messages were delayed. */
13
+ delayed?: AgentMail.MetricTimestamp[];
14
+ /** Timestamps when messages were rejected. */
15
+ rejected?: AgentMail.MetricTimestamp[];
16
+ /** Timestamps when messages received complaints. */
17
+ complained?: AgentMail.MetricTimestamp[];
18
+ /** Timestamps when messages were received. */
19
+ received?: AgentMail.MetricTimestamp[];
20
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * End timestamp for the metrics query range.
6
+ */
7
+ export type MetricEndTimestamp = string;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,16 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * Type of metric event.
6
+ */
7
+ export type MetricEventType = "message.sent" | "message.delivered" | "message.bounced" | "message.delayed" | "message.rejected" | "message.complained" | "message.received";
8
+ export declare const MetricEventType: {
9
+ readonly MessageSent: "message.sent";
10
+ readonly MessageDelivered: "message.delivered";
11
+ readonly MessageBounced: "message.bounced";
12
+ readonly MessageDelayed: "message.delayed";
13
+ readonly MessageRejected: "message.rejected";
14
+ readonly MessageComplained: "message.complained";
15
+ readonly MessageReceived: "message.received";
16
+ };
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.MetricEventType = void 0;
7
+ exports.MetricEventType = {
8
+ MessageSent: "message.sent",
9
+ MessageDelivered: "message.delivered",
10
+ MessageBounced: "message.bounced",
11
+ MessageDelayed: "message.delayed",
12
+ MessageRejected: "message.rejected",
13
+ MessageComplained: "message.complained",
14
+ MessageReceived: "message.received",
15
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as AgentMail from "../../../index.js";
5
+ /**
6
+ * List of metric event types to filter by.
7
+ */
8
+ export type MetricEventTypes = AgentMail.MetricEventType[];
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * Start timestamp for the metrics query range.
6
+ */
7
+ export type MetricStartTimestamp = string;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * Timestamp when the metric event occurred.
6
+ */
7
+ export type MetricTimestamp = string;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ export * from "./MetricEventType.js";
2
+ export * from "./MetricTimestamp.js";
3
+ export * from "./MetricEventTypes.js";
4
+ export * from "./MetricStartTimestamp.js";
5
+ export * from "./MetricEndTimestamp.js";
6
+ export * from "./MessageMetrics.js";
7
+ export * from "./ListMetricsResponse.js";
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./MetricEventType.js"), exports);
18
+ __exportStar(require("./MetricTimestamp.js"), exports);
19
+ __exportStar(require("./MetricEventTypes.js"), exports);
20
+ __exportStar(require("./MetricStartTimestamp.js"), exports);
21
+ __exportStar(require("./MetricEndTimestamp.js"), exports);
22
+ __exportStar(require("./MessageMetrics.js"), exports);
23
+ __exportStar(require("./ListMetricsResponse.js"), exports);
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.0.46";
1
+ export declare const SDK_VERSION = "0.0.49";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "0.0.46";
4
+ exports.SDK_VERSION = "0.0.49";
@@ -7,6 +7,7 @@ import { Inboxes } from "./api/resources/inboxes/client/Client.mjs";
7
7
  import { Webhooks } from "./api/resources/webhooks/client/Client.mjs";
8
8
  import { Domains } from "./api/resources/domains/client/Client.mjs";
9
9
  import { Drafts } from "./api/resources/drafts/client/Client.mjs";
10
+ import { Metrics } from "./api/resources/metrics/client/Client.mjs";
10
11
  import { Threads } from "./api/resources/threads/client/Client.mjs";
11
12
  import { Websockets } from "./api/resources/websockets/client/Client.mjs";
12
13
  export declare namespace AgentMailClient {
@@ -35,6 +36,7 @@ export declare class AgentMailClient {
35
36
  protected _webhooks: Webhooks | undefined;
36
37
  protected _domains: Domains | undefined;
37
38
  protected _drafts: Drafts | undefined;
39
+ protected _metrics: Metrics | undefined;
38
40
  protected _threads: Threads | undefined;
39
41
  protected _websockets: Websockets | undefined;
40
42
  constructor(_options?: AgentMailClient.Options);
@@ -42,6 +44,7 @@ export declare class AgentMailClient {
42
44
  get webhooks(): Webhooks;
43
45
  get domains(): Domains;
44
46
  get drafts(): Drafts;
47
+ get metrics(): Metrics;
45
48
  get threads(): Threads;
46
49
  get websockets(): Websockets;
47
50
  }
@@ -7,6 +7,7 @@ import { Inboxes } from "./api/resources/inboxes/client/Client.mjs";
7
7
  import { Webhooks } from "./api/resources/webhooks/client/Client.mjs";
8
8
  import { Domains } from "./api/resources/domains/client/Client.mjs";
9
9
  import { Drafts } from "./api/resources/drafts/client/Client.mjs";
10
+ import { Metrics } from "./api/resources/metrics/client/Client.mjs";
10
11
  import { Threads } from "./api/resources/threads/client/Client.mjs";
11
12
  import { Websockets } from "./api/resources/websockets/client/Client.mjs";
12
13
  export class AgentMailClient {
@@ -14,8 +15,8 @@ export class AgentMailClient {
14
15
  this._options = Object.assign(Object.assign({}, _options), { headers: mergeHeaders({
15
16
  "X-Fern-Language": "JavaScript",
16
17
  "X-Fern-SDK-Name": "agentmail",
17
- "X-Fern-SDK-Version": "0.0.46",
18
- "User-Agent": "agentmail/0.0.46",
18
+ "X-Fern-SDK-Version": "0.0.49",
19
+ "User-Agent": "agentmail/0.0.49",
19
20
  "X-Fern-Runtime": core.RUNTIME.type,
20
21
  "X-Fern-Runtime-Version": core.RUNTIME.version,
21
22
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -36,6 +37,10 @@ export class AgentMailClient {
36
37
  var _a;
37
38
  return ((_a = this._drafts) !== null && _a !== void 0 ? _a : (this._drafts = new Drafts(this._options)));
38
39
  }
40
+ get metrics() {
41
+ var _a;
42
+ return ((_a = this._metrics) !== null && _a !== void 0 ? _a : (this._metrics = new Metrics(this._options)));
43
+ }
39
44
  get threads() {
40
45
  var _a;
41
46
  return ((_a = this._threads) !== null && _a !== void 0 ? _a : (this._threads = new Threads(this._options)));
@@ -7,6 +7,7 @@ import * as AgentMail from "../../../index.mjs";
7
7
  import { Threads } from "../resources/threads/client/Client.mjs";
8
8
  import { Messages } from "../resources/messages/client/Client.mjs";
9
9
  import { Drafts } from "../resources/drafts/client/Client.mjs";
10
+ import { Metrics } from "../resources/metrics/client/Client.mjs";
10
11
  export declare namespace Inboxes {
11
12
  interface Options {
12
13
  environment?: core.Supplier<environments.AgentMailEnvironment | environments.AgentMailEnvironmentUrls>;
@@ -32,10 +33,12 @@ export declare class Inboxes {
32
33
  protected _threads: Threads | undefined;
33
34
  protected _messages: Messages | undefined;
34
35
  protected _drafts: Drafts | undefined;
36
+ protected _metrics: Metrics | undefined;
35
37
  constructor(_options?: Inboxes.Options);
36
38
  get threads(): Threads;
37
39
  get messages(): Messages;
38
40
  get drafts(): Drafts;
41
+ get metrics(): Metrics;
39
42
  /**
40
43
  * @param {AgentMail.inboxes.ListInboxesRequest} request
41
44
  * @param {Inboxes.RequestOptions} requestOptions - Request-specific configuration.
@@ -18,6 +18,7 @@ import * as errors from "../../../../errors/index.mjs";
18
18
  import { Threads } from "../resources/threads/client/Client.mjs";
19
19
  import { Messages } from "../resources/messages/client/Client.mjs";
20
20
  import { Drafts } from "../resources/drafts/client/Client.mjs";
21
+ import { Metrics } from "../resources/metrics/client/Client.mjs";
21
22
  export class Inboxes {
22
23
  constructor(_options = {}) {
23
24
  this._options = _options;
@@ -34,6 +35,10 @@ export class Inboxes {
34
35
  var _a;
35
36
  return ((_a = this._drafts) !== null && _a !== void 0 ? _a : (this._drafts = new Drafts(this._options)));
36
37
  }
38
+ get metrics() {
39
+ var _a;
40
+ return ((_a = this._metrics) !== null && _a !== void 0 ? _a : (this._metrics = new Metrics(this._options)));
41
+ }
37
42
  /**
38
43
  * @param {AgentMail.inboxes.ListInboxesRequest} request
39
44
  * @param {Inboxes.RequestOptions} requestOptions - Request-specific configuration.
@@ -1,6 +1,8 @@
1
1
  export * as drafts from "./drafts/index.mjs";
2
2
  export * as messages from "./messages/index.mjs";
3
+ export * as metrics from "./metrics/index.mjs";
3
4
  export * as threads from "./threads/index.mjs";
4
5
  export * from "./drafts/client/requests/index.mjs";
5
6
  export * from "./messages/client/requests/index.mjs";
7
+ export * from "./metrics/client/requests/index.mjs";
6
8
  export * from "./threads/client/requests/index.mjs";
@@ -1,6 +1,8 @@
1
1
  export * as drafts from "./drafts/index.mjs";
2
2
  export * as messages from "./messages/index.mjs";
3
+ export * as metrics from "./metrics/index.mjs";
3
4
  export * as threads from "./threads/index.mjs";
4
5
  export * from "./drafts/client/requests/index.mjs";
5
6
  export * from "./messages/client/requests/index.mjs";
7
+ export * from "./metrics/client/requests/index.mjs";
6
8
  export * from "./threads/client/requests/index.mjs";
@@ -59,8 +59,8 @@ export declare class Messages {
59
59
  /**
60
60
  * @throws {@link AgentMail.NotFoundError}
61
61
  */
62
- getRawMessage(inboxId: AgentMail.inboxes.InboxId, messageId: AgentMail.MessageId, requestOptions?: Messages.RequestOptions): core.HttpResponsePromise<core.BinaryResponse>;
63
- private __getRawMessage;
62
+ getRaw(inboxId: AgentMail.inboxes.InboxId, messageId: AgentMail.MessageId, requestOptions?: Messages.RequestOptions): core.HttpResponsePromise<core.BinaryResponse>;
63
+ private __getRaw;
64
64
  /**
65
65
  * @param {AgentMail.inboxes.InboxId} inboxId
66
66
  * @param {AgentMail.SendMessageRequest} request
@@ -200,10 +200,10 @@ export class Messages {
200
200
  /**
201
201
  * @throws {@link AgentMail.NotFoundError}
202
202
  */
203
- getRawMessage(inboxId, messageId, requestOptions) {
204
- return core.HttpResponsePromise.fromPromise(this.__getRawMessage(inboxId, messageId, requestOptions));
203
+ getRaw(inboxId, messageId, requestOptions) {
204
+ return core.HttpResponsePromise.fromPromise(this.__getRaw(inboxId, messageId, requestOptions));
205
205
  }
206
- __getRawMessage(inboxId, messageId, requestOptions) {
206
+ __getRaw(inboxId, messageId, requestOptions) {
207
207
  return __awaiter(this, void 0, void 0, function* () {
208
208
  var _a, _b, _c;
209
209
  const _response = yield core.fetcher({
@@ -0,0 +1,47 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as environments from "../../../../../../environments.mjs";
5
+ import * as core from "../../../../../../core/index.mjs";
6
+ import * as AgentMail from "../../../../../index.mjs";
7
+ export declare namespace Metrics {
8
+ interface Options {
9
+ environment?: core.Supplier<environments.AgentMailEnvironment | environments.AgentMailEnvironmentUrls>;
10
+ /** Specify a custom URL to connect the client to. */
11
+ baseUrl?: core.Supplier<string>;
12
+ apiKey?: core.Supplier<core.BearerToken | undefined>;
13
+ /** Additional headers to include in requests. */
14
+ headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
15
+ }
16
+ interface RequestOptions {
17
+ /** The maximum time to wait for a response in seconds. */
18
+ timeoutInSeconds?: number;
19
+ /** The number of times to retry the request. Defaults to 2. */
20
+ maxRetries?: number;
21
+ /** A hook to abort the request. */
22
+ abortSignal?: AbortSignal;
23
+ /** Additional headers to include in the request. */
24
+ headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
25
+ }
26
+ }
27
+ export declare class Metrics {
28
+ protected readonly _options: Metrics.Options;
29
+ constructor(_options?: Metrics.Options);
30
+ /**
31
+ * @param {AgentMail.inboxes.InboxId} inboxId
32
+ * @param {AgentMail.inboxes.ListInboxMetricsRequest} request
33
+ * @param {Metrics.RequestOptions} requestOptions - Request-specific configuration.
34
+ *
35
+ * @throws {@link AgentMail.NotFoundError}
36
+ * @throws {@link AgentMail.ValidationError}
37
+ *
38
+ * @example
39
+ * await client.inboxes.metrics.get("inbox_id", {
40
+ * start_timestamp: "2024-01-15T09:30:00Z",
41
+ * end_timestamp: "2024-01-15T09:30:00Z"
42
+ * })
43
+ */
44
+ get(inboxId: AgentMail.inboxes.InboxId, request: AgentMail.inboxes.ListInboxMetricsRequest, requestOptions?: Metrics.RequestOptions): core.HttpResponsePromise<AgentMail.ListMetricsResponse>;
45
+ private __get;
46
+ protected _getAuthorizationHeader(): Promise<string>;
47
+ }