bandwidth-sdk 8.3.1 → 9.0.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 (237) hide show
  1. package/.github/workflows/deploy.yml +0 -19
  2. package/.github/workflows/test-pr.yml +0 -20
  3. package/.github/workflows/test-smoke.yml +0 -4
  4. package/.openapi-generator/FILES +2 -0
  5. package/README.md +1 -5
  6. package/api/calls-api.ts +0 -20
  7. package/api/conferences-api.ts +0 -36
  8. package/api/endpoints-api.ts +0 -20
  9. package/api/media-api.ts +0 -16
  10. package/api/messages-api.ts +0 -8
  11. package/api/mfaapi.ts +0 -12
  12. package/api/multi-channel-api.ts +0 -4
  13. package/api/phone-number-lookup-api.ts +0 -12
  14. package/api/recordings-api.ts +0 -40
  15. package/api/statistics-api.ts +0 -4
  16. package/api/toll-free-verification-api.ts +0 -36
  17. package/api/transcriptions-api.ts +0 -12
  18. package/bandwidth.yml +285 -109
  19. package/common.ts +2 -5
  20. package/configuration.ts +4 -13
  21. package/coverage/clover.xml +1249 -1293
  22. package/coverage/coverage-final.json +17 -16
  23. package/coverage/lcov-report/index.html +41 -26
  24. package/coverage/lcov-report/node-sdk/api/calls-api.ts.html +6 -66
  25. package/coverage/lcov-report/node-sdk/api/conferences-api.ts.html +6 -114
  26. package/coverage/lcov-report/node-sdk/api/endpoints-api.ts.html +6 -66
  27. package/coverage/lcov-report/node-sdk/api/index.html +69 -69
  28. package/coverage/lcov-report/node-sdk/api/media-api.ts.html +6 -54
  29. package/coverage/lcov-report/node-sdk/api/messages-api.ts.html +6 -30
  30. package/coverage/lcov-report/node-sdk/api/mfaapi.ts.html +6 -42
  31. package/coverage/lcov-report/node-sdk/api/multi-channel-api.ts.html +6 -18
  32. package/coverage/lcov-report/node-sdk/api/phone-number-lookup-api.ts.html +6 -42
  33. package/coverage/lcov-report/node-sdk/api/recordings-api.ts.html +6 -126
  34. package/coverage/lcov-report/node-sdk/api/statistics-api.ts.html +6 -18
  35. package/coverage/lcov-report/node-sdk/api/toll-free-verification-api.ts.html +6 -114
  36. package/coverage/lcov-report/node-sdk/api/transcriptions-api.ts.html +6 -42
  37. package/coverage/lcov-report/node-sdk/api.ts.html +1 -1
  38. package/coverage/lcov-report/node-sdk/base.ts.html +1 -1
  39. package/coverage/lcov-report/node-sdk/common.ts.html +13 -22
  40. package/coverage/lcov-report/node-sdk/configuration.ts.html +11 -38
  41. package/coverage/lcov-report/node-sdk/index.html +20 -20
  42. package/coverage/lcov-report/node-sdk/models/business-entity-type-enum.ts.html +1 -1
  43. package/coverage/lcov-report/node-sdk/models/business-registration-type-enum.ts.html +1 -1
  44. package/coverage/lcov-report/node-sdk/models/bxml/Bxml.ts.html +1 -1
  45. package/coverage/lcov-report/node-sdk/models/bxml/NestableVerb.ts.html +1 -1
  46. package/coverage/lcov-report/node-sdk/models/bxml/Response.ts.html +1 -1
  47. package/coverage/lcov-report/node-sdk/models/bxml/Root.ts.html +1 -1
  48. package/coverage/lcov-report/node-sdk/models/bxml/Verb.ts.html +1 -1
  49. package/coverage/lcov-report/node-sdk/models/bxml/index.html +1 -1
  50. package/coverage/lcov-report/node-sdk/models/bxml/index.ts.html +1 -1
  51. package/coverage/lcov-report/node-sdk/models/bxml/verbs/Bridge.ts.html +1 -1
  52. package/coverage/lcov-report/node-sdk/models/bxml/verbs/Conference.ts.html +1 -1
  53. package/coverage/lcov-report/node-sdk/models/bxml/verbs/Connect.ts.html +1 -1
  54. package/coverage/lcov-report/node-sdk/models/bxml/verbs/CustomParam.ts.html +1 -1
  55. package/coverage/lcov-report/node-sdk/models/bxml/verbs/Endpoint.ts.html +1 -1
  56. package/coverage/lcov-report/node-sdk/models/bxml/verbs/Forward.ts.html +1 -1
  57. package/coverage/lcov-report/node-sdk/models/bxml/verbs/Gather.ts.html +1 -1
  58. package/coverage/lcov-report/node-sdk/models/bxml/verbs/Hangup.ts.html +1 -1
  59. package/coverage/lcov-report/node-sdk/models/bxml/verbs/Pause.ts.html +1 -1
  60. package/coverage/lcov-report/node-sdk/models/bxml/verbs/PauseRecording.ts.html +1 -1
  61. package/coverage/lcov-report/node-sdk/models/bxml/verbs/PhoneNumber.ts.html +1 -1
  62. package/coverage/lcov-report/node-sdk/models/bxml/verbs/PlayAudio.ts.html +1 -1
  63. package/coverage/lcov-report/node-sdk/models/bxml/verbs/Record.ts.html +1 -1
  64. package/coverage/lcov-report/node-sdk/models/bxml/verbs/Redirect.ts.html +1 -1
  65. package/coverage/lcov-report/node-sdk/models/bxml/verbs/Refer.ts.html +1 -1
  66. package/coverage/lcov-report/node-sdk/models/bxml/verbs/ResumeRecording.ts.html +1 -1
  67. package/coverage/lcov-report/node-sdk/models/bxml/verbs/Ring.ts.html +1 -1
  68. package/coverage/lcov-report/node-sdk/models/bxml/verbs/SendDtmf.ts.html +1 -1
  69. package/coverage/lcov-report/node-sdk/models/bxml/verbs/SipUri.ts.html +1 -1
  70. package/coverage/lcov-report/node-sdk/models/bxml/verbs/SpeakSentence.ts.html +1 -1
  71. package/coverage/lcov-report/node-sdk/models/bxml/verbs/StartGather.ts.html +1 -1
  72. package/coverage/lcov-report/node-sdk/models/bxml/verbs/StartRecording.ts.html +1 -1
  73. package/coverage/lcov-report/node-sdk/models/bxml/verbs/StartStream.ts.html +1 -1
  74. package/coverage/lcov-report/node-sdk/models/bxml/verbs/StartTranscription.ts.html +1 -1
  75. package/coverage/lcov-report/node-sdk/models/bxml/verbs/StopGather.ts.html +1 -1
  76. package/coverage/lcov-report/node-sdk/models/bxml/verbs/StopRecording.ts.html +1 -1
  77. package/coverage/lcov-report/node-sdk/models/bxml/verbs/StopStream.ts.html +1 -1
  78. package/coverage/lcov-report/node-sdk/models/bxml/verbs/StopTranscription.ts.html +1 -1
  79. package/coverage/lcov-report/node-sdk/models/bxml/verbs/StreamParam.ts.html +1 -1
  80. package/coverage/lcov-report/node-sdk/models/bxml/verbs/Tag.ts.html +1 -1
  81. package/coverage/lcov-report/node-sdk/models/bxml/verbs/Transfer.ts.html +1 -1
  82. package/coverage/lcov-report/node-sdk/models/bxml/verbs/index.html +1 -1
  83. package/coverage/lcov-report/node-sdk/models/bxml/verbs/index.ts.html +1 -1
  84. package/coverage/lcov-report/node-sdk/models/call-direction-enum.ts.html +1 -1
  85. package/coverage/lcov-report/node-sdk/models/call-state-enum.ts.html +1 -1
  86. package/coverage/lcov-report/node-sdk/models/call-transcription-detected-language-enum.ts.html +1 -1
  87. package/coverage/lcov-report/node-sdk/models/call-transcription-track-enum.ts.html +1 -1
  88. package/coverage/lcov-report/node-sdk/models/callback-method-enum.ts.html +1 -1
  89. package/coverage/lcov-report/node-sdk/models/card-width-enum.ts.html +1 -1
  90. package/coverage/lcov-report/node-sdk/models/completed-lookup-status-enum.ts.html +1 -1
  91. package/coverage/lcov-report/node-sdk/models/conference-state-enum.ts.html +1 -1
  92. package/coverage/lcov-report/node-sdk/models/deactivation-event-enum.ts.html +1 -1
  93. package/coverage/lcov-report/node-sdk/models/device-status-enum.ts.html +1 -1
  94. package/coverage/lcov-report/node-sdk/models/endpoint-direction-enum.ts.html +1 -1
  95. package/coverage/lcov-report/node-sdk/models/endpoint-event-type-enum.ts.html +1 -1
  96. package/coverage/lcov-report/node-sdk/models/endpoint-status-enum.ts.html +1 -1
  97. package/coverage/lcov-report/node-sdk/models/endpoint-type-enum.ts.html +1 -1
  98. package/coverage/lcov-report/node-sdk/models/file-format-enum.ts.html +1 -1
  99. package/coverage/lcov-report/node-sdk/models/in-progress-lookup-status-enum.ts.html +1 -1
  100. package/coverage/lcov-report/node-sdk/models/inbound-callback-type-enum.ts.html +1 -1
  101. package/coverage/lcov-report/node-sdk/models/index.html +5 -5
  102. package/coverage/lcov-report/node-sdk/models/index.ts.html +7 -4
  103. package/coverage/lcov-report/node-sdk/models/latest-message-delivery-status-enum.ts.html +1 -1
  104. package/coverage/lcov-report/node-sdk/models/line-type-enum.ts.html +1 -1
  105. package/coverage/lcov-report/node-sdk/models/list-message-direction-enum.ts.html +1 -1
  106. package/coverage/lcov-report/node-sdk/models/machine-detection-mode-enum.ts.html +1 -1
  107. package/coverage/lcov-report/node-sdk/models/message-direction-enum.ts.html +1 -1
  108. package/coverage/lcov-report/node-sdk/models/message-status-enum.ts.html +1 -1
  109. package/coverage/lcov-report/node-sdk/models/message-type-enum.ts.html +1 -1
  110. package/coverage/lcov-report/node-sdk/models/multi-channel-message-channel-enum.ts.html +1 -1
  111. package/coverage/lcov-report/node-sdk/models/priority-enum.ts.html +1 -1
  112. package/coverage/lcov-report/node-sdk/models/product-type-enum.ts.html +1 -1
  113. package/coverage/lcov-report/node-sdk/models/rbm-action-type-enum.ts.html +1 -1
  114. package/coverage/lcov-report/node-sdk/models/rbm-media-height-enum.ts.html +1 -1
  115. package/coverage/lcov-report/node-sdk/models/rbm-open-url-enum.ts.html +1 -1
  116. package/coverage/lcov-report/node-sdk/models/rbm-web-view-enum.ts.html +1 -1
  117. package/coverage/lcov-report/node-sdk/models/recording-state-enum.ts.html +1 -1
  118. package/coverage/lcov-report/node-sdk/models/redirect-method-enum.ts.html +1 -1
  119. package/coverage/lcov-report/node-sdk/models/refer-call-status-enum.ts.html +1 -1
  120. package/coverage/lcov-report/node-sdk/models/standalone-card-orientation-enum.ts.html +1 -1
  121. package/coverage/lcov-report/node-sdk/models/status-callback-type-enum.ts.html +6 -3
  122. package/coverage/lcov-report/node-sdk/models/tfv-callback-status-enum.ts.html +1 -1
  123. package/coverage/lcov-report/node-sdk/models/tfv-status-enum.ts.html +1 -1
  124. package/coverage/lcov-report/node-sdk/models/thumbnail-alignment-enum.ts.html +1 -1
  125. package/coverage/lcov-report/node-sdk/models/webhook-subscription-type-enum.ts.html +1 -1
  126. package/coverage/lcov-report/node-sdk/tests/unit/constants.ts.html +103 -0
  127. package/coverage/lcov-report/node-sdk/tests/unit/index.html +116 -0
  128. package/coverage/lcov.info +3073 -3115
  129. package/custom_templates/common.mustache +2 -5
  130. package/custom_templates/configuration.mustache +3 -12
  131. package/dist/api/calls-api.js +0 -15
  132. package/dist/api/conferences-api.js +0 -27
  133. package/dist/api/endpoints-api.js +0 -15
  134. package/dist/api/media-api.js +0 -12
  135. package/dist/api/messages-api.js +0 -6
  136. package/dist/api/mfaapi.js +0 -9
  137. package/dist/api/multi-channel-api.js +0 -3
  138. package/dist/api/phone-number-lookup-api.js +0 -9
  139. package/dist/api/recordings-api.js +0 -30
  140. package/dist/api/statistics-api.js +0 -3
  141. package/dist/api/toll-free-verification-api.js +0 -27
  142. package/dist/api/transcriptions-api.js +0 -9
  143. package/dist/common.js +2 -5
  144. package/dist/configuration.d.ts +0 -10
  145. package/dist/configuration.js +4 -3
  146. package/dist/models/callback.d.ts +2 -0
  147. package/dist/models/disconnect-callback.d.ts +11 -1
  148. package/dist/models/inbound-callback-message.d.ts +2 -0
  149. package/dist/models/index.d.ts +1 -0
  150. package/dist/models/index.js +1 -0
  151. package/dist/models/initiate-callback.d.ts +1 -1
  152. package/dist/models/list-message-item.d.ts +1 -1
  153. package/dist/models/multi-channel-action-calendar-event.d.ts +1 -1
  154. package/dist/models/multi-channel-action.d.ts +1 -1
  155. package/dist/models/rbm-action-base.d.ts +1 -1
  156. package/dist/models/rbm-action-dial.d.ts +1 -1
  157. package/dist/models/rbm-action-open-url.d.ts +1 -1
  158. package/dist/models/rbm-action-view-location.d.ts +1 -1
  159. package/dist/models/rbm-session.d.ts +36 -0
  160. package/dist/models/rbm-session.js +15 -0
  161. package/dist/models/rbm-suggestion-response.d.ts +2 -2
  162. package/dist/models/status-callback-message.d.ts +2 -0
  163. package/dist/models/status-callback-type-enum.d.ts +2 -1
  164. package/dist/models/status-callback-type-enum.js +2 -1
  165. package/dist/models/transfer-disconnect-callback.d.ts +14 -0
  166. package/docs/CallsApi.md +5 -5
  167. package/docs/ConferencesApi.md +9 -9
  168. package/docs/DisconnectCallback.md +5 -1
  169. package/docs/EndpointsApi.md +5 -5
  170. package/docs/InboundCallbackMessage.md +2 -0
  171. package/docs/InitiateCallback.md +1 -1
  172. package/docs/MFAApi.md +3 -3
  173. package/docs/MediaApi.md +4 -4
  174. package/docs/MessagesApi.md +2 -2
  175. package/docs/MultiChannelAction.md +1 -1
  176. package/docs/MultiChannelActionCalendarEvent.md +1 -1
  177. package/docs/MultiChannelApi.md +1 -1
  178. package/docs/PhoneNumberLookupApi.md +3 -3
  179. package/docs/RbmActionBase.md +1 -1
  180. package/docs/RbmActionDial.md +1 -1
  181. package/docs/RbmActionOpenUrl.md +1 -1
  182. package/docs/RbmActionViewLocation.md +1 -1
  183. package/docs/RbmSession.md +29 -0
  184. package/docs/RbmSuggestionResponse.md +2 -2
  185. package/docs/RecordingsApi.md +10 -10
  186. package/docs/StatisticsApi.md +1 -1
  187. package/docs/StatusCallbackMessage.md +2 -0
  188. package/docs/StatusCallbackTypeEnum.md +3 -1
  189. package/docs/TollFreeVerificationApi.md +9 -9
  190. package/docs/TranscriptionsApi.md +3 -3
  191. package/docs/TransferDisconnectCallback.md +6 -0
  192. package/jest.config.js +0 -6
  193. package/models/callback.ts +1 -1
  194. package/models/disconnect-callback.ts +9 -1
  195. package/models/inbound-callback-message.ts +4 -0
  196. package/models/index.ts +1 -0
  197. package/models/initiate-callback.ts +1 -1
  198. package/models/list-message-item.ts +1 -1
  199. package/models/multi-channel-action-calendar-event.ts +1 -1
  200. package/models/multi-channel-action.ts +1 -1
  201. package/models/rbm-action-base.ts +1 -1
  202. package/models/rbm-action-dial.ts +1 -1
  203. package/models/rbm-action-open-url.ts +1 -1
  204. package/models/rbm-action-view-location.ts +1 -1
  205. package/models/rbm-session.ts +42 -0
  206. package/models/rbm-suggestion-response.ts +2 -2
  207. package/models/status-callback-message.ts +4 -0
  208. package/models/status-callback-type-enum.ts +2 -1
  209. package/models/transfer-disconnect-callback.ts +12 -0
  210. package/package.json +1 -1
  211. package/tests/globals.d.ts +0 -6
  212. package/tests/smoke/calls-api.test.ts +1 -23
  213. package/tests/smoke/conferences-api.test.ts +2 -2
  214. package/tests/smoke/media-api.test.ts +4 -1
  215. package/tests/smoke/messages-api.test.ts +4 -19
  216. package/tests/smoke/mfaapi.test.ts +4 -20
  217. package/tests/smoke/multi-channel-api.test.ts +2 -2
  218. package/tests/smoke/statistics-api.test.ts +0 -24
  219. package/tests/unit/api/calls-api.test.ts +2 -1
  220. package/tests/unit/api/conferences-api.test.ts +3 -2
  221. package/tests/unit/api/media-api.test.ts +1 -0
  222. package/tests/unit/api/messages-api.test.ts +1 -0
  223. package/tests/unit/api/mfaapi.test.ts +1 -0
  224. package/tests/unit/api/multi-channel-api.test.ts +1 -0
  225. package/tests/unit/api/phone-number-lookup-api.test.ts +1 -0
  226. package/tests/unit/api/recordings-api.test.ts +2 -1
  227. package/tests/unit/api/statistics-api.test.ts +1 -0
  228. package/tests/unit/api/toll-free-verification-api.test.ts +1 -0
  229. package/tests/unit/api/transcriptions-api.test.ts +1 -0
  230. package/tests/unit/configuration.test.ts +19 -0
  231. package/tests/unit/constants.ts +6 -0
  232. package/tests/unit/models/disconnect-callback.test.ts +4 -0
  233. package/tests/unit/models/inbound-callback-message.test.ts +3 -0
  234. package/tests/unit/models/rbm-session.test.ts +19 -0
  235. package/tests/unit/models/status-callback-message.test.ts +3 -0
  236. package/tests/unit/models/status-callback-type-enum.test.ts +3 -1
  237. package/tests/unit/models/transfer-disconnect-callback.test.ts +6 -0
