agentmail 0.1.6 → 0.1.7

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 (233) hide show
  1. package/README.md +63 -0
  2. package/dist/cjs/BaseClient.d.ts +14 -1
  3. package/dist/cjs/BaseClient.js +59 -0
  4. package/dist/cjs/Client.d.ts +30 -29
  5. package/dist/cjs/Client.js +12 -53
  6. package/dist/cjs/api/resources/apiKeys/client/Client.d.ts +12 -12
  7. package/dist/cjs/api/resources/apiKeys/client/Client.js +29 -31
  8. package/dist/cjs/api/resources/domains/client/Client.d.ts +19 -19
  9. package/dist/cjs/api/resources/domains/client/Client.js +60 -53
  10. package/dist/cjs/api/resources/drafts/client/Client.d.ts +10 -10
  11. package/dist/cjs/api/resources/drafts/client/Client.js +23 -28
  12. package/dist/cjs/api/resources/events/types/DomainVerifiedEvent.d.ts +7 -0
  13. package/dist/cjs/api/resources/{webhooks → events}/types/EventType.d.ts +1 -0
  14. package/dist/cjs/api/resources/{webhooks → events}/types/EventType.js +1 -0
  15. package/dist/cjs/api/resources/events/types/EventTypes.d.ts +5 -0
  16. package/dist/cjs/api/resources/events/types/EventTypes.js +3 -0
  17. package/dist/cjs/api/resources/events/types/index.d.ts +3 -0
  18. package/dist/cjs/api/resources/events/types/index.js +3 -0
  19. package/dist/cjs/api/resources/inboxes/client/Client.d.ts +30 -30
  20. package/dist/cjs/api/resources/inboxes/client/Client.js +55 -51
  21. package/dist/cjs/api/resources/inboxes/resources/drafts/client/Client.d.ts +27 -27
  22. package/dist/cjs/api/resources/inboxes/resources/drafts/client/Client.js +77 -70
  23. package/dist/cjs/api/resources/inboxes/resources/messages/client/Client.d.ts +25 -25
  24. package/dist/cjs/api/resources/inboxes/resources/messages/client/Client.js +83 -73
  25. package/dist/cjs/api/resources/inboxes/resources/metrics/client/Client.d.ts +8 -8
  26. package/dist/cjs/api/resources/inboxes/resources/metrics/client/Client.js +17 -25
  27. package/dist/cjs/api/resources/inboxes/resources/threads/client/Client.d.ts +17 -17
  28. package/dist/cjs/api/resources/inboxes/resources/threads/client/Client.js +51 -50
  29. package/dist/cjs/api/resources/metrics/client/Client.d.ts +7 -7
  30. package/dist/cjs/api/resources/metrics/client/Client.js +12 -20
  31. package/dist/cjs/api/resources/pods/client/Client.d.ts +27 -27
  32. package/dist/cjs/api/resources/pods/client/Client.js +44 -43
  33. package/dist/cjs/api/resources/pods/resources/domains/client/Client.d.ts +15 -15
  34. package/dist/cjs/api/resources/pods/resources/domains/client/Client.js +41 -43
  35. package/dist/cjs/api/resources/pods/resources/drafts/client/Client.d.ts +12 -12
  36. package/dist/cjs/api/resources/pods/resources/drafts/client/Client.js +30 -35
  37. package/dist/cjs/api/resources/pods/resources/inboxes/client/Client.d.ts +19 -19
  38. package/dist/cjs/api/resources/pods/resources/inboxes/client/Client.js +53 -52
  39. package/dist/cjs/api/resources/pods/resources/threads/client/Client.d.ts +13 -13
  40. package/dist/cjs/api/resources/pods/resources/threads/client/Client.js +39 -41
  41. package/dist/cjs/api/resources/threads/client/Client.d.ts +11 -11
  42. package/dist/cjs/api/resources/threads/client/Client.js +32 -34
  43. package/dist/cjs/api/resources/webhooks/client/Client.d.ts +15 -15
  44. package/dist/cjs/api/resources/webhooks/client/Client.js +40 -39
  45. package/dist/cjs/api/resources/webhooks/types/CreateWebhookRequest.d.ts +1 -1
  46. package/dist/cjs/api/resources/webhooks/types/Webhook.d.ts +1 -1
  47. package/dist/cjs/api/resources/webhooks/types/index.d.ts +0 -2
  48. package/dist/cjs/api/resources/webhooks/types/index.js +0 -2
  49. package/dist/cjs/api/resources/websockets/client/Client.d.ts +6 -6
  50. package/dist/cjs/api/resources/websockets/client/Client.js +8 -19
  51. package/dist/cjs/api/resources/websockets/client/Socket.d.ts +1 -1
  52. package/dist/cjs/api/resources/websockets/types/Subscribe.d.ts +5 -1
  53. package/dist/cjs/api/resources/websockets/types/Subscribed.d.ts +5 -1
  54. package/dist/cjs/auth/BearerAuthProvider.d.ts +14 -0
  55. package/dist/cjs/auth/BearerAuthProvider.js +72 -0
  56. package/dist/cjs/auth/index.d.ts +1 -0
  57. package/dist/cjs/auth/index.js +5 -0
  58. package/dist/cjs/core/auth/AuthProvider.d.ts +4 -1
  59. package/dist/cjs/core/auth/BearerToken.d.ts +3 -1
  60. package/dist/cjs/core/auth/BearerToken.js +7 -6
  61. package/dist/cjs/core/auth/NoOpAuthProvider.d.ts +5 -0
  62. package/dist/cjs/core/auth/NoOpAuthProvider.js +9 -0
  63. package/dist/cjs/core/auth/index.d.ts +1 -0
  64. package/dist/cjs/core/auth/index.js +3 -1
  65. package/dist/cjs/core/exports.d.ts +1 -0
  66. package/dist/cjs/core/exports.js +1 -0
  67. package/dist/cjs/core/fetcher/Fetcher.d.ts +4 -1
  68. package/dist/cjs/core/fetcher/Fetcher.js +202 -9
  69. package/dist/cjs/core/fetcher/getRequestBody.d.ts +1 -1
  70. package/dist/cjs/core/fetcher/getRequestBody.js +4 -0
  71. package/dist/cjs/core/fetcher/makeRequest.d.ts +1 -1
  72. package/dist/cjs/core/fetcher/makeRequest.js +0 -2
  73. package/dist/cjs/core/fetcher/requestWithRetries.js +0 -9
  74. package/dist/cjs/core/fetcher/signals.d.ts +0 -6
  75. package/dist/cjs/core/fetcher/signals.js +0 -12
  76. package/dist/cjs/core/headers.js +6 -4
  77. package/dist/cjs/core/index.d.ts +1 -0
  78. package/dist/cjs/core/index.js +2 -1
  79. package/dist/cjs/core/logging/exports.d.ts +18 -0
  80. package/dist/cjs/core/logging/exports.js +45 -0
  81. package/dist/cjs/core/logging/index.d.ts +1 -0
  82. package/dist/cjs/core/logging/index.js +17 -0
  83. package/dist/cjs/core/logging/logger.d.ts +126 -0
  84. package/dist/cjs/core/logging/logger.js +144 -0
  85. package/dist/cjs/core/schemas/Schema.d.ts +1 -0
  86. package/dist/cjs/core/schemas/Schema.js +1 -0
  87. package/dist/cjs/core/schemas/builders/primitives/index.d.ts +1 -0
  88. package/dist/cjs/core/schemas/builders/primitives/index.js +3 -1
  89. package/dist/cjs/core/schemas/builders/primitives/never.d.ts +2 -0
  90. package/dist/cjs/core/schemas/builders/primitives/never.js +14 -0
  91. package/dist/cjs/core/url/join.js +0 -1
  92. package/dist/cjs/serialization/resources/events/types/DomainVerifiedEvent.d.ts +14 -0
  93. package/dist/cjs/serialization/resources/events/types/DomainVerifiedEvent.js +46 -0
  94. package/dist/cjs/serialization/resources/{webhooks → events}/types/EventType.d.ts +2 -2
  95. package/dist/cjs/serialization/resources/{webhooks → events}/types/EventType.js +1 -0
  96. package/dist/cjs/serialization/resources/{webhooks → events}/types/EventTypes.d.ts +1 -1
  97. package/dist/cjs/serialization/resources/events/types/index.d.ts +3 -0
  98. package/dist/cjs/serialization/resources/events/types/index.js +3 -0
  99. package/dist/cjs/serialization/resources/webhooks/types/CreateWebhookRequest.d.ts +1 -1
  100. package/dist/cjs/serialization/resources/webhooks/types/CreateWebhookRequest.js +1 -1
  101. package/dist/cjs/serialization/resources/webhooks/types/Webhook.d.ts +1 -1
  102. package/dist/cjs/serialization/resources/webhooks/types/Webhook.js +1 -1
  103. package/dist/cjs/serialization/resources/webhooks/types/index.d.ts +0 -2
  104. package/dist/cjs/serialization/resources/webhooks/types/index.js +0 -2
  105. package/dist/cjs/serialization/resources/websockets/client/socket/WebsocketsSocketResponse.d.ts +3 -2
  106. package/dist/cjs/serialization/resources/websockets/client/socket/WebsocketsSocketResponse.js +2 -0
  107. package/dist/cjs/serialization/resources/websockets/types/Subscribe.d.ts +4 -1
  108. package/dist/cjs/serialization/resources/websockets/types/Subscribe.js +4 -1
  109. package/dist/cjs/serialization/resources/websockets/types/Subscribed.d.ts +4 -1
  110. package/dist/cjs/serialization/resources/websockets/types/Subscribed.js +4 -1
  111. package/dist/cjs/version.d.ts +1 -1
  112. package/dist/cjs/version.js +1 -1
  113. package/dist/esm/BaseClient.d.mts +14 -1
  114. package/dist/esm/BaseClient.mjs +24 -1
  115. package/dist/esm/Client.d.mts +30 -29
  116. package/dist/esm/Client.mjs +21 -29
  117. package/dist/esm/api/resources/apiKeys/client/Client.d.mts +12 -12
  118. package/dist/esm/api/resources/apiKeys/client/Client.mjs +28 -30
  119. package/dist/esm/api/resources/domains/client/Client.d.mts +19 -19
  120. package/dist/esm/api/resources/domains/client/Client.mjs +59 -52
  121. package/dist/esm/api/resources/drafts/client/Client.d.mts +10 -10
  122. package/dist/esm/api/resources/drafts/client/Client.mjs +22 -27
  123. package/dist/esm/api/resources/events/types/DomainVerifiedEvent.d.mts +7 -0
  124. package/dist/esm/api/resources/{webhooks → events}/types/EventType.d.mts +1 -0
  125. package/dist/esm/api/resources/{webhooks → events}/types/EventType.mjs +1 -0
  126. package/dist/esm/api/resources/events/types/EventTypes.d.mts +5 -0
  127. package/dist/esm/api/resources/events/types/EventTypes.mjs +2 -0
  128. package/dist/esm/api/resources/events/types/index.d.mts +3 -0
  129. package/dist/esm/api/resources/events/types/index.mjs +3 -0
  130. package/dist/esm/api/resources/inboxes/client/Client.d.mts +30 -30
  131. package/dist/esm/api/resources/inboxes/client/Client.mjs +58 -54
  132. package/dist/esm/api/resources/inboxes/resources/drafts/client/Client.d.mts +27 -27
  133. package/dist/esm/api/resources/inboxes/resources/drafts/client/Client.mjs +76 -69
  134. package/dist/esm/api/resources/inboxes/resources/messages/client/Client.d.mts +25 -25
  135. package/dist/esm/api/resources/inboxes/resources/messages/client/Client.mjs +82 -72
  136. package/dist/esm/api/resources/inboxes/resources/metrics/client/Client.d.mts +8 -8
  137. package/dist/esm/api/resources/inboxes/resources/metrics/client/Client.mjs +16 -24
  138. package/dist/esm/api/resources/inboxes/resources/threads/client/Client.d.mts +17 -17
  139. package/dist/esm/api/resources/inboxes/resources/threads/client/Client.mjs +50 -49
  140. package/dist/esm/api/resources/metrics/client/Client.d.mts +7 -7
  141. package/dist/esm/api/resources/metrics/client/Client.mjs +11 -19
  142. package/dist/esm/api/resources/pods/client/Client.d.mts +27 -27
  143. package/dist/esm/api/resources/pods/client/Client.mjs +47 -46
  144. package/dist/esm/api/resources/pods/resources/domains/client/Client.d.mts +15 -15
  145. package/dist/esm/api/resources/pods/resources/domains/client/Client.mjs +40 -42
  146. package/dist/esm/api/resources/pods/resources/drafts/client/Client.d.mts +12 -12
  147. package/dist/esm/api/resources/pods/resources/drafts/client/Client.mjs +29 -34
  148. package/dist/esm/api/resources/pods/resources/inboxes/client/Client.d.mts +19 -19
  149. package/dist/esm/api/resources/pods/resources/inboxes/client/Client.mjs +52 -51
  150. package/dist/esm/api/resources/pods/resources/threads/client/Client.d.mts +13 -13
  151. package/dist/esm/api/resources/pods/resources/threads/client/Client.mjs +38 -40
  152. package/dist/esm/api/resources/threads/client/Client.d.mts +11 -11
  153. package/dist/esm/api/resources/threads/client/Client.mjs +31 -33
  154. package/dist/esm/api/resources/webhooks/client/Client.d.mts +15 -15
  155. package/dist/esm/api/resources/webhooks/client/Client.mjs +39 -38
  156. package/dist/esm/api/resources/webhooks/types/CreateWebhookRequest.d.mts +1 -1
  157. package/dist/esm/api/resources/webhooks/types/Webhook.d.mts +1 -1
  158. package/dist/esm/api/resources/webhooks/types/index.d.mts +0 -2
  159. package/dist/esm/api/resources/webhooks/types/index.mjs +0 -2
  160. package/dist/esm/api/resources/websockets/client/Client.d.mts +6 -6
  161. package/dist/esm/api/resources/websockets/client/Client.mjs +7 -18
  162. package/dist/esm/api/resources/websockets/client/Socket.d.mts +1 -1
  163. package/dist/esm/api/resources/websockets/types/Subscribe.d.mts +5 -1
  164. package/dist/esm/api/resources/websockets/types/Subscribed.d.mts +5 -1
  165. package/dist/esm/auth/BearerAuthProvider.d.mts +14 -0
  166. package/dist/esm/auth/BearerAuthProvider.mjs +35 -0
  167. package/dist/esm/auth/index.d.mts +1 -0
  168. package/dist/esm/auth/index.mjs +1 -0
  169. package/dist/esm/core/auth/AuthProvider.d.mts +4 -1
  170. package/dist/esm/core/auth/BearerToken.d.mts +3 -1
  171. package/dist/esm/core/auth/BearerToken.mjs +7 -6
  172. package/dist/esm/core/auth/NoOpAuthProvider.d.mts +5 -0
  173. package/dist/esm/core/auth/NoOpAuthProvider.mjs +5 -0
  174. package/dist/esm/core/auth/index.d.mts +1 -0
  175. package/dist/esm/core/auth/index.mjs +1 -0
  176. package/dist/esm/core/exports.d.mts +1 -0
  177. package/dist/esm/core/exports.mjs +1 -0
  178. package/dist/esm/core/fetcher/Fetcher.d.mts +4 -1
  179. package/dist/esm/core/fetcher/Fetcher.mjs +202 -9
  180. package/dist/esm/core/fetcher/getRequestBody.d.mts +1 -1
  181. package/dist/esm/core/fetcher/getRequestBody.mjs +4 -0
  182. package/dist/esm/core/fetcher/makeRequest.d.mts +1 -1
  183. package/dist/esm/core/fetcher/makeRequest.mjs +0 -2
  184. package/dist/esm/core/fetcher/requestWithRetries.mjs +0 -9
  185. package/dist/esm/core/fetcher/signals.d.mts +0 -6
  186. package/dist/esm/core/fetcher/signals.mjs +0 -12
  187. package/dist/esm/core/headers.mjs +6 -4
  188. package/dist/esm/core/index.d.mts +1 -0
  189. package/dist/esm/core/index.mjs +1 -0
  190. package/dist/esm/core/logging/exports.d.mts +18 -0
  191. package/dist/esm/core/logging/exports.mjs +9 -0
  192. package/dist/esm/core/logging/index.d.mts +1 -0
  193. package/dist/esm/core/logging/index.mjs +1 -0
  194. package/dist/esm/core/logging/logger.d.mts +126 -0
  195. package/dist/esm/core/logging/logger.mjs +138 -0
  196. package/dist/esm/core/schemas/Schema.d.mts +1 -0
  197. package/dist/esm/core/schemas/Schema.mjs +1 -0
  198. package/dist/esm/core/schemas/builders/primitives/index.d.mts +1 -0
  199. package/dist/esm/core/schemas/builders/primitives/index.mjs +1 -0
  200. package/dist/esm/core/schemas/builders/primitives/never.d.mts +2 -0
  201. package/dist/esm/core/schemas/builders/primitives/never.mjs +11 -0
  202. package/dist/esm/core/url/join.mjs +0 -1
  203. package/dist/esm/serialization/resources/events/types/DomainVerifiedEvent.d.mts +14 -0
  204. package/dist/esm/serialization/resources/events/types/DomainVerifiedEvent.mjs +10 -0
  205. package/dist/esm/serialization/resources/{webhooks → events}/types/EventType.d.mts +2 -2
  206. package/dist/esm/serialization/resources/{webhooks → events}/types/EventType.mjs +1 -0
  207. package/dist/esm/serialization/resources/{webhooks → events}/types/EventTypes.d.mts +1 -1
  208. package/dist/esm/serialization/resources/events/types/index.d.mts +3 -0
  209. package/dist/esm/serialization/resources/events/types/index.mjs +3 -0
  210. package/dist/esm/serialization/resources/webhooks/types/CreateWebhookRequest.d.mts +1 -1
  211. package/dist/esm/serialization/resources/webhooks/types/CreateWebhookRequest.mjs +1 -1
  212. package/dist/esm/serialization/resources/webhooks/types/Webhook.d.mts +1 -1
  213. package/dist/esm/serialization/resources/webhooks/types/Webhook.mjs +1 -1
  214. package/dist/esm/serialization/resources/webhooks/types/index.d.mts +0 -2
  215. package/dist/esm/serialization/resources/webhooks/types/index.mjs +0 -2
  216. package/dist/esm/serialization/resources/websockets/client/socket/WebsocketsSocketResponse.d.mts +3 -2
  217. package/dist/esm/serialization/resources/websockets/client/socket/WebsocketsSocketResponse.mjs +2 -0
  218. package/dist/esm/serialization/resources/websockets/types/Subscribe.d.mts +4 -1
  219. package/dist/esm/serialization/resources/websockets/types/Subscribe.mjs +4 -1
  220. package/dist/esm/serialization/resources/websockets/types/Subscribed.d.mts +4 -1
  221. package/dist/esm/serialization/resources/websockets/types/Subscribed.mjs +4 -1
  222. package/dist/esm/version.d.mts +1 -1
  223. package/dist/esm/version.mjs +1 -1
  224. package/dist/llms-full.txt +620 -54
  225. package/dist/llms.txt +6 -1
  226. package/package.json +1 -1
  227. package/reference.md +170 -170
  228. package/dist/cjs/api/resources/webhooks/types/EventTypes.d.ts +0 -5
  229. package/dist/esm/api/resources/webhooks/types/EventTypes.d.mts +0 -5
  230. /package/dist/cjs/api/resources/{webhooks/types/EventTypes.js → events/types/DomainVerifiedEvent.js} +0 -0
  231. /package/dist/cjs/serialization/resources/{webhooks → events}/types/EventTypes.js +0 -0
  232. /package/dist/esm/api/resources/{webhooks/types/EventTypes.mjs → events/types/DomainVerifiedEvent.mjs} +0 -0
  233. /package/dist/esm/serialization/resources/{webhooks → events}/types/EventTypes.mjs +0 -0
