@deepgram/sdk 5.0.0 → 5.1.0

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 (404) hide show
  1. package/dist/browser/index.global.js +1172 -199
  2. package/dist/cjs/BaseClient.js +2 -2
  3. package/dist/cjs/Client.d.ts +15 -0
  4. package/dist/cjs/Client.js +79 -0
  5. package/dist/cjs/api/resources/agent/resources/v1/client/Client.d.ts +2 -0
  6. package/dist/cjs/api/resources/agent/resources/v1/client/Client.js +5 -5
  7. package/dist/cjs/api/resources/agent/resources/v1/client/Socket.d.ts +6 -6
  8. package/dist/cjs/api/resources/agent/resources/v1/client/Socket.js +6 -6
  9. package/dist/cjs/api/resources/agent/resources/v1/exports.d.ts +1 -0
  10. package/dist/cjs/api/resources/agent/resources/v1/exports.js +3 -1
  11. package/dist/cjs/api/resources/agent/resources/v1/resources/settings/resources/think/resources/models/client/Client.js +1 -1
  12. package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1FunctionCallRequest.d.ts +2 -0
  13. package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1History.d.ts +24 -0
  14. package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1History.js +3 -0
  15. package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1Settings.d.ts +2 -1
  16. package/dist/cjs/api/resources/agent/resources/v1/types/index.d.ts +1 -0
  17. package/dist/cjs/api/resources/agent/resources/v1/types/index.js +1 -0
  18. package/dist/cjs/api/resources/auth/resources/v1/resources/tokens/client/Client.js +1 -1
  19. package/dist/cjs/api/resources/index.d.ts +1 -0
  20. package/dist/cjs/api/resources/index.js +2 -1
  21. package/dist/cjs/api/resources/listen/resources/v1/client/Client.d.ts +2 -0
  22. package/dist/cjs/api/resources/listen/resources/v1/client/Client.js +5 -5
  23. package/dist/cjs/api/resources/listen/resources/v1/client/Socket.d.ts +3 -3
  24. package/dist/cjs/api/resources/listen/resources/v1/client/Socket.js +2 -2
  25. package/dist/cjs/api/resources/listen/resources/v1/exports.d.ts +1 -0
  26. package/dist/cjs/api/resources/listen/resources/v1/exports.js +3 -1
  27. package/dist/cjs/api/resources/listen/resources/v1/resources/media/client/Client.d.ts +1 -0
  28. package/dist/cjs/api/resources/listen/resources/v1/resources/media/client/Client.js +11 -2
  29. package/dist/cjs/api/resources/listen/resources/v1/resources/media/client/requests/ListenV1RequestUrl.d.ts +1 -0
  30. package/dist/cjs/api/resources/listen/resources/v2/client/Client.d.ts +2 -0
  31. package/dist/cjs/api/resources/listen/resources/v2/client/Client.js +5 -5
  32. package/dist/cjs/api/resources/listen/resources/v2/client/Socket.d.ts +4 -4
  33. package/dist/cjs/api/resources/listen/resources/v2/client/Socket.js +3 -3
  34. package/dist/cjs/api/resources/listen/resources/v2/exports.d.ts +1 -0
  35. package/dist/cjs/api/resources/listen/resources/v2/exports.js +3 -1
  36. package/dist/cjs/api/resources/listen/resources/v2/types/ListenV2Configure.d.ts +6 -0
  37. package/dist/cjs/api/resources/listen/resources/v2/types/ListenV2TurnInfo.d.ts +11 -0
  38. package/dist/cjs/api/resources/manage/resources/v1/resources/models/client/Client.js +6 -2
  39. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/client/Client.js +9 -5
  40. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/balances/client/Client.js +2 -2
  41. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/breakdown/client/Client.d.ts +2 -1
  42. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/breakdown/client/Client.js +7 -2
  43. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/breakdown/client/requests/BreakdownListRequest.d.ts +2 -1
  44. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/fields/client/Client.js +5 -1
  45. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/purchases/client/Client.js +5 -1
  46. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/keys/client/Client.js +8 -4
  47. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/members/client/Client.js +2 -2
  48. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/members/resources/invites/client/Client.js +3 -3
  49. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/members/resources/scopes/client/Client.js +2 -2
  50. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/models/client/Client.js +6 -2
  51. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/requests/client/Client.js +6 -2
  52. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/usage/client/Client.js +5 -1
  53. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/usage/resources/breakdown/client/Client.js +5 -1
  54. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/usage/resources/fields/client/Client.js +5 -1
  55. package/dist/cjs/api/resources/read/resources/v1/resources/text/client/Client.js +5 -1
  56. package/dist/cjs/api/resources/selfHosted/resources/v1/resources/distributionCredentials/client/Client.d.ts +1 -0
  57. package/dist/cjs/api/resources/selfHosted/resources/v1/resources/distributionCredentials/client/Client.js +9 -4
  58. package/dist/cjs/api/resources/selfHosted/resources/v1/resources/distributionCredentials/client/requests/CreateProjectDistributionCredentialsV1Request.d.ts +1 -0
  59. package/dist/cjs/api/resources/speak/resources/v1/client/Client.d.ts +3 -0
  60. package/dist/cjs/api/resources/speak/resources/v1/client/Client.js +6 -5
  61. package/dist/cjs/api/resources/speak/resources/v1/client/Socket.d.ts +2 -2
  62. package/dist/cjs/api/resources/speak/resources/v1/client/Socket.js +2 -2
  63. package/dist/cjs/api/resources/speak/resources/v1/exports.d.ts +1 -0
  64. package/dist/cjs/api/resources/speak/resources/v1/exports.js +3 -1
  65. package/dist/cjs/api/resources/speak/resources/v1/resources/audio/client/Client.js +7 -2
  66. package/dist/cjs/api/resources/speak/resources/v1/resources/audio/client/requests/SpeakV1Request.d.ts +2 -0
  67. package/dist/cjs/api/resources/speak/resources/v1/types/SpeakV1Metadata.d.ts +2 -4
  68. package/dist/cjs/api/resources/voiceAgent/client/Client.d.ts +15 -0
  69. package/dist/cjs/api/resources/voiceAgent/client/Client.js +21 -0
  70. package/dist/cjs/api/resources/voiceAgent/exports.d.ts +3 -0
  71. package/dist/cjs/api/resources/voiceAgent/exports.js +22 -0
  72. package/dist/cjs/api/resources/voiceAgent/index.d.ts +2 -0
  73. package/dist/cjs/api/resources/voiceAgent/index.js +18 -0
  74. package/dist/cjs/api/resources/voiceAgent/resources/configurations/client/Client.d.ts +89 -0
  75. package/dist/cjs/api/resources/voiceAgent/resources/configurations/client/Client.js +325 -0
  76. package/dist/cjs/api/resources/voiceAgent/resources/configurations/client/index.d.ts +1 -0
  77. package/dist/cjs/api/resources/voiceAgent/resources/configurations/client/index.js +17 -0
  78. package/dist/cjs/api/resources/voiceAgent/resources/configurations/client/requests/CreateAgentConfigurationV1Request.d.ts +14 -0
  79. package/dist/cjs/api/resources/voiceAgent/resources/configurations/client/requests/CreateAgentConfigurationV1Request.js +3 -0
  80. package/dist/cjs/api/resources/voiceAgent/resources/configurations/client/requests/UpdateAgentMetadataV1Request.d.ts +12 -0
  81. package/dist/cjs/api/resources/voiceAgent/resources/configurations/client/requests/UpdateAgentMetadataV1Request.js +3 -0
  82. package/dist/cjs/api/resources/voiceAgent/resources/configurations/client/requests/index.d.ts +2 -0
  83. package/dist/cjs/api/resources/voiceAgent/resources/configurations/client/requests/index.js +2 -0
  84. package/dist/cjs/api/resources/voiceAgent/resources/configurations/exports.d.ts +2 -0
  85. package/dist/cjs/api/resources/voiceAgent/resources/configurations/exports.js +21 -0
  86. package/dist/cjs/api/resources/voiceAgent/resources/configurations/index.d.ts +1 -0
  87. package/dist/cjs/api/resources/voiceAgent/resources/configurations/index.js +17 -0
  88. package/dist/cjs/api/resources/voiceAgent/resources/index.d.ts +4 -0
  89. package/dist/cjs/api/resources/voiceAgent/resources/index.js +43 -0
  90. package/dist/cjs/api/resources/voiceAgent/resources/variables/client/Client.d.ts +92 -0
  91. package/dist/cjs/api/resources/voiceAgent/resources/variables/client/Client.js +325 -0
  92. package/dist/cjs/api/resources/voiceAgent/resources/variables/client/index.d.ts +1 -0
  93. package/dist/cjs/api/resources/voiceAgent/resources/variables/client/index.js +17 -0
  94. package/dist/cjs/api/resources/voiceAgent/resources/variables/client/requests/CreateAgentVariableV1Request.d.ts +16 -0
  95. package/dist/cjs/api/resources/voiceAgent/resources/variables/client/requests/CreateAgentVariableV1Request.js +3 -0
  96. package/dist/cjs/api/resources/voiceAgent/resources/variables/client/requests/UpdateAgentVariableV1Request.d.ts +11 -0
  97. package/dist/cjs/api/resources/voiceAgent/resources/variables/client/requests/UpdateAgentVariableV1Request.js +3 -0
  98. package/dist/cjs/api/resources/voiceAgent/resources/variables/client/requests/index.d.ts +2 -0
  99. package/dist/cjs/api/resources/voiceAgent/resources/variables/client/requests/index.js +2 -0
  100. package/dist/cjs/api/resources/voiceAgent/resources/variables/exports.d.ts +2 -0
  101. package/dist/cjs/api/resources/voiceAgent/resources/variables/exports.js +21 -0
  102. package/dist/cjs/api/resources/voiceAgent/resources/variables/index.d.ts +1 -0
  103. package/dist/cjs/api/resources/voiceAgent/resources/variables/index.js +17 -0
  104. package/dist/cjs/api/types/AgentConfigurationV1.d.ts +15 -0
  105. package/dist/cjs/api/types/AgentConfigurationV1.js +3 -0
  106. package/dist/cjs/api/types/AgentVariableV1.d.ts +14 -0
  107. package/dist/cjs/api/types/AgentVariableV1.js +3 -0
  108. package/dist/cjs/api/types/Cartesia.d.ts +2 -0
  109. package/dist/cjs/api/types/CreateAgentConfigurationV1Response.d.ts +8 -0
  110. package/dist/cjs/api/types/CreateAgentConfigurationV1Response.js +3 -0
  111. package/dist/cjs/api/types/Deepgram.d.ts +2 -0
  112. package/dist/cjs/api/types/DeleteAgentConfigurationV1Response.d.ts +4 -0
  113. package/dist/cjs/api/types/DeleteAgentConfigurationV1Response.js +3 -0
  114. package/dist/cjs/api/types/DeleteAgentVariableV1Response.d.ts +4 -0
  115. package/dist/cjs/api/types/DeleteAgentVariableV1Response.js +3 -0
  116. package/dist/cjs/api/types/ListAgentConfigurationsV1Response.d.ts +5 -0
  117. package/dist/cjs/api/types/ListAgentConfigurationsV1Response.js +3 -0
  118. package/dist/cjs/api/types/ListAgentVariablesV1Response.d.ts +5 -0
  119. package/dist/cjs/api/types/ListAgentVariablesV1Response.js +3 -0
  120. package/dist/cjs/api/types/ListenV1Callback.d.ts +3 -0
  121. package/dist/cjs/api/types/ListenV1Channels.d.ts +3 -0
  122. package/dist/cjs/api/types/ListenV1Endpointing.d.ts +3 -0
  123. package/dist/cjs/api/types/ListenV1Extra.d.ts +3 -0
  124. package/dist/cjs/api/types/ListenV1Keyterm.d.ts +3 -0
  125. package/dist/cjs/api/types/ListenV1Keywords.d.ts +3 -0
  126. package/dist/cjs/api/types/ListenV1Language.d.ts +3 -0
  127. package/dist/cjs/api/types/ListenV1MipOptOut.d.ts +3 -0
  128. package/dist/cjs/api/types/ListenV1Replace.d.ts +3 -0
  129. package/dist/cjs/api/types/ListenV1SampleRate.d.ts +3 -0
  130. package/dist/cjs/api/types/ListenV1Search.d.ts +3 -0
  131. package/dist/cjs/api/types/ListenV1Tag.d.ts +3 -0
  132. package/dist/cjs/api/types/ListenV1UtteranceEndMs.d.ts +3 -0
  133. package/dist/cjs/api/types/ListenV1Version.d.ts +3 -0
  134. package/dist/cjs/api/types/ListenV2EagerEotThreshold.d.ts +5 -0
  135. package/dist/cjs/api/types/ListenV2EotThreshold.d.ts +4 -0
  136. package/dist/cjs/api/types/ListenV2EotTimeoutMs.d.ts +4 -0
  137. package/dist/cjs/api/types/ListenV2MipOptOut.d.ts +5 -0
  138. package/dist/cjs/api/types/ListenV2Model.d.ts +6 -4
  139. package/dist/cjs/api/types/ListenV2Model.js +6 -0
  140. package/dist/cjs/api/types/ListenV2SampleRate.d.ts +3 -0
  141. package/dist/cjs/api/types/ListenV2Tag.d.ts +4 -0
  142. package/dist/cjs/api/types/SpeakV1MipOptOut.d.ts +3 -0
  143. package/dist/cjs/api/types/SpeakV1Speed.d.ts +4 -0
  144. package/dist/cjs/api/types/SpeakV1Speed.js +3 -0
  145. package/dist/cjs/api/types/UsageBreakdownV1Response.d.ts +3 -4
  146. package/dist/cjs/api/types/index.d.ts +8 -0
  147. package/dist/cjs/api/types/index.js +8 -0
  148. package/dist/cjs/core/auth/BasicAuth.d.ts +2 -2
  149. package/dist/cjs/core/auth/BasicAuth.js +7 -1
  150. package/dist/cjs/core/fetcher/BinaryResponse.d.ts +1 -1
  151. package/dist/cjs/core/fetcher/Fetcher.d.ts +8 -0
  152. package/dist/cjs/core/fetcher/Fetcher.js +13 -8
  153. package/dist/cjs/core/fetcher/index.d.ts +2 -0
  154. package/dist/cjs/core/fetcher/index.js +3 -1
  155. package/dist/cjs/core/fetcher/makePassthroughRequest.d.ts +49 -0
  156. package/dist/cjs/core/fetcher/makePassthroughRequest.js +135 -0
  157. package/dist/cjs/core/file/file.js +3 -2
  158. package/dist/cjs/core/url/QueryStringBuilder.d.ts +47 -0
  159. package/dist/cjs/core/url/QueryStringBuilder.js +83 -0
  160. package/dist/cjs/core/url/index.d.ts +1 -0
  161. package/dist/cjs/core/url/index.js +3 -1
  162. package/dist/cjs/core/url/qs.d.ts +2 -1
  163. package/dist/cjs/core/url/qs.js +24 -12
  164. package/dist/cjs/core/websocket/ws.d.ts +10 -1
  165. package/dist/cjs/core/websocket/ws.js +19 -5
  166. package/dist/cjs/errors/DeepgramError.d.ts +3 -1
  167. package/dist/cjs/errors/DeepgramError.js +4 -1
  168. package/dist/cjs/errors/DeepgramTimeoutError.d.ts +4 -1
  169. package/dist/cjs/errors/DeepgramTimeoutError.js +4 -1
  170. package/dist/cjs/errors/handleNonStatusCodeError.js +4 -1
  171. package/dist/cjs/version.d.ts +1 -1
  172. package/dist/cjs/version.js +1 -1
  173. package/dist/esm/BaseClient.mjs +2 -2
  174. package/dist/esm/Client.d.mts +15 -0
  175. package/dist/esm/Client.mjs +46 -0
  176. package/dist/esm/api/resources/agent/resources/v1/client/Client.d.mts +2 -0
  177. package/dist/esm/api/resources/agent/resources/v1/client/Client.mjs +5 -5
  178. package/dist/esm/api/resources/agent/resources/v1/client/Socket.d.mts +6 -6
  179. package/dist/esm/api/resources/agent/resources/v1/client/Socket.mjs +6 -6
  180. package/dist/esm/api/resources/agent/resources/v1/exports.d.mts +1 -0
  181. package/dist/esm/api/resources/agent/resources/v1/exports.mjs +1 -0
  182. package/dist/esm/api/resources/agent/resources/v1/resources/settings/resources/think/resources/models/client/Client.mjs +1 -1
  183. package/dist/esm/api/resources/agent/resources/v1/types/AgentV1FunctionCallRequest.d.mts +2 -0
  184. package/dist/esm/api/resources/agent/resources/v1/types/AgentV1History.d.mts +24 -0
  185. package/dist/esm/api/resources/agent/resources/v1/types/AgentV1History.mjs +2 -0
  186. package/dist/esm/api/resources/agent/resources/v1/types/AgentV1Settings.d.mts +2 -1
  187. package/dist/esm/api/resources/agent/resources/v1/types/index.d.mts +1 -0
  188. package/dist/esm/api/resources/agent/resources/v1/types/index.mjs +1 -0
  189. package/dist/esm/api/resources/auth/resources/v1/resources/tokens/client/Client.mjs +1 -1
  190. package/dist/esm/api/resources/index.d.mts +1 -0
  191. package/dist/esm/api/resources/index.mjs +1 -0
  192. package/dist/esm/api/resources/listen/resources/v1/client/Client.d.mts +2 -0
  193. package/dist/esm/api/resources/listen/resources/v1/client/Client.mjs +5 -5
  194. package/dist/esm/api/resources/listen/resources/v1/client/Socket.d.mts +3 -3
  195. package/dist/esm/api/resources/listen/resources/v1/client/Socket.mjs +2 -2
  196. package/dist/esm/api/resources/listen/resources/v1/exports.d.mts +1 -0
  197. package/dist/esm/api/resources/listen/resources/v1/exports.mjs +1 -0
  198. package/dist/esm/api/resources/listen/resources/v1/resources/media/client/Client.d.mts +1 -0
  199. package/dist/esm/api/resources/listen/resources/v1/resources/media/client/Client.mjs +11 -2
  200. package/dist/esm/api/resources/listen/resources/v1/resources/media/client/requests/ListenV1RequestUrl.d.mts +1 -0
  201. package/dist/esm/api/resources/listen/resources/v2/client/Client.d.mts +2 -0
  202. package/dist/esm/api/resources/listen/resources/v2/client/Client.mjs +5 -5
  203. package/dist/esm/api/resources/listen/resources/v2/client/Socket.d.mts +4 -4
  204. package/dist/esm/api/resources/listen/resources/v2/client/Socket.mjs +3 -3
  205. package/dist/esm/api/resources/listen/resources/v2/exports.d.mts +1 -0
  206. package/dist/esm/api/resources/listen/resources/v2/exports.mjs +1 -0
  207. package/dist/esm/api/resources/listen/resources/v2/types/ListenV2Configure.d.mts +6 -0
  208. package/dist/esm/api/resources/listen/resources/v2/types/ListenV2TurnInfo.d.mts +11 -0
  209. package/dist/esm/api/resources/manage/resources/v1/resources/models/client/Client.mjs +6 -2
  210. package/dist/esm/api/resources/manage/resources/v1/resources/projects/client/Client.mjs +9 -5
  211. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/balances/client/Client.mjs +2 -2
  212. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/breakdown/client/Client.d.mts +2 -1
  213. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/breakdown/client/Client.mjs +7 -2
  214. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/breakdown/client/requests/BreakdownListRequest.d.mts +2 -1
  215. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/fields/client/Client.mjs +5 -1
  216. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/purchases/client/Client.mjs +5 -1
  217. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/keys/client/Client.mjs +8 -4
  218. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/members/client/Client.mjs +2 -2
  219. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/members/resources/invites/client/Client.mjs +3 -3
  220. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/members/resources/scopes/client/Client.mjs +2 -2
  221. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/models/client/Client.mjs +6 -2
  222. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/requests/client/Client.mjs +6 -2
  223. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/usage/client/Client.mjs +5 -1
  224. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/usage/resources/breakdown/client/Client.mjs +5 -1
  225. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/usage/resources/fields/client/Client.mjs +5 -1
  226. package/dist/esm/api/resources/read/resources/v1/resources/text/client/Client.mjs +5 -1
  227. package/dist/esm/api/resources/selfHosted/resources/v1/resources/distributionCredentials/client/Client.d.mts +1 -0
  228. package/dist/esm/api/resources/selfHosted/resources/v1/resources/distributionCredentials/client/Client.mjs +9 -4
  229. package/dist/esm/api/resources/selfHosted/resources/v1/resources/distributionCredentials/client/requests/CreateProjectDistributionCredentialsV1Request.d.mts +1 -0
  230. package/dist/esm/api/resources/speak/resources/v1/client/Client.d.mts +3 -0
  231. package/dist/esm/api/resources/speak/resources/v1/client/Client.mjs +6 -5
  232. package/dist/esm/api/resources/speak/resources/v1/client/Socket.d.mts +2 -2
  233. package/dist/esm/api/resources/speak/resources/v1/client/Socket.mjs +2 -2
  234. package/dist/esm/api/resources/speak/resources/v1/exports.d.mts +1 -0
  235. package/dist/esm/api/resources/speak/resources/v1/exports.mjs +1 -0
  236. package/dist/esm/api/resources/speak/resources/v1/resources/audio/client/Client.mjs +7 -2
  237. package/dist/esm/api/resources/speak/resources/v1/resources/audio/client/requests/SpeakV1Request.d.mts +2 -0
  238. package/dist/esm/api/resources/speak/resources/v1/types/SpeakV1Metadata.d.mts +2 -4
  239. package/dist/esm/api/resources/voiceAgent/client/Client.d.mts +15 -0
  240. package/dist/esm/api/resources/voiceAgent/client/Client.mjs +17 -0
  241. package/dist/esm/api/resources/voiceAgent/client/index.d.mts +1 -0
  242. package/dist/esm/api/resources/voiceAgent/client/index.mjs +1 -0
  243. package/dist/esm/api/resources/voiceAgent/exports.d.mts +3 -0
  244. package/dist/esm/api/resources/voiceAgent/exports.mjs +4 -0
  245. package/dist/esm/api/resources/voiceAgent/index.d.mts +2 -0
  246. package/dist/esm/api/resources/voiceAgent/index.mjs +2 -0
  247. package/dist/esm/api/resources/voiceAgent/resources/configurations/client/Client.d.mts +89 -0
  248. package/dist/esm/api/resources/voiceAgent/resources/configurations/client/Client.mjs +288 -0
  249. package/dist/esm/api/resources/voiceAgent/resources/configurations/client/index.d.mts +1 -0
  250. package/dist/esm/api/resources/voiceAgent/resources/configurations/client/index.mjs +1 -0
  251. package/dist/esm/api/resources/voiceAgent/resources/configurations/client/requests/CreateAgentConfigurationV1Request.d.mts +14 -0
  252. package/dist/esm/api/resources/voiceAgent/resources/configurations/client/requests/CreateAgentConfigurationV1Request.mjs +2 -0
  253. package/dist/esm/api/resources/voiceAgent/resources/configurations/client/requests/UpdateAgentMetadataV1Request.d.mts +12 -0
  254. package/dist/esm/api/resources/voiceAgent/resources/configurations/client/requests/UpdateAgentMetadataV1Request.mjs +2 -0
  255. package/dist/esm/api/resources/voiceAgent/resources/configurations/client/requests/index.d.mts +2 -0
  256. package/dist/esm/api/resources/voiceAgent/resources/configurations/client/requests/index.mjs +1 -0
  257. package/dist/esm/api/resources/voiceAgent/resources/configurations/exports.d.mts +2 -0
  258. package/dist/esm/api/resources/voiceAgent/resources/configurations/exports.mjs +3 -0
  259. package/dist/esm/api/resources/voiceAgent/resources/configurations/index.d.mts +1 -0
  260. package/dist/esm/api/resources/voiceAgent/resources/configurations/index.mjs +1 -0
  261. package/dist/esm/api/resources/voiceAgent/resources/index.d.mts +4 -0
  262. package/dist/esm/api/resources/voiceAgent/resources/index.mjs +4 -0
  263. package/dist/esm/api/resources/voiceAgent/resources/variables/client/Client.d.mts +92 -0
  264. package/dist/esm/api/resources/voiceAgent/resources/variables/client/Client.mjs +288 -0
  265. package/dist/esm/api/resources/voiceAgent/resources/variables/client/index.d.mts +1 -0
  266. package/dist/esm/api/resources/voiceAgent/resources/variables/client/index.mjs +1 -0
  267. package/dist/esm/api/resources/voiceAgent/resources/variables/client/requests/CreateAgentVariableV1Request.d.mts +16 -0
  268. package/dist/esm/api/resources/voiceAgent/resources/variables/client/requests/CreateAgentVariableV1Request.mjs +2 -0
  269. package/dist/esm/api/resources/voiceAgent/resources/variables/client/requests/UpdateAgentVariableV1Request.d.mts +11 -0
  270. package/dist/esm/api/resources/voiceAgent/resources/variables/client/requests/UpdateAgentVariableV1Request.mjs +2 -0
  271. package/dist/esm/api/resources/voiceAgent/resources/variables/client/requests/index.d.mts +2 -0
  272. package/dist/esm/api/resources/voiceAgent/resources/variables/client/requests/index.mjs +1 -0
  273. package/dist/esm/api/resources/voiceAgent/resources/variables/exports.d.mts +2 -0
  274. package/dist/esm/api/resources/voiceAgent/resources/variables/exports.mjs +3 -0
  275. package/dist/esm/api/resources/voiceAgent/resources/variables/index.d.mts +1 -0
  276. package/dist/esm/api/resources/voiceAgent/resources/variables/index.mjs +1 -0
  277. package/dist/esm/api/types/AgentConfigurationV1.d.mts +15 -0
  278. package/dist/esm/api/types/AgentConfigurationV1.mjs +2 -0
  279. package/dist/esm/api/types/AgentVariableV1.d.mts +14 -0
  280. package/dist/esm/api/types/AgentVariableV1.mjs +2 -0
  281. package/dist/esm/api/types/Cartesia.d.mts +2 -0
  282. package/dist/esm/api/types/CreateAgentConfigurationV1Response.d.mts +8 -0
  283. package/dist/esm/api/types/CreateAgentConfigurationV1Response.mjs +2 -0
  284. package/dist/esm/api/types/Deepgram.d.mts +2 -0
  285. package/dist/esm/api/types/DeleteAgentConfigurationV1Response.d.mts +4 -0
  286. package/dist/esm/api/types/DeleteAgentConfigurationV1Response.mjs +2 -0
  287. package/dist/esm/api/types/DeleteAgentVariableV1Response.d.mts +4 -0
  288. package/dist/esm/api/types/DeleteAgentVariableV1Response.mjs +2 -0
  289. package/dist/esm/api/types/ListAgentConfigurationsV1Response.d.mts +5 -0
  290. package/dist/esm/api/types/ListAgentConfigurationsV1Response.mjs +2 -0
  291. package/dist/esm/api/types/ListAgentVariablesV1Response.d.mts +5 -0
  292. package/dist/esm/api/types/ListAgentVariablesV1Response.mjs +2 -0
  293. package/dist/esm/api/types/ListenV1Callback.d.mts +3 -0
  294. package/dist/esm/api/types/ListenV1Channels.d.mts +3 -0
  295. package/dist/esm/api/types/ListenV1Endpointing.d.mts +3 -0
  296. package/dist/esm/api/types/ListenV1Extra.d.mts +3 -0
  297. package/dist/esm/api/types/ListenV1Keyterm.d.mts +3 -0
  298. package/dist/esm/api/types/ListenV1Keywords.d.mts +3 -0
  299. package/dist/esm/api/types/ListenV1Language.d.mts +3 -0
  300. package/dist/esm/api/types/ListenV1MipOptOut.d.mts +3 -0
  301. package/dist/esm/api/types/ListenV1Replace.d.mts +3 -0
  302. package/dist/esm/api/types/ListenV1SampleRate.d.mts +3 -0
  303. package/dist/esm/api/types/ListenV1Search.d.mts +3 -0
  304. package/dist/esm/api/types/ListenV1Tag.d.mts +3 -0
  305. package/dist/esm/api/types/ListenV1UtteranceEndMs.d.mts +3 -0
  306. package/dist/esm/api/types/ListenV1Version.d.mts +3 -0
  307. package/dist/esm/api/types/ListenV2EagerEotThreshold.d.mts +5 -0
  308. package/dist/esm/api/types/ListenV2EotThreshold.d.mts +4 -0
  309. package/dist/esm/api/types/ListenV2EotTimeoutMs.d.mts +4 -0
  310. package/dist/esm/api/types/ListenV2MipOptOut.d.mts +5 -0
  311. package/dist/esm/api/types/ListenV2Model.d.mts +6 -4
  312. package/dist/esm/api/types/ListenV2Model.mjs +5 -1
  313. package/dist/esm/api/types/ListenV2SampleRate.d.mts +3 -0
  314. package/dist/esm/api/types/ListenV2Tag.d.mts +4 -0
  315. package/dist/esm/api/types/SpeakV1MipOptOut.d.mts +3 -0
  316. package/dist/esm/api/types/SpeakV1Speed.d.mts +4 -0
  317. package/dist/esm/api/types/SpeakV1Speed.mjs +2 -0
  318. package/dist/esm/api/types/UsageBreakdownV1Response.d.mts +3 -4
  319. package/dist/esm/api/types/index.d.mts +8 -0
  320. package/dist/esm/api/types/index.mjs +8 -0
  321. package/dist/esm/core/auth/BasicAuth.d.mts +2 -2
  322. package/dist/esm/core/auth/BasicAuth.mjs +7 -1
  323. package/dist/esm/core/fetcher/BinaryResponse.d.mts +1 -1
  324. package/dist/esm/core/fetcher/Fetcher.d.mts +8 -0
  325. package/dist/esm/core/fetcher/Fetcher.mjs +13 -8
  326. package/dist/esm/core/fetcher/index.d.mts +2 -0
  327. package/dist/esm/core/fetcher/index.mjs +1 -0
  328. package/dist/esm/core/fetcher/makePassthroughRequest.d.mts +49 -0
  329. package/dist/esm/core/fetcher/makePassthroughRequest.mjs +132 -0
  330. package/dist/esm/core/file/file.mjs +3 -2
  331. package/dist/esm/core/url/QueryStringBuilder.d.mts +47 -0
  332. package/dist/esm/core/url/QueryStringBuilder.mjs +80 -0
  333. package/dist/esm/core/url/index.d.mts +1 -0
  334. package/dist/esm/core/url/index.mjs +1 -0
  335. package/dist/esm/core/url/qs.d.mts +2 -1
  336. package/dist/esm/core/url/qs.mjs +24 -12
  337. package/dist/esm/core/websocket/ws.d.mts +10 -1
  338. package/dist/esm/core/websocket/ws.mjs +19 -5
  339. package/dist/esm/errors/DeepgramError.d.mts +3 -1
  340. package/dist/esm/errors/DeepgramError.mjs +4 -1
  341. package/dist/esm/errors/DeepgramTimeoutError.d.mts +4 -1
  342. package/dist/esm/errors/DeepgramTimeoutError.mjs +4 -1
  343. package/dist/esm/errors/handleNonStatusCodeError.mjs +4 -1
  344. package/dist/esm/version.d.mts +1 -1
  345. package/dist/esm/version.mjs +1 -1
  346. package/package.json +540 -500
  347. package/reference.md +731 -1
  348. package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1SettingsAgentSpeakEndpointProvider.d.ts +0 -201
  349. package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1SettingsAgentSpeakEndpointProvider.js +0 -139
  350. package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1SettingsAgentSpeakOneItemProvider.d.ts +0 -201
  351. package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1SettingsAgentSpeakOneItemProvider.js +0 -139
  352. package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1SettingsAgentThinkProvider.d.ts +0 -115
  353. package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1SettingsAgentThinkProvider.js +0 -57
  354. package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1UpdateSpeakSpeakProvider.d.ts +0 -201
  355. package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1UpdateSpeakSpeakProvider.js +0 -139
  356. package/dist/cjs/api/types/OpenAi.d.ts +0 -27
  357. package/dist/cjs/api/types/OpenAi.js +0 -21
  358. package/dist/cjs/middleware/adapters/express.d.ts +0 -103
  359. package/dist/cjs/middleware/adapters/express.js +0 -141
  360. package/dist/cjs/middleware/adapters/fastify.d.ts +0 -32
  361. package/dist/cjs/middleware/adapters/fastify.js +0 -194
  362. package/dist/cjs/middleware/adapters/http.d.ts +0 -153
  363. package/dist/cjs/middleware/adapters/http.js +0 -192
  364. package/dist/cjs/middleware/core/ProxyHandler.d.ts +0 -35
  365. package/dist/cjs/middleware/core/ProxyHandler.js +0 -225
  366. package/dist/cjs/middleware/core/TokenManager.d.ts +0 -29
  367. package/dist/cjs/middleware/core/TokenManager.js +0 -110
  368. package/dist/cjs/middleware/core/WebSocketProxy.d.ts +0 -32
  369. package/dist/cjs/middleware/core/WebSocketProxy.js +0 -169
  370. package/dist/cjs/middleware/core/jwt.d.ts +0 -71
  371. package/dist/cjs/middleware/core/jwt.js +0 -136
  372. package/dist/cjs/middleware/core/types.d.ts +0 -37
  373. package/dist/cjs/middleware/index.d.ts +0 -55
  374. package/dist/cjs/middleware/index.js +0 -75
  375. package/dist/cjs/tests/manual/test-custom-baseurl.js +0 -124
  376. package/dist/esm/api/resources/agent/resources/v1/types/AgentV1SettingsAgentSpeakEndpointProvider.d.mts +0 -201
  377. package/dist/esm/api/resources/agent/resources/v1/types/AgentV1SettingsAgentSpeakEndpointProvider.mjs +0 -136
  378. package/dist/esm/api/resources/agent/resources/v1/types/AgentV1SettingsAgentSpeakOneItemProvider.d.mts +0 -201
  379. package/dist/esm/api/resources/agent/resources/v1/types/AgentV1SettingsAgentSpeakOneItemProvider.mjs +0 -136
  380. package/dist/esm/api/resources/agent/resources/v1/types/AgentV1SettingsAgentThinkProvider.d.mts +0 -115
  381. package/dist/esm/api/resources/agent/resources/v1/types/AgentV1SettingsAgentThinkProvider.mjs +0 -54
  382. package/dist/esm/api/resources/agent/resources/v1/types/AgentV1UpdateSpeakSpeakProvider.d.mts +0 -201
  383. package/dist/esm/api/resources/agent/resources/v1/types/AgentV1UpdateSpeakSpeakProvider.mjs +0 -136
  384. package/dist/esm/api/types/OpenAi.d.mts +0 -27
  385. package/dist/esm/api/types/OpenAi.mjs +0 -18
  386. package/dist/esm/middleware/adapters/express.d.mts +0 -103
  387. package/dist/esm/middleware/adapters/express.mjs +0 -136
  388. package/dist/esm/middleware/adapters/fastify.d.mts +0 -32
  389. package/dist/esm/middleware/adapters/fastify.mjs +0 -157
  390. package/dist/esm/middleware/adapters/http.d.mts +0 -153
  391. package/dist/esm/middleware/adapters/http.mjs +0 -187
  392. package/dist/esm/middleware/core/ProxyHandler.d.mts +0 -35
  393. package/dist/esm/middleware/core/ProxyHandler.mjs +0 -218
  394. package/dist/esm/middleware/core/TokenManager.d.mts +0 -29
  395. package/dist/esm/middleware/core/TokenManager.mjs +0 -106
  396. package/dist/esm/middleware/core/WebSocketProxy.d.mts +0 -32
  397. package/dist/esm/middleware/core/WebSocketProxy.mjs +0 -162
  398. package/dist/esm/middleware/core/jwt.d.mts +0 -71
  399. package/dist/esm/middleware/core/jwt.mjs +0 -99
  400. package/dist/esm/middleware/core/types.d.mts +0 -37
  401. package/dist/esm/middleware/index.d.mts +0 -55
  402. package/dist/esm/middleware/index.mjs +0 -59
  403. /package/dist/{esm/middleware/core/types.mjs → cjs/api/resources/voiceAgent/client/index.d.ts} +0 -0
  404. /package/dist/cjs/{middleware/core/types.js → api/resources/voiceAgent/client/index.js} +0 -0
