purecloud-platform-client-v2 140.0.0 → 140.0.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.
- package/README.md +2 -2
- package/dist/node/purecloud-platform-client-v2.js +82 -79
- package/dist/web-amd/purecloud-platform-client-v2.js +82 -80
- package/dist/web-amd/purecloud-platform-client-v2.min.js +1 -1
- package/dist/web-cjs/bundle.js +82 -79
- package/dist/web-cjs/purecloud-platform-client-v2.js +2176 -117
- package/dist/web-cjs/purecloud-platform-client-v2.min.js +1 -1
- package/package.json +2 -1
- package/src/purecloud-platform-client-v2/ApiClient.js +18 -16
- package/src/purecloud-platform-client-v2/api/AlertingApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/AnalyticsApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/ArchitectApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/AuditApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/AuthorizationApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/BillingApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/ChatApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/CoachingApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/ContentManagementApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/ConversationsApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/DataExtensionsApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/ExternalContactsApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/FaxApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/FlowsApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/GamificationApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/GeneralDataProtectionRegulationApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/GeolocationApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/GreetingsApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/GroupsApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/IdentityProviderApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/IntegrationsApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/JourneyApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/KnowledgeApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/LanguageUnderstandingApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/LanguagesApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/LearningApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/LicenseApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/LocationsApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/MessagingApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/MobileDevicesApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/NotificationsApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/OAuthApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/ObjectsApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/OrganizationApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/OrganizationAuthorizationApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/OutboundApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/PresenceApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/QualityApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/RecordingApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/ResponseManagementApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/RoutingApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/SCIMApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/ScriptsApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/SearchApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/SpeechTextAnalyticsApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/StationsApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/SuggestApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/TelephonyApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/TelephonyProvidersEdgeApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/TextbotsApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/TokensApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/UploadsApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/UsageApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/UserRecordingsApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/UsersApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/UtilitiesApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/VoicemailApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/WebChatApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/WebDeploymentsApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/WebMessagingApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/WidgetsApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/WorkforceManagementApi.js +1 -1
- package/src/purecloud-platform-client-v2/index.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "purecloud-platform-client-v2",
|
|
3
|
-
"version": "140.0.
|
|
3
|
+
"version": "140.0.1",
|
|
4
4
|
"description": "A JavaScript library to interface with the PureCloud Platform API",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/node/purecloud-platform-client-v2.js",
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"axios": "^0.27.2",
|
|
34
34
|
"configparser": "^0.3.9",
|
|
35
|
+
"qs": "^6.10.3",
|
|
35
36
|
"winston": "^3.6.0"
|
|
36
37
|
},
|
|
37
38
|
"devDependencies": {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { default as axios } from 'axios';
|
|
2
2
|
import Configuration from './configuration.js';
|
|
3
|
+
import { default as qs } from 'qs';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* @module purecloud-platform-client-v2/ApiClient
|
|
6
|
-
* @version 140.0.
|
|
7
|
+
* @version 140.0.1
|
|
7
8
|
*/
|
|
8
9
|
class ApiClient {
|
|
9
10
|
/**
|
|
@@ -38,7 +39,7 @@ class ApiClient {
|
|
|
38
39
|
|
|
39
40
|
/**
|
|
40
41
|
* Enumeration of collection format separator strategies.
|
|
41
|
-
* @enum {String}
|
|
42
|
+
* @enum {String}
|
|
42
43
|
* @readonly
|
|
43
44
|
*/
|
|
44
45
|
this.CollectionFormatEnum = {
|
|
@@ -185,7 +186,7 @@ class ApiClient {
|
|
|
185
186
|
// Load current auth data
|
|
186
187
|
const tempState = this.authData.state;
|
|
187
188
|
this.authData = localStorage.getItem(`${this.settingsPrefix}_auth_data`);
|
|
188
|
-
if (!this.authData)
|
|
189
|
+
if (!this.authData)
|
|
189
190
|
this.authData = {};
|
|
190
191
|
else
|
|
191
192
|
this.authData = JSON.parse(this.authData);
|
|
@@ -205,7 +206,7 @@ class ApiClient {
|
|
|
205
206
|
* @description Initiates the implicit grant login flow. Will attempt to load the token from local storage, if enabled.
|
|
206
207
|
* @param {string} clientId - The client ID of an OAuth Implicit Grant client
|
|
207
208
|
* @param {string} redirectUri - The redirect URI of the OAuth Implicit Grant client
|
|
208
|
-
* @param {object} opts - (optional) Additional options
|
|
209
|
+
* @param {object} opts - (optional) Additional options
|
|
209
210
|
* @param {string} opts.state - (optional) An arbitrary string to be passed back with the login response. Used for client apps to associate login responses with a request.
|
|
210
211
|
* @param {string} opts.org - (optional) The organization name that would normally used when specifying an organization name when logging in. This is only used when a provider is also specified.
|
|
211
212
|
* @param {string} opts.provider - (optional) Authentication provider to log in with e.g. okta, adfs, salesforce, onelogin. This is only used when an org is also specified.
|
|
@@ -351,9 +352,9 @@ class ApiClient {
|
|
|
351
352
|
}
|
|
352
353
|
var encodedData = Buffer.from(clientId + ':' + clientSecret).toString('base64');
|
|
353
354
|
var request = this._formAuthRequest(encodedData,
|
|
354
|
-
{ grant_type: 'urn:ietf:params:oauth:grant-type:saml2-bearer'
|
|
355
|
-
|
|
356
|
-
|
|
355
|
+
{ grant_type: 'urn:ietf:params:oauth:grant-type:saml2-bearer',
|
|
356
|
+
orgName: orgName,
|
|
357
|
+
assertion: assertion });
|
|
357
358
|
request.proxy = this.proxy;
|
|
358
359
|
var bodyParam = {
|
|
359
360
|
grant_type: 'urn:ietf:params:oauth:grant-type:saml2-bearer',
|
|
@@ -432,9 +433,9 @@ class ApiClient {
|
|
|
432
433
|
}
|
|
433
434
|
var encodedData = Buffer.from(clientId + ':' + clientSecret).toString('base64');
|
|
434
435
|
var request = this._formAuthRequest(encodedData,
|
|
435
|
-
{ grant_type: 'authorization_code'
|
|
436
|
-
|
|
437
|
-
|
|
436
|
+
{ grant_type: 'authorization_code',
|
|
437
|
+
code: authCode,
|
|
438
|
+
redirect_uri: redirectUri });
|
|
438
439
|
request.proxy = this.proxy;
|
|
439
440
|
var bodyParam = {
|
|
440
441
|
grant_type: 'authorization_code',
|
|
@@ -460,7 +461,7 @@ class ApiClient {
|
|
|
460
461
|
return;
|
|
461
462
|
}
|
|
462
463
|
var encodedData = Buffer.from(clientId + ':' + clientSecret).toString('base64');
|
|
463
|
-
var request = this._formAuthRequest(encodedData, { grant_type: 'refresh_token'
|
|
464
|
+
var request = this._formAuthRequest(encodedData, { grant_type: 'refresh_token' , refresh_token: refreshToken });
|
|
464
465
|
request.proxy = this.proxy;
|
|
465
466
|
var bodyParam = {
|
|
466
467
|
grant_type: 'refresh_token',
|
|
@@ -537,8 +538,9 @@ class ApiClient {
|
|
|
537
538
|
/**
|
|
538
539
|
* @description Utility function to create the request for auth requests
|
|
539
540
|
* @param {string} encodedData - Base64 encoded client and clientSecret pair
|
|
541
|
+
* @param {object} data - data to url form encode
|
|
540
542
|
*/
|
|
541
|
-
_formAuthRequest(encodedData) {
|
|
543
|
+
_formAuthRequest(encodedData, data) {
|
|
542
544
|
var request = axios({
|
|
543
545
|
method: `POST`,
|
|
544
546
|
url: `https://login.${this.config.environment}/oauth/token`,
|
|
@@ -546,7 +548,7 @@ class ApiClient {
|
|
|
546
548
|
'Authorization': 'Basic ' + encodedData,
|
|
547
549
|
'Content-Type': 'application/x-www-form-urlencoded'
|
|
548
550
|
},
|
|
549
|
-
data:
|
|
551
|
+
data: qs.stringify(data)
|
|
550
552
|
});
|
|
551
553
|
|
|
552
554
|
return request;
|
|
@@ -610,7 +612,7 @@ class ApiClient {
|
|
|
610
612
|
}
|
|
611
613
|
|
|
612
614
|
// Test token
|
|
613
|
-
this.callApi('/api/v2/tokens/me', 'GET',
|
|
615
|
+
this.callApi('/api/v2/tokens/me', 'GET',
|
|
614
616
|
null, null, null, null, null, ['PureCloud OAuth'], ['application/json'], ['application/json'])
|
|
615
617
|
.then(() => {
|
|
616
618
|
resolve();
|
|
@@ -636,7 +638,7 @@ class ApiClient {
|
|
|
636
638
|
const match = hashRegex.exec(h);
|
|
637
639
|
if (match) hash[match[1]] = decodeURIComponent(decodeURIComponent(match[2].replace(/\+/g, '%20')));
|
|
638
640
|
});
|
|
639
|
-
|
|
641
|
+
|
|
640
642
|
// Check for error
|
|
641
643
|
if (hash.error) {
|
|
642
644
|
return hash;
|
|
@@ -834,7 +836,7 @@ class ApiClient {
|
|
|
834
836
|
/**
|
|
835
837
|
* Checks whether the given parameter value represents file-like content.
|
|
836
838
|
* @param param The parameter to check.
|
|
837
|
-
* @returns {Boolean} <code>true</code> if <code>param</code> represents a file.
|
|
839
|
+
* @returns {Boolean} <code>true</code> if <code>param</code> represents a file.
|
|
838
840
|
*/
|
|
839
841
|
isFileParam(param) {
|
|
840
842
|
// fs.ReadStream in Node.js (but not in runtime like browserify)
|