@@ -8,33 +8,34 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.mjs";
11
+ import { normalizeClientOptionsWithAuth } from "../../../../../../BaseClient.mjs";
12
+ import { mergeHeaders } from "../../../../../../core/headers.mjs";
12
13
  import * as core from "../../../../../../core/index.mjs";
13
14
  import { toJson } from "../../../../../../core/json.mjs";
14
15
  import * as environments from "../../../../../../environments.mjs";
15
16
  import * as errors from "../../../../../../errors/index.mjs";
16
17
  import * as serializers from "../../../../../../serialization/index.mjs";
17
18
  import * as AgentMail from "../../../../../index.mjs";
18
- export class Messages {
19
- constructor(_options = {}) {
20
- this._options = _options;
19
+ export class MessagesClient {
20
+ constructor(options = {}) {
21
+ this._options = normalizeClientOptionsWithAuth(options);
21
22
  }
22
23
  /**
23
- * @param {AgentMail.inboxes.InboxId} inboxId
24
+ * @param {AgentMail.inboxes.InboxId} inbox_id
24
25
  * @param {AgentMail.inboxes.ListMessagesRequest} request
25
- * @param {Messages.RequestOptions} requestOptions - Request-specific configuration.
26
+ * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
26
27
  *
27
28
  * @throws {@link AgentMail.NotFoundError}
28
29
  *
29
30
  * @example
30
31
  * await client.inboxes.messages.list("inbox_id")
31
32
  */
32
- list(inboxId, request = {}, requestOptions) {
33
- return core.HttpResponsePromise.fromPromise(this.__list(inboxId, request, requestOptions));
33
+ list(inbox_id, request = {}, requestOptions) {
34
+ return core.HttpResponsePromise.fromPromise(this.__list(inbox_id, request, requestOptions));
34
35
  }
35
- __list(inboxId_1) {
36
- return __awaiter(this, arguments, void 0, function* (inboxId, request = {}, requestOptions) {
37
- var _a, _b, _c, _d, _e, _f, _g, _h;
36
+ __list(inbox_id_1) {
37
+ return __awaiter(this, arguments, void 0, function* (inbox_id, request = {}, requestOptions) {
38
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
38
39
  const { limit, pageToken, labels, before, after, ascending } = request;
39
40
  const _queryParams = {};
40
41
  if (limit != null) {
@@ -60,15 +61,18 @@ export class Messages {
60
61
  if (ascending != null) {
61
62
  _queryParams.ascending = ascending.toString();
62
63
  }
63
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
64
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
65
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
64
66
  const _response = yield core.fetcher({
65
- 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.Production).http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inboxId, { omitUndefined: true }))}/messages`),
67
+ 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.Production).http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages`),
66
68
  method: "GET",
67
69
  headers: _headers,
68
70
  queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
69
71
  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,
70
72
  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,
71
73
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
74
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
75
+ logging: this._options.logging,
72
76
  });
73
77
  if (_response.ok) {
74
78
  return {
@@ -118,30 +122,33 @@ export class Messages {
118
122
  });
119
123
  }
120
124
  /**
121
- * @param {AgentMail.inboxes.InboxId} inboxId
122
- * @param {AgentMail.MessageId} messageId
123
- * @param {Messages.RequestOptions} requestOptions - Request-specific configuration.
125
+ * @param {AgentMail.inboxes.InboxId} inbox_id
126
+ * @param {AgentMail.MessageId} message_id
127
+ * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
124
128
  *
125
129
  * @throws {@link AgentMail.NotFoundError}
126
130
  *
127
131
  * @example
128
132
  * await client.inboxes.messages.get("inbox_id", "message_id")
129
133
  */
130
- get(inboxId, messageId, requestOptions) {
131
- return core.HttpResponsePromise.fromPromise(this.__get(inboxId, messageId, requestOptions));
134
+ get(inbox_id, message_id, requestOptions) {
135
+ return core.HttpResponsePromise.fromPromise(this.__get(inbox_id, message_id, requestOptions));
132
136
  }
133
- __get(inboxId, messageId, requestOptions) {
137
+ __get(inbox_id, message_id, requestOptions) {
134
138
  return __awaiter(this, void 0, void 0, function* () {
135
- var _a, _b, _c, _d, _e, _f, _g, _h;
136
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
139
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
140
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
141
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
137
142
  const _response = yield core.fetcher({
138
- 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.Production).http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inboxId, { omitUndefined: true }))}/messages/${core.url.encodePathParam(serializers.MessageId.jsonOrThrow(messageId, { omitUndefined: true }))}`),
143
+ 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.Production).http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages/${core.url.encodePathParam(serializers.MessageId.jsonOrThrow(message_id, { omitUndefined: true }))}`),
139
144
  method: "GET",
140
145
  headers: _headers,
141
146
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
142
147
  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,
143
148
  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,
144
149
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
150
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
151
+ logging: this._options.logging,
145
152
  });
146
153
  if (_response.ok) {
147
154
  return {
@@ -193,15 +200,16 @@ export class Messages {
193
200
  /**
194
201
  * @throws {@link AgentMail.NotFoundError}
195
202
  */
196
- getAttachment(inboxId, messageId, attachmentId, requestOptions) {
197
- return core.HttpResponsePromise.fromPromise(this.__getAttachment(inboxId, messageId, attachmentId, requestOptions));
203
+ getAttachment(inbox_id, message_id, attachment_id, requestOptions) {
204
+ return core.HttpResponsePromise.fromPromise(this.__getAttachment(inbox_id, message_id, attachment_id, requestOptions));
198
205
  }
199
- __getAttachment(inboxId, messageId, attachmentId, requestOptions) {
206
+ __getAttachment(inbox_id, message_id, attachment_id, requestOptions) {
200
207
  return __awaiter(this, void 0, void 0, function* () {
201
- var _a, _b, _c, _d, _e, _f, _g, _h;
202
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
208
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
209
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
210
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
203
211
  const _response = yield core.fetcher({
204
- 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.Production).http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inboxId, { omitUndefined: true }))}/messages/${core.url.encodePathParam(serializers.MessageId.jsonOrThrow(messageId, { omitUndefined: true }))}/attachments/${core.url.encodePathParam(serializers.AttachmentId.jsonOrThrow(attachmentId, { omitUndefined: true }))}`),
212
+ 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.Production).http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages/${core.url.encodePathParam(serializers.MessageId.jsonOrThrow(message_id, { omitUndefined: true }))}/attachments/${core.url.encodePathParam(serializers.AttachmentId.jsonOrThrow(attachment_id, { omitUndefined: true }))}`),
205
213
  method: "GET",
206
214
  headers: _headers,
207
215
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
@@ -209,6 +217,8 @@ export class Messages {
209
217
  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,
210
218
  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,
211
219
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
220
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
221
+ logging: this._options.logging,
212
222
  });
213
223
  if (_response.ok) {
214
224
  return { data: _response.body, rawResponse: _response.rawResponse };
@@ -251,15 +261,16 @@ export class Messages {
251
261
  /**
252
262
  * @throws {@link AgentMail.NotFoundError}
253
263
  */
254
- getRaw(inboxId, messageId, requestOptions) {
255
- return core.HttpResponsePromise.fromPromise(this.__getRaw(inboxId, messageId, requestOptions));
264
+ getRaw(inbox_id, message_id, requestOptions) {
265
+ return core.HttpResponsePromise.fromPromise(this.__getRaw(inbox_id, message_id, requestOptions));
256
266
  }
257
- __getRaw(inboxId, messageId, requestOptions) {
267
+ __getRaw(inbox_id, message_id, requestOptions) {
258
268
  return __awaiter(this, void 0, void 0, function* () {
259
- var _a, _b, _c, _d, _e, _f, _g, _h;
260
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
269
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
270
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
271
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
261
272
  const _response = yield core.fetcher({
262
- 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.Production).http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inboxId, { omitUndefined: true }))}/messages/${core.url.encodePathParam(serializers.MessageId.jsonOrThrow(messageId, { omitUndefined: true }))}/raw`),
273
+ 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.Production).http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages/${core.url.encodePathParam(serializers.MessageId.jsonOrThrow(message_id, { omitUndefined: true }))}/raw`),
263
274
  method: "GET",
264
275
  headers: _headers,
265
276
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
@@ -267,6 +278,8 @@ export class Messages {
267
278
  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,
268
279
  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,
269
280
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
281
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
282
+ logging: this._options.logging,
270
283
  });
271
284
  if (_response.ok) {
272
285
  return { data: _response.body, rawResponse: _response.rawResponse };
@@ -307,9 +320,9 @@ export class Messages {
307
320
  });
308
321
  }
309
322
  /**
310
- * @param {AgentMail.inboxes.InboxId} inboxId
323
+ * @param {AgentMail.inboxes.InboxId} inbox_id
311
324
  * @param {AgentMail.SendMessageRequest} request
312
- * @param {Messages.RequestOptions} requestOptions - Request-specific configuration.
325
+ * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
313
326
  *
314
327
  * @throws {@link AgentMail.ValidationError}
315
328
  * @throws {@link AgentMail.NotFoundError}
@@ -318,15 +331,16 @@ export class Messages {
318
331
  * @example
319
332
  * await client.inboxes.messages.send("inbox_id", {})
320
333
  */
321
- send(inboxId, request, requestOptions) {
322
- return core.HttpResponsePromise.fromPromise(this.__send(inboxId, request, requestOptions));
334
+ send(inbox_id, request, requestOptions) {
335
+ return core.HttpResponsePromise.fromPromise(this.__send(inbox_id, request, requestOptions));
323
336
  }
324
- __send(inboxId, request, requestOptions) {
337
+ __send(inbox_id, request, requestOptions) {
325
338
  return __awaiter(this, void 0, void 0, function* () {
326
- var _a, _b, _c, _d, _e, _f, _g, _h;
327
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
339
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
340
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
341
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
328
342
  const _response = yield core.fetcher({
329
- 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.Production).http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inboxId, { omitUndefined: true }))}/messages/send`),
343
+ 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.Production).http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages/send`),
330
344
  method: "POST",
331
345
  headers: _headers,
332
346
  contentType: "application/json",
@@ -341,6 +355,8 @@ export class Messages {
341
355
  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,
342
356
  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,
343
357
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
358
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
359
+ logging: this._options.logging,
344
360
  });
345
361
  if (_response.ok) {
346
362
  return {
@@ -406,10 +422,10 @@ export class Messages {
406
422
  });
407
423
  }
408
424
  /**
409
- * @param {AgentMail.inboxes.InboxId} inboxId
410
- * @param {AgentMail.MessageId} messageId
425
+ * @param {AgentMail.inboxes.InboxId} inbox_id
426
+ * @param {AgentMail.MessageId} message_id
411
427
  * @param {AgentMail.ReplyToMessageRequest} request
412
- * @param {Messages.RequestOptions} requestOptions - Request-specific configuration.
428
+ * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
413
429
  *
414
430
  * @throws {@link AgentMail.ValidationError}
415
431
  * @throws {@link AgentMail.NotFoundError}
@@ -418,15 +434,16 @@ export class Messages {
418
434
  * @example
419
435
  * await client.inboxes.messages.reply("inbox_id", "message_id", {})
420
436
  */
421
- reply(inboxId, messageId, request, requestOptions) {
422
- return core.HttpResponsePromise.fromPromise(this.__reply(inboxId, messageId, request, requestOptions));
437
+ reply(inbox_id, message_id, request, requestOptions) {
438
+ return core.HttpResponsePromise.fromPromise(this.__reply(inbox_id, message_id, request, requestOptions));
423
439
  }
424
- __reply(inboxId, messageId, request, requestOptions) {
440
+ __reply(inbox_id, message_id, request, requestOptions) {
425
441
  return __awaiter(this, void 0, void 0, function* () {
426
- var _a, _b, _c, _d, _e, _f, _g, _h;
427
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
442
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
443
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
444
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
428
445
  const _response = yield core.fetcher({
429
- 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.Production).http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inboxId, { omitUndefined: true }))}/messages/${core.url.encodePathParam(serializers.MessageId.jsonOrThrow(messageId, { omitUndefined: true }))}/reply`),
446
+ 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.Production).http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages/${core.url.encodePathParam(serializers.MessageId.jsonOrThrow(message_id, { omitUndefined: true }))}/reply`),
430
447
  method: "POST",
431
448
  headers: _headers,
432
449
  contentType: "application/json",
@@ -441,6 +458,8 @@ export class Messages {
441
458
  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,
442
459
  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,
443
460
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
461
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
462
+ logging: this._options.logging,
444
463
  });
445
464
  if (_response.ok) {
446
465
  return {
@@ -506,10 +525,10 @@ export class Messages {
506
525
  });
507
526
  }
508
527
  /**
509
- * @param {AgentMail.inboxes.InboxId} inboxId
510
- * @param {AgentMail.MessageId} messageId
528
+ * @param {AgentMail.inboxes.InboxId} inbox_id
529
+ * @param {AgentMail.MessageId} message_id
511
530
  * @param {AgentMail.UpdateMessageRequest} request
512
- * @param {Messages.RequestOptions} requestOptions - Request-specific configuration.
531
+ * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
513
532
  *
514
533
  * @throws {@link AgentMail.ValidationError}
515
534
  * @throws {@link AgentMail.NotFoundError}
@@ -517,15 +536,16 @@ export class Messages {
517
536
  * @example
518
537
  * await client.inboxes.messages.update("inbox_id", "message_id", {})
519
538
  */
520
- update(inboxId, messageId, request, requestOptions) {
521
- return core.HttpResponsePromise.fromPromise(this.__update(inboxId, messageId, request, requestOptions));
539
+ update(inbox_id, message_id, request, requestOptions) {
540
+ return core.HttpResponsePromise.fromPromise(this.__update(inbox_id, message_id, request, requestOptions));
522
541
  }
523
- __update(inboxId, messageId, request, requestOptions) {
542
+ __update(inbox_id, message_id, request, requestOptions) {
524
543
  return __awaiter(this, void 0, void 0, function* () {
525
- var _a, _b, _c, _d, _e, _f, _g, _h;
526
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
544
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
545
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
546
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
527
547
  const _response = yield core.fetcher({
528
- 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.Production).http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inboxId, { omitUndefined: true }))}/messages/${core.url.encodePathParam(serializers.MessageId.jsonOrThrow(messageId, { omitUndefined: true }))}`),
548
+ 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.Production).http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages/${core.url.encodePathParam(serializers.MessageId.jsonOrThrow(message_id, { omitUndefined: true }))}`),
529
549
  method: "PATCH",
530
550
  headers: _headers,
531
551
  contentType: "application/json",
@@ -540,6 +560,8 @@ export class Messages {
540
560
  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,
541
561
  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,
542
562
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
563
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
564
+ logging: this._options.logging,
543
565
  });
544
566
  if (_response.ok) {
545
567
  return {
@@ -596,16 +618,4 @@ export class Messages {
596
618
  }
597
619
  });
598
620
  }
599
- _getAuthorizationHeader() {
600
- return __awaiter(this, void 0, void 0, function* () {
601
- var _a;
602
- 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;
603
- if (bearer == null) {
604
- throw new errors.AgentMailError({
605
- message: "Please specify a bearer by either passing it in to the constructor or initializing a AGENTMAIL_API_KEY environment variable",
606
- });
607
- }
608
- return `Bearer ${bearer}`;
609
- });
610
- }
611
621
  }
@@ -1,19 +1,20 @@
1
1
  import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../BaseClient.mjs";
2
+ import { type NormalizedClientOptionsWithAuth } from "../../../../../../BaseClient.mjs";
2
3
  import * as core from "../../../../../../core/index.mjs";
3
4
  import * as AgentMail from "../../../../../index.mjs";
4
- export declare namespace Metrics {
5
+ export declare namespace MetricsClient {
5
6
  interface Options extends BaseClientOptions {
6
7
  }
7
8
  interface RequestOptions extends BaseRequestOptions {
8
9
  }
9
10
  }
10
- export declare class Metrics {
11
- protected readonly _options: Metrics.Options;
12
- constructor(_options?: Metrics.Options);
11
+ export declare class MetricsClient {
12
+ protected readonly _options: NormalizedClientOptionsWithAuth<MetricsClient.Options>;
13
+ constructor(options?: MetricsClient.Options);
13
14
  /**
14
- * @param {AgentMail.inboxes.InboxId} inboxId
15
+ * @param {AgentMail.inboxes.InboxId} inbox_id
15
16
  * @param {AgentMail.inboxes.ListInboxMetricsRequest} request
16
- * @param {Metrics.RequestOptions} requestOptions - Request-specific configuration.
17
+ * @param {MetricsClient.RequestOptions} requestOptions - Request-specific configuration.
17
18
  *
18
19
  * @throws {@link AgentMail.NotFoundError}
19
20
  * @throws {@link AgentMail.ValidationError}
@@ -24,7 +25,6 @@ export declare class Metrics {
24
25
  * endTimestamp: new Date("2024-01-15T09:30:00.000Z")
25
26
  * })
26
27
  */
27
- get(inboxId: AgentMail.inboxes.InboxId, request: AgentMail.inboxes.ListInboxMetricsRequest, requestOptions?: Metrics.RequestOptions): core.HttpResponsePromise<AgentMail.ListMetricsResponse>;
28
+ get(inbox_id: AgentMail.inboxes.InboxId, request: AgentMail.inboxes.ListInboxMetricsRequest, requestOptions?: MetricsClient.RequestOptions): core.HttpResponsePromise<AgentMail.ListMetricsResponse>;
28
29
  private __get;
29
- protected _getAuthorizationHeader(): Promise<string>;
30
30
  }
@@ -8,21 +8,22 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.mjs";
11
+ import { normalizeClientOptionsWithAuth } from "../../../../../../BaseClient.mjs";
12
+ import { mergeHeaders } from "../../../../../../core/headers.mjs";
12
13
  import * as core from "../../../../../../core/index.mjs";
13
14
  import { toJson } from "../../../../../../core/json.mjs";
14
15
  import * as environments from "../../../../../../environments.mjs";
15
16
  import * as errors from "../../../../../../errors/index.mjs";
16
17
  import * as serializers from "../../../../../../serialization/index.mjs";
17
18
  import * as AgentMail from "../../../../../index.mjs";
18
- export class Metrics {
19
- constructor(_options = {}) {
20
- this._options = _options;
19
+ export class MetricsClient {
20
+ constructor(options = {}) {
21
+ this._options = normalizeClientOptionsWithAuth(options);
21
22
  }
22
23
  /**
23
- * @param {AgentMail.inboxes.InboxId} inboxId
24
+ * @param {AgentMail.inboxes.InboxId} inbox_id
24
25
  * @param {AgentMail.inboxes.ListInboxMetricsRequest} request
25
- * @param {Metrics.RequestOptions} requestOptions - Request-specific configuration.
26
+ * @param {MetricsClient.RequestOptions} requestOptions - Request-specific configuration.
26
27
  *
27
28
  * @throws {@link AgentMail.NotFoundError}
28
29
  * @throws {@link AgentMail.ValidationError}
@@ -33,12 +34,12 @@ export class Metrics {
33
34
  * endTimestamp: new Date("2024-01-15T09:30:00.000Z")
34
35
  * })
35
36
  */
36
- get(inboxId, request, requestOptions) {
37
- return core.HttpResponsePromise.fromPromise(this.__get(inboxId, request, requestOptions));
37
+ get(inbox_id, request, requestOptions) {
38
+ return core.HttpResponsePromise.fromPromise(this.__get(inbox_id, request, requestOptions));
38
39
  }
39
- __get(inboxId, request, requestOptions) {
40
+ __get(inbox_id, request, requestOptions) {
40
41
  return __awaiter(this, void 0, void 0, function* () {
41
- var _a, _b, _c, _d, _e, _f, _g, _h;
42
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
42
43
  const { eventTypes, startTimestamp, endTimestamp } = request;
43
44
  const _queryParams = {};
44
45
  if (eventTypes != null) {
@@ -51,15 +52,18 @@ export class Metrics {
51
52
  }
52
53
  _queryParams.start_timestamp = startTimestamp.toISOString();
53
54
  _queryParams.end_timestamp = endTimestamp.toISOString();
54
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
55
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
56
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
55
57
  const _response = yield core.fetcher({
56
- 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.Production).http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inboxId, { omitUndefined: true }))}/metrics`),
58
+ 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.Production).http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/metrics`),
57
59
  method: "GET",
58
60
  headers: _headers,
59
61
  queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
60
62
  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,
61
63
  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,
62
64
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
65
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
66
+ logging: this._options.logging,
63
67
  });
64
68
  if (_response.ok) {
65
69
  return {
@@ -116,16 +120,4 @@ export class Metrics {
116
120
  }
117
121
  });
118
122
  }
119
- _getAuthorizationHeader() {
120
- return __awaiter(this, void 0, void 0, function* () {
121
- var _a;
122
- 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;
123
- if (bearer == null) {
124
- throw new errors.AgentMailError({
125
- message: "Please specify a bearer by either passing it in to the constructor or initializing a AGENTMAIL_API_KEY environment variable",
126
- });
127
- }
128
- return `Bearer ${bearer}`;
129
- });
130
- }
131
123
  }
@@ -1,55 +1,55 @@
1
1
  import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../BaseClient.mjs";
2
+ import { type NormalizedClientOptionsWithAuth } from "../../../../../../BaseClient.mjs";
2
3
  import * as core from "../../../../../../core/index.mjs";
3
4
  import * as AgentMail from "../../../../../index.mjs";
4
- export declare namespace Threads {
5
+ export declare namespace ThreadsClient {
5
6
  interface Options extends BaseClientOptions {
6
7
  }
7
8
  interface RequestOptions extends BaseRequestOptions {
8
9
  }
9
10
  }
10
- export declare class Threads {
11
- protected readonly _options: Threads.Options;
12
- constructor(_options?: Threads.Options);
11
+ export declare class ThreadsClient {
12
+ protected readonly _options: NormalizedClientOptionsWithAuth<ThreadsClient.Options>;
13
+ constructor(options?: ThreadsClient.Options);
13
14
  /**
14
- * @param {AgentMail.inboxes.InboxId} inboxId
15
+ * @param {AgentMail.inboxes.InboxId} inbox_id
15
16
  * @param {AgentMail.inboxes.ListThreadsRequest} request
16
- * @param {Threads.RequestOptions} requestOptions - Request-specific configuration.
17
+ * @param {ThreadsClient.RequestOptions} requestOptions - Request-specific configuration.
17
18
  *
18
19
  * @throws {@link AgentMail.NotFoundError}
19
20
  *
20
21
  * @example
21
22
  * await client.inboxes.threads.list("inbox_id")
22
23
  */
23
- list(inboxId: AgentMail.inboxes.InboxId, request?: AgentMail.inboxes.ListThreadsRequest, requestOptions?: Threads.RequestOptions): core.HttpResponsePromise<AgentMail.ListThreadsResponse>;
24
+ list(inbox_id: AgentMail.inboxes.InboxId, request?: AgentMail.inboxes.ListThreadsRequest, requestOptions?: ThreadsClient.RequestOptions): core.HttpResponsePromise<AgentMail.ListThreadsResponse>;
24
25
  private __list;
25
26
  /**
26
- * @param {AgentMail.inboxes.InboxId} inboxId
27
- * @param {AgentMail.ThreadId} threadId
28
- * @param {Threads.RequestOptions} requestOptions - Request-specific configuration.
27
+ * @param {AgentMail.inboxes.InboxId} inbox_id
28
+ * @param {AgentMail.ThreadId} thread_id
29
+ * @param {ThreadsClient.RequestOptions} requestOptions - Request-specific configuration.
29
30
  *
30
31
  * @throws {@link AgentMail.NotFoundError}
31
32
  *
32
33
  * @example
33
34
  * await client.inboxes.threads.get("inbox_id", "thread_id")
34
35
  */
35
- get(inboxId: AgentMail.inboxes.InboxId, threadId: AgentMail.ThreadId, requestOptions?: Threads.RequestOptions): core.HttpResponsePromise<AgentMail.Thread>;
36
+ get(inbox_id: AgentMail.inboxes.InboxId, thread_id: AgentMail.ThreadId, requestOptions?: ThreadsClient.RequestOptions): core.HttpResponsePromise<AgentMail.Thread>;
36
37
  private __get;
37
38
  /**
38
39
  * @throws {@link AgentMail.NotFoundError}
39
40
  */
40
- getAttachment(inboxId: AgentMail.inboxes.InboxId, threadId: AgentMail.ThreadId, attachmentId: AgentMail.AttachmentId, requestOptions?: Threads.RequestOptions): core.HttpResponsePromise<core.BinaryResponse>;
41
+ getAttachment(inbox_id: AgentMail.inboxes.InboxId, thread_id: AgentMail.ThreadId, attachment_id: AgentMail.AttachmentId, requestOptions?: ThreadsClient.RequestOptions): core.HttpResponsePromise<core.BinaryResponse>;
41
42
  private __getAttachment;
42
43
  /**
43
- * @param {AgentMail.inboxes.InboxId} inboxId
44
- * @param {AgentMail.ThreadId} threadId
45
- * @param {Threads.RequestOptions} requestOptions - Request-specific configuration.
44
+ * @param {AgentMail.inboxes.InboxId} inbox_id
45
+ * @param {AgentMail.ThreadId} thread_id
46
+ * @param {ThreadsClient.RequestOptions} requestOptions - Request-specific configuration.
46
47
  *
47
48
  * @throws {@link AgentMail.NotFoundError}
48
49
  *
49
50
  * @example
50
51
  * await client.inboxes.threads.delete("inbox_id", "thread_id")
51
52
  */
52
- delete(inboxId: AgentMail.inboxes.InboxId, threadId: AgentMail.ThreadId, requestOptions?: Threads.RequestOptions): core.HttpResponsePromise<void>;
53
+ delete(inbox_id: AgentMail.inboxes.InboxId, thread_id: AgentMail.ThreadId, requestOptions?: ThreadsClient.RequestOptions): core.HttpResponsePromise<void>;
53
54
  private __delete;
54
- protected _getAuthorizationHeader(): Promise<string>;
55
55
  }