rcs-js 2.0.21 → 2.0.23-rc.1

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 (389) hide show
  1. package/dist/cjs/Client.d.ts +6 -0
  2. package/dist/cjs/Client.js +32 -22
  3. package/dist/cjs/api/errors/BadGatewayError.d.ts +6 -0
  4. package/dist/cjs/api/errors/BadGatewayError.js +50 -0
  5. package/dist/cjs/api/errors/ConflictError.d.ts +6 -0
  6. package/dist/cjs/api/errors/ConflictError.js +50 -0
  7. package/dist/cjs/api/errors/GoneError.d.ts +6 -0
  8. package/dist/cjs/api/errors/GoneError.js +50 -0
  9. package/dist/cjs/api/errors/ServiceUnavailableError.d.ts +6 -0
  10. package/dist/cjs/api/errors/ServiceUnavailableError.js +50 -0
  11. package/dist/cjs/api/errors/TooEarlyError.d.ts +6 -0
  12. package/dist/cjs/api/errors/TooEarlyError.js +50 -0
  13. package/dist/cjs/api/errors/UnprocessableEntityError.d.ts +6 -0
  14. package/dist/cjs/api/errors/UnprocessableEntityError.js +50 -0
  15. package/dist/cjs/api/errors/index.d.ts +6 -0
  16. package/dist/cjs/api/errors/index.js +6 -0
  17. package/dist/cjs/api/resources/calls/client/Client.d.ts +181 -0
  18. package/dist/cjs/api/resources/calls/client/Client.js +788 -0
  19. package/dist/cjs/api/resources/calls/client/index.d.ts +1 -0
  20. package/dist/cjs/api/resources/calls/client/index.js +17 -0
  21. package/dist/cjs/api/resources/calls/client/requests/CallsDownloadRecordingRequest.d.ts +8 -0
  22. package/dist/cjs/api/resources/calls/client/requests/CallsDownloadRecordingRequest.js +3 -0
  23. package/dist/cjs/api/resources/calls/client/requests/CallsListEventsRequest.d.ts +10 -0
  24. package/dist/cjs/api/resources/calls/client/requests/CallsListEventsRequest.js +3 -0
  25. package/dist/cjs/api/resources/calls/client/requests/CallsListRequest.d.ts +17 -0
  26. package/dist/cjs/api/resources/calls/client/requests/CallsListRequest.js +3 -0
  27. package/dist/cjs/api/resources/calls/client/requests/CreateCallParams.d.ts +17 -0
  28. package/dist/cjs/api/resources/calls/client/requests/CreateCallParams.js +3 -0
  29. package/dist/cjs/api/resources/calls/client/requests/CreateStreamTokenParams.d.ts +12 -0
  30. package/dist/cjs/api/resources/calls/client/requests/CreateStreamTokenParams.js +3 -0
  31. package/dist/cjs/api/resources/calls/client/requests/UpdateCallParams.d.ts +12 -0
  32. package/dist/cjs/api/resources/calls/client/requests/UpdateCallParams.js +3 -0
  33. package/dist/cjs/api/resources/calls/client/requests/index.d.ts +6 -0
  34. package/dist/cjs/api/resources/calls/client/requests/index.js +2 -0
  35. package/dist/cjs/api/resources/calls/index.d.ts +1 -0
  36. package/dist/cjs/api/resources/calls/index.js +17 -0
  37. package/dist/cjs/api/resources/forms/client/Client.d.ts +1 -1
  38. package/dist/cjs/api/resources/forms/client/Client.js +1 -1
  39. package/dist/cjs/api/resources/index.d.ts +3 -0
  40. package/dist/cjs/api/resources/index.js +4 -1
  41. package/dist/cjs/api/resources/network/client/Client.d.ts +21 -0
  42. package/dist/cjs/api/resources/network/client/Client.js +30 -0
  43. package/dist/cjs/api/resources/network/client/index.d.ts +1 -0
  44. package/dist/cjs/api/resources/network/client/index.js +2 -0
  45. package/dist/cjs/api/resources/network/index.d.ts +2 -0
  46. package/dist/cjs/api/resources/network/index.js +18 -0
  47. package/dist/cjs/api/resources/network/resources/index.d.ts +8 -0
  48. package/dist/cjs/api/resources/network/resources/index.js +47 -0
  49. package/dist/cjs/api/resources/network/resources/requests/client/Client.d.ts +61 -0
  50. package/dist/cjs/api/resources/network/resources/requests/client/Client.js +223 -0
  51. package/dist/cjs/api/resources/network/resources/requests/client/index.d.ts +1 -0
  52. package/dist/cjs/api/resources/network/resources/requests/client/index.js +17 -0
  53. package/dist/cjs/api/resources/network/resources/requests/client/requests/ListNetworkRequestsParams.d.ts +21 -0
  54. package/dist/cjs/api/resources/network/resources/requests/client/requests/ListNetworkRequestsParams.js +3 -0
  55. package/dist/cjs/api/resources/network/resources/requests/client/requests/index.d.ts +1 -0
  56. package/dist/cjs/api/resources/network/resources/requests/client/requests/index.js +2 -0
  57. package/dist/cjs/api/resources/network/resources/requests/index.d.ts +1 -0
  58. package/dist/cjs/api/resources/network/resources/requests/index.js +17 -0
  59. package/dist/cjs/api/resources/network/resources/silentAuth/client/Client.d.ts +71 -0
  60. package/dist/cjs/api/resources/network/resources/silentAuth/client/Client.js +234 -0
  61. package/dist/cjs/api/resources/network/resources/silentAuth/client/index.d.ts +1 -0
  62. package/dist/cjs/api/resources/network/resources/silentAuth/client/index.js +17 -0
  63. package/dist/cjs/api/resources/network/resources/silentAuth/client/requests/SilentAuthCheckRequest.d.ts +10 -0
  64. package/dist/cjs/api/resources/network/resources/silentAuth/client/requests/SilentAuthCheckRequest.js +3 -0
  65. package/dist/cjs/api/resources/network/resources/silentAuth/client/requests/SilentAuthRequest.d.ts +34 -0
  66. package/dist/cjs/api/resources/network/resources/silentAuth/client/requests/SilentAuthRequest.js +3 -0
  67. package/dist/cjs/api/resources/network/resources/silentAuth/client/requests/index.d.ts +2 -0
  68. package/dist/cjs/api/resources/network/resources/silentAuth/client/requests/index.js +2 -0
  69. package/dist/cjs/api/resources/network/resources/silentAuth/index.d.ts +1 -0
  70. package/dist/cjs/api/resources/network/resources/silentAuth/index.js +17 -0
  71. package/dist/cjs/api/resources/network/resources/simSwap/client/Client.d.ts +37 -0
  72. package/dist/cjs/api/resources/network/resources/simSwap/client/Client.js +143 -0
  73. package/dist/cjs/api/resources/network/resources/simSwap/client/index.d.ts +1 -0
  74. package/dist/cjs/api/resources/network/resources/simSwap/client/index.js +17 -0
  75. package/dist/cjs/api/resources/network/resources/simSwap/client/requests/SimSwapRequest.d.ts +13 -0
  76. package/dist/cjs/api/resources/network/resources/simSwap/client/requests/SimSwapRequest.js +3 -0
  77. package/dist/cjs/api/resources/network/resources/simSwap/client/requests/index.d.ts +1 -0
  78. package/dist/cjs/api/resources/network/resources/simSwap/client/requests/index.js +2 -0
  79. package/dist/cjs/api/resources/network/resources/simSwap/index.d.ts +1 -0
  80. package/dist/cjs/api/resources/network/resources/simSwap/index.js +17 -0
  81. package/dist/cjs/api/resources/network/resources/subscriberMatch/client/Client.d.ts +47 -0
  82. package/dist/cjs/api/resources/network/resources/subscriberMatch/client/Client.js +153 -0
  83. package/dist/cjs/api/resources/network/resources/subscriberMatch/client/index.d.ts +1 -0
  84. package/dist/cjs/api/resources/network/resources/subscriberMatch/client/index.js +17 -0
  85. package/dist/cjs/api/resources/network/resources/subscriberMatch/client/requests/SubscriberMatchRequest.d.ts +22 -0
  86. package/dist/cjs/api/resources/network/resources/subscriberMatch/client/requests/SubscriberMatchRequest.js +3 -0
  87. package/dist/cjs/api/resources/network/resources/subscriberMatch/client/requests/index.d.ts +1 -0
  88. package/dist/cjs/api/resources/network/resources/subscriberMatch/client/requests/index.js +2 -0
  89. package/dist/cjs/api/resources/network/resources/subscriberMatch/index.d.ts +1 -0
  90. package/dist/cjs/api/resources/network/resources/subscriberMatch/index.js +17 -0
  91. package/dist/cjs/api/resources/voiceStreams/index.d.ts +1 -0
  92. package/dist/cjs/api/resources/voiceStreams/index.js +17 -0
  93. package/dist/cjs/api/resources/voiceStreams/types/VoiceClientFrame.d.ts +10 -0
  94. package/dist/cjs/api/resources/voiceStreams/types/VoiceClientFrame.js +3 -0
  95. package/dist/cjs/api/resources/voiceStreams/types/VoiceClientMedia.d.ts +10 -0
  96. package/dist/cjs/api/resources/voiceStreams/types/VoiceClientMedia.js +3 -0
  97. package/dist/cjs/api/resources/voiceStreams/types/VoiceClientMediaFrame.d.ts +11 -0
  98. package/dist/cjs/api/resources/voiceStreams/types/VoiceClientMediaFrame.js +10 -0
  99. package/dist/cjs/api/resources/voiceStreams/types/VoiceCommandAckFrame.d.ts +22 -0
  100. package/dist/cjs/api/resources/voiceStreams/types/VoiceCommandAckFrame.js +14 -0
  101. package/dist/cjs/api/resources/voiceStreams/types/VoiceCommandAction.d.ts +15 -0
  102. package/dist/cjs/api/resources/voiceStreams/types/VoiceCommandAction.js +18 -0
  103. package/dist/cjs/api/resources/voiceStreams/types/VoiceCommandFrame.d.ts +15 -0
  104. package/dist/cjs/api/resources/voiceStreams/types/VoiceCommandFrame.js +10 -0
  105. package/dist/cjs/api/resources/voiceStreams/types/VoiceConnectedFrame.d.ts +11 -0
  106. package/dist/cjs/api/resources/voiceStreams/types/VoiceConnectedFrame.js +10 -0
  107. package/dist/cjs/api/resources/voiceStreams/types/VoiceEventFrame.d.ts +15 -0
  108. package/dist/cjs/api/resources/voiceStreams/types/VoiceEventFrame.js +10 -0
  109. package/dist/cjs/api/resources/voiceStreams/types/VoiceMediaTrack.d.ts +5 -0
  110. package/dist/cjs/api/resources/voiceStreams/types/VoiceMediaTrack.js +8 -0
  111. package/dist/cjs/api/resources/voiceStreams/types/VoiceServerFrame.d.ts +16 -0
  112. package/dist/cjs/api/resources/voiceStreams/types/VoiceServerFrame.js +3 -0
  113. package/dist/cjs/api/resources/voiceStreams/types/VoiceServerMedia.d.ts +10 -0
  114. package/dist/cjs/api/resources/voiceStreams/types/VoiceServerMedia.js +3 -0
  115. package/dist/cjs/api/resources/voiceStreams/types/VoiceServerMediaFrame.d.ts +13 -0
  116. package/dist/cjs/api/resources/voiceStreams/types/VoiceServerMediaFrame.js +10 -0
  117. package/dist/cjs/api/resources/voiceStreams/types/index.d.ts +12 -0
  118. package/dist/cjs/api/resources/voiceStreams/types/index.js +28 -0
  119. package/dist/cjs/api/types/AgentSummary.d.ts +2 -2
  120. package/dist/cjs/api/types/Call.d.ts +16 -0
  121. package/dist/cjs/api/types/Call.js +3 -0
  122. package/dist/cjs/api/types/CallDirection.d.ts +11 -0
  123. package/dist/cjs/api/types/CallDirection.js +14 -0
  124. package/dist/cjs/api/types/CallEvent.d.ts +15 -0
  125. package/dist/cjs/api/types/CallEvent.js +3 -0
  126. package/dist/cjs/api/types/CallEventSource.d.ts +8 -0
  127. package/dist/cjs/api/types/CallEventSource.js +11 -0
  128. package/dist/cjs/api/types/CallMetadata.d.ts +4 -0
  129. package/dist/cjs/api/types/CallMetadata.js +3 -0
  130. package/dist/cjs/api/types/CallState.d.ts +25 -0
  131. package/dist/cjs/api/types/CallState.js +28 -0
  132. package/dist/cjs/api/types/CallStatusEvent.d.ts +41 -0
  133. package/dist/cjs/api/types/CallStatusEvent.js +3 -0
  134. package/dist/cjs/api/types/CallStreamToken.d.ts +7 -0
  135. package/dist/cjs/api/types/CallStreamToken.js +3 -0
  136. package/dist/cjs/api/types/CreatedCall.d.ts +18 -0
  137. package/dist/cjs/api/types/CreatedCall.js +3 -0
  138. package/dist/cjs/api/types/E164PhoneNumber.d.ts +4 -0
  139. package/dist/cjs/api/types/E164PhoneNumber.js +3 -0
  140. package/dist/cjs/api/types/HostedSilentAuthResponse.d.ts +8 -0
  141. package/dist/cjs/api/types/HostedSilentAuthResponse.js +3 -0
  142. package/dist/cjs/api/types/JsonSilentAuthResponse.d.ts +8 -0
  143. package/dist/cjs/api/types/JsonSilentAuthResponse.js +3 -0
  144. package/dist/cjs/api/types/ListCallEventsResponse.d.ts +5 -0
  145. package/dist/cjs/api/types/ListCallEventsResponse.js +3 -0
  146. package/dist/cjs/api/types/ListCallsResponse.d.ts +5 -0
  147. package/dist/cjs/api/types/ListCallsResponse.js +3 -0
  148. package/dist/cjs/api/types/ListNetworkRequestsResponse.d.ts +8 -0
  149. package/dist/cjs/api/types/ListNetworkRequestsResponse.js +3 -0
  150. package/dist/cjs/api/types/NetworkInsightStatus.d.ts +8 -0
  151. package/dist/cjs/api/types/NetworkInsightStatus.js +11 -0
  152. package/dist/cjs/api/types/NetworkRequestId.d.ts +4 -0
  153. package/dist/cjs/api/types/NetworkRequestId.js +3 -0
  154. package/dist/cjs/api/types/NetworkRequestResult.d.ts +5 -0
  155. package/dist/cjs/api/types/NetworkRequestResult.js +3 -0
  156. package/dist/cjs/api/types/NetworkRequestStatus.d.ts +9 -0
  157. package/dist/cjs/api/types/NetworkRequestStatus.js +12 -0
  158. package/dist/cjs/api/types/NetworkRequestSummary.d.ts +19 -0
  159. package/dist/cjs/api/types/NetworkRequestSummary.js +3 -0
  160. package/dist/cjs/api/types/NetworkRequestType.d.ts +7 -0
  161. package/dist/cjs/api/types/NetworkRequestType.js +10 -0
  162. package/dist/cjs/api/types/RecordingDownload.d.ts +5 -0
  163. package/dist/cjs/api/types/RecordingDownload.js +3 -0
  164. package/dist/cjs/api/types/RecordingState.d.ts +15 -0
  165. package/dist/cjs/api/types/RecordingState.js +18 -0
  166. package/dist/cjs/api/types/SilentAuthCheckResponse.d.ts +14 -0
  167. package/dist/cjs/api/types/SilentAuthCheckResponse.js +12 -0
  168. package/dist/cjs/api/types/SilentAuthResponse.d.ts +10 -0
  169. package/dist/cjs/api/types/SilentAuthResponse.js +3 -0
  170. package/dist/cjs/api/types/SimSwapResponse.d.ts +9 -0
  171. package/dist/cjs/api/types/SimSwapResponse.js +3 -0
  172. package/dist/cjs/api/types/SubscriberMatchAttributes.d.ts +27 -0
  173. package/dist/cjs/api/types/SubscriberMatchAttributes.js +3 -0
  174. package/dist/cjs/api/types/SubscriberMatchResponse.d.ts +46 -0
  175. package/dist/cjs/api/types/SubscriberMatchResponse.js +3 -0
  176. package/dist/cjs/api/types/SubscriberMatchResult.d.ts +12 -0
  177. package/dist/cjs/api/types/SubscriberMatchResult.js +15 -0
  178. package/dist/cjs/api/types/WebhookEventEnum.d.ts +1 -0
  179. package/dist/cjs/api/types/WebhookEventEnum.js +1 -0
  180. package/dist/cjs/api/types/index.d.ts +29 -0
  181. package/dist/cjs/api/types/index.js +29 -0
  182. package/dist/cjs/index.d.ts +6 -1
  183. package/dist/cjs/index.js +12 -3
  184. package/dist/cjs/version.d.ts +1 -1
  185. package/dist/cjs/version.js +1 -1
  186. package/dist/cjs/wrapper/PinnacleClient.d.ts +4 -1
  187. package/dist/cjs/wrapper/PinnacleClient.js +17 -6
  188. package/dist/cjs/wrapper/messages/Client.d.ts +1 -1
  189. package/dist/cjs/wrapper/voice/Client.d.ts +34 -0
  190. package/dist/cjs/wrapper/voice/Client.js +147 -0
  191. package/dist/cjs/wrapper/voice/VoiceSocket.d.ts +98 -0
  192. package/dist/cjs/wrapper/voice/VoiceSocket.js +371 -0
  193. package/dist/cjs/wrapper/voice/types.d.ts +199 -0
  194. package/dist/cjs/wrapper/voice/types.js +35 -0
  195. package/dist/esm/Client.d.mts +6 -0
  196. package/dist/esm/Client.mjs +12 -2
  197. package/dist/esm/api/errors/BadGatewayError.d.mts +6 -0
  198. package/dist/esm/api/errors/BadGatewayError.mjs +13 -0
  199. package/dist/esm/api/errors/ConflictError.d.mts +6 -0
  200. package/dist/esm/api/errors/ConflictError.mjs +13 -0
  201. package/dist/esm/api/errors/GoneError.d.mts +6 -0
  202. package/dist/esm/api/errors/GoneError.mjs +13 -0
  203. package/dist/esm/api/errors/ServiceUnavailableError.d.mts +6 -0
  204. package/dist/esm/api/errors/ServiceUnavailableError.mjs +13 -0
  205. package/dist/esm/api/errors/TooEarlyError.d.mts +6 -0
  206. package/dist/esm/api/errors/TooEarlyError.mjs +13 -0
  207. package/dist/esm/api/errors/UnprocessableEntityError.d.mts +6 -0
  208. package/dist/esm/api/errors/UnprocessableEntityError.mjs +13 -0
  209. package/dist/esm/api/errors/index.d.mts +6 -0
  210. package/dist/esm/api/errors/index.mjs +6 -0
  211. package/dist/esm/api/resources/calls/client/Client.d.mts +181 -0
  212. package/dist/esm/api/resources/calls/client/Client.mjs +751 -0
  213. package/dist/esm/api/resources/calls/client/index.d.mts +1 -0
  214. package/dist/esm/api/resources/calls/client/index.mjs +1 -0
  215. package/dist/esm/api/resources/calls/client/requests/CallsDownloadRecordingRequest.d.mts +8 -0
  216. package/dist/esm/api/resources/calls/client/requests/CallsDownloadRecordingRequest.mjs +2 -0
  217. package/dist/esm/api/resources/calls/client/requests/CallsListEventsRequest.d.mts +10 -0
  218. package/dist/esm/api/resources/calls/client/requests/CallsListEventsRequest.mjs +2 -0
  219. package/dist/esm/api/resources/calls/client/requests/CallsListRequest.d.mts +17 -0
  220. package/dist/esm/api/resources/calls/client/requests/CallsListRequest.mjs +2 -0
  221. package/dist/esm/api/resources/calls/client/requests/CreateCallParams.d.mts +17 -0
  222. package/dist/esm/api/resources/calls/client/requests/CreateCallParams.mjs +2 -0
  223. package/dist/esm/api/resources/calls/client/requests/CreateStreamTokenParams.d.mts +12 -0
  224. package/dist/esm/api/resources/calls/client/requests/CreateStreamTokenParams.mjs +2 -0
  225. package/dist/esm/api/resources/calls/client/requests/UpdateCallParams.d.mts +12 -0
  226. package/dist/esm/api/resources/calls/client/requests/UpdateCallParams.mjs +2 -0
  227. package/dist/esm/api/resources/calls/client/requests/index.d.mts +6 -0
  228. package/dist/esm/api/resources/calls/client/requests/index.mjs +1 -0
  229. package/dist/esm/api/resources/calls/index.d.mts +1 -0
  230. package/dist/esm/api/resources/calls/index.mjs +1 -0
  231. package/dist/esm/api/resources/forms/client/Client.d.mts +1 -1
  232. package/dist/esm/api/resources/forms/client/Client.mjs +1 -1
  233. package/dist/esm/api/resources/index.d.mts +3 -0
  234. package/dist/esm/api/resources/index.mjs +3 -0
  235. package/dist/esm/api/resources/network/client/Client.d.mts +21 -0
  236. package/dist/esm/api/resources/network/client/Client.mjs +26 -0
  237. package/dist/esm/api/resources/network/client/index.d.mts +1 -0
  238. package/dist/esm/api/resources/network/client/index.mjs +1 -0
  239. package/dist/esm/api/resources/network/index.d.mts +2 -0
  240. package/dist/esm/api/resources/network/index.mjs +2 -0
  241. package/dist/esm/api/resources/network/resources/index.d.mts +8 -0
  242. package/dist/esm/api/resources/network/resources/index.mjs +8 -0
  243. package/dist/esm/api/resources/network/resources/requests/client/Client.d.mts +61 -0
  244. package/dist/esm/api/resources/network/resources/requests/client/Client.mjs +186 -0
  245. package/dist/esm/api/resources/network/resources/requests/client/index.d.mts +1 -0
  246. package/dist/esm/api/resources/network/resources/requests/client/index.mjs +1 -0
  247. package/dist/esm/api/resources/network/resources/requests/client/requests/ListNetworkRequestsParams.d.mts +21 -0
  248. package/dist/esm/api/resources/network/resources/requests/client/requests/ListNetworkRequestsParams.mjs +2 -0
  249. package/dist/esm/api/resources/network/resources/requests/client/requests/index.d.mts +1 -0
  250. package/dist/esm/api/resources/network/resources/requests/client/requests/index.mjs +1 -0
  251. package/dist/esm/api/resources/network/resources/requests/index.d.mts +1 -0
  252. package/dist/esm/api/resources/network/resources/requests/index.mjs +1 -0
  253. package/dist/esm/api/resources/network/resources/silentAuth/client/Client.d.mts +71 -0
  254. package/dist/esm/api/resources/network/resources/silentAuth/client/Client.mjs +197 -0
  255. package/dist/esm/api/resources/network/resources/silentAuth/client/index.d.mts +1 -0
  256. package/dist/esm/api/resources/network/resources/silentAuth/client/index.mjs +1 -0
  257. package/dist/esm/api/resources/network/resources/silentAuth/client/requests/SilentAuthCheckRequest.d.mts +10 -0
  258. package/dist/esm/api/resources/network/resources/silentAuth/client/requests/SilentAuthCheckRequest.mjs +2 -0
  259. package/dist/esm/api/resources/network/resources/silentAuth/client/requests/SilentAuthRequest.d.mts +34 -0
  260. package/dist/esm/api/resources/network/resources/silentAuth/client/requests/SilentAuthRequest.mjs +2 -0
  261. package/dist/esm/api/resources/network/resources/silentAuth/client/requests/index.d.mts +2 -0
  262. package/dist/esm/api/resources/network/resources/silentAuth/client/requests/index.mjs +1 -0
  263. package/dist/esm/api/resources/network/resources/silentAuth/index.d.mts +1 -0
  264. package/dist/esm/api/resources/network/resources/silentAuth/index.mjs +1 -0
  265. package/dist/esm/api/resources/network/resources/simSwap/client/Client.d.mts +37 -0
  266. package/dist/esm/api/resources/network/resources/simSwap/client/Client.mjs +106 -0
  267. package/dist/esm/api/resources/network/resources/simSwap/client/index.d.mts +1 -0
  268. package/dist/esm/api/resources/network/resources/simSwap/client/index.mjs +1 -0
  269. package/dist/esm/api/resources/network/resources/simSwap/client/requests/SimSwapRequest.d.mts +13 -0
  270. package/dist/esm/api/resources/network/resources/simSwap/client/requests/SimSwapRequest.mjs +2 -0
  271. package/dist/esm/api/resources/network/resources/simSwap/client/requests/index.d.mts +1 -0
  272. package/dist/esm/api/resources/network/resources/simSwap/client/requests/index.mjs +1 -0
  273. package/dist/esm/api/resources/network/resources/simSwap/index.d.mts +1 -0
  274. package/dist/esm/api/resources/network/resources/simSwap/index.mjs +1 -0
  275. package/dist/esm/api/resources/network/resources/subscriberMatch/client/Client.d.mts +47 -0
  276. package/dist/esm/api/resources/network/resources/subscriberMatch/client/Client.mjs +116 -0
  277. package/dist/esm/api/resources/network/resources/subscriberMatch/client/index.d.mts +1 -0
  278. package/dist/esm/api/resources/network/resources/subscriberMatch/client/index.mjs +1 -0
  279. package/dist/esm/api/resources/network/resources/subscriberMatch/client/requests/SubscriberMatchRequest.d.mts +22 -0
  280. package/dist/esm/api/resources/network/resources/subscriberMatch/client/requests/SubscriberMatchRequest.mjs +2 -0
  281. package/dist/esm/api/resources/network/resources/subscriberMatch/client/requests/index.d.mts +1 -0
  282. package/dist/esm/api/resources/network/resources/subscriberMatch/client/requests/index.mjs +1 -0
  283. package/dist/esm/api/resources/network/resources/subscriberMatch/index.d.mts +1 -0
  284. package/dist/esm/api/resources/network/resources/subscriberMatch/index.mjs +1 -0
  285. package/dist/esm/api/resources/voiceStreams/index.d.mts +1 -0
  286. package/dist/esm/api/resources/voiceStreams/index.mjs +1 -0
  287. package/dist/esm/api/resources/voiceStreams/types/VoiceClientFrame.d.mts +10 -0
  288. package/dist/esm/api/resources/voiceStreams/types/VoiceClientFrame.mjs +2 -0
  289. package/dist/esm/api/resources/voiceStreams/types/VoiceClientMedia.d.mts +10 -0
  290. package/dist/esm/api/resources/voiceStreams/types/VoiceClientMedia.mjs +2 -0
  291. package/dist/esm/api/resources/voiceStreams/types/VoiceClientMediaFrame.d.mts +11 -0
  292. package/dist/esm/api/resources/voiceStreams/types/VoiceClientMediaFrame.mjs +7 -0
  293. package/dist/esm/api/resources/voiceStreams/types/VoiceCommandAckFrame.d.mts +22 -0
  294. package/dist/esm/api/resources/voiceStreams/types/VoiceCommandAckFrame.mjs +11 -0
  295. package/dist/esm/api/resources/voiceStreams/types/VoiceCommandAction.d.mts +15 -0
  296. package/dist/esm/api/resources/voiceStreams/types/VoiceCommandAction.mjs +15 -0
  297. package/dist/esm/api/resources/voiceStreams/types/VoiceCommandFrame.d.mts +15 -0
  298. package/dist/esm/api/resources/voiceStreams/types/VoiceCommandFrame.mjs +7 -0
  299. package/dist/esm/api/resources/voiceStreams/types/VoiceConnectedFrame.d.mts +11 -0
  300. package/dist/esm/api/resources/voiceStreams/types/VoiceConnectedFrame.mjs +7 -0
  301. package/dist/esm/api/resources/voiceStreams/types/VoiceEventFrame.d.mts +15 -0
  302. package/dist/esm/api/resources/voiceStreams/types/VoiceEventFrame.mjs +7 -0
  303. package/dist/esm/api/resources/voiceStreams/types/VoiceMediaTrack.d.mts +5 -0
  304. package/dist/esm/api/resources/voiceStreams/types/VoiceMediaTrack.mjs +5 -0
  305. package/dist/esm/api/resources/voiceStreams/types/VoiceServerFrame.d.mts +16 -0
  306. package/dist/esm/api/resources/voiceStreams/types/VoiceServerFrame.mjs +2 -0
  307. package/dist/esm/api/resources/voiceStreams/types/VoiceServerMedia.d.mts +10 -0
  308. package/dist/esm/api/resources/voiceStreams/types/VoiceServerMedia.mjs +2 -0
  309. package/dist/esm/api/resources/voiceStreams/types/VoiceServerMediaFrame.d.mts +13 -0
  310. package/dist/esm/api/resources/voiceStreams/types/VoiceServerMediaFrame.mjs +7 -0
  311. package/dist/esm/api/resources/voiceStreams/types/index.d.mts +12 -0
  312. package/dist/esm/api/resources/voiceStreams/types/index.mjs +12 -0
  313. package/dist/esm/api/types/AgentSummary.d.mts +2 -2
  314. package/dist/esm/api/types/Call.d.mts +16 -0
  315. package/dist/esm/api/types/Call.mjs +2 -0
  316. package/dist/esm/api/types/CallDirection.d.mts +11 -0
  317. package/dist/esm/api/types/CallDirection.mjs +11 -0
  318. package/dist/esm/api/types/CallEvent.d.mts +15 -0
  319. package/dist/esm/api/types/CallEvent.mjs +2 -0
  320. package/dist/esm/api/types/CallEventSource.d.mts +8 -0
  321. package/dist/esm/api/types/CallEventSource.mjs +8 -0
  322. package/dist/esm/api/types/CallMetadata.d.mts +4 -0
  323. package/dist/esm/api/types/CallMetadata.mjs +2 -0
  324. package/dist/esm/api/types/CallState.d.mts +25 -0
  325. package/dist/esm/api/types/CallState.mjs +25 -0
  326. package/dist/esm/api/types/CallStatusEvent.d.mts +41 -0
  327. package/dist/esm/api/types/CallStatusEvent.mjs +2 -0
  328. package/dist/esm/api/types/CallStreamToken.d.mts +7 -0
  329. package/dist/esm/api/types/CallStreamToken.mjs +2 -0
  330. package/dist/esm/api/types/CreatedCall.d.mts +18 -0
  331. package/dist/esm/api/types/CreatedCall.mjs +2 -0
  332. package/dist/esm/api/types/E164PhoneNumber.d.mts +4 -0
  333. package/dist/esm/api/types/E164PhoneNumber.mjs +2 -0
  334. package/dist/esm/api/types/HostedSilentAuthResponse.d.mts +8 -0
  335. package/dist/esm/api/types/HostedSilentAuthResponse.mjs +2 -0
  336. package/dist/esm/api/types/JsonSilentAuthResponse.d.mts +8 -0
  337. package/dist/esm/api/types/JsonSilentAuthResponse.mjs +2 -0
  338. package/dist/esm/api/types/ListCallEventsResponse.d.mts +5 -0
  339. package/dist/esm/api/types/ListCallEventsResponse.mjs +2 -0
  340. package/dist/esm/api/types/ListCallsResponse.d.mts +5 -0
  341. package/dist/esm/api/types/ListCallsResponse.mjs +2 -0
  342. package/dist/esm/api/types/ListNetworkRequestsResponse.d.mts +8 -0
  343. package/dist/esm/api/types/ListNetworkRequestsResponse.mjs +2 -0
  344. package/dist/esm/api/types/NetworkInsightStatus.d.mts +8 -0
  345. package/dist/esm/api/types/NetworkInsightStatus.mjs +8 -0
  346. package/dist/esm/api/types/NetworkRequestId.d.mts +4 -0
  347. package/dist/esm/api/types/NetworkRequestId.mjs +2 -0
  348. package/dist/esm/api/types/NetworkRequestResult.d.mts +5 -0
  349. package/dist/esm/api/types/NetworkRequestResult.mjs +2 -0
  350. package/dist/esm/api/types/NetworkRequestStatus.d.mts +9 -0
  351. package/dist/esm/api/types/NetworkRequestStatus.mjs +9 -0
  352. package/dist/esm/api/types/NetworkRequestSummary.d.mts +19 -0
  353. package/dist/esm/api/types/NetworkRequestSummary.mjs +2 -0
  354. package/dist/esm/api/types/NetworkRequestType.d.mts +7 -0
  355. package/dist/esm/api/types/NetworkRequestType.mjs +7 -0
  356. package/dist/esm/api/types/RecordingDownload.d.mts +5 -0
  357. package/dist/esm/api/types/RecordingDownload.mjs +2 -0
  358. package/dist/esm/api/types/RecordingState.d.mts +15 -0
  359. package/dist/esm/api/types/RecordingState.mjs +15 -0
  360. package/dist/esm/api/types/SilentAuthCheckResponse.d.mts +14 -0
  361. package/dist/esm/api/types/SilentAuthCheckResponse.mjs +9 -0
  362. package/dist/esm/api/types/SilentAuthResponse.d.mts +10 -0
  363. package/dist/esm/api/types/SilentAuthResponse.mjs +2 -0
  364. package/dist/esm/api/types/SimSwapResponse.d.mts +9 -0
  365. package/dist/esm/api/types/SimSwapResponse.mjs +2 -0
  366. package/dist/esm/api/types/SubscriberMatchAttributes.d.mts +27 -0
  367. package/dist/esm/api/types/SubscriberMatchAttributes.mjs +2 -0
  368. package/dist/esm/api/types/SubscriberMatchResponse.d.mts +46 -0
  369. package/dist/esm/api/types/SubscriberMatchResponse.mjs +2 -0
  370. package/dist/esm/api/types/SubscriberMatchResult.d.mts +12 -0
  371. package/dist/esm/api/types/SubscriberMatchResult.mjs +12 -0
  372. package/dist/esm/api/types/WebhookEventEnum.d.mts +1 -0
  373. package/dist/esm/api/types/WebhookEventEnum.mjs +1 -0
  374. package/dist/esm/api/types/index.d.mts +29 -0
  375. package/dist/esm/api/types/index.mjs +29 -0
  376. package/dist/esm/index.d.mts +6 -1
  377. package/dist/esm/index.mjs +4 -1
  378. package/dist/esm/version.d.mts +1 -1
  379. package/dist/esm/version.mjs +1 -1
  380. package/dist/esm/wrapper/PinnacleClient.d.mts +4 -1
  381. package/dist/esm/wrapper/PinnacleClient.mjs +16 -5
  382. package/dist/esm/wrapper/messages/Client.d.mts +1 -1
  383. package/dist/esm/wrapper/voice/Client.d.mts +34 -0
  384. package/dist/esm/wrapper/voice/Client.mjs +143 -0
  385. package/dist/esm/wrapper/voice/VoiceSocket.d.mts +98 -0
  386. package/dist/esm/wrapper/voice/VoiceSocket.mjs +366 -0
  387. package/dist/esm/wrapper/voice/types.d.mts +199 -0
  388. package/dist/esm/wrapper/voice/types.mjs +32 -0
  389. package/package.json +9 -8
