bandwidth-sdk 7.0.1 → 7.2.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.
- package/.github/workflows/deploy.yml +11 -4
- package/.github/workflows/test-pr.yml +3 -1
- package/.github/workflows/test-smoke.yml +4 -2
- package/.openapi-generator/FILES +4 -0
- package/README.md +12 -2
- package/api/calls-api.ts +20 -0
- package/api/conferences-api.ts +36 -0
- package/api/media-api.ts +16 -0
- package/api/messages-api.ts +8 -0
- package/api/mfaapi.ts +12 -0
- package/api/multi-channel-api.ts +4 -0
- package/api/phone-number-lookup-api.ts +12 -0
- package/api/recordings-api.ts +40 -0
- package/api/statistics-api.ts +4 -0
- package/api/toll-free-verification-api.ts +36 -0
- package/api/transcriptions-api.ts +12 -0
- package/bandwidth.yml +58 -0
- package/common.ts +3 -1
- package/configuration.ts +44 -2
- package/coverage/clover.xml +1126 -1050
- package/coverage/coverage-final.json +16 -14
- package/coverage/lcov-report/index.html +28 -28
- package/coverage/lcov-report/node-sdk/api/calls-api.ts.html +66 -6
- package/coverage/lcov-report/node-sdk/api/conferences-api.ts.html +114 -6
- package/coverage/lcov-report/node-sdk/api/index.html +60 -60
- package/coverage/lcov-report/node-sdk/api/media-api.ts.html +54 -6
- package/coverage/lcov-report/node-sdk/api/messages-api.ts.html +30 -6
- package/coverage/lcov-report/node-sdk/api/mfaapi.ts.html +42 -6
- package/coverage/lcov-report/node-sdk/api/multi-channel-api.ts.html +18 -6
- package/coverage/lcov-report/node-sdk/api/phone-number-lookup-api.ts.html +42 -6
- package/coverage/lcov-report/node-sdk/api/recordings-api.ts.html +126 -6
- package/coverage/lcov-report/node-sdk/api/statistics-api.ts.html +18 -6
- package/coverage/lcov-report/node-sdk/api/toll-free-verification-api.ts.html +114 -6
- package/coverage/lcov-report/node-sdk/api/transcriptions-api.ts.html +42 -6
- package/coverage/lcov-report/node-sdk/api.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/base.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/common.ts.html +25 -19
- package/coverage/lcov-report/node-sdk/configuration.ts.html +138 -12
- package/coverage/lcov-report/node-sdk/index.html +30 -30
- package/coverage/lcov-report/node-sdk/models/business-entity-type-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/business-registration-type-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/Bxml.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/NestableVerb.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/Response.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/Root.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/Verb.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/index.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/index.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/Bridge.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/Conference.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/CustomParam.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/Forward.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/Gather.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/Hangup.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/Pause.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/PauseRecording.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/PhoneNumber.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/PlayAudio.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/Record.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/Redirect.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/ResumeRecording.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/Ring.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/SendDtmf.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/SipUri.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/SpeakSentence.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/StartGather.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/StartRecording.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/StartStream.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/StartTranscription.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/StopGather.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/StopRecording.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/StopStream.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/StopTranscription.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/StreamParam.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/Tag.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/Transfer.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/index.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/index.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/call-direction-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/call-state-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/call-transcription-detected-language-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/call-transcription-track-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/callback-method-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/card-width-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/completed-lookup-status-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/conference-state-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/deactivation-event-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/file-format-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/in-progress-lookup-status-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/inbound-callback-type-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/index.html +35 -5
- package/coverage/lcov-report/node-sdk/models/index.ts.html +10 -4
- package/coverage/lcov-report/node-sdk/models/latest-message-delivery-status-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/line-type-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/list-message-direction-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/machine-detection-mode-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/message-direction-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/message-status-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/message-type-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/multi-channel-message-channel-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/priority-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/product-type-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/rbm-action-type-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/rbm-media-height-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/rbm-open-url-enum.ts.html +172 -0
- package/coverage/lcov-report/node-sdk/models/rbm-web-view-enum.ts.html +175 -0
- package/coverage/lcov-report/node-sdk/models/recording-state-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/redirect-method-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/standalone-card-orientation-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/status-callback-type-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/tfv-callback-status-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/tfv-status-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/thumbnail-alignment-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/webhook-subscription-type-enum.ts.html +1 -1
- package/coverage/lcov.info +2804 -2695
- package/custom_templates/README.mustache +2 -2
- package/custom_templates/common.mustache +3 -1
- package/custom_templates/configuration.mustache +43 -1
- package/custom_templates/package.mustache +11 -9
- package/dist/api/calls-api.js +192 -142
- package/dist/api/conferences-api.js +333 -243
- package/dist/api/media-api.js +142 -102
- package/dist/api/messages-api.js +145 -125
- package/dist/api/mfaapi.js +102 -72
- package/dist/api/multi-channel-api.js +34 -24
- package/dist/api/phone-number-lookup-api.js +101 -71
- package/dist/api/recordings-api.js +368 -268
- package/dist/api/statistics-api.js +30 -20
- package/dist/api/toll-free-verification-api.js +298 -208
- package/dist/api/transcriptions-api.js +105 -75
- package/dist/common.js +3 -1
- package/dist/configuration.d.ts +18 -0
- package/dist/configuration.js +71 -3
- package/dist/models/index.d.ts +2 -0
- package/dist/models/index.js +2 -0
- package/dist/models/multi-channel-action.d.ts +4 -0
- package/dist/models/rbm-open-url-enum.d.ts +19 -0
- package/dist/models/rbm-open-url-enum.js +23 -0
- package/dist/models/rbm-web-view-enum.d.ts +20 -0
- package/dist/models/rbm-web-view-enum.js +24 -0
- package/dist/models/tfv-status.d.ts +4 -0
- package/dist/models/verification-request.d.ts +4 -0
- package/dist/models/verification-update-request.d.ts +4 -0
- package/docs/CallsApi.md +5 -5
- package/docs/ConferencesApi.md +9 -9
- package/docs/MFAApi.md +3 -3
- package/docs/MediaApi.md +4 -4
- package/docs/MessagesApi.md +2 -2
- package/docs/MultiChannelAction.md +4 -0
- package/docs/MultiChannelApi.md +1 -1
- package/docs/PhoneNumberLookupApi.md +3 -3
- package/docs/RbmActionOpenUrl.md +4 -0
- package/docs/RbmOpenUrlEnum.md +11 -0
- package/docs/RbmWebViewEnum.md +13 -0
- package/docs/RecordingsApi.md +10 -10
- package/docs/StatisticsApi.md +1 -1
- package/docs/TfvStatus.md +2 -0
- package/docs/TollFreeVerificationApi.md +9 -9
- package/docs/TranscriptionsApi.md +3 -3
- package/docs/VerificationRequest.md +2 -0
- package/docs/VerificationUpdateRequest.md +2 -0
- package/jest.config.js +2 -0
- package/models/index.ts +2 -0
- package/models/multi-channel-action.ts +8 -0
- package/models/rbm-action-open-url.ts +6 -0
- package/models/rbm-open-url-enum.ts +29 -0
- package/models/rbm-web-view-enum.ts +30 -0
- package/models/tfv-status.ts +4 -0
- package/models/verification-request.ts +4 -0
- package/models/verification-update-request.ts +4 -0
- package/package.json +12 -5
- package/tests/smoke/bxml.test.ts +4 -1
- package/tests/smoke/calls-api.test.ts +4 -1
- package/tests/smoke/conferences-api.test.ts +4 -1
- package/tests/smoke/phone-number-lookup-api.test.ts +2 -2
- package/tests/smoke/recordings-api.test.ts +4 -1
- package/tests/smoke/statistics-api.test.ts +4 -1
- package/tests/smoke/toll-free-verification-api.test.ts +4 -1
- package/tests/smoke/transcriptions-api.test.ts +4 -1
- package/tests/unit/api/toll-free-verification-api.test.ts +15 -2
- package/tests/unit/models/rbm-open-url-enum.test.ts +8 -0
- package/tests/unit/models/rbm-veb-view-enum.test.ts +9 -0
|
@@ -67,6 +67,10 @@ export const TranscriptionsApiAxiosParamCreator = function (configuration?: Conf
|
|
|
67
67
|
// http basic authentication required
|
|
68
68
|
setBasicAuthToObject(localVarRequestOptions, configuration)
|
|
69
69
|
|
|
70
|
+
// authentication OAuth2 required
|
|
71
|
+
// oauth required
|
|
72
|
+
await setOAuthToObject(localVarHeaderParameter, "OAuth2", [], configuration)
|
|
73
|
+
|
|
70
74
|
|
|
71
75
|
|
|
72
76
|
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
@@ -113,6 +117,10 @@ export const TranscriptionsApiAxiosParamCreator = function (configuration?: Conf
|
|
|
113
117
|
// http basic authentication required
|
|
114
118
|
setBasicAuthToObject(localVarRequestOptions, configuration)
|
|
115
119
|
|
|
120
|
+
// authentication OAuth2 required
|
|
121
|
+
// oauth required
|
|
122
|
+
await setOAuthToObject(localVarHeaderParameter, "OAuth2", [], configuration)
|
|
123
|
+
|
|
116
124
|
|
|
117
125
|
|
|
118
126
|
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
@@ -155,6 +163,10 @@ export const TranscriptionsApiAxiosParamCreator = function (configuration?: Conf
|
|
|
155
163
|
// http basic authentication required
|
|
156
164
|
setBasicAuthToObject(localVarRequestOptions, configuration)
|
|
157
165
|
|
|
166
|
+
// authentication OAuth2 required
|
|
167
|
+
// oauth required
|
|
168
|
+
await setOAuthToObject(localVarHeaderParameter, "OAuth2", [], configuration)
|
|
169
|
+
|
|
158
170
|
|
|
159
171
|
|
|
160
172
|
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
package/bandwidth.yml
CHANGED
|
@@ -9,6 +9,7 @@ info:
|
|
|
9
9
|
version: 1.0.0
|
|
10
10
|
security:
|
|
11
11
|
- Basic: []
|
|
12
|
+
- OAuth2: []
|
|
12
13
|
tags:
|
|
13
14
|
- name: Messages
|
|
14
15
|
- name: Media
|
|
@@ -2377,6 +2378,35 @@ components:
|
|
|
2377
2378
|
- OPEN_URL
|
|
2378
2379
|
- REQUEST_LOCATION
|
|
2379
2380
|
example: REPLY
|
|
2381
|
+
rbmOpenUrlEnum:
|
|
2382
|
+
type: string
|
|
2383
|
+
description: >-
|
|
2384
|
+
Specifies how the URL should be opened on a mobile device.
|
|
2385
|
+
|
|
2386
|
+
- `BROWSER` Opens the URL in the device's default browser. If
|
|
2387
|
+
application is not set or the device doesn’t support WebView, this
|
|
2388
|
+
option is used by default.
|
|
2389
|
+
|
|
2390
|
+
- `WEBVIEW` Opens the URL in an in-app WebView.
|
|
2391
|
+
enum:
|
|
2392
|
+
- BROWSER
|
|
2393
|
+
- WEBVIEW
|
|
2394
|
+
example: WEBVIEW
|
|
2395
|
+
rbmWebViewEnum:
|
|
2396
|
+
type: string
|
|
2397
|
+
description: >-
|
|
2398
|
+
Defines the layout of the WebView on a mobile device. It must be defined
|
|
2399
|
+
when application is set to `WEBVIEW`
|
|
2400
|
+
|
|
2401
|
+
- `FULL` WebView takes the full screen.
|
|
2402
|
+
|
|
2403
|
+
- `HALF` WebView takes half of the screen.
|
|
2404
|
+
|
|
2405
|
+
- `TALL` WebView takes three-quarters of the screen.
|
|
2406
|
+
enum:
|
|
2407
|
+
- FULL
|
|
2408
|
+
- HALF
|
|
2409
|
+
- TALL
|
|
2380
2410
|
rbmActionText:
|
|
2381
2411
|
title: Text
|
|
2382
2412
|
type: string
|
|
@@ -2481,6 +2511,10 @@ components:
|
|
|
2481
2511
|
description: The URL to open in browser.
|
|
2482
2512
|
example: https://dev.bandwidth.com
|
|
2483
2513
|
maxLength: 2048
|
|
2514
|
+
application:
|
|
2515
|
+
$ref: '#/components/schemas/rbmOpenUrlEnum'
|
|
2516
|
+
webviewViewMode:
|
|
2517
|
+
$ref: '#/components/schemas/rbmWebViewEnum'
|
|
2484
2518
|
required:
|
|
2485
2519
|
- url
|
|
2486
2520
|
multiChannelFullActions:
|
|
@@ -5922,6 +5956,8 @@ components:
|
|
|
5922
5956
|
$ref: '#/components/schemas/helpMessageResponse'
|
|
5923
5957
|
ageGatedContent:
|
|
5924
5958
|
$ref: '#/components/schemas/ageGatedContent'
|
|
5959
|
+
cvToken:
|
|
5960
|
+
$ref: '#/components/schemas/cvToken'
|
|
5925
5961
|
verificationUpdateRequest:
|
|
5926
5962
|
type: object
|
|
5927
5963
|
required:
|
|
@@ -5971,6 +6007,8 @@ components:
|
|
|
5971
6007
|
$ref: '#/components/schemas/helpMessageResponse'
|
|
5972
6008
|
ageGatedContent:
|
|
5973
6009
|
$ref: '#/components/schemas/ageGatedContent'
|
|
6010
|
+
cvToken:
|
|
6011
|
+
$ref: '#/components/schemas/cvToken'
|
|
5974
6012
|
tfvBasicAuthentication:
|
|
5975
6013
|
type: object
|
|
5976
6014
|
properties:
|
|
@@ -6422,6 +6460,8 @@ components:
|
|
|
6422
6460
|
$ref: '#/components/schemas/blocked'
|
|
6423
6461
|
blockedReason:
|
|
6424
6462
|
$ref: '#/components/schemas/blockedReason'
|
|
6463
|
+
cvToken:
|
|
6464
|
+
$ref: '#/components/schemas/cvToken'
|
|
6425
6465
|
tfvSubmissionInfo:
|
|
6426
6466
|
type: object
|
|
6427
6467
|
properties:
|
|
@@ -6486,6 +6526,18 @@ components:
|
|
|
6486
6526
|
nullable: true
|
|
6487
6527
|
pattern: ^[ -~]{16,64}$
|
|
6488
6528
|
type: string
|
|
6529
|
+
cvToken:
|
|
6530
|
+
type: string
|
|
6531
|
+
description: >-
|
|
6532
|
+
The token provided by Campaign Verify to validate your political use
|
|
6533
|
+
case. Only required for 527 political organizations. If you are not a
|
|
6534
|
+
527 political organization, this field should be omitted. If you pass an
|
|
6535
|
+
empty string, it will be passed along and potentially rejected.
|
|
6536
|
+
minLength: 0
|
|
6537
|
+
maxLength: 500
|
|
6538
|
+
nullable: true
|
|
6539
|
+
example: >-
|
|
6540
|
+
cv.user123|sess456|mno|tfree|read_write|X7yZ9aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVw
|
|
6489
6541
|
responses:
|
|
6490
6542
|
createMessageResponse:
|
|
6491
6543
|
description: Accepted
|
|
@@ -8427,6 +8479,12 @@ components:
|
|
|
8427
8479
|
|
|
8428
8480
|
|
|
8429
8481
|
- Example: `Authorization: Basic ZGVtbZpwQDU1dzByZA==`
|
|
8482
|
+
OAuth2:
|
|
8483
|
+
type: oauth2
|
|
8484
|
+
flows:
|
|
8485
|
+
clientCredentials:
|
|
8486
|
+
tokenUrl: https://api.bandwidth.com/api/v1/oauth2/token
|
|
8487
|
+
scopes: {}
|
|
8430
8488
|
callbacks:
|
|
8431
8489
|
inboundCallback:
|
|
8432
8490
|
'{inboundCallbackUrl}':
|
package/common.ts
CHANGED
|
@@ -58,7 +58,9 @@ export const setOAuthToObject = async function (object: any, name: string, scope
|
|
|
58
58
|
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
|
|
59
59
|
? await configuration.accessToken(name, scopes)
|
|
60
60
|
: await configuration.accessToken;
|
|
61
|
-
|
|
61
|
+
if (localVarAccessTokenValue) {
|
|
62
|
+
object["Authorization"] = "Bearer " + localVarAccessTokenValue;
|
|
63
|
+
}
|
|
62
64
|
}
|
|
63
65
|
}
|
|
64
66
|
|
package/configuration.ts
CHANGED
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
* Do not edit the class manually.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
+
import globalAxios from 'axios';
|
|
15
|
+
|
|
14
16
|
interface AWSv4Configuration {
|
|
15
17
|
options?: {
|
|
16
18
|
region?: string
|
|
@@ -27,6 +29,8 @@ export interface ConfigurationParameters {
|
|
|
27
29
|
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
|
|
28
30
|
username?: string;
|
|
29
31
|
password?: string;
|
|
32
|
+
clientId?: string;
|
|
33
|
+
clientSecret?: string;
|
|
30
34
|
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
|
|
31
35
|
awsv4?: AWSv4Configuration;
|
|
32
36
|
basePath?: string;
|
|
@@ -49,12 +53,28 @@ export class Configuration {
|
|
|
49
53
|
* parameter for basic security
|
|
50
54
|
*/
|
|
51
55
|
password?: string;
|
|
56
|
+
/**
|
|
57
|
+
* parameter for client ID
|
|
58
|
+
*/
|
|
59
|
+
clientId?: string;
|
|
60
|
+
/**
|
|
61
|
+
* parameter for client secret
|
|
62
|
+
*/
|
|
63
|
+
clientSecret?: string;
|
|
52
64
|
/**
|
|
53
65
|
* parameter for oauth2 security
|
|
54
66
|
* @param name security name
|
|
55
67
|
* @param scopes oauth2 scope
|
|
56
68
|
*/
|
|
57
69
|
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
|
|
70
|
+
/**
|
|
71
|
+
* temporary access token storage
|
|
72
|
+
*/
|
|
73
|
+
tempAccessToken?: string;
|
|
74
|
+
/**
|
|
75
|
+
* when the temporary access token expires
|
|
76
|
+
*/
|
|
77
|
+
tempAccessTokenExpiration?: number;
|
|
58
78
|
/**
|
|
59
79
|
* parameter for aws4 signature security
|
|
60
80
|
* @param {Object} AWS4Signature - AWS4 Signature security
|
|
@@ -91,7 +111,29 @@ export class Configuration {
|
|
|
91
111
|
this.apiKey = param.apiKey;
|
|
92
112
|
this.username = param.username;
|
|
93
113
|
this.password = param.password;
|
|
94
|
-
this.
|
|
114
|
+
this.clientId = param.clientId;
|
|
115
|
+
this.clientSecret = param.clientSecret;
|
|
116
|
+
this.tempAccessToken;
|
|
117
|
+
this.tempAccessTokenExpiration;
|
|
118
|
+
this.accessToken = param.accessToken ?? (async (name, scopes) => {
|
|
119
|
+
const now = Math.floor(Date.now() / 1000);
|
|
120
|
+
if (this.tempAccessToken && (!this.tempAccessTokenExpiration || this.tempAccessTokenExpiration > now + 60)) {
|
|
121
|
+
return this.tempAccessToken;
|
|
122
|
+
} else if (this.clientId && this.clientSecret) {
|
|
123
|
+
const tokenRequestArgs = {
|
|
124
|
+
method: 'POST',
|
|
125
|
+
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
126
|
+
auth: { username: this.clientId || '', password: this.clientSecret || '' },
|
|
127
|
+
data: 'grant_type=client_credentials',
|
|
128
|
+
url: 'https://api.bandwidth.com/api/v1/oauth2/token'
|
|
129
|
+
};
|
|
130
|
+
const response = await globalAxios.request(tokenRequestArgs);
|
|
131
|
+
this.tempAccessToken = response.data.access_token;
|
|
132
|
+
this.tempAccessTokenExpiration = now + response.data.expires_in;
|
|
133
|
+
return this.tempAccessToken!;
|
|
134
|
+
}
|
|
135
|
+
return undefined;
|
|
136
|
+
});
|
|
95
137
|
this.awsv4 = param.awsv4;
|
|
96
138
|
this.basePath = param.basePath;
|
|
97
139
|
this.serverIndex = param.serverIndex;
|
|
@@ -99,7 +141,7 @@ export class Configuration {
|
|
|
99
141
|
...param.baseOptions,
|
|
100
142
|
headers: {
|
|
101
143
|
...param.baseOptions?.headers,
|
|
102
|
-
'User-Agent': "OpenAPI-Generator/7.0
|
|
144
|
+
'User-Agent': "OpenAPI-Generator/7.2.0/typescript-axios"
|
|
103
145
|
},
|
|
104
146
|
};
|
|
105
147
|
this.formDataCtor = param.formDataCtor;
|