agentmail 0.1.5 → 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 (279) 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/domains/types/Domain.d.ts +1 -0
  11. package/dist/cjs/api/resources/domains/types/DomainItem.d.ts +1 -0
  12. package/dist/cjs/api/resources/drafts/client/Client.d.ts +10 -10
  13. package/dist/cjs/api/resources/drafts/client/Client.js +23 -28
  14. package/dist/cjs/api/resources/events/types/DomainVerifiedEvent.d.ts +7 -0
  15. package/dist/cjs/api/resources/{webhooks → events}/types/EventType.d.ts +1 -0
  16. package/dist/cjs/api/resources/{webhooks → events}/types/EventType.js +1 -0
  17. package/dist/cjs/api/resources/events/types/EventTypes.d.ts +5 -0
  18. package/dist/cjs/api/resources/events/types/EventTypes.js +3 -0
  19. package/dist/cjs/api/resources/events/types/index.d.ts +3 -0
  20. package/dist/cjs/api/resources/events/types/index.js +3 -0
  21. package/dist/cjs/api/resources/inboxes/client/Client.d.ts +30 -30
  22. package/dist/cjs/api/resources/inboxes/client/Client.js +55 -51
  23. package/dist/cjs/api/resources/inboxes/resources/drafts/client/Client.d.ts +27 -27
  24. package/dist/cjs/api/resources/inboxes/resources/drafts/client/Client.js +77 -70
  25. package/dist/cjs/api/resources/inboxes/resources/messages/client/Client.d.ts +25 -25
  26. package/dist/cjs/api/resources/inboxes/resources/messages/client/Client.js +83 -73
  27. package/dist/cjs/api/resources/inboxes/resources/metrics/client/Client.d.ts +8 -8
  28. package/dist/cjs/api/resources/inboxes/resources/metrics/client/Client.js +17 -25
  29. package/dist/cjs/api/resources/inboxes/resources/threads/client/Client.d.ts +17 -17
  30. package/dist/cjs/api/resources/inboxes/resources/threads/client/Client.js +51 -50
  31. package/dist/cjs/api/resources/inboxes/types/Inbox.d.ts +1 -0
  32. package/dist/cjs/api/resources/messages/types/ReplyToMessageRequest.d.ts +1 -0
  33. package/dist/cjs/api/resources/messages/types/SendMessageHeaders.d.ts +4 -0
  34. package/dist/cjs/api/resources/messages/types/SendMessageHeaders.js +3 -0
  35. package/dist/cjs/api/resources/messages/types/SendMessageRequest.d.ts +1 -0
  36. package/dist/cjs/api/resources/messages/types/index.d.ts +1 -0
  37. package/dist/cjs/api/resources/messages/types/index.js +1 -0
  38. package/dist/cjs/api/resources/metrics/client/Client.d.ts +7 -7
  39. package/dist/cjs/api/resources/metrics/client/Client.js +12 -20
  40. package/dist/cjs/api/resources/pods/client/Client.d.ts +27 -27
  41. package/dist/cjs/api/resources/pods/client/Client.js +44 -43
  42. package/dist/cjs/api/resources/pods/resources/domains/client/Client.d.ts +15 -15
  43. package/dist/cjs/api/resources/pods/resources/domains/client/Client.js +41 -43
  44. package/dist/cjs/api/resources/pods/resources/drafts/client/Client.d.ts +12 -12
  45. package/dist/cjs/api/resources/pods/resources/drafts/client/Client.js +30 -35
  46. package/dist/cjs/api/resources/pods/resources/inboxes/client/Client.d.ts +19 -19
  47. package/dist/cjs/api/resources/pods/resources/inboxes/client/Client.js +53 -52
  48. package/dist/cjs/api/resources/pods/resources/threads/client/Client.d.ts +13 -13
  49. package/dist/cjs/api/resources/pods/resources/threads/client/Client.js +39 -41
  50. package/dist/cjs/api/resources/threads/client/Client.d.ts +11 -11
  51. package/dist/cjs/api/resources/threads/client/Client.js +32 -34
  52. package/dist/cjs/api/resources/webhooks/client/Client.d.ts +15 -15
  53. package/dist/cjs/api/resources/webhooks/client/Client.js +40 -39
  54. package/dist/cjs/api/resources/webhooks/types/CreateWebhookRequest.d.ts +1 -1
  55. package/dist/cjs/api/resources/webhooks/types/Webhook.d.ts +1 -1
  56. package/dist/cjs/api/resources/webhooks/types/index.d.ts +0 -2
  57. package/dist/cjs/api/resources/webhooks/types/index.js +0 -2
  58. package/dist/cjs/api/resources/websockets/client/Client.d.ts +6 -6
  59. package/dist/cjs/api/resources/websockets/client/Client.js +8 -19
  60. package/dist/cjs/api/resources/websockets/client/Socket.d.ts +1 -1
  61. package/dist/cjs/api/resources/websockets/types/Subscribe.d.ts +5 -1
  62. package/dist/cjs/api/resources/websockets/types/Subscribed.d.ts +5 -1
  63. package/dist/cjs/auth/BearerAuthProvider.d.ts +14 -0
  64. package/dist/cjs/auth/BearerAuthProvider.js +72 -0
  65. package/dist/cjs/auth/index.d.ts +1 -0
  66. package/dist/cjs/auth/index.js +5 -0
  67. package/dist/cjs/core/auth/AuthProvider.d.ts +4 -1
  68. package/dist/cjs/core/auth/BearerToken.d.ts +3 -1
  69. package/dist/cjs/core/auth/BearerToken.js +7 -6
  70. package/dist/cjs/core/auth/NoOpAuthProvider.d.ts +5 -0
  71. package/dist/cjs/core/auth/NoOpAuthProvider.js +9 -0
  72. package/dist/cjs/core/auth/index.d.ts +1 -0
  73. package/dist/cjs/core/auth/index.js +3 -1
  74. package/dist/cjs/core/exports.d.ts +1 -0
  75. package/dist/cjs/core/exports.js +1 -0
  76. package/dist/cjs/core/fetcher/Fetcher.d.ts +4 -1
  77. package/dist/cjs/core/fetcher/Fetcher.js +202 -9
  78. package/dist/cjs/core/fetcher/getRequestBody.d.ts +1 -1
  79. package/dist/cjs/core/fetcher/getRequestBody.js +4 -0
  80. package/dist/cjs/core/fetcher/makeRequest.d.ts +1 -1
  81. package/dist/cjs/core/fetcher/makeRequest.js +0 -2
  82. package/dist/cjs/core/fetcher/requestWithRetries.js +0 -9
  83. package/dist/cjs/core/fetcher/signals.d.ts +0 -6
  84. package/dist/cjs/core/fetcher/signals.js +0 -12
  85. package/dist/cjs/core/headers.js +6 -4
  86. package/dist/cjs/core/index.d.ts +1 -0
  87. package/dist/cjs/core/index.js +2 -1
  88. package/dist/cjs/core/logging/exports.d.ts +18 -0
  89. package/dist/cjs/core/logging/exports.js +45 -0
  90. package/dist/cjs/core/logging/index.d.ts +1 -0
  91. package/dist/cjs/core/logging/index.js +17 -0
  92. package/dist/cjs/core/logging/logger.d.ts +126 -0
  93. package/dist/cjs/core/logging/logger.js +144 -0
  94. package/dist/cjs/core/schemas/Schema.d.ts +1 -0
  95. package/dist/cjs/core/schemas/Schema.js +1 -0
  96. package/dist/cjs/core/schemas/builders/primitives/index.d.ts +1 -0
  97. package/dist/cjs/core/schemas/builders/primitives/index.js +3 -1
  98. package/dist/cjs/core/schemas/builders/primitives/never.d.ts +2 -0
  99. package/dist/cjs/core/schemas/builders/primitives/never.js +14 -0
  100. package/dist/cjs/core/url/join.js +0 -1
  101. package/dist/cjs/serialization/resources/domains/types/Domain.d.ts +2 -0
  102. package/dist/cjs/serialization/resources/domains/types/Domain.js +2 -0
  103. package/dist/cjs/serialization/resources/domains/types/DomainItem.d.ts +2 -0
  104. package/dist/cjs/serialization/resources/domains/types/DomainItem.js +2 -0
  105. package/dist/cjs/serialization/resources/events/types/DomainVerifiedEvent.d.ts +14 -0
  106. package/dist/cjs/serialization/resources/events/types/DomainVerifiedEvent.js +46 -0
  107. package/dist/cjs/serialization/resources/{webhooks → events}/types/EventType.d.ts +2 -2
  108. package/dist/cjs/serialization/resources/{webhooks → events}/types/EventType.js +1 -0
  109. package/dist/cjs/serialization/resources/{webhooks → events}/types/EventTypes.d.ts +1 -1
  110. package/dist/cjs/serialization/resources/events/types/index.d.ts +3 -0
  111. package/dist/cjs/serialization/resources/events/types/index.js +3 -0
  112. package/dist/cjs/serialization/resources/inboxes/types/Inbox.d.ts +2 -0
  113. package/dist/cjs/serialization/resources/inboxes/types/Inbox.js +2 -0
  114. package/dist/cjs/serialization/resources/messages/types/ReplyToMessageRequest.d.ts +2 -0
  115. package/dist/cjs/serialization/resources/messages/types/ReplyToMessageRequest.js +2 -0
  116. package/dist/cjs/serialization/resources/messages/types/SendMessageHeaders.d.ts +7 -0
  117. package/dist/cjs/serialization/resources/messages/types/SendMessageHeaders.js +39 -0
  118. package/dist/cjs/serialization/resources/messages/types/SendMessageRequest.d.ts +2 -0
  119. package/dist/cjs/serialization/resources/messages/types/SendMessageRequest.js +2 -0
  120. package/dist/cjs/serialization/resources/messages/types/index.d.ts +1 -0
  121. package/dist/cjs/serialization/resources/messages/types/index.js +1 -0
  122. package/dist/cjs/serialization/resources/webhooks/types/CreateWebhookRequest.d.ts +1 -1
  123. package/dist/cjs/serialization/resources/webhooks/types/CreateWebhookRequest.js +1 -1
  124. package/dist/cjs/serialization/resources/webhooks/types/Webhook.d.ts +1 -1
  125. package/dist/cjs/serialization/resources/webhooks/types/Webhook.js +1 -1
  126. package/dist/cjs/serialization/resources/webhooks/types/index.d.ts +0 -2
  127. package/dist/cjs/serialization/resources/webhooks/types/index.js +0 -2
  128. package/dist/cjs/serialization/resources/websockets/client/socket/WebsocketsSocketResponse.d.ts +3 -2
  129. package/dist/cjs/serialization/resources/websockets/client/socket/WebsocketsSocketResponse.js +2 -0
  130. package/dist/cjs/serialization/resources/websockets/types/Subscribe.d.ts +4 -1
  131. package/dist/cjs/serialization/resources/websockets/types/Subscribe.js +4 -1
  132. package/dist/cjs/serialization/resources/websockets/types/Subscribed.d.ts +4 -1
  133. package/dist/cjs/serialization/resources/websockets/types/Subscribed.js +4 -1
  134. package/dist/cjs/version.d.ts +1 -1
  135. package/dist/cjs/version.js +1 -1
  136. package/dist/esm/BaseClient.d.mts +14 -1
  137. package/dist/esm/BaseClient.mjs +24 -1
  138. package/dist/esm/Client.d.mts +30 -29
  139. package/dist/esm/Client.mjs +21 -29
  140. package/dist/esm/api/resources/apiKeys/client/Client.d.mts +12 -12
  141. package/dist/esm/api/resources/apiKeys/client/Client.mjs +28 -30
  142. package/dist/esm/api/resources/domains/client/Client.d.mts +19 -19
  143. package/dist/esm/api/resources/domains/client/Client.mjs +59 -52
  144. package/dist/esm/api/resources/domains/types/Domain.d.mts +1 -0
  145. package/dist/esm/api/resources/domains/types/DomainItem.d.mts +1 -0
  146. package/dist/esm/api/resources/drafts/client/Client.d.mts +10 -10
  147. package/dist/esm/api/resources/drafts/client/Client.mjs +22 -27
  148. package/dist/esm/api/resources/events/types/DomainVerifiedEvent.d.mts +7 -0
  149. package/dist/esm/api/resources/{webhooks → events}/types/EventType.d.mts +1 -0
  150. package/dist/esm/api/resources/{webhooks → events}/types/EventType.mjs +1 -0
  151. package/dist/esm/api/resources/events/types/EventTypes.d.mts +5 -0
  152. package/dist/esm/api/resources/events/types/EventTypes.mjs +2 -0
  153. package/dist/esm/api/resources/events/types/index.d.mts +3 -0
  154. package/dist/esm/api/resources/events/types/index.mjs +3 -0
  155. package/dist/esm/api/resources/inboxes/client/Client.d.mts +30 -30
  156. package/dist/esm/api/resources/inboxes/client/Client.mjs +58 -54
  157. package/dist/esm/api/resources/inboxes/resources/drafts/client/Client.d.mts +27 -27
  158. package/dist/esm/api/resources/inboxes/resources/drafts/client/Client.mjs +76 -69
  159. package/dist/esm/api/resources/inboxes/resources/messages/client/Client.d.mts +25 -25
  160. package/dist/esm/api/resources/inboxes/resources/messages/client/Client.mjs +82 -72
  161. package/dist/esm/api/resources/inboxes/resources/metrics/client/Client.d.mts +8 -8
  162. package/dist/esm/api/resources/inboxes/resources/metrics/client/Client.mjs +16 -24
  163. package/dist/esm/api/resources/inboxes/resources/threads/client/Client.d.mts +17 -17
  164. package/dist/esm/api/resources/inboxes/resources/threads/client/Client.mjs +50 -49
  165. package/dist/esm/api/resources/inboxes/types/Inbox.d.mts +1 -0
  166. package/dist/esm/api/resources/messages/types/ReplyToMessageRequest.d.mts +1 -0
  167. package/dist/esm/api/resources/messages/types/SendMessageHeaders.d.mts +4 -0
  168. package/dist/esm/api/resources/messages/types/SendMessageHeaders.mjs +2 -0
  169. package/dist/esm/api/resources/messages/types/SendMessageRequest.d.mts +1 -0
  170. package/dist/esm/api/resources/messages/types/index.d.mts +1 -0
  171. package/dist/esm/api/resources/messages/types/index.mjs +1 -0
  172. package/dist/esm/api/resources/metrics/client/Client.d.mts +7 -7
  173. package/dist/esm/api/resources/metrics/client/Client.mjs +11 -19
  174. package/dist/esm/api/resources/pods/client/Client.d.mts +27 -27
  175. package/dist/esm/api/resources/pods/client/Client.mjs +47 -46
  176. package/dist/esm/api/resources/pods/resources/domains/client/Client.d.mts +15 -15
  177. package/dist/esm/api/resources/pods/resources/domains/client/Client.mjs +40 -42
  178. package/dist/esm/api/resources/pods/resources/drafts/client/Client.d.mts +12 -12
  179. package/dist/esm/api/resources/pods/resources/drafts/client/Client.mjs +29 -34
  180. package/dist/esm/api/resources/pods/resources/inboxes/client/Client.d.mts +19 -19
  181. package/dist/esm/api/resources/pods/resources/inboxes/client/Client.mjs +52 -51
  182. package/dist/esm/api/resources/pods/resources/threads/client/Client.d.mts +13 -13
  183. package/dist/esm/api/resources/pods/resources/threads/client/Client.mjs +38 -40
  184. package/dist/esm/api/resources/threads/client/Client.d.mts +11 -11
  185. package/dist/esm/api/resources/threads/client/Client.mjs +31 -33
  186. package/dist/esm/api/resources/webhooks/client/Client.d.mts +15 -15
  187. package/dist/esm/api/resources/webhooks/client/Client.mjs +39 -38
  188. package/dist/esm/api/resources/webhooks/types/CreateWebhookRequest.d.mts +1 -1
  189. package/dist/esm/api/resources/webhooks/types/Webhook.d.mts +1 -1
  190. package/dist/esm/api/resources/webhooks/types/index.d.mts +0 -2
  191. package/dist/esm/api/resources/webhooks/types/index.mjs +0 -2
  192. package/dist/esm/api/resources/websockets/client/Client.d.mts +6 -6
  193. package/dist/esm/api/resources/websockets/client/Client.mjs +7 -18
  194. package/dist/esm/api/resources/websockets/client/Socket.d.mts +1 -1
  195. package/dist/esm/api/resources/websockets/types/Subscribe.d.mts +5 -1
  196. package/dist/esm/api/resources/websockets/types/Subscribed.d.mts +5 -1
  197. package/dist/esm/auth/BearerAuthProvider.d.mts +14 -0
  198. package/dist/esm/auth/BearerAuthProvider.mjs +35 -0
  199. package/dist/esm/auth/index.d.mts +1 -0
  200. package/dist/esm/auth/index.mjs +1 -0
  201. package/dist/esm/core/auth/AuthProvider.d.mts +4 -1
  202. package/dist/esm/core/auth/BearerToken.d.mts +3 -1
  203. package/dist/esm/core/auth/BearerToken.mjs +7 -6
  204. package/dist/esm/core/auth/NoOpAuthProvider.d.mts +5 -0
  205. package/dist/esm/core/auth/NoOpAuthProvider.mjs +5 -0
  206. package/dist/esm/core/auth/index.d.mts +1 -0
  207. package/dist/esm/core/auth/index.mjs +1 -0
  208. package/dist/esm/core/exports.d.mts +1 -0
  209. package/dist/esm/core/exports.mjs +1 -0
  210. package/dist/esm/core/fetcher/Fetcher.d.mts +4 -1
  211. package/dist/esm/core/fetcher/Fetcher.mjs +202 -9
  212. package/dist/esm/core/fetcher/getRequestBody.d.mts +1 -1
  213. package/dist/esm/core/fetcher/getRequestBody.mjs +4 -0
  214. package/dist/esm/core/fetcher/makeRequest.d.mts +1 -1
  215. package/dist/esm/core/fetcher/makeRequest.mjs +0 -2
  216. package/dist/esm/core/fetcher/requestWithRetries.mjs +0 -9
  217. package/dist/esm/core/fetcher/signals.d.mts +0 -6
  218. package/dist/esm/core/fetcher/signals.mjs +0 -12
  219. package/dist/esm/core/headers.mjs +6 -4
  220. package/dist/esm/core/index.d.mts +1 -0
  221. package/dist/esm/core/index.mjs +1 -0
  222. package/dist/esm/core/logging/exports.d.mts +18 -0
  223. package/dist/esm/core/logging/exports.mjs +9 -0
  224. package/dist/esm/core/logging/index.d.mts +1 -0
  225. package/dist/esm/core/logging/index.mjs +1 -0
  226. package/dist/esm/core/logging/logger.d.mts +126 -0
  227. package/dist/esm/core/logging/logger.mjs +138 -0
  228. package/dist/esm/core/schemas/Schema.d.mts +1 -0
  229. package/dist/esm/core/schemas/Schema.mjs +1 -0
  230. package/dist/esm/core/schemas/builders/primitives/index.d.mts +1 -0
  231. package/dist/esm/core/schemas/builders/primitives/index.mjs +1 -0
  232. package/dist/esm/core/schemas/builders/primitives/never.d.mts +2 -0
  233. package/dist/esm/core/schemas/builders/primitives/never.mjs +11 -0
  234. package/dist/esm/core/url/join.mjs +0 -1
  235. package/dist/esm/serialization/resources/domains/types/Domain.d.mts +2 -0
  236. package/dist/esm/serialization/resources/domains/types/Domain.mjs +2 -0
  237. package/dist/esm/serialization/resources/domains/types/DomainItem.d.mts +2 -0
  238. package/dist/esm/serialization/resources/domains/types/DomainItem.mjs +2 -0
  239. package/dist/esm/serialization/resources/events/types/DomainVerifiedEvent.d.mts +14 -0
  240. package/dist/esm/serialization/resources/events/types/DomainVerifiedEvent.mjs +10 -0
  241. package/dist/esm/serialization/resources/{webhooks → events}/types/EventType.d.mts +2 -2
  242. package/dist/esm/serialization/resources/{webhooks → events}/types/EventType.mjs +1 -0
  243. package/dist/esm/serialization/resources/{webhooks → events}/types/EventTypes.d.mts +1 -1
  244. package/dist/esm/serialization/resources/events/types/index.d.mts +3 -0
  245. package/dist/esm/serialization/resources/events/types/index.mjs +3 -0
  246. package/dist/esm/serialization/resources/inboxes/types/Inbox.d.mts +2 -0
  247. package/dist/esm/serialization/resources/inboxes/types/Inbox.mjs +2 -0
  248. package/dist/esm/serialization/resources/messages/types/ReplyToMessageRequest.d.mts +2 -0
  249. package/dist/esm/serialization/resources/messages/types/ReplyToMessageRequest.mjs +2 -0
  250. package/dist/esm/serialization/resources/messages/types/SendMessageHeaders.d.mts +7 -0
  251. package/dist/esm/serialization/resources/messages/types/SendMessageHeaders.mjs +3 -0
  252. package/dist/esm/serialization/resources/messages/types/SendMessageRequest.d.mts +2 -0
  253. package/dist/esm/serialization/resources/messages/types/SendMessageRequest.mjs +2 -0
  254. package/dist/esm/serialization/resources/messages/types/index.d.mts +1 -0
  255. package/dist/esm/serialization/resources/messages/types/index.mjs +1 -0
  256. package/dist/esm/serialization/resources/webhooks/types/CreateWebhookRequest.d.mts +1 -1
  257. package/dist/esm/serialization/resources/webhooks/types/CreateWebhookRequest.mjs +1 -1
  258. package/dist/esm/serialization/resources/webhooks/types/Webhook.d.mts +1 -1
  259. package/dist/esm/serialization/resources/webhooks/types/Webhook.mjs +1 -1
  260. package/dist/esm/serialization/resources/webhooks/types/index.d.mts +0 -2
  261. package/dist/esm/serialization/resources/webhooks/types/index.mjs +0 -2
  262. package/dist/esm/serialization/resources/websockets/client/socket/WebsocketsSocketResponse.d.mts +3 -2
  263. package/dist/esm/serialization/resources/websockets/client/socket/WebsocketsSocketResponse.mjs +2 -0
  264. package/dist/esm/serialization/resources/websockets/types/Subscribe.d.mts +4 -1
  265. package/dist/esm/serialization/resources/websockets/types/Subscribe.mjs +4 -1
  266. package/dist/esm/serialization/resources/websockets/types/Subscribed.d.mts +4 -1
  267. package/dist/esm/serialization/resources/websockets/types/Subscribed.mjs +4 -1
  268. package/dist/esm/version.d.mts +1 -1
  269. package/dist/esm/version.mjs +1 -1
  270. package/dist/llms-full.txt +1241 -123
  271. package/dist/llms.txt +7 -1
  272. package/package.json +1 -1
  273. package/reference.md +170 -170
  274. package/dist/cjs/api/resources/webhooks/types/EventTypes.d.ts +0 -5
  275. package/dist/esm/api/resources/webhooks/types/EventTypes.d.mts +0 -5
  276. /package/dist/cjs/api/resources/{webhooks/types/EventTypes.js → events/types/DomainVerifiedEvent.js} +0 -0
  277. /package/dist/cjs/serialization/resources/{webhooks → events}/types/EventTypes.js +0 -0
  278. /package/dist/esm/api/resources/{webhooks/types/EventTypes.mjs → events/types/DomainVerifiedEvent.mjs} +0 -0
  279. /package/dist/esm/serialization/resources/{webhooks → events}/types/EventTypes.mjs +0 -0