@@ -130,9 +130,9 @@ var Deepgram = (() => {
130
130
  }
131
131
  });
132
132
 
133
- // node_modules/.pnpm/ws@8.19.0/node_modules/ws/browser.js
133
+ // node_modules/.pnpm/ws@8.20.0/node_modules/ws/browser.js
134
134
  var require_browser = __commonJS({
135
- "node_modules/.pnpm/ws@8.19.0/node_modules/ws/browser.js"(exports, module) {
135
+ "node_modules/.pnpm/ws@8.20.0/node_modules/ws/browser.js"(exports, module) {
136
136
  "use strict";
137
137
  module.exports = function() {
138
138
  throw new Error(
@@ -180,6 +180,7 @@ var Deepgram = (() => {
180
180
  ListenV1SmartFormat: () => ListenV1SmartFormat,
181
181
  ListenV1VadEvents: () => ListenV1VadEvents,
182
182
  ListenV2Encoding: () => ListenV2Encoding,
183
+ ListenV2Model: () => ListenV2Model,
183
184
  OpenAiSpeakProvider: () => OpenAiSpeakProvider,
184
185
  OpenAiThinkProvider: () => OpenAiThinkProvider,
185
186
  SpeakV1Encoding: () => SpeakV1Encoding,
@@ -192,7 +193,8 @@ var Deepgram = (() => {
192
193
  manage: () => manage_exports,
193
194
  read: () => read_exports,
194
195
  selfHosted: () => selfHosted_exports,
195
- speak: () => speak_exports
196
+ speak: () => speak_exports,
197
+ voiceAgent: () => voiceAgent_exports
196
198
  });
197
199
 
198
200
  // src/api/index.ts
@@ -222,6 +224,7 @@ var Deepgram = (() => {
222
224
  ListenV1SmartFormat: () => ListenV1SmartFormat,
223
225
  ListenV1VadEvents: () => ListenV1VadEvents,
224
226
  ListenV2Encoding: () => ListenV2Encoding,
227
+ ListenV2Model: () => ListenV2Model,
225
228
  OpenAiSpeakProvider: () => OpenAiSpeakProvider,
226
229
  OpenAiThinkProvider: () => OpenAiThinkProvider,
227
230
  SpeakV1Encoding: () => SpeakV1Encoding,
@@ -233,7 +236,8 @@ var Deepgram = (() => {
233
236
  manage: () => manage_exports,
234
237
  read: () => read_exports,
235
238
  selfHosted: () => selfHosted_exports,
236
- speak: () => speak_exports
239
+ speak: () => speak_exports,
240
+ voiceAgent: () => voiceAgent_exports
237
241
  });
238
242
 
239
243
  // src/core/json.ts
@@ -250,7 +254,8 @@ var Deepgram = (() => {
250
254
  message,
251
255
  statusCode,
252
256
  body,
253
- rawResponse
257
+ rawResponse,
258
+ cause
254
259
  }) {
255
260
  super(buildMessage({ message, statusCode, body }));
256
261
  Object.setPrototypeOf(this, new.target.prototype);
@@ -261,6 +266,9 @@ var Deepgram = (() => {
261
266
  this.statusCode = statusCode;
262
267
  this.body = body;
263
268
  this.rawResponse = rawResponse;
269
+ if (cause != null) {
270
+ this.cause = cause;
271
+ }
264
272
  }
265
273
  };
266
274
  function buildMessage({
@@ -283,13 +291,16 @@ var Deepgram = (() => {
283
291
 
284
292
  // src/errors/DeepgramTimeoutError.ts
285
293
  var DeepgramTimeoutError = class extends Error {
286
- constructor(message) {
294
+ constructor(message, opts) {
287
295
  super(message);
288
296
  Object.setPrototypeOf(this, new.target.prototype);
289
297
  if (Error.captureStackTrace) {
290
298
  Error.captureStackTrace(this, this.constructor);
291
299
  }
292
300
  this.name = this.constructor.name;
301
+ if ((opts == null ? void 0 : opts.cause) != null) {
302
+ this.cause = opts.cause;
303
+ }
293
304
  }
294
305
  };
295
306
 
@@ -1045,6 +1056,19 @@ var Deepgram = (() => {
1045
1056
  };
1046
1057
  })(SpeakV1Flushed || (SpeakV1Flushed = {}));
1047
1058
 
1059
+ // src/api/resources/voiceAgent/index.ts
1060
+ var voiceAgent_exports = {};
1061
+ __export(voiceAgent_exports, {
1062
+ configurations: () => configurations_exports,
1063
+ variables: () => variables_exports
1064
+ });
1065
+
1066
+ // src/api/resources/voiceAgent/resources/configurations/index.ts
1067
+ var configurations_exports = {};
1068
+
1069
+ // src/api/resources/voiceAgent/resources/variables/index.ts
1070
+ var variables_exports = {};
1071
+
1048
1072
  // src/api/types/Anthropic.ts
1049
1073
  var Anthropic;
1050
1074
  ((Anthropic2) => {
@@ -1348,6 +1372,12 @@ var Deepgram = (() => {
1348
1372
  OggOpus: "ogg-opus"
1349
1373
  };
1350
1374
 
1375
+ // src/api/types/ListenV2Model.ts
1376
+ var ListenV2Model = {
1377
+ FluxGeneralEn: "flux-general-en",
1378
+ FluxGeneralMulti: "flux-general-multi"
1379
+ };
1380
+
1351
1381
  // src/api/types/OpenAiSpeakProvider.ts
1352
1382
  var OpenAiSpeakProvider;
1353
1383
  ((OpenAiSpeakProvider2) => {
@@ -1641,18 +1671,27 @@ var Deepgram = (() => {
1641
1671
  if (value.length === 0) {
1642
1672
  continue;
1643
1673
  }
1644
- for (let i = 0; i < value.length; i++) {
1645
- const item = value[i];
1646
- if (item === void 0) {
1647
- continue;
1674
+ const effectiveFormat = options.arrayFormat;
1675
+ if (effectiveFormat === "comma") {
1676
+ const encodedKey = options.encode ? encodeURIComponent(fullKey) : fullKey;
1677
+ const encodedValues = value.filter((item) => item !== void 0 && item !== null).map((item) => encodeValue(item, options.encode));
1678
+ if (encodedValues.length > 0) {
1679
+ parts.push(`${encodedKey}=${encodedValues.join(",")}`);
1648
1680
  }
1649
- if (typeof item === "object" && !Array.isArray(item) && item !== null) {
1650
- const arrayKey = options.arrayFormat === "indices" ? `${fullKey}[${i}]` : fullKey;
1651
- parts.push(...stringifyObject(item, arrayKey, options));
1652
- } else {
1653
- const arrayKey = options.arrayFormat === "indices" ? `${fullKey}[${i}]` : fullKey;
1654
- const encodedKey = options.encode ? encodeURIComponent(arrayKey) : arrayKey;
1655
- parts.push(`${encodedKey}=${encodeValue(item, options.encode)}`);
1681
+ } else {
1682
+ for (let i = 0; i < value.length; i++) {
1683
+ const item = value[i];
1684
+ if (item === void 0) {
1685
+ continue;
1686
+ }
1687
+ if (typeof item === "object" && !Array.isArray(item) && item !== null) {
1688
+ const arrayKey = effectiveFormat === "indices" ? `${fullKey}[${i}]` : fullKey;
1689
+ parts.push(...stringifyObject(item, arrayKey, options));
1690
+ } else {
1691
+ const arrayKey = effectiveFormat === "indices" ? `${fullKey}[${i}]` : fullKey;
1692
+ const encodedKey = options.encode ? encodeURIComponent(arrayKey) : arrayKey;
1693
+ parts.push(`${encodedKey}=${encodeValue(item, options.encode)}`);
1694
+ }
1656
1695
  }
1657
1696
  }
1658
1697
  } else if (typeof value === "object" && value !== null) {
@@ -1805,15 +1844,15 @@ var Deepgram = (() => {
1805
1844
  }
1806
1845
 
1807
1846
  // src/core/fetcher/Headers.ts
1808
- var Headers;
1847
+ var Headers2;
1809
1848
  if (typeof globalThis.Headers !== "undefined") {
1810
- Headers = globalThis.Headers;
1849
+ Headers2 = globalThis.Headers;
1811
1850
  } else {
1812
- Headers = class Headers2 {
1851
+ Headers2 = class Headers3 {
1813
1852
  constructor(init) {
1814
1853
  this.headers = /* @__PURE__ */ new Map();
1815
1854
  if (init) {
1816
- if (init instanceof Headers2) {
1855
+ if (init instanceof Headers3) {
1817
1856
  init.forEach((value, key) => this.append(key, value));
1818
1857
  } else if (Array.isArray(init)) {
1819
1858
  for (const [key, value] of init) {
@@ -1947,7 +1986,7 @@ var Deepgram = (() => {
1947
1986
 
1948
1987
  // src/core/fetcher/RawResponse.ts
1949
1988
  var abortRawResponse = {
1950
- headers: new Headers(),
1989
+ headers: new Headers2(),
1951
1990
  redirected: false,
1952
1991
  status: 499,
1953
1992
  statusText: "Client Closed Request",
@@ -1955,7 +1994,7 @@ var Deepgram = (() => {
1955
1994
  url: ""
1956
1995
  };
1957
1996
  var unknownRawResponse = {
1958
- headers: new Headers(),
1997
+ headers: new Headers2(),
1959
1998
  redirected: false,
1960
1999
  status: 0,
1961
2000
  statusText: "Unknown Error",
@@ -2050,7 +2089,7 @@ var Deepgram = (() => {
2050
2089
  ]);
2051
2090
  function redactHeaders(headers) {
2052
2091
  const filtered = {};
2053
- for (const [key, value] of headers instanceof Headers ? headers.entries() : Object.entries(headers)) {
2092
+ for (const [key, value] of headers instanceof Headers2 ? headers.entries() : Object.entries(headers)) {
2054
2093
  if (SENSITIVE_HEADERS.has(key.toLowerCase())) {
2055
2094
  filtered[key] = "[REDACTED]";
2056
2095
  } else {
@@ -2081,15 +2120,11 @@ var Deepgram = (() => {
2081
2120
  ]);
2082
2121
  function redactQueryParameters(queryParameters) {
2083
2122
  if (queryParameters == null) {
2084
- return queryParameters;
2123
+ return void 0;
2085
2124
  }
2086
2125
  const redacted = {};
2087
2126
  for (const [key, value] of Object.entries(queryParameters)) {
2088
- if (SENSITIVE_QUERY_PARAMS.has(key.toLowerCase())) {
2089
- redacted[key] = "[REDACTED]";
2090
- } else {
2091
- redacted[key] = value;
2092
- }
2127
+ redacted[key] = SENSITIVE_QUERY_PARAMS.has(key.toLowerCase()) ? "[REDACTED]" : value;
2093
2128
  }
2094
2129
  return redacted;
2095
2130
  }
@@ -2149,7 +2184,7 @@ var Deepgram = (() => {
2149
2184
  function getHeaders(args) {
2150
2185
  return __async(this, null, function* () {
2151
2186
  var _a;
2152
- const newHeaders = new Headers();
2187
+ const newHeaders = new Headers2();
2153
2188
  newHeaders.set(
2154
2189
  "Accept",
2155
2190
  args.responseType === "json" ? "application/json" : args.responseType === "text" ? "text/plain" : args.responseType === "sse" ? "text/event-stream" : "*/*"
@@ -2177,7 +2212,12 @@ var Deepgram = (() => {
2177
2212
  function fetcherImpl(args) {
2178
2213
  return __async(this, null, function* () {
2179
2214
  var _a, _b, _c;
2180
- const url = createRequestUrl(args.url, args.queryParameters);
2215
+ let url = args.url;
2216
+ if (args.queryString != null && args.queryString.length > 0) {
2217
+ url = `${url}?${args.queryString}`;
2218
+ } else {
2219
+ url = createRequestUrl(args.url, args.queryParameters);
2220
+ }
2181
2221
  const requestBody = yield getRequestBody({
2182
2222
  body: args.body,
2183
2223
  type: (_a = args.requestType) != null ? _a : "other"
@@ -2263,7 +2303,8 @@ var Deepgram = (() => {
2263
2303
  ok: false,
2264
2304
  error: {
2265
2305
  reason: "unknown",
2266
- errorMessage: "The user aborted a request"
2306
+ errorMessage: "The user aborted a request",
2307
+ cause: error
2267
2308
  },
2268
2309
  rawResponse: abortRawResponse
2269
2310
  };
@@ -2279,7 +2320,8 @@ var Deepgram = (() => {
2279
2320
  return {
2280
2321
  ok: false,
2281
2322
  error: {
2282
- reason: "timeout"
2323
+ reason: "timeout",
2324
+ cause: error
2283
2325
  },
2284
2326
  rawResponse: abortRawResponse
2285
2327
  };
@@ -2296,7 +2338,8 @@ var Deepgram = (() => {
2296
2338
  ok: false,
2297
2339
  error: {
2298
2340
  reason: "unknown",
2299
- errorMessage: error.message
2341
+ errorMessage: error.message,
2342
+ cause: error
2300
2343
  },
2301
2344
  rawResponse: unknownRawResponse
2302
2345
  };
@@ -2313,7 +2356,8 @@ var Deepgram = (() => {
2313
2356
  ok: false,
2314
2357
  error: {
2315
2358
  reason: "unknown",
2316
- errorMessage: toJson(error)
2359
+ errorMessage: toJson(error),
2360
+ cause: error
2317
2361
  },
2318
2362
  rawResponse: unknownRawResponse
2319
2363
  };
@@ -2410,6 +2454,69 @@ var Deepgram = (() => {
2410
2454
  }
2411
2455
  };
2412
2456
 
2457
+ // src/core/url/join.ts
2458
+ function join(base, ...segments) {
2459
+ if (!base) {
2460
+ return "";
2461
+ }
2462
+ if (segments.length === 0) {
2463
+ return base;
2464
+ }
2465
+ if (base.includes("://")) {
2466
+ let url;
2467
+ try {
2468
+ url = new URL(base);
2469
+ } catch (e) {
2470
+ return joinPath(base, ...segments);
2471
+ }
2472
+ const lastSegment = segments[segments.length - 1];
2473
+ const shouldPreserveTrailingSlash = lastSegment == null ? void 0 : lastSegment.endsWith("/");
2474
+ for (const segment of segments) {
2475
+ const cleanSegment = trimSlashes(segment);
2476
+ if (cleanSegment) {
2477
+ url.pathname = joinPathSegments(url.pathname, cleanSegment);
2478
+ }
2479
+ }
2480
+ if (shouldPreserveTrailingSlash && !url.pathname.endsWith("/")) {
2481
+ url.pathname += "/";
2482
+ }
2483
+ return url.toString();
2484
+ }
2485
+ return joinPath(base, ...segments);
2486
+ }
2487
+ function joinPath(base, ...segments) {
2488
+ if (segments.length === 0) {
2489
+ return base;
2490
+ }
2491
+ let result = base;
2492
+ const lastSegment = segments[segments.length - 1];
2493
+ const shouldPreserveTrailingSlash = lastSegment == null ? void 0 : lastSegment.endsWith("/");
2494
+ for (const segment of segments) {
2495
+ const cleanSegment = trimSlashes(segment);
2496
+ if (cleanSegment) {
2497
+ result = joinPathSegments(result, cleanSegment);
2498
+ }
2499
+ }
2500
+ if (shouldPreserveTrailingSlash && !result.endsWith("/")) {
2501
+ result += "/";
2502
+ }
2503
+ return result;
2504
+ }
2505
+ function joinPathSegments(left, right) {
2506
+ if (left.endsWith("/")) {
2507
+ return left + right;
2508
+ }
2509
+ return `${left}/${right}`;
2510
+ }
2511
+ function trimSlashes(str) {
2512
+ if (!str) return str;
2513
+ let start = 0;
2514
+ let end = str.length;
2515
+ if (str.startsWith("/")) start = 1;
2516
+ if (str.endsWith("/")) end = str.length - 1;
2517
+ return start === 0 && end === str.length ? str : str.slice(start, end);
2518
+ }
2519
+
2413
2520
  // src/core/fetcher/Supplier.ts
2414
2521
  var Supplier = {
2415
2522
  get: (supplier) => __async(null, null, function* () {
@@ -2421,6 +2528,113 @@ var Deepgram = (() => {
2421
2528
  })
2422
2529
  };
2423
2530
 
2531
+ // src/core/fetcher/makePassthroughRequest.ts
2532
+ function makePassthroughRequest(input, init, clientOptions, requestOptions) {
2533
+ return __async(this, null, function* () {
2534
+ var _a, _b, _c, _d, _e, _f, _g;
2535
+ const logger = createLogger(clientOptions.logging);
2536
+ let url;
2537
+ let effectiveInit = init;
2538
+ if (input instanceof Request) {
2539
+ url = input.url;
2540
+ if (init == null) {
2541
+ effectiveInit = {
2542
+ method: input.method,
2543
+ headers: Object.fromEntries(input.headers.entries()),
2544
+ body: input.body,
2545
+ signal: input.signal,
2546
+ credentials: input.credentials,
2547
+ cache: input.cache,
2548
+ redirect: input.redirect,
2549
+ referrer: input.referrer,
2550
+ integrity: input.integrity,
2551
+ mode: input.mode
2552
+ };
2553
+ }
2554
+ } else {
2555
+ url = input instanceof URL ? input.toString() : input;
2556
+ }
2557
+ const baseUrl = (_a = clientOptions.baseUrl != null ? yield Supplier.get(clientOptions.baseUrl) : void 0) != null ? _a : clientOptions.environment != null ? yield Supplier.get(clientOptions.environment) : void 0;
2558
+ let fullUrl;
2559
+ if (url.startsWith("http://") || url.startsWith("https://")) {
2560
+ fullUrl = url;
2561
+ } else if (baseUrl != null) {
2562
+ fullUrl = join(baseUrl, url);
2563
+ } else {
2564
+ fullUrl = url;
2565
+ }
2566
+ const mergedHeaders = {};
2567
+ if (clientOptions.headers != null) {
2568
+ for (const [key, value] of Object.entries(clientOptions.headers)) {
2569
+ const resolved = yield EndpointSupplier.get(value, { endpointMetadata: {} });
2570
+ if (resolved != null) {
2571
+ mergedHeaders[key.toLowerCase()] = `${resolved}`;
2572
+ }
2573
+ }
2574
+ }
2575
+ if (clientOptions.getAuthHeaders != null) {
2576
+ const authHeaders = yield clientOptions.getAuthHeaders();
2577
+ for (const [key, value] of Object.entries(authHeaders)) {
2578
+ mergedHeaders[key.toLowerCase()] = value;
2579
+ }
2580
+ }
2581
+ if ((effectiveInit == null ? void 0 : effectiveInit.headers) != null) {
2582
+ const initHeaders = effectiveInit.headers instanceof Headers ? Object.fromEntries(effectiveInit.headers.entries()) : Array.isArray(effectiveInit.headers) ? Object.fromEntries(effectiveInit.headers) : effectiveInit.headers;
2583
+ for (const [key, value] of Object.entries(initHeaders)) {
2584
+ if (value != null) {
2585
+ mergedHeaders[key.toLowerCase()] = value;
2586
+ }
2587
+ }
2588
+ }
2589
+ if ((requestOptions == null ? void 0 : requestOptions.headers) != null) {
2590
+ for (const [key, value] of Object.entries(requestOptions.headers)) {
2591
+ mergedHeaders[key.toLowerCase()] = value;
2592
+ }
2593
+ }
2594
+ const method = (_b = effectiveInit == null ? void 0 : effectiveInit.method) != null ? _b : "GET";
2595
+ const body = effectiveInit == null ? void 0 : effectiveInit.body;
2596
+ const timeoutInSeconds = (_c = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _c : clientOptions.timeoutInSeconds;
2597
+ const timeoutMs = timeoutInSeconds != null ? timeoutInSeconds * 1e3 : void 0;
2598
+ const maxRetries = (_d = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _d : clientOptions.maxRetries;
2599
+ const abortSignal = (_f = (_e = requestOptions == null ? void 0 : requestOptions.abortSignal) != null ? _e : effectiveInit == null ? void 0 : effectiveInit.signal) != null ? _f : void 0;
2600
+ const fetchFn = (_g = clientOptions.fetch) != null ? _g : yield getFetchFn();
2601
+ if (logger.isDebug()) {
2602
+ logger.debug("Making passthrough HTTP request", {
2603
+ method,
2604
+ url: fullUrl,
2605
+ hasBody: body != null
2606
+ });
2607
+ }
2608
+ const response = yield requestWithRetries(
2609
+ () => __async(null, null, function* () {
2610
+ return makeRequest(
2611
+ fetchFn,
2612
+ fullUrl,
2613
+ method,
2614
+ mergedHeaders,
2615
+ body != null ? body : void 0,
2616
+ timeoutMs,
2617
+ abortSignal,
2618
+ (effectiveInit == null ? void 0 : effectiveInit.credentials) === "include",
2619
+ void 0,
2620
+ // duplex
2621
+ false
2622
+ // disableCache
2623
+ );
2624
+ }),
2625
+ maxRetries
2626
+ );
2627
+ if (logger.isDebug()) {
2628
+ logger.debug("Passthrough HTTP request completed", {
2629
+ method,
2630
+ url: fullUrl,
2631
+ statusCode: response.status
2632
+ });
2633
+ }
2634
+ return response;
2635
+ });
2636
+ }
2637
+
2424
2638
  // src/core/file/index.ts
2425
2639
  var file_exports = {};
2426
2640
  __export(file_exports, {
@@ -2473,7 +2687,7 @@ var Deepgram = (() => {
2473
2687
  }
2474
2688
  if ("path" in file) {
2475
2689
  const fs = yield Promise.resolve().then(() => __toESM(require_fs()));
2476
- if (!fs || !fs.createReadStream) {
2690
+ if (!(fs == null ? void 0 : fs.createReadStream)) {
2477
2691
  throw new Error("File path uploads are not supported in this environment.");
2478
2692
  }
2479
2693
  const data = fs.createReadStream(file.path);
@@ -2507,9 +2721,10 @@ var Deepgram = (() => {
2507
2721
  }
2508
2722
  function tryGetFileSizeFromPath(path) {
2509
2723
  return __async(this, null, function* () {
2724
+ var _a;
2510
2725
  try {
2511
2726
  const fs = yield Promise.resolve().then(() => __toESM(require_fs()));
2512
- if (!fs || !fs.promises || !fs.promises.stat) {
2727
+ if (!((_a = fs == null ? void 0 : fs.promises) == null ? void 0 : _a.stat)) {
2513
2728
  return void 0;
2514
2729
  }
2515
2730
  const fileStat = yield fs.promises.stat(path);
@@ -2677,6 +2892,7 @@ var Deepgram = (() => {
2677
2892
  __export(url_exports, {
2678
2893
  encodePathParam: () => encodePathParam,
2679
2894
  join: () => join,
2895
+ queryBuilder: () => queryBuilder,
2680
2896
  toQueryString: () => toQueryString
2681
2897
  });
2682
2898
 
@@ -2700,68 +2916,75 @@ var Deepgram = (() => {
2700
2916
  return encodeURIComponent(param);
2701
2917
  }
2702
2918
 
2703
- // src/core/url/join.ts
2704
- function join(base, ...segments) {
2705
- if (!base) {
2706
- return "";
2707
- }
2708
- if (segments.length === 0) {
2709
- return base;
2919
+ // src/core/url/QueryStringBuilder.ts
2920
+ function queryBuilder() {
2921
+ return new QueryStringBuilder();
2922
+ }
2923
+ var QueryStringBuilder = class {
2924
+ constructor() {
2925
+ this.parts = /* @__PURE__ */ new Map();
2710
2926
  }
2711
- if (base.includes("://")) {
2712
- let url;
2713
- try {
2714
- url = new URL(base);
2715
- } catch (e) {
2716
- return joinPath(base, ...segments);
2717
- }
2718
- const lastSegment = segments[segments.length - 1];
2719
- const shouldPreserveTrailingSlash = lastSegment == null ? void 0 : lastSegment.endsWith("/");
2720
- for (const segment of segments) {
2721
- const cleanSegment = trimSlashes(segment);
2722
- if (cleanSegment) {
2723
- url.pathname = joinPathSegments(url.pathname, cleanSegment);
2724
- }
2927
+ /**
2928
+ * Adds a query parameter, serializing it immediately.
2929
+ *
2930
+ * By default arrays use "repeat" format (`key=a&key=b`).
2931
+ * Pass `{ style: "comma" }` for OpenAPI `explode: false` parameters
2932
+ * to get comma-separated values (`key=a,b,c`).
2933
+ *
2934
+ * Null / undefined values are silently skipped.
2935
+ */
2936
+ add(key, value, options) {
2937
+ if (value === void 0 || value === null) {
2938
+ return this;
2725
2939
  }
2726
- if (shouldPreserveTrailingSlash && !url.pathname.endsWith("/")) {
2727
- url.pathname += "/";
2940
+ const serialized = toQueryString(
2941
+ { [key]: value },
2942
+ { arrayFormat: (options == null ? void 0 : options.style) === "comma" ? "comma" : "repeat" }
2943
+ );
2944
+ if (serialized.length > 0) {
2945
+ this.parts.set(key, serialized);
2728
2946
  }
2729
- return url.toString();
2730
- }
2731
- return joinPath(base, ...segments);
2732
- }
2733
- function joinPath(base, ...segments) {
2734
- if (segments.length === 0) {
2735
- return base;
2947
+ return this;
2736
2948
  }
2737
- let result = base;
2738
- const lastSegment = segments[segments.length - 1];
2739
- const shouldPreserveTrailingSlash = lastSegment == null ? void 0 : lastSegment.endsWith("/");
2740
- for (const segment of segments) {
2741
- const cleanSegment = trimSlashes(segment);
2742
- if (cleanSegment) {
2743
- result = joinPathSegments(result, cleanSegment);
2949
+ /**
2950
+ * Adds multiple query parameters at once from a record.
2951
+ * All parameters use the default "repeat" array format.
2952
+ * Null / undefined values are silently skipped.
2953
+ */
2954
+ addMany(params) {
2955
+ if (params != null) {
2956
+ for (const [key, value] of Object.entries(params)) {
2957
+ this.add(key, value);
2958
+ }
2744
2959
  }
2960
+ return this;
2745
2961
  }
2746
- if (shouldPreserveTrailingSlash && !result.endsWith("/")) {
2747
- result += "/";
2962
+ /**
2963
+ * Merges additional query parameters supplied at call-time via
2964
+ * `requestOptions.queryParams`. Overrides existing keys (last-write-wins).
2965
+ */
2966
+ mergeAdditional(additionalParams) {
2967
+ if (additionalParams != null) {
2968
+ for (const [key, value] of Object.entries(additionalParams)) {
2969
+ if (value === void 0 || value === null) {
2970
+ continue;
2971
+ }
2972
+ const serialized = toQueryString({ [key]: value }, { arrayFormat: "repeat" });
2973
+ if (serialized.length > 0) {
2974
+ this.parts.set(key, serialized);
2975
+ }
2976
+ }
2977
+ }
2978
+ return this;
2748
2979
  }
2749
- return result;
2750
- }
2751
- function joinPathSegments(left, right) {
2752
- if (left.endsWith("/")) {
2753
- return left + right;
2980
+ /**
2981
+ * Returns the assembled query string (without the leading `?`).
2982
+ * Returns an empty string when no parameters were added.
2983
+ */
2984
+ build() {
2985
+ return [...this.parts.values()].join("&");
2754
2986
  }
2755
- return `${left}/${right}`;
2756
- }
2757
- function trimSlashes(str) {
2758
- if (!str) return str;
2759
- let start = 0;
2760
- let end = str.length;
2761
- if (str.startsWith("/")) start = 1;
2762
- if (str.endsWith("/")) end = str.length - 1;
2763
- return start === 0 && end === str.length ? str : str.slice(start, end);
2764
- }
2987
+ };
2765
2988
 
2766
2989
  // src/core/websocket/ws.ts
2767
2990
  var import_ws = __toESM(require_browser());
@@ -2791,10 +3014,10 @@ var Deepgram = (() => {
2791
3014
 
2792
3015
  // src/core/websocket/ws.ts
2793
3016
  var getGlobalWebSocket = () => {
2794
- if (typeof WebSocket !== "undefined") {
2795
- return WebSocket;
2796
- } else if (RUNTIME.type === "node") {
3017
+ if (RUNTIME.type === "node" || RUNTIME.type === "bun" || RUNTIME.type === "deno") {
2797
3018
  return import_ws.WebSocket;
3019
+ } else if (typeof WebSocket !== "undefined") {
3020
+ return WebSocket;
2798
3021
  }
2799
3022
  return void 0;
2800
3023
  };
@@ -2855,6 +3078,8 @@ var Deepgram = (() => {
2855
3078
  this._clearTimeouts();
2856
3079
  if (this._ws) {
2857
3080
  this._removeListeners();
3081
+ this._ws.addEventListener("error", () => {
3082
+ });
2858
3083
  try {
2859
3084
  this._ws.close(1e3, "aborted");
2860
3085
  this._handleClose(new CloseEvent(1e3, "aborted", this));
@@ -2979,7 +3204,7 @@ var Deepgram = (() => {
2979
3204
  if (this._ws) {
2980
3205
  return this._ws.readyState;
2981
3206
  }
2982
- return this._options.startClosed ? _ReconnectingWebSocket.CLOSED : _ReconnectingWebSocket.CONNECTING;
3207
+ return this._options.startClosed ? _ReconnectingWebSocket.ReadyState.CLOSED : _ReconnectingWebSocket.ReadyState.CONNECTING;
2983
3208
  }
2984
3209
  /**
2985
3210
  * The URL as resolved by the constructor
@@ -3162,6 +3387,8 @@ var Deepgram = (() => {
3162
3387
  return;
3163
3388
  }
3164
3389
  this._removeListeners();
3390
+ this._ws.addEventListener("error", () => {
3391
+ });
3165
3392
  try {
3166
3393
  this._ws.close(code, reason);
3167
3394
  this._handleClose(new CloseEvent(code, reason, this));
@@ -3209,6 +3436,14 @@ var Deepgram = (() => {
3209
3436
  _ReconnectingWebSocket.CLOSING = 2;
3210
3437
  _ReconnectingWebSocket.CLOSED = 3;
3211
3438
  var ReconnectingWebSocket = _ReconnectingWebSocket;
3439
+ ((ReconnectingWebSocket2) => {
3440
+ ReconnectingWebSocket2.ReadyState = {
3441
+ CONNECTING: 0,
3442
+ OPEN: 1,
3443
+ CLOSING: 2,
3444
+ CLOSED: 3
3445
+ };
3446
+ })(ReconnectingWebSocket || (ReconnectingWebSocket = {}));
3212
3447
 
3213
3448
  // src/auth/HeaderAuthProvider.ts
3214
3449
  var PARAM_KEY = "apiKey";
@@ -3278,8 +3513,8 @@ var Deepgram = (() => {
3278
3513
  {
3279
3514
  "X-Fern-Language": "JavaScript",
3280
3515
  "X-Fern-SDK-Name": "@deepgram/sdk",
3281
- "X-Fern-SDK-Version": "4.11.4",
3282
- "User-Agent": "@deepgram/sdk/4.11.4",
3516
+ "X-Fern-SDK-Version": "5.0.1",
3517
+ "User-Agent": "@deepgram/sdk/5.0.1",
3283
3518
  "X-Fern-Runtime": RUNTIME.type,
3284
3519
  "X-Fern-Runtime-Version": RUNTIME.version
3285
3520
  },
@@ -3332,11 +3567,14 @@ var Deepgram = (() => {
3332
3567
  rawResponse
3333
3568
  });
3334
3569
  case "timeout":
3335
- throw new DeepgramTimeoutError(`Timeout exceeded when calling ${method} ${path}.`);
3570
+ throw new DeepgramTimeoutError(`Timeout exceeded when calling ${method} ${path}.`, {
3571
+ cause: error.cause
3572
+ });
3336
3573
  case "unknown":
3337
3574
  throw new DeepgramError({
3338
3575
  message: error.errorMessage,
3339
- rawResponse
3576
+ rawResponse,
3577
+ cause: error.cause
3340
3578
  });
3341
3579
  default:
3342
3580
  throw new DeepgramError({
@@ -3375,7 +3613,7 @@ var Deepgram = (() => {
3375
3613
  ),
3376
3614
  method: "GET",
3377
3615
  headers: _headers,
3378
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
3616
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
3379
3617
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
3380
3618
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
3381
3619
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -3482,10 +3720,6 @@ var Deepgram = (() => {
3482
3720
  this.assertSocketIsOpen();
3483
3721
  this.sendJson(message);
3484
3722
  }
3485
- sendUpdateThink(message) {
3486
- this.assertSocketIsOpen();
3487
- this.sendJson(message);
3488
- }
3489
3723
  sendInjectUserMessage(message) {
3490
3724
  this.assertSocketIsOpen();
3491
3725
  this.sendJson(message);
@@ -3506,6 +3740,10 @@ var Deepgram = (() => {
3506
3740
  this.assertSocketIsOpen();
3507
3741
  this.sendJson(message);
3508
3742
  }
3743
+ sendUpdateThink(message) {
3744
+ this.assertSocketIsOpen();
3745
+ this.sendJson(message);
3746
+ }
3509
3747
  sendMedia(message) {
3510
3748
  this.assertSocketIsOpen();
3511
3749
  this.sendBinary(message);
@@ -3531,7 +3769,7 @@ var Deepgram = (() => {
3531
3769
  /** Returns a promise that resolves when the websocket is open. */
3532
3770
  waitForOpen() {
3533
3771
  return __async(this, null, function* () {
3534
- if (this.socket.readyState === ReconnectingWebSocket.OPEN) {
3772
+ if (this.socket.readyState === ReconnectingWebSocket.ReadyState.OPEN) {
3535
3773
  return this.socket;
3536
3774
  }
3537
3775
  return new Promise((resolve, reject) => {
@@ -3549,7 +3787,7 @@ var Deepgram = (() => {
3549
3787
  if (!this.socket) {
3550
3788
  throw new Error("Socket is not connected.");
3551
3789
  }
3552
- if (this.socket.readyState !== ReconnectingWebSocket.OPEN) {
3790
+ if (this.socket.readyState !== ReconnectingWebSocket.ReadyState.OPEN) {
3553
3791
  throw new Error("Socket is not open.");
3554
3792
  }
3555
3793
  }
@@ -3575,18 +3813,19 @@ var Deepgram = (() => {
3575
3813
  }
3576
3814
  connect(args) {
3577
3815
  return __async(this, null, function* () {
3578
- var _a, _b;
3579
- const { queryParams, headers, debug, reconnectAttempts, connectionTimeoutInSeconds, abortSignal } = args;
3816
+ var _a, _b, _c;
3817
+ const { protocols, queryParams, headers, debug, reconnectAttempts, connectionTimeoutInSeconds, abortSignal } = args;
3580
3818
  const _headers = mergeHeaders(
3819
+ (_a = this._options) == null ? void 0 : _a.headers,
3581
3820
  mergeOnlyDefinedHeaders({ Authorization: args.Authorization }),
3582
3821
  headers
3583
3822
  );
3584
3823
  const socket = new ReconnectingWebSocket({
3585
3824
  url: url_exports.join(
3586
- (_b = yield Supplier.get(this._options.baseUrl)) != null ? _b : ((_a = yield Supplier.get(this._options.environment)) != null ? _a : DeepgramEnvironment.Production).agent,
3825
+ (_c = yield Supplier.get(this._options.baseUrl)) != null ? _c : ((_b = yield Supplier.get(this._options.environment)) != null ? _b : DeepgramEnvironment.Production).agent,
3587
3826
  "/v1/agent/converse"
3588
3827
  ),
3589
- protocols: [],
3828
+ protocols: protocols != null ? protocols : [],
3590
3829
  queryParameters: queryParams != null ? queryParams : {},
3591
3830
  headers: _headers,
3592
3831
  options: {
@@ -3648,7 +3887,7 @@ var Deepgram = (() => {
3648
3887
  method: "POST",
3649
3888
  headers: _headers,
3650
3889
  contentType: "application/json",
3651
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
3890
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
3652
3891
  requestType: "json",
3653
3892
  body: request,
3654
3893
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
@@ -3732,6 +3971,7 @@ var Deepgram = (() => {
3732
3971
  * dictation: true,
3733
3972
  * encoding: "linear16",
3734
3973
  * filler_words: true,
3974
+ * keyterm: ["keyterm"],
3735
3975
  * keywords: "keywords",
3736
3976
  * language: "language",
3737
3977
  * measurements: true,
@@ -3885,7 +4125,7 @@ var Deepgram = (() => {
3885
4125
  method: "POST",
3886
4126
  headers: _headers,
3887
4127
  contentType: "application/json",
3888
- queryParameters: __spreadValues(__spreadValues({}, _queryParams), requestOptions == null ? void 0 : requestOptions.queryParams),
4128
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
3889
4129
  requestType: "json",
3890
4130
  body: _body,
3891
4131
  timeoutMs: ((_h = (_g = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _g : (_f = this._options) == null ? void 0 : _f.timeoutInSeconds) != null ? _h : 60) * 1e3,
@@ -3988,7 +4228,7 @@ var Deepgram = (() => {
3988
4228
  method: "POST",
3989
4229
  headers: _headers,
3990
4230
  contentType: "application/octet-stream",
3991
- queryParameters: __spreadValues(__spreadValues({}, _queryParams), requestOptions == null ? void 0 : requestOptions.queryParams),
4231
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
3992
4232
  requestType: "bytes",
3993
4233
  duplex: "half",
3994
4234
  body: _binaryUploadRequest.body,
@@ -4103,7 +4343,7 @@ var Deepgram = (() => {
4103
4343
  /** Returns a promise that resolves when the websocket is open. */
4104
4344
  waitForOpen() {
4105
4345
  return __async(this, null, function* () {
4106
- if (this.socket.readyState === ReconnectingWebSocket.OPEN) {
4346
+ if (this.socket.readyState === ReconnectingWebSocket.ReadyState.OPEN) {
4107
4347
  return this.socket;
4108
4348
  }
4109
4349
  return new Promise((resolve, reject) => {
@@ -4121,7 +4361,7 @@ var Deepgram = (() => {
4121
4361
  if (!this.socket) {
4122
4362
  throw new Error("Socket is not connected.");
4123
4363
  }
4124
- if (this.socket.readyState !== ReconnectingWebSocket.OPEN) {
4364
+ if (this.socket.readyState !== ReconnectingWebSocket.ReadyState.OPEN) {
4125
4365
  throw new Error("Socket is not open.");
4126
4366
  }
4127
4367
  }
@@ -4147,7 +4387,7 @@ var Deepgram = (() => {
4147
4387
  }
4148
4388
  connect(args) {
4149
4389
  return __async(this, null, function* () {
4150
- var _a, _b;
4390
+ var _a, _b, _c;
4151
4391
  const {
4152
4392
  callback,
4153
4393
  callback_method: callbackMethod,
@@ -4177,6 +4417,7 @@ var Deepgram = (() => {
4177
4417
  utterance_end_ms: utteranceEndMs,
4178
4418
  vad_events: vadEvents,
4179
4419
  version,
4420
+ protocols,
4180
4421
  queryParams,
4181
4422
  headers,
4182
4423
  debug,
@@ -4215,15 +4456,16 @@ var Deepgram = (() => {
4215
4456
  version: version != null ? typeof version === "string" ? version : toJson(version) : void 0
4216
4457
  };
4217
4458
  const _headers = mergeHeaders(
4459
+ (_a = this._options) == null ? void 0 : _a.headers,
4218
4460
  mergeOnlyDefinedHeaders({ Authorization: args.Authorization }),
4219
4461
  headers
4220
4462
  );
4221
4463
  const socket = new ReconnectingWebSocket({
4222
4464
  url: url_exports.join(
4223
- (_b = yield Supplier.get(this._options.baseUrl)) != null ? _b : ((_a = yield Supplier.get(this._options.environment)) != null ? _a : DeepgramEnvironment.Production).production,
4465
+ (_c = yield Supplier.get(this._options.baseUrl)) != null ? _c : ((_b = yield Supplier.get(this._options.environment)) != null ? _b : DeepgramEnvironment.Production).production,
4224
4466
  "/v1/listen"
4225
4467
  ),
4226
- protocols: [],
4468
+ protocols: protocols != null ? protocols : [],
4227
4469
  queryParameters: __spreadValues(__spreadValues({}, _queryParams), queryParams),
4228
4470
  headers: _headers,
4229
4471
  options: {
@@ -4291,7 +4533,7 @@ var Deepgram = (() => {
4291
4533
  this.assertSocketIsOpen();
4292
4534
  this.sendJson(message);
4293
4535
  }
4294
- sendListenV2Configure(message) {
4536
+ sendConfigure(message) {
4295
4537
  this.assertSocketIsOpen();
4296
4538
  this.sendJson(message);
4297
4539
  }
@@ -4316,7 +4558,7 @@ var Deepgram = (() => {
4316
4558
  /** Returns a promise that resolves when the websocket is open. */
4317
4559
  waitForOpen() {
4318
4560
  return __async(this, null, function* () {
4319
- if (this.socket.readyState === ReconnectingWebSocket.OPEN) {
4561
+ if (this.socket.readyState === ReconnectingWebSocket.ReadyState.OPEN) {
4320
4562
  return this.socket;
4321
4563
  }
4322
4564
  return new Promise((resolve, reject) => {
@@ -4334,7 +4576,7 @@ var Deepgram = (() => {
4334
4576
  if (!this.socket) {
4335
4577
  throw new Error("Socket is not connected.");
4336
4578
  }
4337
- if (this.socket.readyState !== ReconnectingWebSocket.OPEN) {
4579
+ if (this.socket.readyState !== ReconnectingWebSocket.ReadyState.OPEN) {
4338
4580
  throw new Error("Socket is not open.");
4339
4581
  }
4340
4582
  }
@@ -4356,7 +4598,7 @@ var Deepgram = (() => {
4356
4598
  }
4357
4599
  connect(args) {
4358
4600
  return __async(this, null, function* () {
4359
- var _a, _b;
4601
+ var _a, _b, _c;
4360
4602
  const {
4361
4603
  model,
4362
4604
  encoding,
@@ -4367,6 +4609,7 @@ var Deepgram = (() => {
4367
4609
  keyterm,
4368
4610
  mip_opt_out: mipOptOut,
4369
4611
  tag,
4612
+ protocols,
4370
4613
  queryParams,
4371
4614
  headers,
4372
4615
  debug,
@@ -4386,15 +4629,16 @@ var Deepgram = (() => {
4386
4629
  tag: tag != null ? typeof tag === "string" ? tag : toJson(tag) : void 0
4387
4630
  };
4388
4631
  const _headers = mergeHeaders(
4632
+ (_a = this._options) == null ? void 0 : _a.headers,
4389
4633
  mergeOnlyDefinedHeaders({ Authorization: args.Authorization }),
4390
4634
  headers
4391
4635
  );
4392
4636
  const socket = new ReconnectingWebSocket({
4393
4637
  url: url_exports.join(
4394
- (_b = yield Supplier.get(this._options.baseUrl)) != null ? _b : ((_a = yield Supplier.get(this._options.environment)) != null ? _a : DeepgramEnvironment.Production).production,
4638
+ (_c = yield Supplier.get(this._options.baseUrl)) != null ? _c : ((_b = yield Supplier.get(this._options.environment)) != null ? _b : DeepgramEnvironment.Production).production,
4395
4639
  "/v2/listen"
4396
4640
  ),
4397
- protocols: [],
4641
+ protocols: protocols != null ? protocols : [],
4398
4642
  queryParameters: __spreadValues(__spreadValues({}, _queryParams), queryParams),
4399
4643
  headers: _headers,
4400
4644
  options: {
@@ -4465,7 +4709,7 @@ var Deepgram = (() => {
4465
4709
  ),
4466
4710
  method: "GET",
4467
4711
  headers: _headers,
4468
- queryParameters: __spreadValues(__spreadValues({}, _queryParams), requestOptions == null ? void 0 : requestOptions.queryParams),
4712
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
4469
4713
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
4470
4714
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
4471
4715
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -4520,7 +4764,7 @@ var Deepgram = (() => {
4520
4764
  ),
4521
4765
  method: "GET",
4522
4766
  headers: _headers,
4523
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
4767
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
4524
4768
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
4525
4769
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
4526
4770
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -4582,7 +4826,7 @@ var Deepgram = (() => {
4582
4826
  ),
4583
4827
  method: "GET",
4584
4828
  headers: _headers,
4585
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
4829
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
4586
4830
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
4587
4831
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
4588
4832
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -4646,7 +4890,7 @@ var Deepgram = (() => {
4646
4890
  ),
4647
4891
  method: "GET",
4648
4892
  headers: _headers,
4649
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
4893
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
4650
4894
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
4651
4895
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
4652
4896
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -4699,7 +4943,8 @@ var Deepgram = (() => {
4699
4943
  * accessor: "12345678-1234-1234-1234-123456789012",
4700
4944
  * deployment: "hosted",
4701
4945
  * tag: "tag1",
4702
- * line_item: "streaming::nova-3"
4946
+ * line_item: "streaming::nova-3",
4947
+ * grouping: ["deployment", "line_item"]
4703
4948
  * })
4704
4949
  */
4705
4950
  list(project_id, request = {}, requestOptions) {
@@ -4731,7 +4976,7 @@ var Deepgram = (() => {
4731
4976
  ),
4732
4977
  method: "GET",
4733
4978
  headers: _headers,
4734
- queryParameters: __spreadValues(__spreadValues({}, _queryParams), requestOptions == null ? void 0 : requestOptions.queryParams),
4979
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
4735
4980
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
4736
4981
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
4737
4982
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -4807,7 +5052,7 @@ var Deepgram = (() => {
4807
5052
  ),
4808
5053
  method: "GET",
4809
5054
  headers: _headers,
4810
- queryParameters: __spreadValues(__spreadValues({}, _queryParams), requestOptions == null ? void 0 : requestOptions.queryParams),
5055
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
4811
5056
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
4812
5057
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
4813
5058
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -4881,7 +5126,7 @@ var Deepgram = (() => {
4881
5126
  ),
4882
5127
  method: "GET",
4883
5128
  headers: _headers,
4884
- queryParameters: __spreadValues(__spreadValues({}, _queryParams), requestOptions == null ? void 0 : requestOptions.queryParams),
5129
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
4885
5130
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
4886
5131
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
4887
5132
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -4981,7 +5226,7 @@ var Deepgram = (() => {
4981
5226
  ),
4982
5227
  method: "GET",
4983
5228
  headers: _headers,
4984
- queryParameters: __spreadValues(__spreadValues({}, _queryParams), requestOptions == null ? void 0 : requestOptions.queryParams),
5229
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
4985
5230
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
4986
5231
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
4987
5232
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -5045,7 +5290,7 @@ var Deepgram = (() => {
5045
5290
  method: "POST",
5046
5291
  headers: _headers,
5047
5292
  contentType: "application/json",
5048
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
5293
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
5049
5294
  requestType: "json",
5050
5295
  body: request,
5051
5296
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
@@ -5108,7 +5353,7 @@ var Deepgram = (() => {
5108
5353
  ),
5109
5354
  method: "GET",
5110
5355
  headers: _headers,
5111
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
5356
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
5112
5357
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
5113
5358
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
5114
5359
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -5169,7 +5414,7 @@ var Deepgram = (() => {
5169
5414
  ),
5170
5415
  method: "DELETE",
5171
5416
  headers: _headers,
5172
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
5417
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
5173
5418
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
5174
5419
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
5175
5420
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -5236,7 +5481,7 @@ var Deepgram = (() => {
5236
5481
  ),
5237
5482
  method: "GET",
5238
5483
  headers: _headers,
5239
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
5484
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
5240
5485
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
5241
5486
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
5242
5487
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -5304,7 +5549,7 @@ var Deepgram = (() => {
5304
5549
  method: "POST",
5305
5550
  headers: _headers,
5306
5551
  contentType: "application/json",
5307
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
5552
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
5308
5553
  requestType: "json",
5309
5554
  body: request,
5310
5555
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
@@ -5370,7 +5615,7 @@ var Deepgram = (() => {
5370
5615
  ),
5371
5616
  method: "DELETE",
5372
5617
  headers: _headers,
5373
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
5618
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
5374
5619
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
5375
5620
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
5376
5621
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -5441,7 +5686,7 @@ var Deepgram = (() => {
5441
5686
  ),
5442
5687
  method: "GET",
5443
5688
  headers: _headers,
5444
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
5689
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
5445
5690
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
5446
5691
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
5447
5692
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -5509,7 +5754,7 @@ var Deepgram = (() => {
5509
5754
  method: "PUT",
5510
5755
  headers: _headers,
5511
5756
  contentType: "application/json",
5512
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
5757
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
5513
5758
  requestType: "json",
5514
5759
  body: request,
5515
5760
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
@@ -5589,7 +5834,7 @@ var Deepgram = (() => {
5589
5834
  ),
5590
5835
  method: "GET",
5591
5836
  headers: _headers,
5592
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
5837
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
5593
5838
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
5594
5839
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
5595
5840
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -5653,7 +5898,7 @@ var Deepgram = (() => {
5653
5898
  ),
5654
5899
  method: "DELETE",
5655
5900
  headers: _headers,
5656
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
5901
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
5657
5902
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
5658
5903
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
5659
5904
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -5730,7 +5975,7 @@ var Deepgram = (() => {
5730
5975
  ),
5731
5976
  method: "GET",
5732
5977
  headers: _headers,
5733
- queryParameters: __spreadValues(__spreadValues({}, _queryParams), requestOptions == null ? void 0 : requestOptions.queryParams),
5978
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
5734
5979
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
5735
5980
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
5736
5981
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -5791,7 +6036,7 @@ var Deepgram = (() => {
5791
6036
  ),
5792
6037
  method: "GET",
5793
6038
  headers: _headers,
5794
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
6039
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
5795
6040
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
5796
6041
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
5797
6042
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -5894,7 +6139,7 @@ var Deepgram = (() => {
5894
6139
  ),
5895
6140
  method: "GET",
5896
6141
  headers: _headers,
5897
- queryParameters: __spreadValues(__spreadValues({}, _queryParams), requestOptions == null ? void 0 : requestOptions.queryParams),
6142
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
5898
6143
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
5899
6144
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
5900
6145
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -5958,7 +6203,7 @@ var Deepgram = (() => {
5958
6203
  ),
5959
6204
  method: "GET",
5960
6205
  headers: _headers,
5961
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
6206
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
5962
6207
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
5963
6208
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
5964
6209
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -6166,7 +6411,7 @@ var Deepgram = (() => {
6166
6411
  ),
6167
6412
  method: "GET",
6168
6413
  headers: _headers,
6169
- queryParameters: __spreadValues(__spreadValues({}, _queryParams), requestOptions == null ? void 0 : requestOptions.queryParams),
6414
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
6170
6415
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
6171
6416
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
6172
6417
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -6242,7 +6487,7 @@ var Deepgram = (() => {
6242
6487
  ),
6243
6488
  method: "GET",
6244
6489
  headers: _headers,
6245
- queryParameters: __spreadValues(__spreadValues({}, _queryParams), requestOptions == null ? void 0 : requestOptions.queryParams),
6490
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
6246
6491
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
6247
6492
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
6248
6493
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -6457,7 +6702,7 @@ var Deepgram = (() => {
6457
6702
  ),
6458
6703
  method: "GET",
6459
6704
  headers: _headers,
6460
- queryParameters: __spreadValues(__spreadValues({}, _queryParams), requestOptions == null ? void 0 : requestOptions.queryParams),
6705
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
6461
6706
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
6462
6707
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
6463
6708
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -6547,7 +6792,7 @@ var Deepgram = (() => {
6547
6792
  ),
6548
6793
  method: "GET",
6549
6794
  headers: _headers,
6550
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
6795
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
6551
6796
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
6552
6797
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
6553
6798
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -6611,7 +6856,7 @@ var Deepgram = (() => {
6611
6856
  ),
6612
6857
  method: "GET",
6613
6858
  headers: _headers,
6614
- queryParameters: __spreadValues(__spreadValues({}, _queryParams), requestOptions == null ? void 0 : requestOptions.queryParams),
6859
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
6615
6860
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
6616
6861
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
6617
6862
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -6666,7 +6911,7 @@ var Deepgram = (() => {
6666
6911
  ),
6667
6912
  method: "DELETE",
6668
6913
  headers: _headers,
6669
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
6914
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
6670
6915
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
6671
6916
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
6672
6917
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -6723,7 +6968,7 @@ var Deepgram = (() => {
6723
6968
  method: "PATCH",
6724
6969
  headers: _headers,
6725
6970
  contentType: "application/json",
6726
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
6971
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
6727
6972
  requestType: "json",
6728
6973
  body: request,
6729
6974
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
@@ -6780,7 +7025,7 @@ var Deepgram = (() => {
6780
7025
  ),
6781
7026
  method: "DELETE",
6782
7027
  headers: _headers,
6783
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
7028
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
6784
7029
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
6785
7030
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
6786
7031
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -6919,7 +7164,7 @@ var Deepgram = (() => {
6919
7164
  method: "POST",
6920
7165
  headers: _headers,
6921
7166
  contentType: "application/json",
6922
- queryParameters: __spreadValues(__spreadValues({}, _queryParams), requestOptions == null ? void 0 : requestOptions.queryParams),
7167
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
6923
7168
  requestType: "json",
6924
7169
  body: _body,
6925
7170
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
@@ -7005,7 +7250,7 @@ var Deepgram = (() => {
7005
7250
  ),
7006
7251
  method: "GET",
7007
7252
  headers: _headers,
7008
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
7253
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
7009
7254
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
7010
7255
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
7011
7256
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -7049,6 +7294,7 @@ var Deepgram = (() => {
7049
7294
  *
7050
7295
  * @example
7051
7296
  * await client.selfHosted.v1.distributionCredentials.create("123456-7890-1234-5678-901234", {
7297
+ * scopes: ["self-hosted:products"],
7052
7298
  * provider: "quay"
7053
7299
  * })
7054
7300
  */
@@ -7077,7 +7323,7 @@ var Deepgram = (() => {
7077
7323
  method: "POST",
7078
7324
  headers: _headers,
7079
7325
  contentType: "application/json",
7080
- queryParameters: __spreadValues(__spreadValues({}, _queryParams), requestOptions == null ? void 0 : requestOptions.queryParams),
7326
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
7081
7327
  requestType: "json",
7082
7328
  body: _body,
7083
7329
  timeoutMs: ((_h = (_g = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _g : (_f = this._options) == null ? void 0 : _f.timeoutInSeconds) != null ? _h : 60) * 1e3,
@@ -7145,7 +7391,7 @@ var Deepgram = (() => {
7145
7391
  ),
7146
7392
  method: "GET",
7147
7393
  headers: _headers,
7148
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
7394
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
7149
7395
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
7150
7396
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
7151
7397
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -7211,7 +7457,7 @@ var Deepgram = (() => {
7211
7457
  ),
7212
7458
  method: "DELETE",
7213
7459
  headers: _headers,
7214
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
7460
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
7215
7461
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
7216
7462
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
7217
7463
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -7293,7 +7539,8 @@ var Deepgram = (() => {
7293
7539
  container,
7294
7540
  encoding,
7295
7541
  model,
7296
- sample_rate: sampleRate
7542
+ sample_rate: sampleRate,
7543
+ speed
7297
7544
  } = _a, _body = __objRest(_a, [
7298
7545
  "callback",
7299
7546
  "callback_method",
@@ -7303,7 +7550,8 @@ var Deepgram = (() => {
7303
7550
  "container",
7304
7551
  "encoding",
7305
7552
  "model",
7306
- "sample_rate"
7553
+ "sample_rate",
7554
+ "speed"
7307
7555
  ]);
7308
7556
  const _queryParams = {
7309
7557
  callback,
@@ -7314,7 +7562,8 @@ var Deepgram = (() => {
7314
7562
  container: container != null ? container : void 0,
7315
7563
  encoding: encoding != null ? encoding : void 0,
7316
7564
  model: model != null ? model : void 0,
7317
- sample_rate: sampleRate
7565
+ sample_rate: sampleRate,
7566
+ speed
7318
7567
  };
7319
7568
  const _authRequest = yield this._options.authProvider.getAuthRequest();
7320
7569
  const _headers = mergeHeaders(
@@ -7330,7 +7579,7 @@ var Deepgram = (() => {
7330
7579
  method: "POST",
7331
7580
  headers: _headers,
7332
7581
  contentType: "application/json",
7333
- queryParameters: __spreadValues(__spreadValues({}, _queryParams), requestOptions == null ? void 0 : requestOptions.queryParams),
7582
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
7334
7583
  requestType: "json",
7335
7584
  body: _body,
7336
7585
  responseType: "binary-response",
@@ -7442,7 +7691,7 @@ var Deepgram = (() => {
7442
7691
  /** Returns a promise that resolves when the websocket is open. */
7443
7692
  waitForOpen() {
7444
7693
  return __async(this, null, function* () {
7445
- if (this.socket.readyState === ReconnectingWebSocket.OPEN) {
7694
+ if (this.socket.readyState === ReconnectingWebSocket.ReadyState.OPEN) {
7446
7695
  return this.socket;
7447
7696
  }
7448
7697
  return new Promise((resolve, reject) => {
@@ -7460,7 +7709,7 @@ var Deepgram = (() => {
7460
7709
  if (!this.socket) {
7461
7710
  throw new Error("Socket is not connected.");
7462
7711
  }
7463
- if (this.socket.readyState !== ReconnectingWebSocket.OPEN) {
7712
+ if (this.socket.readyState !== ReconnectingWebSocket.ReadyState.OPEN) {
7464
7713
  throw new Error("Socket is not open.");
7465
7714
  }
7466
7715
  }
@@ -7486,12 +7735,14 @@ var Deepgram = (() => {
7486
7735
  }
7487
7736
  connect(args) {
7488
7737
  return __async(this, null, function* () {
7489
- var _a, _b;
7738
+ var _a, _b, _c;
7490
7739
  const {
7491
7740
  encoding,
7492
7741
  mip_opt_out: mipOptOut,
7493
7742
  model,
7494
7743
  sample_rate: sampleRate,
7744
+ speed,
7745
+ protocols,
7495
7746
  queryParams,
7496
7747
  headers,
7497
7748
  debug,
@@ -7503,18 +7754,20 @@ var Deepgram = (() => {
7503
7754
  encoding: encoding != null ? encoding : void 0,
7504
7755
  mip_opt_out: mipOptOut != null ? typeof mipOptOut === "string" ? mipOptOut : toJson(mipOptOut) : void 0,
7505
7756
  model: model != null ? model : void 0,
7506
- sample_rate: sampleRate != null ? sampleRate : void 0
7757
+ sample_rate: sampleRate != null ? sampleRate : void 0,
7758
+ speed
7507
7759
  };
7508
7760
  const _headers = mergeHeaders(
7761
+ (_a = this._options) == null ? void 0 : _a.headers,
7509
7762
  mergeOnlyDefinedHeaders({ Authorization: args.Authorization }),
7510
7763
  headers
7511
7764
  );
7512
7765
  const socket = new ReconnectingWebSocket({
7513
7766
  url: url_exports.join(
7514
- (_b = yield Supplier.get(this._options.baseUrl)) != null ? _b : ((_a = yield Supplier.get(this._options.environment)) != null ? _a : DeepgramEnvironment.Production).production,
7767
+ (_c = yield Supplier.get(this._options.baseUrl)) != null ? _c : ((_b = yield Supplier.get(this._options.environment)) != null ? _b : DeepgramEnvironment.Production).production,
7515
7768
  "/v1/speak"
7516
7769
  ),
7517
- protocols: [],
7770
+ protocols: protocols != null ? protocols : [],
7518
7771
  queryParameters: __spreadValues(__spreadValues({}, _queryParams), queryParams),
7519
7772
  headers: _headers,
7520
7773
  options: {
@@ -7540,38 +7793,758 @@ var Deepgram = (() => {
7540
7793
  }
7541
7794
  };
7542
7795
 
7543
- // src/Client.ts
7544
- var DeepgramClient = class {
7796
+ // src/api/resources/voiceAgent/resources/configurations/client/Client.ts
7797
+ var ConfigurationsClient = class {
7545
7798
  constructor(options = {}) {
7546
7799
  this._options = normalizeClientOptionsWithAuth(options);
7547
7800
  }
7548
- get agent() {
7549
- var _a;
7550
- return (_a = this._agent) != null ? _a : this._agent = new AgentClient(this._options);
7551
- }
7552
- get auth() {
7553
- var _a;
7554
- return (_a = this._auth) != null ? _a : this._auth = new AuthClient(this._options);
7555
- }
7556
- get listen() {
7557
- var _a;
7558
- return (_a = this._listen) != null ? _a : this._listen = new ListenClient(this._options);
7559
- }
7560
- get manage() {
7561
- var _a;
7562
- return (_a = this._manage) != null ? _a : this._manage = new ManageClient(this._options);
7563
- }
7564
- get read() {
7565
- var _a;
7566
- return (_a = this._read) != null ? _a : this._read = new ReadClient(this._options);
7567
- }
7568
- get selfHosted() {
7569
- var _a;
7570
- return (_a = this._selfHosted) != null ? _a : this._selfHosted = new SelfHostedClient(this._options);
7801
+ /**
7802
+ * Returns all agent configurations for the specified project. Configurations are returned in their uninterpolated form—template variable placeholders appear as-is rather than with their substituted values.
7803
+ *
7804
+ * @param {string} project_id - The unique identifier of the project
7805
+ * @param {ConfigurationsClient.RequestOptions} requestOptions - Request-specific configuration.
7806
+ *
7807
+ * @throws {@link Deepgram.BadRequestError}
7808
+ *
7809
+ * @example
7810
+ * await client.voiceAgent.configurations.list("123456-7890-1234-5678-901234")
7811
+ */
7812
+ list(project_id, requestOptions) {
7813
+ return HttpResponsePromise.fromPromise(this.__list(project_id, requestOptions));
7571
7814
  }
7572
- get speak() {
7573
- var _a;
7574
- return (_a = this._speak) != null ? _a : this._speak = new SpeakClient(this._options);
7815
+ __list(project_id, requestOptions) {
7816
+ return __async(this, null, function* () {
7817
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
7818
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
7819
+ const _headers = mergeHeaders(
7820
+ _authRequest.headers,
7821
+ (_a = this._options) == null ? void 0 : _a.headers,
7822
+ requestOptions == null ? void 0 : requestOptions.headers
7823
+ );
7824
+ const _response = yield ((_b = this._options.fetcher) != null ? _b : fetcher)({
7825
+ url: url_exports.join(
7826
+ (_d = yield Supplier.get(this._options.baseUrl)) != null ? _d : ((_c = yield Supplier.get(this._options.environment)) != null ? _c : DeepgramEnvironment.Production).base,
7827
+ `v1/projects/${url_exports.encodePathParam(project_id)}/agents`
7828
+ ),
7829
+ method: "GET",
7830
+ headers: _headers,
7831
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
7832
+ timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
7833
+ maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
7834
+ abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
7835
+ fetchFn: (_j = this._options) == null ? void 0 : _j.fetch,
7836
+ logging: this._options.logging
7837
+ });
7838
+ if (_response.ok) {
7839
+ return {
7840
+ data: _response.body,
7841
+ rawResponse: _response.rawResponse
7842
+ };
7843
+ }
7844
+ if (_response.error.reason === "status-code") {
7845
+ switch (_response.error.statusCode) {
7846
+ case 400:
7847
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
7848
+ default:
7849
+ throw new DeepgramError({
7850
+ statusCode: _response.error.statusCode,
7851
+ body: _response.error.body,
7852
+ rawResponse: _response.rawResponse
7853
+ });
7854
+ }
7855
+ }
7856
+ return handleNonStatusCodeError(
7857
+ _response.error,
7858
+ _response.rawResponse,
7859
+ "GET",
7860
+ "/v1/projects/{project_id}/agents"
7861
+ );
7862
+ });
7863
+ }
7864
+ /**
7865
+ * Creates a new reusable agent configuration. The `config` field must be a valid JSON string representing the `agent` block of a Settings message. The returned `agent_id` can be passed in place of the full `agent` object in future Settings messages.
7866
+ *
7867
+ * @param {string} project_id - The unique identifier of the project
7868
+ * @param {Deepgram.voiceAgent.CreateAgentConfigurationV1Request} request
7869
+ * @param {ConfigurationsClient.RequestOptions} requestOptions - Request-specific configuration.
7870
+ *
7871
+ * @throws {@link Deepgram.BadRequestError}
7872
+ *
7873
+ * @example
7874
+ * await client.voiceAgent.configurations.create("123456-7890-1234-5678-901234", {
7875
+ * config: "config"
7876
+ * })
7877
+ */
7878
+ create(project_id, request, requestOptions) {
7879
+ return HttpResponsePromise.fromPromise(this.__create(project_id, request, requestOptions));
7880
+ }
7881
+ __create(project_id, request, requestOptions) {
7882
+ return __async(this, null, function* () {
7883
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
7884
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
7885
+ const _headers = mergeHeaders(
7886
+ _authRequest.headers,
7887
+ (_a = this._options) == null ? void 0 : _a.headers,
7888
+ requestOptions == null ? void 0 : requestOptions.headers
7889
+ );
7890
+ const _response = yield ((_b = this._options.fetcher) != null ? _b : fetcher)({
7891
+ url: url_exports.join(
7892
+ (_d = yield Supplier.get(this._options.baseUrl)) != null ? _d : ((_c = yield Supplier.get(this._options.environment)) != null ? _c : DeepgramEnvironment.Production).base,
7893
+ `v1/projects/${url_exports.encodePathParam(project_id)}/agents`
7894
+ ),
7895
+ method: "POST",
7896
+ headers: _headers,
7897
+ contentType: "application/json",
7898
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
7899
+ requestType: "json",
7900
+ body: request,
7901
+ timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
7902
+ maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
7903
+ abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
7904
+ fetchFn: (_j = this._options) == null ? void 0 : _j.fetch,
7905
+ logging: this._options.logging
7906
+ });
7907
+ if (_response.ok) {
7908
+ return {
7909
+ data: _response.body,
7910
+ rawResponse: _response.rawResponse
7911
+ };
7912
+ }
7913
+ if (_response.error.reason === "status-code") {
7914
+ switch (_response.error.statusCode) {
7915
+ case 400:
7916
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
7917
+ default:
7918
+ throw new DeepgramError({
7919
+ statusCode: _response.error.statusCode,
7920
+ body: _response.error.body,
7921
+ rawResponse: _response.rawResponse
7922
+ });
7923
+ }
7924
+ }
7925
+ return handleNonStatusCodeError(
7926
+ _response.error,
7927
+ _response.rawResponse,
7928
+ "POST",
7929
+ "/v1/projects/{project_id}/agents"
7930
+ );
7931
+ });
7932
+ }
7933
+ /**
7934
+ * Returns the specified agent configuration in its uninterpolated form
7935
+ *
7936
+ * @param {string} project_id - The unique identifier of the project
7937
+ * @param {string} agent_id - The unique identifier of the agent configuration
7938
+ * @param {ConfigurationsClient.RequestOptions} requestOptions - Request-specific configuration.
7939
+ *
7940
+ * @throws {@link Deepgram.BadRequestError}
7941
+ *
7942
+ * @example
7943
+ * await client.voiceAgent.configurations.get("123456-7890-1234-5678-901234", "a1b2c3d4-e5f6-7890-abcd-ef1234567890")
7944
+ */
7945
+ get(project_id, agent_id, requestOptions) {
7946
+ return HttpResponsePromise.fromPromise(this.__get(project_id, agent_id, requestOptions));
7947
+ }
7948
+ __get(project_id, agent_id, requestOptions) {
7949
+ return __async(this, null, function* () {
7950
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
7951
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
7952
+ const _headers = mergeHeaders(
7953
+ _authRequest.headers,
7954
+ (_a = this._options) == null ? void 0 : _a.headers,
7955
+ requestOptions == null ? void 0 : requestOptions.headers
7956
+ );
7957
+ const _response = yield ((_b = this._options.fetcher) != null ? _b : fetcher)({
7958
+ url: url_exports.join(
7959
+ (_d = yield Supplier.get(this._options.baseUrl)) != null ? _d : ((_c = yield Supplier.get(this._options.environment)) != null ? _c : DeepgramEnvironment.Production).base,
7960
+ `v1/projects/${url_exports.encodePathParam(project_id)}/agents/${url_exports.encodePathParam(agent_id)}`
7961
+ ),
7962
+ method: "GET",
7963
+ headers: _headers,
7964
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
7965
+ timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
7966
+ maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
7967
+ abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
7968
+ fetchFn: (_j = this._options) == null ? void 0 : _j.fetch,
7969
+ logging: this._options.logging
7970
+ });
7971
+ if (_response.ok) {
7972
+ return { data: _response.body, rawResponse: _response.rawResponse };
7973
+ }
7974
+ if (_response.error.reason === "status-code") {
7975
+ switch (_response.error.statusCode) {
7976
+ case 400:
7977
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
7978
+ default:
7979
+ throw new DeepgramError({
7980
+ statusCode: _response.error.statusCode,
7981
+ body: _response.error.body,
7982
+ rawResponse: _response.rawResponse
7983
+ });
7984
+ }
7985
+ }
7986
+ return handleNonStatusCodeError(
7987
+ _response.error,
7988
+ _response.rawResponse,
7989
+ "GET",
7990
+ "/v1/projects/{project_id}/agents/{agent_id}"
7991
+ );
7992
+ });
7993
+ }
7994
+ /**
7995
+ * Updates the metadata associated with an agent configuration. The config itself is immutable—to change the configuration, delete the existing agent and create a new one.
7996
+ *
7997
+ * @param {string} project_id - The unique identifier of the project
7998
+ * @param {string} agent_id - The unique identifier of the agent configuration
7999
+ * @param {Deepgram.voiceAgent.UpdateAgentMetadataV1Request} request
8000
+ * @param {ConfigurationsClient.RequestOptions} requestOptions - Request-specific configuration.
8001
+ *
8002
+ * @throws {@link Deepgram.BadRequestError}
8003
+ *
8004
+ * @example
8005
+ * await client.voiceAgent.configurations.update("123456-7890-1234-5678-901234", "a1b2c3d4-e5f6-7890-abcd-ef1234567890", {
8006
+ * metadata: {
8007
+ * "key": "value"
8008
+ * }
8009
+ * })
8010
+ */
8011
+ update(project_id, agent_id, request, requestOptions) {
8012
+ return HttpResponsePromise.fromPromise(this.__update(project_id, agent_id, request, requestOptions));
8013
+ }
8014
+ __update(project_id, agent_id, request, requestOptions) {
8015
+ return __async(this, null, function* () {
8016
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
8017
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
8018
+ const _headers = mergeHeaders(
8019
+ _authRequest.headers,
8020
+ (_a = this._options) == null ? void 0 : _a.headers,
8021
+ requestOptions == null ? void 0 : requestOptions.headers
8022
+ );
8023
+ const _response = yield ((_b = this._options.fetcher) != null ? _b : fetcher)({
8024
+ url: url_exports.join(
8025
+ (_d = yield Supplier.get(this._options.baseUrl)) != null ? _d : ((_c = yield Supplier.get(this._options.environment)) != null ? _c : DeepgramEnvironment.Production).base,
8026
+ `v1/projects/${url_exports.encodePathParam(project_id)}/agents/${url_exports.encodePathParam(agent_id)}`
8027
+ ),
8028
+ method: "PUT",
8029
+ headers: _headers,
8030
+ contentType: "application/json",
8031
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
8032
+ requestType: "json",
8033
+ body: request,
8034
+ timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
8035
+ maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
8036
+ abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
8037
+ fetchFn: (_j = this._options) == null ? void 0 : _j.fetch,
8038
+ logging: this._options.logging
8039
+ });
8040
+ if (_response.ok) {
8041
+ return { data: _response.body, rawResponse: _response.rawResponse };
8042
+ }
8043
+ if (_response.error.reason === "status-code") {
8044
+ switch (_response.error.statusCode) {
8045
+ case 400:
8046
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
8047
+ default:
8048
+ throw new DeepgramError({
8049
+ statusCode: _response.error.statusCode,
8050
+ body: _response.error.body,
8051
+ rawResponse: _response.rawResponse
8052
+ });
8053
+ }
8054
+ }
8055
+ return handleNonStatusCodeError(
8056
+ _response.error,
8057
+ _response.rawResponse,
8058
+ "PUT",
8059
+ "/v1/projects/{project_id}/agents/{agent_id}"
8060
+ );
8061
+ });
8062
+ }
8063
+ /**
8064
+ * Deletes the specified agent configuration. Deleting an agent configuration can cause a production outage if your service references this agent UUID. Migrate all active sessions to a new configuration before deleting.
8065
+ *
8066
+ * @param {string} project_id - The unique identifier of the project
8067
+ * @param {string} agent_id - The unique identifier of the agent configuration
8068
+ * @param {ConfigurationsClient.RequestOptions} requestOptions - Request-specific configuration.
8069
+ *
8070
+ * @throws {@link Deepgram.BadRequestError}
8071
+ *
8072
+ * @example
8073
+ * await client.voiceAgent.configurations.delete("123456-7890-1234-5678-901234", "a1b2c3d4-e5f6-7890-abcd-ef1234567890")
8074
+ */
8075
+ delete(project_id, agent_id, requestOptions) {
8076
+ return HttpResponsePromise.fromPromise(this.__delete(project_id, agent_id, requestOptions));
8077
+ }
8078
+ __delete(project_id, agent_id, requestOptions) {
8079
+ return __async(this, null, function* () {
8080
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
8081
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
8082
+ const _headers = mergeHeaders(
8083
+ _authRequest.headers,
8084
+ (_a = this._options) == null ? void 0 : _a.headers,
8085
+ requestOptions == null ? void 0 : requestOptions.headers
8086
+ );
8087
+ const _response = yield ((_b = this._options.fetcher) != null ? _b : fetcher)({
8088
+ url: url_exports.join(
8089
+ (_d = yield Supplier.get(this._options.baseUrl)) != null ? _d : ((_c = yield Supplier.get(this._options.environment)) != null ? _c : DeepgramEnvironment.Production).base,
8090
+ `v1/projects/${url_exports.encodePathParam(project_id)}/agents/${url_exports.encodePathParam(agent_id)}`
8091
+ ),
8092
+ method: "DELETE",
8093
+ headers: _headers,
8094
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
8095
+ timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
8096
+ maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
8097
+ abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
8098
+ fetchFn: (_j = this._options) == null ? void 0 : _j.fetch,
8099
+ logging: this._options.logging
8100
+ });
8101
+ if (_response.ok) {
8102
+ return {
8103
+ data: _response.body,
8104
+ rawResponse: _response.rawResponse
8105
+ };
8106
+ }
8107
+ if (_response.error.reason === "status-code") {
8108
+ switch (_response.error.statusCode) {
8109
+ case 400:
8110
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
8111
+ default:
8112
+ throw new DeepgramError({
8113
+ statusCode: _response.error.statusCode,
8114
+ body: _response.error.body,
8115
+ rawResponse: _response.rawResponse
8116
+ });
8117
+ }
8118
+ }
8119
+ return handleNonStatusCodeError(
8120
+ _response.error,
8121
+ _response.rawResponse,
8122
+ "DELETE",
8123
+ "/v1/projects/{project_id}/agents/{agent_id}"
8124
+ );
8125
+ });
8126
+ }
8127
+ };
8128
+
8129
+ // src/api/resources/voiceAgent/resources/variables/client/Client.ts
8130
+ var VariablesClient = class {
8131
+ constructor(options = {}) {
8132
+ this._options = normalizeClientOptionsWithAuth(options);
8133
+ }
8134
+ /**
8135
+ * Returns all template variables for the specified project
8136
+ *
8137
+ * @param {string} project_id - The unique identifier of the project
8138
+ * @param {VariablesClient.RequestOptions} requestOptions - Request-specific configuration.
8139
+ *
8140
+ * @throws {@link Deepgram.BadRequestError}
8141
+ *
8142
+ * @example
8143
+ * await client.voiceAgent.variables.list("123456-7890-1234-5678-901234")
8144
+ */
8145
+ list(project_id, requestOptions) {
8146
+ return HttpResponsePromise.fromPromise(this.__list(project_id, requestOptions));
8147
+ }
8148
+ __list(project_id, requestOptions) {
8149
+ return __async(this, null, function* () {
8150
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
8151
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
8152
+ const _headers = mergeHeaders(
8153
+ _authRequest.headers,
8154
+ (_a = this._options) == null ? void 0 : _a.headers,
8155
+ requestOptions == null ? void 0 : requestOptions.headers
8156
+ );
8157
+ const _response = yield ((_b = this._options.fetcher) != null ? _b : fetcher)({
8158
+ url: url_exports.join(
8159
+ (_d = yield Supplier.get(this._options.baseUrl)) != null ? _d : ((_c = yield Supplier.get(this._options.environment)) != null ? _c : DeepgramEnvironment.Production).base,
8160
+ `v1/projects/${url_exports.encodePathParam(project_id)}/agent-variables`
8161
+ ),
8162
+ method: "GET",
8163
+ headers: _headers,
8164
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
8165
+ timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
8166
+ maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
8167
+ abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
8168
+ fetchFn: (_j = this._options) == null ? void 0 : _j.fetch,
8169
+ logging: this._options.logging
8170
+ });
8171
+ if (_response.ok) {
8172
+ return {
8173
+ data: _response.body,
8174
+ rawResponse: _response.rawResponse
8175
+ };
8176
+ }
8177
+ if (_response.error.reason === "status-code") {
8178
+ switch (_response.error.statusCode) {
8179
+ case 400:
8180
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
8181
+ default:
8182
+ throw new DeepgramError({
8183
+ statusCode: _response.error.statusCode,
8184
+ body: _response.error.body,
8185
+ rawResponse: _response.rawResponse
8186
+ });
8187
+ }
8188
+ }
8189
+ return handleNonStatusCodeError(
8190
+ _response.error,
8191
+ _response.rawResponse,
8192
+ "GET",
8193
+ "/v1/projects/{project_id}/agent-variables"
8194
+ );
8195
+ });
8196
+ }
8197
+ /**
8198
+ * Creates a new template variable. Variables follow the `DG_<VARIABLE_NAME>` naming format and can substitute any JSON value in an agent configuration.
8199
+ *
8200
+ * @param {string} project_id - The unique identifier of the project
8201
+ * @param {Deepgram.voiceAgent.CreateAgentVariableV1Request} request
8202
+ * @param {VariablesClient.RequestOptions} requestOptions - Request-specific configuration.
8203
+ *
8204
+ * @throws {@link Deepgram.BadRequestError}
8205
+ *
8206
+ * @example
8207
+ * await client.voiceAgent.variables.create("project_id", {
8208
+ * key: "key",
8209
+ * value: {
8210
+ * "key": "value"
8211
+ * }
8212
+ * })
8213
+ */
8214
+ create(project_id, request, requestOptions) {
8215
+ return HttpResponsePromise.fromPromise(this.__create(project_id, request, requestOptions));
8216
+ }
8217
+ __create(project_id, request, requestOptions) {
8218
+ return __async(this, null, function* () {
8219
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
8220
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
8221
+ const _headers = mergeHeaders(
8222
+ _authRequest.headers,
8223
+ (_a = this._options) == null ? void 0 : _a.headers,
8224
+ requestOptions == null ? void 0 : requestOptions.headers
8225
+ );
8226
+ const _response = yield ((_b = this._options.fetcher) != null ? _b : fetcher)({
8227
+ url: url_exports.join(
8228
+ (_d = yield Supplier.get(this._options.baseUrl)) != null ? _d : ((_c = yield Supplier.get(this._options.environment)) != null ? _c : DeepgramEnvironment.Production).base,
8229
+ `v1/projects/${url_exports.encodePathParam(project_id)}/agent-variables`
8230
+ ),
8231
+ method: "POST",
8232
+ headers: _headers,
8233
+ contentType: "application/json",
8234
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
8235
+ requestType: "json",
8236
+ body: request,
8237
+ timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
8238
+ maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
8239
+ abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
8240
+ fetchFn: (_j = this._options) == null ? void 0 : _j.fetch,
8241
+ logging: this._options.logging
8242
+ });
8243
+ if (_response.ok) {
8244
+ return { data: _response.body, rawResponse: _response.rawResponse };
8245
+ }
8246
+ if (_response.error.reason === "status-code") {
8247
+ switch (_response.error.statusCode) {
8248
+ case 400:
8249
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
8250
+ default:
8251
+ throw new DeepgramError({
8252
+ statusCode: _response.error.statusCode,
8253
+ body: _response.error.body,
8254
+ rawResponse: _response.rawResponse
8255
+ });
8256
+ }
8257
+ }
8258
+ return handleNonStatusCodeError(
8259
+ _response.error,
8260
+ _response.rawResponse,
8261
+ "POST",
8262
+ "/v1/projects/{project_id}/agent-variables"
8263
+ );
8264
+ });
8265
+ }
8266
+ /**
8267
+ * Returns the specified template variable
8268
+ *
8269
+ * @param {string} project_id - The unique identifier of the project
8270
+ * @param {string} variable_id - The unique identifier of the agent variable
8271
+ * @param {VariablesClient.RequestOptions} requestOptions - Request-specific configuration.
8272
+ *
8273
+ * @throws {@link Deepgram.BadRequestError}
8274
+ *
8275
+ * @example
8276
+ * await client.voiceAgent.variables.get("123456-7890-1234-5678-901234", "v1a2b3c4-d5e6-7890-abcd-ef1234567890")
8277
+ */
8278
+ get(project_id, variable_id, requestOptions) {
8279
+ return HttpResponsePromise.fromPromise(this.__get(project_id, variable_id, requestOptions));
8280
+ }
8281
+ __get(project_id, variable_id, requestOptions) {
8282
+ return __async(this, null, function* () {
8283
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
8284
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
8285
+ const _headers = mergeHeaders(
8286
+ _authRequest.headers,
8287
+ (_a = this._options) == null ? void 0 : _a.headers,
8288
+ requestOptions == null ? void 0 : requestOptions.headers
8289
+ );
8290
+ const _response = yield ((_b = this._options.fetcher) != null ? _b : fetcher)({
8291
+ url: url_exports.join(
8292
+ (_d = yield Supplier.get(this._options.baseUrl)) != null ? _d : ((_c = yield Supplier.get(this._options.environment)) != null ? _c : DeepgramEnvironment.Production).base,
8293
+ `v1/projects/${url_exports.encodePathParam(project_id)}/agent-variables/${url_exports.encodePathParam(variable_id)}`
8294
+ ),
8295
+ method: "GET",
8296
+ headers: _headers,
8297
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
8298
+ timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
8299
+ maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
8300
+ abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
8301
+ fetchFn: (_j = this._options) == null ? void 0 : _j.fetch,
8302
+ logging: this._options.logging
8303
+ });
8304
+ if (_response.ok) {
8305
+ return { data: _response.body, rawResponse: _response.rawResponse };
8306
+ }
8307
+ if (_response.error.reason === "status-code") {
8308
+ switch (_response.error.statusCode) {
8309
+ case 400:
8310
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
8311
+ default:
8312
+ throw new DeepgramError({
8313
+ statusCode: _response.error.statusCode,
8314
+ body: _response.error.body,
8315
+ rawResponse: _response.rawResponse
8316
+ });
8317
+ }
8318
+ }
8319
+ return handleNonStatusCodeError(
8320
+ _response.error,
8321
+ _response.rawResponse,
8322
+ "GET",
8323
+ "/v1/projects/{project_id}/agent-variables/{variable_id}"
8324
+ );
8325
+ });
8326
+ }
8327
+ /**
8328
+ * Deletes the specified template variable
8329
+ *
8330
+ * @param {string} project_id - The unique identifier of the project
8331
+ * @param {string} variable_id - The unique identifier of the agent variable
8332
+ * @param {VariablesClient.RequestOptions} requestOptions - Request-specific configuration.
8333
+ *
8334
+ * @throws {@link Deepgram.BadRequestError}
8335
+ *
8336
+ * @example
8337
+ * await client.voiceAgent.variables.delete("123456-7890-1234-5678-901234", "v1a2b3c4-d5e6-7890-abcd-ef1234567890")
8338
+ */
8339
+ delete(project_id, variable_id, requestOptions) {
8340
+ return HttpResponsePromise.fromPromise(this.__delete(project_id, variable_id, requestOptions));
8341
+ }
8342
+ __delete(project_id, variable_id, requestOptions) {
8343
+ return __async(this, null, function* () {
8344
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
8345
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
8346
+ const _headers = mergeHeaders(
8347
+ _authRequest.headers,
8348
+ (_a = this._options) == null ? void 0 : _a.headers,
8349
+ requestOptions == null ? void 0 : requestOptions.headers
8350
+ );
8351
+ const _response = yield ((_b = this._options.fetcher) != null ? _b : fetcher)({
8352
+ url: url_exports.join(
8353
+ (_d = yield Supplier.get(this._options.baseUrl)) != null ? _d : ((_c = yield Supplier.get(this._options.environment)) != null ? _c : DeepgramEnvironment.Production).base,
8354
+ `v1/projects/${url_exports.encodePathParam(project_id)}/agent-variables/${url_exports.encodePathParam(variable_id)}`
8355
+ ),
8356
+ method: "DELETE",
8357
+ headers: _headers,
8358
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
8359
+ timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
8360
+ maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
8361
+ abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
8362
+ fetchFn: (_j = this._options) == null ? void 0 : _j.fetch,
8363
+ logging: this._options.logging
8364
+ });
8365
+ if (_response.ok) {
8366
+ return {
8367
+ data: _response.body,
8368
+ rawResponse: _response.rawResponse
8369
+ };
8370
+ }
8371
+ if (_response.error.reason === "status-code") {
8372
+ switch (_response.error.statusCode) {
8373
+ case 400:
8374
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
8375
+ default:
8376
+ throw new DeepgramError({
8377
+ statusCode: _response.error.statusCode,
8378
+ body: _response.error.body,
8379
+ rawResponse: _response.rawResponse
8380
+ });
8381
+ }
8382
+ }
8383
+ return handleNonStatusCodeError(
8384
+ _response.error,
8385
+ _response.rawResponse,
8386
+ "DELETE",
8387
+ "/v1/projects/{project_id}/agent-variables/{variable_id}"
8388
+ );
8389
+ });
8390
+ }
8391
+ /**
8392
+ * Updates the value of an existing template variable
8393
+ *
8394
+ * @param {string} project_id - The unique identifier of the project
8395
+ * @param {string} variable_id - The unique identifier of the agent variable
8396
+ * @param {Deepgram.voiceAgent.UpdateAgentVariableV1Request} request
8397
+ * @param {VariablesClient.RequestOptions} requestOptions - Request-specific configuration.
8398
+ *
8399
+ * @throws {@link Deepgram.BadRequestError}
8400
+ *
8401
+ * @example
8402
+ * await client.voiceAgent.variables.update("project_id", "variable_id", {
8403
+ * value: {
8404
+ * "key": "value"
8405
+ * }
8406
+ * })
8407
+ */
8408
+ update(project_id, variable_id, request, requestOptions) {
8409
+ return HttpResponsePromise.fromPromise(this.__update(project_id, variable_id, request, requestOptions));
8410
+ }
8411
+ __update(project_id, variable_id, request, requestOptions) {
8412
+ return __async(this, null, function* () {
8413
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
8414
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
8415
+ const _headers = mergeHeaders(
8416
+ _authRequest.headers,
8417
+ (_a = this._options) == null ? void 0 : _a.headers,
8418
+ requestOptions == null ? void 0 : requestOptions.headers
8419
+ );
8420
+ const _response = yield ((_b = this._options.fetcher) != null ? _b : fetcher)({
8421
+ url: url_exports.join(
8422
+ (_d = yield Supplier.get(this._options.baseUrl)) != null ? _d : ((_c = yield Supplier.get(this._options.environment)) != null ? _c : DeepgramEnvironment.Production).base,
8423
+ `v1/projects/${url_exports.encodePathParam(project_id)}/agent-variables/${url_exports.encodePathParam(variable_id)}`
8424
+ ),
8425
+ method: "PATCH",
8426
+ headers: _headers,
8427
+ contentType: "application/json",
8428
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
8429
+ requestType: "json",
8430
+ body: request,
8431
+ timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
8432
+ maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
8433
+ abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
8434
+ fetchFn: (_j = this._options) == null ? void 0 : _j.fetch,
8435
+ logging: this._options.logging
8436
+ });
8437
+ if (_response.ok) {
8438
+ return { data: _response.body, rawResponse: _response.rawResponse };
8439
+ }
8440
+ if (_response.error.reason === "status-code") {
8441
+ switch (_response.error.statusCode) {
8442
+ case 400:
8443
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
8444
+ default:
8445
+ throw new DeepgramError({
8446
+ statusCode: _response.error.statusCode,
8447
+ body: _response.error.body,
8448
+ rawResponse: _response.rawResponse
8449
+ });
8450
+ }
8451
+ }
8452
+ return handleNonStatusCodeError(
8453
+ _response.error,
8454
+ _response.rawResponse,
8455
+ "PATCH",
8456
+ "/v1/projects/{project_id}/agent-variables/{variable_id}"
8457
+ );
8458
+ });
8459
+ }
8460
+ };
8461
+
8462
+ // src/api/resources/voiceAgent/client/Client.ts
8463
+ var VoiceAgentClient = class {
8464
+ constructor(options = {}) {
8465
+ this._options = normalizeClientOptionsWithAuth(options);
8466
+ }
8467
+ get configurations() {
8468
+ var _a;
8469
+ return (_a = this._configurations) != null ? _a : this._configurations = new ConfigurationsClient(this._options);
8470
+ }
8471
+ get variables() {
8472
+ var _a;
8473
+ return (_a = this._variables) != null ? _a : this._variables = new VariablesClient(this._options);
8474
+ }
8475
+ };
8476
+
8477
+ // src/Client.ts
8478
+ var DeepgramClient = class {
8479
+ constructor(options = {}) {
8480
+ this._options = normalizeClientOptionsWithAuth(options);
8481
+ }
8482
+ get agent() {
8483
+ var _a;
8484
+ return (_a = this._agent) != null ? _a : this._agent = new AgentClient(this._options);
8485
+ }
8486
+ get auth() {
8487
+ var _a;
8488
+ return (_a = this._auth) != null ? _a : this._auth = new AuthClient(this._options);
8489
+ }
8490
+ get listen() {
8491
+ var _a;
8492
+ return (_a = this._listen) != null ? _a : this._listen = new ListenClient(this._options);
8493
+ }
8494
+ get manage() {
8495
+ var _a;
8496
+ return (_a = this._manage) != null ? _a : this._manage = new ManageClient(this._options);
8497
+ }
8498
+ get read() {
8499
+ var _a;
8500
+ return (_a = this._read) != null ? _a : this._read = new ReadClient(this._options);
8501
+ }
8502
+ get selfHosted() {
8503
+ var _a;
8504
+ return (_a = this._selfHosted) != null ? _a : this._selfHosted = new SelfHostedClient(this._options);
8505
+ }
8506
+ get speak() {
8507
+ var _a;
8508
+ return (_a = this._speak) != null ? _a : this._speak = new SpeakClient(this._options);
8509
+ }
8510
+ get voiceAgent() {
8511
+ var _a;
8512
+ return (_a = this._voiceAgent) != null ? _a : this._voiceAgent = new VoiceAgentClient(this._options);
8513
+ }
8514
+ /**
8515
+ * Make a passthrough request using the SDK's configured auth, retry, logging, etc.
8516
+ * This is useful for making requests to endpoints not yet supported in the SDK.
8517
+ * The input can be a URL string, URL object, or Request object. Relative paths are resolved against the configured base URL.
8518
+ *
8519
+ * @param {Request | string | URL} input - The URL, path, or Request object.
8520
+ * @param {RequestInit} init - Standard fetch RequestInit options.
8521
+ * @param {core.PassthroughRequest.RequestOptions} requestOptions - Per-request overrides (timeout, retries, headers, abort signal).
8522
+ * @returns {Promise<Response>} A standard Response object.
8523
+ */
8524
+ fetch(input, init, requestOptions) {
8525
+ return __async(this, null, function* () {
8526
+ var _a;
8527
+ return makePassthroughRequest(
8528
+ input,
8529
+ init,
8530
+ {
8531
+ baseUrl: (_a = this._options.baseUrl) != null ? _a : (() => __async(this, null, function* () {
8532
+ var _a2;
8533
+ const env = yield Supplier.get(this._options.environment);
8534
+ return typeof env === "string" ? env : (_a2 = env == null ? void 0 : env.base) != null ? _a2 : DeepgramEnvironment.Production.base;
8535
+ })),
8536
+ headers: this._options.headers,
8537
+ timeoutInSeconds: this._options.timeoutInSeconds,
8538
+ maxRetries: this._options.maxRetries,
8539
+ fetch: this._options.fetch,
8540
+ logging: this._options.logging,
8541
+ getAuthHeaders: () => __async(this, null, function* () {
8542
+ return (yield this._options.authProvider.getAuthRequest()).headers;
8543
+ })
8544
+ },
8545
+ requestOptions
8546
+ );
8547
+ });
7575
8548
  }
7576
8549
  };
7577
8550