@@ -0,0 +1,751 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.mjs";
12
+ import * as core from "../../../../core/index.mjs";
13
+ import * as environments from "../../../../environments.mjs";
14
+ import * as errors from "../../../../errors/index.mjs";
15
+ import * as Pinnacle from "../../../index.mjs";
16
+ export class Calls {
17
+ constructor(_options) {
18
+ this._options = _options;
19
+ }
20
+ /**
21
+ * List voice calls for your team. Results are sorted newest first.
22
+ *
23
+ * @param {Pinnacle.CallsListRequest} request
24
+ * @param {Calls.RequestOptions} requestOptions - Request-specific configuration.
25
+ *
26
+ * @throws {@link Pinnacle.BadRequestError}
27
+ * @throws {@link Pinnacle.UnauthorizedError}
28
+ * @throws {@link Pinnacle.InternalServerError}
29
+ *
30
+ * @example
31
+ * await client.calls.list()
32
+ */
33
+ list(request = {}, requestOptions) {
34
+ return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions));
35
+ }
36
+ __list() {
37
+ return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
38
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
39
+ const { limit, cursor, state, direction, from: from_, to, created_after: createdAfter, created_before: createdBefore, } = request;
40
+ const _queryParams = {};
41
+ if (limit != null) {
42
+ _queryParams.limit = limit.toString();
43
+ }
44
+ if (cursor != null) {
45
+ _queryParams.cursor = cursor;
46
+ }
47
+ if (state != null) {
48
+ _queryParams.state = state;
49
+ }
50
+ if (direction != null) {
51
+ _queryParams.direction = direction;
52
+ }
53
+ if (from_ != null) {
54
+ _queryParams.from = from_;
55
+ }
56
+ if (to != null) {
57
+ _queryParams.to = to;
58
+ }
59
+ if (createdAfter != null) {
60
+ _queryParams.created_after = createdAfter;
61
+ }
62
+ if (createdBefore != null) {
63
+ _queryParams.created_before = createdBefore;
64
+ }
65
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
66
+ const _response = yield core.fetcher({
67
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PinnacleEnvironment.Default, "calls"),
68
+ method: "GET",
69
+ headers: _headers,
70
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
71
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
72
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
73
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
74
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
75
+ logging: this._options.logging,
76
+ });
77
+ if (_response.ok) {
78
+ return { data: _response.body, rawResponse: _response.rawResponse };
79
+ }
80
+ if (_response.error.reason === "status-code") {
81
+ switch (_response.error.statusCode) {
82
+ case 400:
83
+ throw new Pinnacle.BadRequestError(_response.error.body, _response.rawResponse);
84
+ case 401:
85
+ throw new Pinnacle.UnauthorizedError(_response.error.body, _response.rawResponse);
86
+ case 500:
87
+ throw new Pinnacle.InternalServerError(_response.error.body, _response.rawResponse);
88
+ default:
89
+ throw new errors.PinnacleError({
90
+ statusCode: _response.error.statusCode,
91
+ body: _response.error.body,
92
+ rawResponse: _response.rawResponse,
93
+ });
94
+ }
95
+ }
96
+ switch (_response.error.reason) {
97
+ case "non-json":
98
+ throw new errors.PinnacleError({
99
+ statusCode: _response.error.statusCode,
100
+ body: _response.error.rawBody,
101
+ rawResponse: _response.rawResponse,
102
+ });
103
+ case "timeout":
104
+ throw new errors.PinnacleTimeoutError("Timeout exceeded when calling GET /calls.");
105
+ case "unknown":
106
+ throw new errors.PinnacleError({
107
+ message: _response.error.errorMessage,
108
+ rawResponse: _response.rawResponse,
109
+ });
110
+ }
111
+ });
112
+ }
113
+ /**
114
+ * Start an outbound voice call from a voice-enabled phone number owned by your team.
115
+ *
116
+ * @param {Pinnacle.CreateCallParams} request
117
+ * @param {Calls.RequestOptions} requestOptions - Request-specific configuration.
118
+ *
119
+ * @throws {@link Pinnacle.BadRequestError}
120
+ * @throws {@link Pinnacle.UnauthorizedError}
121
+ * @throws {@link Pinnacle.ForbiddenError}
122
+ * @throws {@link Pinnacle.InternalServerError}
123
+ * @throws {@link Pinnacle.NotImplementedError}
124
+ * @throws {@link Pinnacle.BadGatewayError}
125
+ * @throws {@link Pinnacle.ServiceUnavailableError}
126
+ *
127
+ * @example
128
+ * await client.calls.create({
129
+ * to: "to",
130
+ * from: "from"
131
+ * })
132
+ */
133
+ create(request, requestOptions) {
134
+ return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions));
135
+ }
136
+ __create(request, requestOptions) {
137
+ return __awaiter(this, void 0, void 0, function* () {
138
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
139
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
140
+ const _response = yield core.fetcher({
141
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PinnacleEnvironment.Default, "calls"),
142
+ method: "POST",
143
+ headers: _headers,
144
+ contentType: "application/json",
145
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
146
+ requestType: "json",
147
+ body: request,
148
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
149
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
150
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
151
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
152
+ logging: this._options.logging,
153
+ });
154
+ if (_response.ok) {
155
+ return { data: _response.body, rawResponse: _response.rawResponse };
156
+ }
157
+ if (_response.error.reason === "status-code") {
158
+ switch (_response.error.statusCode) {
159
+ case 400:
160
+ throw new Pinnacle.BadRequestError(_response.error.body, _response.rawResponse);
161
+ case 401:
162
+ throw new Pinnacle.UnauthorizedError(_response.error.body, _response.rawResponse);
163
+ case 403:
164
+ throw new Pinnacle.ForbiddenError(_response.error.body, _response.rawResponse);
165
+ case 500:
166
+ throw new Pinnacle.InternalServerError(_response.error.body, _response.rawResponse);
167
+ case 501:
168
+ throw new Pinnacle.NotImplementedError(_response.error.body, _response.rawResponse);
169
+ case 502:
170
+ throw new Pinnacle.BadGatewayError(_response.error.body, _response.rawResponse);
171
+ case 503:
172
+ throw new Pinnacle.ServiceUnavailableError(_response.error.body, _response.rawResponse);
173
+ default:
174
+ throw new errors.PinnacleError({
175
+ statusCode: _response.error.statusCode,
176
+ body: _response.error.body,
177
+ rawResponse: _response.rawResponse,
178
+ });
179
+ }
180
+ }
181
+ switch (_response.error.reason) {
182
+ case "non-json":
183
+ throw new errors.PinnacleError({
184
+ statusCode: _response.error.statusCode,
185
+ body: _response.error.rawBody,
186
+ rawResponse: _response.rawResponse,
187
+ });
188
+ case "timeout":
189
+ throw new errors.PinnacleTimeoutError("Timeout exceeded when calling POST /calls.");
190
+ case "unknown":
191
+ throw new errors.PinnacleError({
192
+ message: _response.error.errorMessage,
193
+ rawResponse: _response.rawResponse,
194
+ });
195
+ }
196
+ });
197
+ }
198
+ /**
199
+ * Retrieve one voice call by its Pinnacle call ID.
200
+ *
201
+ * @param {string} id - Pinnacle call ID.
202
+ * @param {Calls.RequestOptions} requestOptions - Request-specific configuration.
203
+ *
204
+ * @throws {@link Pinnacle.UnauthorizedError}
205
+ * @throws {@link Pinnacle.NotFoundError}
206
+ * @throws {@link Pinnacle.InternalServerError}
207
+ *
208
+ * @example
209
+ * await client.calls.get("call_7cQe4F8xT1yB2mN9pK3L")
210
+ */
211
+ get(id, requestOptions) {
212
+ return core.HttpResponsePromise.fromPromise(this.__get(id, requestOptions));
213
+ }
214
+ __get(id, requestOptions) {
215
+ return __awaiter(this, void 0, void 0, function* () {
216
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
217
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
218
+ const _response = yield core.fetcher({
219
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PinnacleEnvironment.Default, `calls/${core.url.encodePathParam(id)}`),
220
+ method: "GET",
221
+ headers: _headers,
222
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
223
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
224
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
225
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
226
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
227
+ logging: this._options.logging,
228
+ });
229
+ if (_response.ok) {
230
+ return { data: _response.body, rawResponse: _response.rawResponse };
231
+ }
232
+ if (_response.error.reason === "status-code") {
233
+ switch (_response.error.statusCode) {
234
+ case 401:
235
+ throw new Pinnacle.UnauthorizedError(_response.error.body, _response.rawResponse);
236
+ case 404:
237
+ throw new Pinnacle.NotFoundError(_response.error.body, _response.rawResponse);
238
+ case 500:
239
+ throw new Pinnacle.InternalServerError(_response.error.body, _response.rawResponse);
240
+ default:
241
+ throw new errors.PinnacleError({
242
+ statusCode: _response.error.statusCode,
243
+ body: _response.error.body,
244
+ rawResponse: _response.rawResponse,
245
+ });
246
+ }
247
+ }
248
+ switch (_response.error.reason) {
249
+ case "non-json":
250
+ throw new errors.PinnacleError({
251
+ statusCode: _response.error.statusCode,
252
+ body: _response.error.rawBody,
253
+ rawResponse: _response.rawResponse,
254
+ });
255
+ case "timeout":
256
+ throw new errors.PinnacleTimeoutError("Timeout exceeded when calling GET /calls/{id}.");
257
+ case "unknown":
258
+ throw new errors.PinnacleError({
259
+ message: _response.error.errorMessage,
260
+ rawResponse: _response.rawResponse,
261
+ });
262
+ }
263
+ });
264
+ }
265
+ /**
266
+ * End a live call. Terminal calls are returned unchanged.
267
+ *
268
+ * @param {string} id - Pinnacle call ID.
269
+ * @param {Calls.RequestOptions} requestOptions - Request-specific configuration.
270
+ *
271
+ * @throws {@link Pinnacle.UnauthorizedError}
272
+ * @throws {@link Pinnacle.NotFoundError}
273
+ * @throws {@link Pinnacle.InternalServerError}
274
+ * @throws {@link Pinnacle.BadGatewayError}
275
+ * @throws {@link Pinnacle.ServiceUnavailableError}
276
+ *
277
+ * @example
278
+ * await client.calls.cancel("call_7cQe4F8xT1yB2mN9pK3L")
279
+ */
280
+ cancel(id, requestOptions) {
281
+ return core.HttpResponsePromise.fromPromise(this.__cancel(id, requestOptions));
282
+ }
283
+ __cancel(id, requestOptions) {
284
+ return __awaiter(this, void 0, void 0, function* () {
285
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
286
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
287
+ const _response = yield core.fetcher({
288
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PinnacleEnvironment.Default, `calls/${core.url.encodePathParam(id)}`),
289
+ method: "DELETE",
290
+ headers: _headers,
291
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
292
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
293
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
294
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
295
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
296
+ logging: this._options.logging,
297
+ });
298
+ if (_response.ok) {
299
+ return { data: _response.body, rawResponse: _response.rawResponse };
300
+ }
301
+ if (_response.error.reason === "status-code") {
302
+ switch (_response.error.statusCode) {
303
+ case 401:
304
+ throw new Pinnacle.UnauthorizedError(_response.error.body, _response.rawResponse);
305
+ case 404:
306
+ throw new Pinnacle.NotFoundError(_response.error.body, _response.rawResponse);
307
+ case 500:
308
+ throw new Pinnacle.InternalServerError(_response.error.body, _response.rawResponse);
309
+ case 502:
310
+ throw new Pinnacle.BadGatewayError(_response.error.body, _response.rawResponse);
311
+ case 503:
312
+ throw new Pinnacle.ServiceUnavailableError(_response.error.body, _response.rawResponse);
313
+ default:
314
+ throw new errors.PinnacleError({
315
+ statusCode: _response.error.statusCode,
316
+ body: _response.error.body,
317
+ rawResponse: _response.rawResponse,
318
+ });
319
+ }
320
+ }
321
+ switch (_response.error.reason) {
322
+ case "non-json":
323
+ throw new errors.PinnacleError({
324
+ statusCode: _response.error.statusCode,
325
+ body: _response.error.rawBody,
326
+ rawResponse: _response.rawResponse,
327
+ });
328
+ case "timeout":
329
+ throw new errors.PinnacleTimeoutError("Timeout exceeded when calling DELETE /calls/{id}.");
330
+ case "unknown":
331
+ throw new errors.PinnacleError({
332
+ message: _response.error.errorMessage,
333
+ rawResponse: _response.rawResponse,
334
+ });
335
+ }
336
+ });
337
+ }
338
+ /**
339
+ * Replace a call's metadata. For live calls, future call events carry the updated metadata.
340
+ *
341
+ * @param {string} id - Pinnacle call ID.
342
+ * @param {Pinnacle.UpdateCallParams} request
343
+ * @param {Calls.RequestOptions} requestOptions - Request-specific configuration.
344
+ *
345
+ * @throws {@link Pinnacle.BadRequestError}
346
+ * @throws {@link Pinnacle.UnauthorizedError}
347
+ * @throws {@link Pinnacle.NotFoundError}
348
+ * @throws {@link Pinnacle.InternalServerError}
349
+ * @throws {@link Pinnacle.BadGatewayError}
350
+ * @throws {@link Pinnacle.ServiceUnavailableError}
351
+ *
352
+ * @example
353
+ * await client.calls.update("call_7cQe4F8xT1yB2mN9pK3L", {
354
+ * metadata: {
355
+ * "key": "value"
356
+ * }
357
+ * })
358
+ */
359
+ update(id, request, requestOptions) {
360
+ return core.HttpResponsePromise.fromPromise(this.__update(id, request, requestOptions));
361
+ }
362
+ __update(id, request, requestOptions) {
363
+ return __awaiter(this, void 0, void 0, function* () {
364
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
365
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
366
+ const _response = yield core.fetcher({
367
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PinnacleEnvironment.Default, `calls/${core.url.encodePathParam(id)}`),
368
+ method: "PATCH",
369
+ headers: _headers,
370
+ contentType: "application/json",
371
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
372
+ requestType: "json",
373
+ body: request,
374
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
375
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
376
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
377
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
378
+ logging: this._options.logging,
379
+ });
380
+ if (_response.ok) {
381
+ return { data: _response.body, rawResponse: _response.rawResponse };
382
+ }
383
+ if (_response.error.reason === "status-code") {
384
+ switch (_response.error.statusCode) {
385
+ case 400:
386
+ throw new Pinnacle.BadRequestError(_response.error.body, _response.rawResponse);
387
+ case 401:
388
+ throw new Pinnacle.UnauthorizedError(_response.error.body, _response.rawResponse);
389
+ case 404:
390
+ throw new Pinnacle.NotFoundError(_response.error.body, _response.rawResponse);
391
+ case 500:
392
+ throw new Pinnacle.InternalServerError(_response.error.body, _response.rawResponse);
393
+ case 502:
394
+ throw new Pinnacle.BadGatewayError(_response.error.body, _response.rawResponse);
395
+ case 503:
396
+ throw new Pinnacle.ServiceUnavailableError(_response.error.body, _response.rawResponse);
397
+ default:
398
+ throw new errors.PinnacleError({
399
+ statusCode: _response.error.statusCode,
400
+ body: _response.error.body,
401
+ rawResponse: _response.rawResponse,
402
+ });
403
+ }
404
+ }
405
+ switch (_response.error.reason) {
406
+ case "non-json":
407
+ throw new errors.PinnacleError({
408
+ statusCode: _response.error.statusCode,
409
+ body: _response.error.rawBody,
410
+ rawResponse: _response.rawResponse,
411
+ });
412
+ case "timeout":
413
+ throw new errors.PinnacleTimeoutError("Timeout exceeded when calling PATCH /calls/{id}.");
414
+ case "unknown":
415
+ throw new errors.PinnacleError({
416
+ message: _response.error.errorMessage,
417
+ rawResponse: _response.rawResponse,
418
+ });
419
+ }
420
+ });
421
+ }
422
+ /**
423
+ * List the event timeline for a call.
424
+ *
425
+ * @param {string} id - Pinnacle call ID.
426
+ * @param {Pinnacle.CallsListEventsRequest} request
427
+ * @param {Calls.RequestOptions} requestOptions - Request-specific configuration.
428
+ *
429
+ * @throws {@link Pinnacle.BadRequestError}
430
+ * @throws {@link Pinnacle.UnauthorizedError}
431
+ * @throws {@link Pinnacle.NotFoundError}
432
+ * @throws {@link Pinnacle.InternalServerError}
433
+ *
434
+ * @example
435
+ * await client.calls.listEvents("call_7cQe4F8xT1yB2mN9pK3L")
436
+ */
437
+ listEvents(id, request = {}, requestOptions) {
438
+ return core.HttpResponsePromise.fromPromise(this.__listEvents(id, request, requestOptions));
439
+ }
440
+ __listEvents(id_1) {
441
+ return __awaiter(this, arguments, void 0, function* (id, request = {}, requestOptions) {
442
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
443
+ const { limit, cursor } = request;
444
+ const _queryParams = {};
445
+ if (limit != null) {
446
+ _queryParams.limit = limit.toString();
447
+ }
448
+ if (cursor != null) {
449
+ _queryParams.cursor = cursor;
450
+ }
451
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
452
+ const _response = yield core.fetcher({
453
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PinnacleEnvironment.Default, `calls/${core.url.encodePathParam(id)}/events`),
454
+ method: "GET",
455
+ headers: _headers,
456
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
457
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
458
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
459
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
460
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
461
+ logging: this._options.logging,
462
+ });
463
+ if (_response.ok) {
464
+ return { data: _response.body, rawResponse: _response.rawResponse };
465
+ }
466
+ if (_response.error.reason === "status-code") {
467
+ switch (_response.error.statusCode) {
468
+ case 400:
469
+ throw new Pinnacle.BadRequestError(_response.error.body, _response.rawResponse);
470
+ case 401:
471
+ throw new Pinnacle.UnauthorizedError(_response.error.body, _response.rawResponse);
472
+ case 404:
473
+ throw new Pinnacle.NotFoundError(_response.error.body, _response.rawResponse);
474
+ case 500:
475
+ throw new Pinnacle.InternalServerError(_response.error.body, _response.rawResponse);
476
+ default:
477
+ throw new errors.PinnacleError({
478
+ statusCode: _response.error.statusCode,
479
+ body: _response.error.body,
480
+ rawResponse: _response.rawResponse,
481
+ });
482
+ }
483
+ }
484
+ switch (_response.error.reason) {
485
+ case "non-json":
486
+ throw new errors.PinnacleError({
487
+ statusCode: _response.error.statusCode,
488
+ body: _response.error.rawBody,
489
+ rawResponse: _response.rawResponse,
490
+ });
491
+ case "timeout":
492
+ throw new errors.PinnacleTimeoutError("Timeout exceeded when calling GET /calls/{id}/events.");
493
+ case "unknown":
494
+ throw new errors.PinnacleError({
495
+ message: _response.error.errorMessage,
496
+ rawResponse: _response.rawResponse,
497
+ });
498
+ }
499
+ });
500
+ }
501
+ /**
502
+ * Mint a short-lived WebSocket token for a call. Use the returned `stream_url` to connect to Pinnacle's bidirectional voice stream.
503
+ *
504
+ * @param {string} id - Pinnacle call ID.
505
+ * @param {Pinnacle.CreateStreamTokenParams} request
506
+ * @param {Calls.RequestOptions} requestOptions - Request-specific configuration.
507
+ *
508
+ * @throws {@link Pinnacle.BadRequestError}
509
+ * @throws {@link Pinnacle.UnauthorizedError}
510
+ * @throws {@link Pinnacle.NotFoundError}
511
+ * @throws {@link Pinnacle.ConflictError}
512
+ * @throws {@link Pinnacle.InternalServerError}
513
+ * @throws {@link Pinnacle.ServiceUnavailableError}
514
+ *
515
+ * @example
516
+ * await client.calls.createStreamToken("call_7cQe4F8xT1yB2mN9pK3L")
517
+ */
518
+ createStreamToken(id, request = {}, requestOptions) {
519
+ return core.HttpResponsePromise.fromPromise(this.__createStreamToken(id, request, requestOptions));
520
+ }
521
+ __createStreamToken(id_1) {
522
+ return __awaiter(this, arguments, void 0, function* (id, request = {}, requestOptions) {
523
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
524
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
525
+ const _response = yield core.fetcher({
526
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PinnacleEnvironment.Default, `calls/${core.url.encodePathParam(id)}/stream-token`),
527
+ method: "POST",
528
+ headers: _headers,
529
+ contentType: "application/json",
530
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
531
+ requestType: "json",
532
+ body: request,
533
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
534
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
535
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
536
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
537
+ logging: this._options.logging,
538
+ });
539
+ if (_response.ok) {
540
+ return { data: _response.body, rawResponse: _response.rawResponse };
541
+ }
542
+ if (_response.error.reason === "status-code") {
543
+ switch (_response.error.statusCode) {
544
+ case 400:
545
+ throw new Pinnacle.BadRequestError(_response.error.body, _response.rawResponse);
546
+ case 401:
547
+ throw new Pinnacle.UnauthorizedError(_response.error.body, _response.rawResponse);
548
+ case 404:
549
+ throw new Pinnacle.NotFoundError(_response.error.body, _response.rawResponse);
550
+ case 409:
551
+ throw new Pinnacle.ConflictError(_response.error.body, _response.rawResponse);
552
+ case 500:
553
+ throw new Pinnacle.InternalServerError(_response.error.body, _response.rawResponse);
554
+ case 503:
555
+ throw new Pinnacle.ServiceUnavailableError(_response.error.body, _response.rawResponse);
556
+ default:
557
+ throw new errors.PinnacleError({
558
+ statusCode: _response.error.statusCode,
559
+ body: _response.error.body,
560
+ rawResponse: _response.rawResponse,
561
+ });
562
+ }
563
+ }
564
+ switch (_response.error.reason) {
565
+ case "non-json":
566
+ throw new errors.PinnacleError({
567
+ statusCode: _response.error.statusCode,
568
+ body: _response.error.rawBody,
569
+ rawResponse: _response.rawResponse,
570
+ });
571
+ case "timeout":
572
+ throw new errors.PinnacleTimeoutError("Timeout exceeded when calling POST /calls/{id}/stream-token.");
573
+ case "unknown":
574
+ throw new errors.PinnacleError({
575
+ message: _response.error.errorMessage,
576
+ rawResponse: _response.rawResponse,
577
+ });
578
+ }
579
+ });
580
+ }
581
+ /**
582
+ * Return a short-lived signed URL for the call recording.
583
+ *
584
+ * @param {string} id - Pinnacle call ID.
585
+ * @param {Pinnacle.CallsDownloadRecordingRequest} request
586
+ * @param {Calls.RequestOptions} requestOptions - Request-specific configuration.
587
+ *
588
+ * @throws {@link Pinnacle.BadRequestError}
589
+ * @throws {@link Pinnacle.UnauthorizedError}
590
+ * @throws {@link Pinnacle.NotFoundError}
591
+ * @throws {@link Pinnacle.GoneError}
592
+ * @throws {@link Pinnacle.UnprocessableEntityError}
593
+ * @throws {@link Pinnacle.TooEarlyError}
594
+ * @throws {@link Pinnacle.InternalServerError}
595
+ * @throws {@link Pinnacle.ServiceUnavailableError}
596
+ *
597
+ * @example
598
+ * await client.calls.downloadRecording("call_7cQe4F8xT1yB2mN9pK3L")
599
+ */
600
+ downloadRecording(id, request = {}, requestOptions) {
601
+ return core.HttpResponsePromise.fromPromise(this.__downloadRecording(id, request, requestOptions));
602
+ }
603
+ __downloadRecording(id_1) {
604
+ return __awaiter(this, arguments, void 0, function* (id, request = {}, requestOptions) {
605
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
606
+ const { expires_in: expiresIn } = request;
607
+ const _queryParams = {};
608
+ if (expiresIn != null) {
609
+ _queryParams.expires_in = expiresIn.toString();
610
+ }
611
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
612
+ const _response = yield core.fetcher({
613
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PinnacleEnvironment.Default, `calls/${core.url.encodePathParam(id)}/recording`),
614
+ method: "GET",
615
+ headers: _headers,
616
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
617
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
618
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
619
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
620
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
621
+ logging: this._options.logging,
622
+ });
623
+ if (_response.ok) {
624
+ return { data: _response.body, rawResponse: _response.rawResponse };
625
+ }
626
+ if (_response.error.reason === "status-code") {
627
+ switch (_response.error.statusCode) {
628
+ case 400:
629
+ throw new Pinnacle.BadRequestError(_response.error.body, _response.rawResponse);
630
+ case 401:
631
+ throw new Pinnacle.UnauthorizedError(_response.error.body, _response.rawResponse);
632
+ case 404:
633
+ throw new Pinnacle.NotFoundError(_response.error.body, _response.rawResponse);
634
+ case 410:
635
+ throw new Pinnacle.GoneError(_response.error.body, _response.rawResponse);
636
+ case 422:
637
+ throw new Pinnacle.UnprocessableEntityError(_response.error.body, _response.rawResponse);
638
+ case 425:
639
+ throw new Pinnacle.TooEarlyError(_response.error.body, _response.rawResponse);
640
+ case 500:
641
+ throw new Pinnacle.InternalServerError(_response.error.body, _response.rawResponse);
642
+ case 503:
643
+ throw new Pinnacle.ServiceUnavailableError(_response.error.body, _response.rawResponse);
644
+ default:
645
+ throw new errors.PinnacleError({
646
+ statusCode: _response.error.statusCode,
647
+ body: _response.error.body,
648
+ rawResponse: _response.rawResponse,
649
+ });
650
+ }
651
+ }
652
+ switch (_response.error.reason) {
653
+ case "non-json":
654
+ throw new errors.PinnacleError({
655
+ statusCode: _response.error.statusCode,
656
+ body: _response.error.rawBody,
657
+ rawResponse: _response.rawResponse,
658
+ });
659
+ case "timeout":
660
+ throw new errors.PinnacleTimeoutError("Timeout exceeded when calling GET /calls/{id}/recording.");
661
+ case "unknown":
662
+ throw new errors.PinnacleError({
663
+ message: _response.error.errorMessage,
664
+ rawResponse: _response.rawResponse,
665
+ });
666
+ }
667
+ });
668
+ }
669
+ /**
670
+ * Delete the canonical recording and queued fragments for a terminal call.
671
+ *
672
+ * @param {string} id - Pinnacle call ID.
673
+ * @param {Calls.RequestOptions} requestOptions - Request-specific configuration.
674
+ *
675
+ * @throws {@link Pinnacle.UnauthorizedError}
676
+ * @throws {@link Pinnacle.NotFoundError}
677
+ * @throws {@link Pinnacle.ConflictError}
678
+ * @throws {@link Pinnacle.InternalServerError}
679
+ * @throws {@link Pinnacle.BadGatewayError}
680
+ * @throws {@link Pinnacle.ServiceUnavailableError}
681
+ *
682
+ * @example
683
+ * await client.calls.deleteRecording("call_7cQe4F8xT1yB2mN9pK3L")
684
+ */
685
+ deleteRecording(id, requestOptions) {
686
+ return core.HttpResponsePromise.fromPromise(this.__deleteRecording(id, requestOptions));
687
+ }
688
+ __deleteRecording(id, requestOptions) {
689
+ return __awaiter(this, void 0, void 0, function* () {
690
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
691
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
692
+ const _response = yield core.fetcher({
693
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PinnacleEnvironment.Default, `calls/${core.url.encodePathParam(id)}/recording`),
694
+ method: "DELETE",
695
+ headers: _headers,
696
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
697
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
698
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
699
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
700
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
701
+ logging: this._options.logging,
702
+ });
703
+ if (_response.ok) {
704
+ return { data: undefined, rawResponse: _response.rawResponse };
705
+ }
706
+ if (_response.error.reason === "status-code") {
707
+ switch (_response.error.statusCode) {
708
+ case 401:
709
+ throw new Pinnacle.UnauthorizedError(_response.error.body, _response.rawResponse);
710
+ case 404:
711
+ throw new Pinnacle.NotFoundError(_response.error.body, _response.rawResponse);
712
+ case 409:
713
+ throw new Pinnacle.ConflictError(_response.error.body, _response.rawResponse);
714
+ case 500:
715
+ throw new Pinnacle.InternalServerError(_response.error.body, _response.rawResponse);
716
+ case 502:
717
+ throw new Pinnacle.BadGatewayError(_response.error.body, _response.rawResponse);
718
+ case 503:
719
+ throw new Pinnacle.ServiceUnavailableError(_response.error.body, _response.rawResponse);
720
+ default:
721
+ throw new errors.PinnacleError({
722
+ statusCode: _response.error.statusCode,
723
+ body: _response.error.body,
724
+ rawResponse: _response.rawResponse,
725
+ });
726
+ }
727
+ }
728
+ switch (_response.error.reason) {
729
+ case "non-json":
730
+ throw new errors.PinnacleError({
731
+ statusCode: _response.error.statusCode,
732
+ body: _response.error.rawBody,
733
+ rawResponse: _response.rawResponse,
734
+ });
735
+ case "timeout":
736
+ throw new errors.PinnacleTimeoutError("Timeout exceeded when calling DELETE /calls/{id}/recording.");
737
+ case "unknown":
738
+ throw new errors.PinnacleError({
739
+ message: _response.error.errorMessage,
740
+ rawResponse: _response.rawResponse,
741
+ });
742
+ }
743
+ });
744
+ }
745
+ _getCustomAuthorizationHeaders() {
746
+ return __awaiter(this, void 0, void 0, function* () {
747
+ const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
748
+ return { "PINNACLE-API-KEY": apiKeyValue };
749
+ });
750
+ }
751
+ }