@@ -15,7 +15,7 @@
15
15
 
16
16
 
17
17
  /**
18
- * The possible status callbacks when sending an MT SMS or MMS or RBM message: - `message-sending` indicates that Bandwidth is sending the message to the upstream provider. - `message-sent` indicates that the message has left the Bandwidth network and is in transit to the provider. - `message-delivered` indicates that the message was successfully delivered to handset. - `message-failed` indicates that the message could not be sent to the intended recipient. - `message-read` indicates that the RBM message was read by the recipient.
18
+ * The possible status callbacks when sending an MT SMS or MMS or RBM message: - `message-sending` indicates that Bandwidth is sending the message to the upstream provider. - `message-sent` indicates that the message has left the Bandwidth network and is in transit to the provider. - `message-delivered` indicates that the message was successfully delivered to handset. - `message-failed` indicates that the message could not be sent to the intended recipient. - `message-read` indicates that the RBM message was read by the recipient. - `session-started` indicates that a previously exchanged RBM message is now part of an RCS interactive session and is no longer billed individually.
19
19
  */
20
20
 
21
21
  export const StatusCallbackTypeEnum = {
@@ -24,6 +24,7 @@ export const StatusCallbackTypeEnum = {
24
24
  MessageDelivered: 'message-delivered',
25
25
  MessageFailed: 'message-failed',
26
26
  MessageRead: 'message-read',
27
+ SessionStarted: 'session-started',
27
28
  } as const;
28
29
 
29
30
  export type StatusCallbackTypeEnum = typeof StatusCallbackTypeEnum[keyof typeof StatusCallbackTypeEnum];
@@ -98,6 +98,18 @@ export interface TransferDisconnectCallback {
98
98
  * Bandwidth\'s internal id that references the error event.
99
99
  */
100
100
  'errorId'?: string | null;
101
+ /**
102
+ * (optional) The SIP status code of the final response that rejected an outbound call\'s (or transferred leg\'s) INVITE (e.g. 486 for busy, 603 for decline). Present only when the call was rejected with a SIP response.
103
+ */
104
+ 'sipResponseCode'?: number;
105
+ /**
106
+ * (optional) The full SIP status line, exactly as received, of the final response that rejected an outbound call\'s INVITE. The reason phrase can help distinguish outcomes that share a status code, such as `603 Network Blocked` and `603 Decline`. Present only when an outbound call was rejected with a SIP response.
107
+ */
108
+ 'sipStatusLine'?: string;
109
+ /**
110
+ * (optional) Map of SIP headers, with lowercase keys (SIP headers are case-insensitive). On the Initiate callback, contains the customer-supplied X-* headers from the original INVITE; present only for inbound SIP URI calls with custom headers. On the Disconnect and Transfer Disconnect callbacks, contains a single `reason` key holding the raw, unmodified `Reason` header value from the final SIP response that rejected an outbound call (or transferred leg); present only when that response included a `Reason` header (for example, `v=analytics1` call-analytics block information from a terminating carrier). If the response carries more than one `Reason` header, all values are returned in the order received, separated by `, `. Note - on the Initiate callback, keys preserve the original SIP header name in lowercase rather than Bandwidth\'s usual camelCase JSON convention, since these are passthrough values from the caller\'s SIP INVITE, not Bandwidth-defined fields. If the same header name is sent more than once in the INVITE, only the last value is kept. The example shown is for the Initiate callback; on the Disconnect and Transfer Disconnect callbacks the only key is `reason`.
111
+ */
112
+ 'sipHeaders'?: { [key: string]: string; };
101
113
  }
102
114
 
103
115
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bandwidth-sdk",
3
- "version": "8.3.1",
3
+ "version": "9.0.0",
4
4
  "description": "OpenAPI client for bandwidth-sdk",
5
5
  "author": "OpenAPI-Generator Contributors",
6
6
  "repository": {
@@ -1,7 +1,5 @@
1
1
  /// <reference types="jest-extended" />
2
2
 
3
- declare const BW_USERNAME: string;
4
- declare const BW_PASSWORD: string;
5
3
  declare const BW_CLIENT_ID: string;
6
4
  declare const BW_CLIENT_SECRET: string;
7
5
  declare const BW_ACCOUNT_ID: string;
@@ -15,9 +13,5 @@ declare const MANTECA_APPLICATION_ID: string;
15
13
  declare const MANTECA_IDLE_NUMBER: string;
16
14
  declare const MANTECA_ACTIVE_NUMBER: string;
17
15
  declare const MANTECA_BASE_URL: string;
18
- declare const FORBIDDEN_USERNAME: string;
19
- declare const FORBIDDEN_PASSWORD: string;
20
- declare const UNAUTHORIZED_USERNAME: string;
21
- declare const UNAUTHORIZED_PASSWORD: string;
22
16
  declare const MAX_RETRIES: number;
23
17
  declare const SLEEP_TIME_S: number;
@@ -104,7 +104,7 @@ describe('CallsApi', () => {
104
104
 
105
105
  describe('listCalls', () => {
106
106
  test('should return an array of calls', async () => {
107
- const { status, data } = await callsApi.listCalls(BW_ACCOUNT_ID);
107
+ const { status, data } = await callsApi.listCalls(BW_ACCOUNT_ID, USER_NUMBER, BW_NUMBER);
108
108
 
109
109
  expect(status).toEqual(200);
110
110
  expect(data).toBeInstanceOf(Array);
@@ -171,28 +171,6 @@ describe('CallsApi', () => {
171
171
  }
172
172
  });
173
173
 
174
- test('401', async () => {
175
- const configBad = new Configuration({username: UNAUTHORIZED_USERNAME, password: UNAUTHORIZED_PASSWORD});
176
- const callsApiBad = new CallsApi(configBad);
177
-
178
- try {
179
- await callsApiBad.getCallState(BW_ACCOUNT_ID, callId);
180
- } catch (e) {
181
- expect(e.response.status).toEqual(401);
182
- }
183
- });
184
-
185
- test('403', async () => {
186
- const configBad = new Configuration({username: FORBIDDEN_USERNAME, password: FORBIDDEN_PASSWORD});
187
- const callsApiBad = new CallsApi(configBad);
188
-
189
- try {
190
- await callsApiBad.getCallState(BW_ACCOUNT_ID, callId);
191
- } catch (e) {
192
- expect(e.response.status).toEqual(403);
193
- }
194
- });
195
-
196
174
  test('404', async () => {
197
175
  try {
198
176
  await callsApi.getCallState(BW_ACCOUNT_ID, 'does-not-exist');
@@ -7,8 +7,8 @@ import { setupManteca, createMantecaCall, cleanupCalls, getMantecaTestStatus, sl
7
7
  describe('ConferencesApi', () => {
8
8
  jest.setTimeout(125000);
9
9
  const config = new Configuration({
10
- username: BW_USERNAME,
11
- password: BW_PASSWORD
10
+ clientId: BW_CLIENT_ID,
11
+ clientSecret: BW_CLIENT_SECRET
12
12
  });
13
13
  const callsApi = new CallsApi(config);
14
14
  const conferencesApi = new ConferencesApi(config);
@@ -5,7 +5,10 @@ import { BinaryLike, createHash, randomUUID } from 'crypto';
5
5
  import * as fs from 'fs';
6
6
 
7
7
  describe('MediaApi', () => {
8
- const config = new Configuration({ username: BW_USERNAME, password: BW_PASSWORD });
8
+ const config = new Configuration({
9
+ clientId: BW_CLIENT_ID,
10
+ clientSecret: BW_CLIENT_SECRET
11
+ });
9
12
  const mediaApi = new MediaApi(config);
10
13
 
11
14
  const binaryMediaData = '123456';
@@ -4,7 +4,10 @@ import { Configuration } from '../../configuration';
4
4
  import { ListMessageDirectionEnum, MessageRequest, PriorityEnum } from '../../models';
5
5
 
6
6
  describe('MessagesApi', () => {
7
- const config = new Configuration({username: BW_USERNAME, password: BW_PASSWORD});
7
+ const config = new Configuration({
8
+ clientId: BW_CLIENT_ID,
9
+ clientSecret: BW_CLIENT_SECRET
10
+ });
8
11
  const messagesApi = new MessagesApi(config);
9
12
 
10
13
  const mmsText = 'nodejs sdk test MMS';
@@ -98,23 +101,5 @@ describe('MessagesApi', () => {
98
101
  expect(e.response.status).toEqual(400);
99
102
  }
100
103
  });
101
-
102
- test('401', async () => {
103
- const configBad = new Configuration({username: UNAUTHORIZED_USERNAME, password: UNAUTHORIZED_PASSWORD});
104
- const messagesApiBad = new MessagesApi(configBad);
105
-
106
- const messageRequest: MessageRequest = {
107
- applicationId: BW_MESSAGING_APPLICATION_ID,
108
- to: new Set([USER_NUMBER]),
109
- from: BW_NUMBER,
110
- text: smsText
111
- };
112
-
113
- try {
114
- await messagesApiBad.createMessage(BW_ACCOUNT_ID, messageRequest);
115
- } catch (e) {
116
- expect(e.response.status).toEqual(401);
117
- }
118
- });
119
104
  });
120
105
  });
@@ -4,7 +4,10 @@ import { Configuration } from '../../configuration';
4
4
  import { CodeRequest, VerifyCodeRequest } from '../../models';
5
5
 
6
6
  describe('MFAApi', () => {
7
- const config = new Configuration({username: BW_USERNAME, password: BW_PASSWORD});
7
+ const config = new Configuration({
8
+ clientId: BW_CLIENT_ID,
9
+ clientSecret: BW_CLIENT_SECRET
10
+ });
8
11
  const mfaApi = new MFAApi(config);
9
12
 
10
13
  const message = 'Your temporary {NAME} {SCOPE} code is {CODE}';
@@ -76,24 +79,5 @@ describe('MFAApi', () => {
76
79
  expect(e.response.status).toEqual(400);
77
80
  }
78
81
  });
79
-
80
- test('403', async () => {
81
- const configBad = new Configuration({username: UNAUTHORIZED_USERNAME, password: UNAUTHORIZED_PASSWORD});
82
- const mfaApiBad = new MFAApi(configBad);
83
-
84
- const codeRequest: CodeRequest = {
85
- to: USER_NUMBER,
86
- from: BW_NUMBER,
87
- applicationId: BW_MESSAGING_APPLICATION_ID,
88
- message: message,
89
- digits: digits
90
- };
91
-
92
- try {
93
- await mfaApiBad.generateMessagingCode(BW_ACCOUNT_ID, codeRequest);
94
- } catch (e) {
95
- expect(e.response.status).toEqual(403);
96
- }
97
- });
98
82
  });
99
83
  });
@@ -29,8 +29,8 @@ import {
29
29
 
30
30
  describe('MultiChannelApi', () => {
31
31
  const config = new Configuration({
32
- username: BW_USERNAME,
33
- password: BW_PASSWORD
32
+ clientId: BW_CLIENT_ID,
33
+ clientSecret: BW_CLIENT_SECRET
34
34
  });
35
35
  const multiChannelApi = new MultiChannelApi(config);
36
36
 
@@ -18,28 +18,4 @@ describe('StatisticsApi', () => {
18
18
  expect(data.maxCallQueueSize).toEqual(7500);
19
19
  });
20
20
  });
21
-
22
- describe('HTTP Errors', () => {
23
- test('401', async () => {
24
- const configBad = new Configuration({username: UNAUTHORIZED_USERNAME, password: UNAUTHORIZED_PASSWORD});
25
- const statisticsApiBad = new StatisticsApi(configBad);
26
-
27
- try {
28
- await statisticsApiBad.getStatistics(BW_ACCOUNT_ID);
29
- } catch (e) {
30
- expect(e.response.status).toEqual(401);
31
- }
32
- });
33
-
34
- test('403', async () => {
35
- const configBad = new Configuration({username: FORBIDDEN_USERNAME, password: FORBIDDEN_PASSWORD});
36
- const statisticsApiBad = new StatisticsApi(configBad);
37
-
38
- try {
39
- await statisticsApiBad.getStatistics(BW_ACCOUNT_ID);
40
- } catch (e) {
41
- expect(e.response.status).toEqual(403);
42
- }
43
- });
44
- });
45
21
  });
@@ -1,6 +1,7 @@
1
1
  import axios from 'axios';
2
2
  import { CallsApi } from '../../../api';
3
3
  import { Configuration } from '../../../configuration';
4
+ import { BW_ACCOUNT_ID, BW_NUMBER, USER_NUMBER, BW_VOICE_APPLICATION_ID, BASE_CALLBACK_URL } from '../constants';
4
5
  import {
5
6
  CallbackMethodEnum,
6
7
  CallDirectionEnum,
@@ -138,7 +139,7 @@ describe('CallsApi', () => {
138
139
  test('should update a call', async () => {
139
140
  const updateCallBody: UpdateCall = {
140
141
  state: CallStateEnum.Active,
141
- redirectUrl: `${MANTECA_BASE_URL}/bxml/pause`
142
+ redirectUrl: `${BASE_CALLBACK_URL}/bxml/pause`
142
143
  };
143
144
 
144
145
  const { status } = await callsApi.updateCall(BW_ACCOUNT_ID, callId, updateCallBody);
@@ -1,5 +1,6 @@
1
1
  import { ConferencesApi } from '../../../api';
2
2
  import { Configuration } from '../../../configuration';
3
+ import { BW_ACCOUNT_ID, BASE_CALLBACK_URL } from '../constants';
3
4
  import {
4
5
  ConferenceStateEnum,
5
6
  RedirectMethodEnum,
@@ -79,11 +80,11 @@ describe('ConferencesApi', () => {
79
80
  test('should update conference', async () => {
80
81
  const updateConferenceBody: UpdateConference = {
81
82
  status: ConferenceStateEnum.Active,
82
- redirectUrl: `${MANTECA_BASE_URL}/bxml/pause`,
83
+ redirectUrl: `${BASE_CALLBACK_URL}/bxml/pause`,
83
84
  redirectMethod: RedirectMethodEnum.Post,
84
85
  username: 'username',
85
86
  password: 'password',
86
- redirectFallbackUrl: `${MANTECA_BASE_URL}/bxml/pause`,
87
+ redirectFallbackUrl: `${BASE_CALLBACK_URL}/bxml/pause`,
87
88
  redirectFallbackMethod: RedirectMethodEnum.Post,
88
89
  fallbackUsername: 'username',
89
90
  fallbackPassword: 'password'
@@ -1,5 +1,6 @@
1
1
  import { MediaApi } from '../../../api';
2
2
  import { Configuration } from '../../../configuration';
3
+ import { BW_ACCOUNT_ID } from '../constants';
3
4
 
4
5
  describe('MediaApi', () => {
5
6
  const config = new Configuration({
@@ -1,6 +1,7 @@
1
1
  import axios from 'axios';
2
2
  import { MessagesApi } from '../../../api';
3
3
  import { Configuration } from '../../../configuration';
4
+ import { BW_ACCOUNT_ID, BW_NUMBER, USER_NUMBER, BW_MESSAGING_APPLICATION_ID } from '../constants';
4
5
  import {
5
6
  ListMessageDirectionEnum,
6
7
  MessageDirectionEnum,
@@ -1,6 +1,7 @@
1
1
  import axios from 'axios';
2
2
  import { MFAApi } from '../../../api';
3
3
  import { Configuration } from '../../../configuration';
4
+ import { BW_ACCOUNT_ID, BW_NUMBER, USER_NUMBER, BW_VOICE_APPLICATION_ID, BW_MESSAGING_APPLICATION_ID } from '../constants';
4
5
  import { CodeRequest, VerifyCodeRequest } from '../../../models';
5
6
 
6
7
  describe('MFAApi', () => {
@@ -1,6 +1,7 @@
1
1
  //@ts-nocheck
2
2
  import { MultiChannelApi } from '../../../api';
3
3
  import { Configuration } from '../../../configuration';
4
+ import { BW_ACCOUNT_ID, BW_NUMBER, USER_NUMBER, BW_MESSAGING_APPLICATION_ID } from '../constants';
4
5
  import {
5
6
  MultiChannelChannelListRBMObject,
6
7
  MultiChannelMessageChannelEnum,
@@ -1,5 +1,6 @@
1
1
  import { PhoneNumberLookupApi } from "../../../api";
2
2
  import { Configuration } from "../../../configuration";
3
+ import { BW_ACCOUNT_ID, BW_NUMBER, USER_NUMBER } from "../constants";
3
4
  import {
4
5
  AsyncLookupRequest,
5
6
  CompletedLookupStatusEnum,
@@ -1,5 +1,6 @@
1
1
  import { RecordingsApi } from "../../../api";
2
2
  import { Configuration } from "../../../configuration";
3
+ import { BW_ACCOUNT_ID, BASE_CALLBACK_URL } from "../constants";
3
4
  import {
4
5
  CallDirectionEnum,
5
6
  FileFormatEnum,
@@ -135,7 +136,7 @@ describe('RecordingsApi', () => {
135
136
  describe('transcribeCallRecording', () => {
136
137
  test('should create a transcription request', async () => {
137
138
  const transcribeRecording: TranscribeRecording = {
138
- callbackUrl: `${MANTECA_BASE_URL}/transcriptions`,
139
+ callbackUrl: `${BASE_CALLBACK_URL}/transcriptions`,
139
140
  tag: callId
140
141
  };
141
142
  const { status } =
@@ -1,6 +1,7 @@
1
1
  import axios from 'axios';
2
2
  import { StatisticsApi } from '../../../api';
3
3
  import { Configuration } from '../../../configuration';
4
+ import { BW_ACCOUNT_ID } from '../constants';
4
5
 
5
6
  describe('StatisticsApi', () => {
6
7
  const config = new Configuration({
@@ -1,5 +1,6 @@
1
1
  import { TollFreeVerificationApi } from '../../../api';
2
2
  import { Configuration } from '../../../configuration';
3
+ import { BW_ACCOUNT_ID } from '../constants';
3
4
  import {
4
5
  BusinessEntityTypeEnum,
5
6
  BusinessRegistrationTypeEnum,
@@ -1,5 +1,6 @@
1
1
  import { TranscriptionsApi } from "../../../api";
2
2
  import { Configuration } from "../../../configuration";
3
+ import { BW_ACCOUNT_ID } from "../constants";
3
4
  import { CallTranscriptionDetectedLanguageEnum, CallTranscriptionTrackEnum } from "../../../models";
4
5
 
5
6
  describe('TranscriptionsApi', () => {
@@ -82,3 +82,22 @@ describe('Configuration OAuth', () => {
82
82
  expect(mockedAxios.request).not.toHaveBeenCalled();
83
83
  });
84
84
  });
85
+
86
+ describe('Configuration Basic auth', () => {
87
+ const expectedError = 'Basic authentication is no longer supported. Use `clientId` and `clientSecret` instead.';
88
+
89
+ test('throws when username and password are provided', () => {
90
+ // @ts-expect-error username and password are no longer valid parameters
91
+ expect(() => new Configuration({ username: 'user', password: 'pass' })).toThrow(expectedError);
92
+ });
93
+
94
+ test('throws when only username is provided', () => {
95
+ // @ts-expect-error username is no longer a valid parameter
96
+ expect(() => new Configuration({ username: 'user' })).toThrow(expectedError);
97
+ });
98
+
99
+ test('throws when only password is provided', () => {
100
+ // @ts-expect-error password is no longer a valid parameter
101
+ expect(() => new Configuration({ password: 'pass' })).toThrow(expectedError);
102
+ });
103
+ });
@@ -0,0 +1,6 @@
1
+ export const BW_ACCOUNT_ID = '9900000';
2
+ export const BW_NUMBER = '+19195551234';
3
+ export const USER_NUMBER = '+19195554321';
4
+ export const BW_VOICE_APPLICATION_ID = 'abc12345-6def-abc1-2345-6defabc12345';
5
+ export const BW_MESSAGING_APPLICATION_ID = 'abc12345-6def-abc1-2345-6defabc12345';
6
+ export const BASE_CALLBACK_URL = 'https://example.com';
@@ -23,6 +23,8 @@ describe('DisconnectCallback', () => {
23
23
  tag: 'test-tag',
24
24
  sipCallId: 'test-sipCallId',
25
25
  sipResponseCode: 200,
26
+ sipStatusLine: 'test-sipStatusLine',
27
+ sipHeaders: { reason: 'test-reason' },
26
28
  };
27
29
 
28
30
  expect(fixture.eventType).toBe('test-eventType');
@@ -44,5 +46,7 @@ describe('DisconnectCallback', () => {
44
46
  expect(fixture.tag).toBe('test-tag');
45
47
  expect(fixture.sipCallId).toBe('test-sipCallId');
46
48
  expect(fixture.sipResponseCode).toBe(200);
49
+ expect(fixture.sipStatusLine).toBe('test-sipStatusLine');
50
+ expect(fixture.sipHeaders).toEqual({ reason: 'test-reason' });
47
51
  });
48
52
  });
@@ -2,6 +2,7 @@ import { InboundCallbackMessage } from '../../../models/inbound-callback-message
2
2
  import { MessageDirectionEnum } from '../../../models/message-direction-enum';
3
3
  import { PriorityEnum } from '../../../models/priority-enum';
4
4
  import { MultiChannelMessageChannelEnum } from '../../../models/multi-channel-message-channel-enum';
5
+ import { RbmSession } from '../../../models/rbm-session';
5
6
  import { MultiChannelMessageContent } from '../../../models/multi-channel-message-content';
6
7
  import { RbmSuggestionResponse } from '../../../models/rbm-suggestion-response';
7
8
  import { RbmLocationResponse } from '../../../models/rbm-location-response';
@@ -23,6 +24,7 @@ describe('InboundCallbackMessage', () => {
23
24
  media: [],
24
25
  priority: PriorityEnum.Default,
25
26
  channel: MultiChannelMessageChannelEnum.Rbm,
27
+ session: {} as unknown as RbmSession,
26
28
  content: {} as unknown as MultiChannelMessageContent,
27
29
  suggestionResponse: {} as unknown as RbmSuggestionResponse,
28
30
  locationResponse: {} as unknown as RbmLocationResponse,
@@ -41,6 +43,7 @@ describe('InboundCallbackMessage', () => {
41
43
  expect(fixture.media).toEqual([]);
42
44
  expect(fixture.priority).toBe(PriorityEnum.Default);
43
45
  expect(fixture.channel).toBe(MultiChannelMessageChannelEnum.Rbm);
46
+ expect(fixture.session).toBeDefined();
44
47
  expect(fixture.content).toBeDefined();
45
48
  expect(fixture.suggestionResponse).toBeDefined();
46
49
  expect(fixture.locationResponse).toBeDefined();
@@ -0,0 +1,19 @@
1
+ import { RbmSession } from '../../../models/rbm-session';
2
+
3
+ describe('RbmSession', () => {
4
+ test('should accept the expected shape', () => {
5
+ const fixture: RbmSession = {
6
+ canInitiate: true,
7
+ id: 'test-id',
8
+ type: 'test-type',
9
+ startTime: 'test-startTime',
10
+ endTime: 'test-endTime',
11
+ };
12
+
13
+ expect(fixture.canInitiate).toBe(true);
14
+ expect(fixture.id).toBe('test-id');
15
+ expect(fixture.type).toBe('test-type');
16
+ expect(fixture.startTime).toBe('test-startTime');
17
+ expect(fixture.endTime).toBe('test-endTime');
18
+ });
19
+ });
@@ -2,6 +2,7 @@ import { StatusCallbackMessage } from '../../../models/status-callback-message';
2
2
  import { MessageDirectionEnum } from '../../../models/message-direction-enum';
3
3
  import { PriorityEnum } from '../../../models/priority-enum';
4
4
  import { MultiChannelMessageChannelEnum } from '../../../models/multi-channel-message-channel-enum';
5
+ import { RbmSession } from '../../../models/rbm-session';
5
6
 
6
7
  describe('StatusCallbackMessage', () => {
7
8
  test('should accept the expected shape', () => {
@@ -20,6 +21,7 @@ describe('StatusCallbackMessage', () => {
20
21
  media: [],
21
22
  priority: PriorityEnum.Default,
22
23
  channel: MultiChannelMessageChannelEnum.Rbm,
24
+ session: {} as unknown as RbmSession,
23
25
  };
24
26
 
25
27
  expect(fixture.id).toBe('test-id');
@@ -35,5 +37,6 @@ describe('StatusCallbackMessage', () => {
35
37
  expect(fixture.media).toEqual([]);
36
38
  expect(fixture.priority).toBe(PriorityEnum.Default);
37
39
  expect(fixture.channel).toBe(MultiChannelMessageChannelEnum.Rbm);
40
+ expect(fixture.session).toBeDefined();
38
41
  });
39
42
  });
@@ -7,12 +7,14 @@ describe('StatusCallbackTypeEnum', () => {
7
7
  expect(StatusCallbackTypeEnum.MessageDelivered).toBe('message-delivered');
8
8
  expect(StatusCallbackTypeEnum.MessageFailed).toBe('message-failed');
9
9
  expect(StatusCallbackTypeEnum.MessageRead).toBe('message-read');
10
+ expect(StatusCallbackTypeEnum.SessionStarted).toBe('session-started');
10
11
  expect(Object.values(StatusCallbackTypeEnum)).toEqual([
11
12
  'message-sending',
12
13
  'message-sent',
13
14
  'message-delivered',
14
15
  'message-failed',
15
- 'message-read'
16
+ 'message-read',
17
+ 'session-started'
16
18
  ]);
17
19
  });
18
20
  });
@@ -24,6 +24,9 @@ describe('TransferDisconnectCallback', () => {
24
24
  cause: 'test-cause',
25
25
  errorMessage: 'test-errorMessage',
26
26
  errorId: 'test-errorId',
27
+ sipResponseCode: 200,
28
+ sipStatusLine: 'test-sipStatusLine',
29
+ sipHeaders: { reason: 'test-reason' },
27
30
  };
28
31
 
29
32
  expect(fixture.eventType).toBe('test-eventType');
@@ -46,5 +49,8 @@ describe('TransferDisconnectCallback', () => {
46
49
  expect(fixture.cause).toBe('test-cause');
47
50
  expect(fixture.errorMessage).toBe('test-errorMessage');
48
51
  expect(fixture.errorId).toBe('test-errorId');
52
+ expect(fixture.sipResponseCode).toBe(200);
53
+ expect(fixture.sipStatusLine).toBe('test-sipStatusLine');
54
+ expect(fixture.sipHeaders).toEqual({ reason: 'test-reason' });
49
55
  });
50
56
  });