@@ -43,7 +43,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
43
43
  });
44
44
  };
45
45
  Object.defineProperty(exports, "__esModule", { value: true });
46
- exports.Threads = void 0;
46
+ exports.ThreadsClient = void 0;
47
+ const BaseClient_js_1 = require("../../../../../../BaseClient.js");
47
48
  const headers_js_1 = require("../../../../../../core/headers.js");
48
49
  const core = __importStar(require("../../../../../../core/index.js"));
49
50
  const json_js_1 = require("../../../../../../core/json.js");
@@ -51,26 +52,26 @@ const environments = __importStar(require("../../../../../../environments.js"));
51
52
  const errors = __importStar(require("../../../../../../errors/index.js"));
52
53
  const serializers = __importStar(require("../../../../../../serialization/index.js"));
53
54
  const AgentMail = __importStar(require("../../../../../index.js"));
54
- class Threads {
55
- constructor(_options = {}) {
56
- this._options = _options;
55
+ class ThreadsClient {
56
+ constructor(options = {}) {
57
+ this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
57
58
  }
58
59
  /**
59
- * @param {AgentMail.pods.PodId} podId
60
+ * @param {AgentMail.pods.PodId} pod_id
60
61
  * @param {AgentMail.pods.ListThreadsRequest} request
61
- * @param {Threads.RequestOptions} requestOptions - Request-specific configuration.
62
+ * @param {ThreadsClient.RequestOptions} requestOptions - Request-specific configuration.
62
63
  *
63
64
  * @throws {@link AgentMail.NotFoundError}
64
65
  *
65
66
  * @example
66
67
  * await client.pods.threads.list("pod_id")
67
68
  */
68
- list(podId, request = {}, requestOptions) {
69
- return core.HttpResponsePromise.fromPromise(this.__list(podId, request, requestOptions));
69
+ list(pod_id, request = {}, requestOptions) {
70
+ return core.HttpResponsePromise.fromPromise(this.__list(pod_id, request, requestOptions));
70
71
  }
71
- __list(podId_1) {
72
- return __awaiter(this, arguments, void 0, function* (podId, request = {}, requestOptions) {
73
- var _a, _b, _c, _d, _e, _f, _g, _h;
72
+ __list(pod_id_1) {
73
+ return __awaiter(this, arguments, void 0, function* (pod_id, request = {}, requestOptions) {
74
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
74
75
  const { limit, pageToken, labels, before, after, ascending } = request;
75
76
  const _queryParams = {};
76
77
  if (limit != null) {
@@ -96,15 +97,18 @@ class Threads {
96
97
  if (ascending != null) {
97
98
  _queryParams.ascending = ascending.toString();
98
99
  }
99
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
100
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
101
+ 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);
100
102
  const _response = yield core.fetcher({
101
- 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/pods/${core.url.encodePathParam(serializers.pods.PodId.jsonOrThrow(podId, { omitUndefined: true }))}/threads`),
103
+ 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/pods/${core.url.encodePathParam(serializers.pods.PodId.jsonOrThrow(pod_id, { omitUndefined: true }))}/threads`),
102
104
  method: "GET",
103
105
  headers: _headers,
104
106
  queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
105
107
  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,
106
108
  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,
107
109
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
110
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
111
+ logging: this._options.logging,
108
112
  });
109
113
  if (_response.ok) {
110
114
  return {
@@ -154,30 +158,33 @@ class Threads {
154
158
  });
155
159
  }
156
160
  /**
157
- * @param {AgentMail.pods.PodId} podId
158
- * @param {AgentMail.ThreadId} threadId
159
- * @param {Threads.RequestOptions} requestOptions - Request-specific configuration.
161
+ * @param {AgentMail.pods.PodId} pod_id
162
+ * @param {AgentMail.ThreadId} thread_id
163
+ * @param {ThreadsClient.RequestOptions} requestOptions - Request-specific configuration.
160
164
  *
161
165
  * @throws {@link AgentMail.NotFoundError}
162
166
  *
163
167
  * @example
164
168
  * await client.pods.threads.get("pod_id", "thread_id")
165
169
  */
166
- get(podId, threadId, requestOptions) {
167
- return core.HttpResponsePromise.fromPromise(this.__get(podId, threadId, requestOptions));
170
+ get(pod_id, thread_id, requestOptions) {
171
+ return core.HttpResponsePromise.fromPromise(this.__get(pod_id, thread_id, requestOptions));
168
172
  }
169
- __get(podId, threadId, requestOptions) {
173
+ __get(pod_id, thread_id, requestOptions) {
170
174
  return __awaiter(this, void 0, void 0, function* () {
171
- var _a, _b, _c, _d, _e, _f, _g, _h;
172
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
175
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
176
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
177
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
173
178
  const _response = yield core.fetcher({
174
- 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/pods/${core.url.encodePathParam(serializers.pods.PodId.jsonOrThrow(podId, { omitUndefined: true }))}/threads/${core.url.encodePathParam(serializers.ThreadId.jsonOrThrow(threadId, { omitUndefined: true }))}`),
179
+ url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Production).http, `/v0/pods/${core.url.encodePathParam(serializers.pods.PodId.jsonOrThrow(pod_id, { omitUndefined: true }))}/threads/${core.url.encodePathParam(serializers.ThreadId.jsonOrThrow(thread_id, { omitUndefined: true }))}`),
175
180
  method: "GET",
176
181
  headers: _headers,
177
182
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
178
183
  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,
179
184
  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,
180
185
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
186
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
187
+ logging: this._options.logging,
181
188
  });
182
189
  if (_response.ok) {
183
190
  return {
@@ -229,15 +236,16 @@ class Threads {
229
236
  /**
230
237
  * @throws {@link AgentMail.NotFoundError}
231
238
  */
232
- getAttachment(podId, threadId, attachmentId, requestOptions) {
233
- return core.HttpResponsePromise.fromPromise(this.__getAttachment(podId, threadId, attachmentId, requestOptions));
239
+ getAttachment(pod_id, thread_id, attachment_id, requestOptions) {
240
+ return core.HttpResponsePromise.fromPromise(this.__getAttachment(pod_id, thread_id, attachment_id, requestOptions));
234
241
  }
235
- __getAttachment(podId, threadId, attachmentId, requestOptions) {
242
+ __getAttachment(pod_id, thread_id, attachment_id, requestOptions) {
236
243
  return __awaiter(this, void 0, void 0, function* () {
237
- var _a, _b, _c, _d, _e, _f, _g, _h;
238
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
244
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
245
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
246
+ 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);
239
247
  const _response = yield core.fetcher({
240
- 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/pods/${core.url.encodePathParam(serializers.pods.PodId.jsonOrThrow(podId, { omitUndefined: true }))}/threads/${core.url.encodePathParam(serializers.ThreadId.jsonOrThrow(threadId, { omitUndefined: true }))}/attachments/${core.url.encodePathParam(serializers.AttachmentId.jsonOrThrow(attachmentId, { omitUndefined: true }))}`),
248
+ 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/pods/${core.url.encodePathParam(serializers.pods.PodId.jsonOrThrow(pod_id, { omitUndefined: true }))}/threads/${core.url.encodePathParam(serializers.ThreadId.jsonOrThrow(thread_id, { omitUndefined: true }))}/attachments/${core.url.encodePathParam(serializers.AttachmentId.jsonOrThrow(attachment_id, { omitUndefined: true }))}`),
241
249
  method: "GET",
242
250
  headers: _headers,
243
251
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
@@ -245,6 +253,8 @@ class Threads {
245
253
  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,
246
254
  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,
247
255
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
256
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
257
+ logging: this._options.logging,
248
258
  });
249
259
  if (_response.ok) {
250
260
  return { data: _response.body, rawResponse: _response.rawResponse };
@@ -284,17 +294,5 @@ class Threads {
284
294
  }
285
295
  });
286
296
  }
287
- _getAuthorizationHeader() {
288
- return __awaiter(this, void 0, void 0, function* () {
289
- var _a;
290
- 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;
291
- if (bearer == null) {
292
- throw new errors.AgentMailError({
293
- message: "Please specify a bearer by either passing it in to the constructor or initializing a AGENTMAIL_API_KEY environment variable",
294
- });
295
- }
296
- return `Bearer ${bearer}`;
297
- });
298
- }
299
297
  }
300
- exports.Threads = Threads;
298
+ exports.ThreadsClient = ThreadsClient;
@@ -1,41 +1,41 @@
1
1
  import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js";
2
+ import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.js";
2
3
  import * as core from "../../../../core/index.js";
3
4
  import * as AgentMail from "../../../index.js";
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
15
  * @param {AgentMail.ListThreadsRequest} request
15
- * @param {Threads.RequestOptions} requestOptions - Request-specific configuration.
16
+ * @param {ThreadsClient.RequestOptions} requestOptions - Request-specific configuration.
16
17
  *
17
18
  * @throws {@link AgentMail.NotFoundError}
18
19
  *
19
20
  * @example
20
21
  * await client.threads.list()
21
22
  */
22
- list(request?: AgentMail.ListThreadsRequest, requestOptions?: Threads.RequestOptions): core.HttpResponsePromise<AgentMail.ListThreadsResponse>;
23
+ list(request?: AgentMail.ListThreadsRequest, requestOptions?: ThreadsClient.RequestOptions): core.HttpResponsePromise<AgentMail.ListThreadsResponse>;
23
24
  private __list;
24
25
  /**
25
- * @param {AgentMail.ThreadId} threadId
26
- * @param {Threads.RequestOptions} requestOptions - Request-specific configuration.
26
+ * @param {AgentMail.ThreadId} thread_id
27
+ * @param {ThreadsClient.RequestOptions} requestOptions - Request-specific configuration.
27
28
  *
28
29
  * @throws {@link AgentMail.NotFoundError}
29
30
  *
30
31
  * @example
31
32
  * await client.threads.get("thread_id")
32
33
  */
33
- get(threadId: AgentMail.ThreadId, requestOptions?: Threads.RequestOptions): core.HttpResponsePromise<AgentMail.Thread>;
34
+ get(thread_id: AgentMail.ThreadId, requestOptions?: ThreadsClient.RequestOptions): core.HttpResponsePromise<AgentMail.Thread>;
34
35
  private __get;
35
36
  /**
36
37
  * @throws {@link AgentMail.NotFoundError}
37
38
  */
38
- getAttachment(threadId: AgentMail.ThreadId, attachmentId: AgentMail.AttachmentId, requestOptions?: Threads.RequestOptions): core.HttpResponsePromise<core.BinaryResponse>;
39
+ getAttachment(thread_id: AgentMail.ThreadId, attachment_id: AgentMail.AttachmentId, requestOptions?: ThreadsClient.RequestOptions): core.HttpResponsePromise<core.BinaryResponse>;
39
40
  private __getAttachment;
40
- protected _getAuthorizationHeader(): Promise<string>;
41
41
  }
@@ -43,7 +43,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
43
43
  });
44
44
  };
45
45
  Object.defineProperty(exports, "__esModule", { value: true });
46
- exports.Threads = void 0;
46
+ exports.ThreadsClient = void 0;
47
+ const BaseClient_js_1 = require("../../../../BaseClient.js");
47
48
  const headers_js_1 = require("../../../../core/headers.js");
48
49
  const core = __importStar(require("../../../../core/index.js"));
49
50
  const json_js_1 = require("../../../../core/json.js");
@@ -51,13 +52,13 @@ const environments = __importStar(require("../../../../environments.js"));
51
52
  const errors = __importStar(require("../../../../errors/index.js"));
52
53
  const serializers = __importStar(require("../../../../serialization/index.js"));
53
54
  const AgentMail = __importStar(require("../../../index.js"));
54
- class Threads {
55
- constructor(_options = {}) {
56
- this._options = _options;
55
+ class ThreadsClient {
56
+ constructor(options = {}) {
57
+ this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
57
58
  }
58
59
  /**
59
60
  * @param {AgentMail.ListThreadsRequest} request
60
- * @param {Threads.RequestOptions} requestOptions - Request-specific configuration.
61
+ * @param {ThreadsClient.RequestOptions} requestOptions - Request-specific configuration.
61
62
  *
62
63
  * @throws {@link AgentMail.NotFoundError}
63
64
  *
@@ -69,7 +70,7 @@ class Threads {
69
70
  }
70
71
  __list() {
71
72
  return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
72
- var _a, _b, _c, _d, _e, _f, _g, _h;
73
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
73
74
  const { limit, pageToken, labels, before, after, ascending } = request;
74
75
  const _queryParams = {};
75
76
  if (limit != null) {
@@ -95,7 +96,8 @@ class Threads {
95
96
  if (ascending != null) {
96
97
  _queryParams.ascending = ascending.toString();
97
98
  }
98
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
99
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
100
+ 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);
99
101
  const _response = yield core.fetcher({
100
102
  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/threads"),
101
103
  method: "GET",
@@ -104,6 +106,8 @@ class Threads {
104
106
  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,
105
107
  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,
106
108
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
109
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
110
+ logging: this._options.logging,
107
111
  });
108
112
  if (_response.ok) {
109
113
  return {
@@ -153,29 +157,32 @@ class Threads {
153
157
  });
154
158
  }
155
159
  /**
156
- * @param {AgentMail.ThreadId} threadId
157
- * @param {Threads.RequestOptions} requestOptions - Request-specific configuration.
160
+ * @param {AgentMail.ThreadId} thread_id
161
+ * @param {ThreadsClient.RequestOptions} requestOptions - Request-specific configuration.
158
162
  *
159
163
  * @throws {@link AgentMail.NotFoundError}
160
164
  *
161
165
  * @example
162
166
  * await client.threads.get("thread_id")
163
167
  */
164
- get(threadId, requestOptions) {
165
- return core.HttpResponsePromise.fromPromise(this.__get(threadId, requestOptions));
168
+ get(thread_id, requestOptions) {
169
+ return core.HttpResponsePromise.fromPromise(this.__get(thread_id, requestOptions));
166
170
  }
167
- __get(threadId, requestOptions) {
171
+ __get(thread_id, requestOptions) {
168
172
  return __awaiter(this, void 0, void 0, function* () {
169
- var _a, _b, _c, _d, _e, _f, _g, _h;
170
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
173
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
174
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
175
+ 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);
171
176
  const _response = yield core.fetcher({
172
- 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/threads/${core.url.encodePathParam(serializers.ThreadId.jsonOrThrow(threadId, { omitUndefined: true }))}`),
177
+ 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/threads/${core.url.encodePathParam(serializers.ThreadId.jsonOrThrow(thread_id, { omitUndefined: true }))}`),
173
178
  method: "GET",
174
179
  headers: _headers,
175
180
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
176
181
  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,
177
182
  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,
178
183
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
184
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
185
+ logging: this._options.logging,
179
186
  });
180
187
  if (_response.ok) {
181
188
  return {
@@ -227,15 +234,16 @@ class Threads {
227
234
  /**
228
235
  * @throws {@link AgentMail.NotFoundError}
229
236
  */
230
- getAttachment(threadId, attachmentId, requestOptions) {
231
- return core.HttpResponsePromise.fromPromise(this.__getAttachment(threadId, attachmentId, requestOptions));
237
+ getAttachment(thread_id, attachment_id, requestOptions) {
238
+ return core.HttpResponsePromise.fromPromise(this.__getAttachment(thread_id, attachment_id, requestOptions));
232
239
  }
233
- __getAttachment(threadId, attachmentId, requestOptions) {
240
+ __getAttachment(thread_id, attachment_id, requestOptions) {
234
241
  return __awaiter(this, void 0, void 0, function* () {
235
- var _a, _b, _c, _d, _e, _f, _g, _h;
236
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
242
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
243
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
244
+ 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);
237
245
  const _response = yield core.fetcher({
238
- 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/threads/${core.url.encodePathParam(serializers.ThreadId.jsonOrThrow(threadId, { omitUndefined: true }))}/attachments/${core.url.encodePathParam(serializers.AttachmentId.jsonOrThrow(attachmentId, { omitUndefined: true }))}`),
246
+ 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/threads/${core.url.encodePathParam(serializers.ThreadId.jsonOrThrow(thread_id, { omitUndefined: true }))}/attachments/${core.url.encodePathParam(serializers.AttachmentId.jsonOrThrow(attachment_id, { omitUndefined: true }))}`),
239
247
  method: "GET",
240
248
  headers: _headers,
241
249
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
@@ -243,6 +251,8 @@ class Threads {
243
251
  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,
244
252
  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,
245
253
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
254
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
255
+ logging: this._options.logging,
246
256
  });
247
257
  if (_response.ok) {
248
258
  return { data: _response.body, rawResponse: _response.rawResponse };
@@ -282,17 +292,5 @@ class Threads {
282
292
  }
283
293
  });
284
294
  }
285
- _getAuthorizationHeader() {
286
- return __awaiter(this, void 0, void 0, function* () {
287
- var _a;
288
- 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;
289
- if (bearer == null) {
290
- throw new errors.AgentMailError({
291
- message: "Please specify a bearer by either passing it in to the constructor or initializing a AGENTMAIL_API_KEY environment variable",
292
- });
293
- }
294
- return `Bearer ${bearer}`;
295
- });
296
- }
297
295
  }
298
- exports.Threads = Threads;
296
+ exports.ThreadsClient = ThreadsClient;
@@ -1,38 +1,39 @@
1
1
  import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js";
2
+ import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.js";
2
3
  import * as core from "../../../../core/index.js";
3
4
  import * as AgentMail from "../../../index.js";
4
- export declare namespace Webhooks {
5
+ export declare namespace WebhooksClient {
5
6
  interface Options extends BaseClientOptions {
6
7
  }
7
8
  interface RequestOptions extends BaseRequestOptions {
8
9
  }
9
10
  }
10
- export declare class Webhooks {
11
- protected readonly _options: Webhooks.Options;
12
- constructor(_options?: Webhooks.Options);
11
+ export declare class WebhooksClient {
12
+ protected readonly _options: NormalizedClientOptionsWithAuth<WebhooksClient.Options>;
13
+ constructor(options?: WebhooksClient.Options);
13
14
  /**
14
15
  * @param {AgentMail.webhooks.ListWebhooksRequest} request
15
- * @param {Webhooks.RequestOptions} requestOptions - Request-specific configuration.
16
+ * @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
16
17
  *
17
18
  * @example
18
19
  * await client.webhooks.list()
19
20
  */
20
- list(request?: AgentMail.webhooks.ListWebhooksRequest, requestOptions?: Webhooks.RequestOptions): core.HttpResponsePromise<AgentMail.webhooks.ListWebhooksResponse>;
21
+ list(request?: AgentMail.webhooks.ListWebhooksRequest, requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<AgentMail.webhooks.ListWebhooksResponse>;
21
22
  private __list;
22
23
  /**
23
- * @param {AgentMail.webhooks.WebhookId} webhookId
24
- * @param {Webhooks.RequestOptions} requestOptions - Request-specific configuration.
24
+ * @param {AgentMail.webhooks.WebhookId} webhook_id
25
+ * @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
25
26
  *
26
27
  * @throws {@link AgentMail.NotFoundError}
27
28
  *
28
29
  * @example
29
30
  * await client.webhooks.get("webhook_id")
30
31
  */
31
- get(webhookId: AgentMail.webhooks.WebhookId, requestOptions?: Webhooks.RequestOptions): core.HttpResponsePromise<AgentMail.webhooks.Webhook>;
32
+ get(webhook_id: AgentMail.webhooks.WebhookId, requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<AgentMail.webhooks.Webhook>;
32
33
  private __get;
33
34
  /**
34
35
  * @param {AgentMail.webhooks.CreateWebhookRequest} request
35
- * @param {Webhooks.RequestOptions} requestOptions - Request-specific configuration.
36
+ * @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
36
37
  *
37
38
  * @throws {@link AgentMail.ValidationError}
38
39
  *
@@ -42,18 +43,17 @@ export declare class Webhooks {
42
43
  * eventTypes: ["message.received", "message.received"]
43
44
  * })
44
45
  */
45
- create(request: AgentMail.webhooks.CreateWebhookRequest, requestOptions?: Webhooks.RequestOptions): core.HttpResponsePromise<AgentMail.webhooks.Webhook>;
46
+ create(request: AgentMail.webhooks.CreateWebhookRequest, requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<AgentMail.webhooks.Webhook>;
46
47
  private __create;
47
48
  /**
48
- * @param {AgentMail.webhooks.WebhookId} webhookId
49
- * @param {Webhooks.RequestOptions} requestOptions - Request-specific configuration.
49
+ * @param {AgentMail.webhooks.WebhookId} webhook_id
50
+ * @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
50
51
  *
51
52
  * @throws {@link AgentMail.NotFoundError}
52
53
  *
53
54
  * @example
54
55
  * await client.webhooks.delete("webhook_id")
55
56
  */
56
- delete(webhookId: AgentMail.webhooks.WebhookId, requestOptions?: Webhooks.RequestOptions): core.HttpResponsePromise<void>;
57
+ delete(webhook_id: AgentMail.webhooks.WebhookId, requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<void>;
57
58
  private __delete;
58
- protected _getAuthorizationHeader(): Promise<string>;
59
59
  }