purecloud-platform-client-v2 184.0.0 → 185.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.
- package/README.md +68 -2
- package/dist/node/purecloud-platform-client-v2.js +801 -79
- package/dist/web-amd/purecloud-platform-client-v2.js +801 -79
- package/dist/web-amd/purecloud-platform-client-v2.min.js +1 -1
- package/dist/web-cjs/bundle.js +260 -99
- package/dist/web-cjs/purecloud-platform-client-v2.js +260 -99
- package/dist/web-cjs/purecloud-platform-client-v2.min.js +1 -1
- package/index.d.ts +557 -33
- package/package.json +1 -1
- package/src/purecloud-platform-client-v2/ApiClient.js +334 -1
- 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 +3 -3
- package/src/purecloud-platform-client-v2/api/AuditApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/AuthorizationApi.js +2 -2
- package/src/purecloud-platform-client-v2/api/BillingApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/CarrierServicesApi.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/DownloadsApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/EmailsApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/EventsApi.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/InfrastructureAsCodeApi.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/LogCaptureApi.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/OperationalEventsApi.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/ProcessAutomationApi.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 +168 -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/SettingsApi.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/TaskManagementApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/TeamsApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/TelephonyApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/TelephonyProvidersEdgeApi.js +3 -2
- 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 +222 -1
- package/src/purecloud-platform-client-v2/index.js +1 -1
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@ import { default as qs } from 'qs';
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @module purecloud-platform-client-v2/ApiClient
|
|
7
|
-
* @version
|
|
7
|
+
* @version 185.0.0
|
|
8
8
|
*/
|
|
9
9
|
class ApiClient {
|
|
10
10
|
/**
|
|
@@ -415,6 +415,339 @@ class ApiClient {
|
|
|
415
415
|
});
|
|
416
416
|
}
|
|
417
417
|
|
|
418
|
+
/**
|
|
419
|
+
* @description Completes the PKCE Code Authorization.
|
|
420
|
+
* @param {string} clientId - The client ID of an OAuth Code Authorization Grant client
|
|
421
|
+
* @param {string} codeVerifier - code verifier used to generate the code challenge
|
|
422
|
+
* @param {string} authCode - Authorization code
|
|
423
|
+
* @param {string} redirectUri - Authorized redirect URI for your Code Authorization client
|
|
424
|
+
*/
|
|
425
|
+
authorizePKCEGrant(clientId, codeVerifier, authCode, redirectUri) {
|
|
426
|
+
this.clientId = clientId;
|
|
427
|
+
return new Promise((resolve, reject) => {
|
|
428
|
+
var request = axios({
|
|
429
|
+
method: `POST`,
|
|
430
|
+
url: `https://login.${this.config.environment}/oauth/token`,
|
|
431
|
+
headers: {
|
|
432
|
+
'Content-Type': 'application/x-www-form-urlencoded'
|
|
433
|
+
},
|
|
434
|
+
data: qs.stringify({ grant_type: 'authorization_code',
|
|
435
|
+
code: authCode,
|
|
436
|
+
code_verifier: codeVerifier,
|
|
437
|
+
client_id: clientId,
|
|
438
|
+
redirect_uri: redirectUri })
|
|
439
|
+
});
|
|
440
|
+
|
|
441
|
+
request.proxy = this.proxy;
|
|
442
|
+
var bodyParam = {
|
|
443
|
+
grant_type: 'authorization_code',
|
|
444
|
+
code: authCode,
|
|
445
|
+
code_verifier: codeVerifier,
|
|
446
|
+
client_id: clientId,
|
|
447
|
+
redirect_uri: redirectUri,
|
|
448
|
+
};
|
|
449
|
+
// Handle response
|
|
450
|
+
request
|
|
451
|
+
.then((response) => {
|
|
452
|
+
// Logging
|
|
453
|
+
this.config.logger.log(
|
|
454
|
+
'trace',
|
|
455
|
+
response.status,
|
|
456
|
+
'POST',
|
|
457
|
+
`https://login.${this.config.environment}/oauth/token`,
|
|
458
|
+
request.headers,
|
|
459
|
+
response.headers,
|
|
460
|
+
bodyParam,
|
|
461
|
+
undefined
|
|
462
|
+
);
|
|
463
|
+
this.config.logger.log(
|
|
464
|
+
'debug',
|
|
465
|
+
response.status,
|
|
466
|
+
'POST',
|
|
467
|
+
`https://login.${this.config.environment}/oauth/token`,
|
|
468
|
+
request.headers,
|
|
469
|
+
undefined,
|
|
470
|
+
bodyParam,
|
|
471
|
+
undefined
|
|
472
|
+
);
|
|
473
|
+
|
|
474
|
+
// Get access token from response
|
|
475
|
+
var access_token = response.data.access_token;
|
|
476
|
+
|
|
477
|
+
this.setAccessToken(access_token);
|
|
478
|
+
this.authData.tokenExpiryTime = new Date().getTime() + response.data['expires_in'] * 1000;
|
|
479
|
+
this.authData.tokenExpiryTimeString = new Date(this.authData.tokenExpiryTime).toUTCString();
|
|
480
|
+
|
|
481
|
+
// Return auth data
|
|
482
|
+
resolve(this.authData);
|
|
483
|
+
})
|
|
484
|
+
.catch((error) => {
|
|
485
|
+
// Log error
|
|
486
|
+
if (error.response) {
|
|
487
|
+
this.config.logger.log(
|
|
488
|
+
'error',
|
|
489
|
+
error.response.status,
|
|
490
|
+
'POST',
|
|
491
|
+
`https://login.${this.config.environment}/oauth/token`,
|
|
492
|
+
request.headers,
|
|
493
|
+
error.response.headers,
|
|
494
|
+
bodyParam,
|
|
495
|
+
error.response.data
|
|
496
|
+
);
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
reject(error);
|
|
500
|
+
});
|
|
501
|
+
|
|
502
|
+
});
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
/**
|
|
506
|
+
* @description Generate a random string used as PKCE Code Verifier - length = 43 to 128.
|
|
507
|
+
* @param {number} nChar - code length
|
|
508
|
+
*/
|
|
509
|
+
generatePKCECodeVerifier(nChar) {
|
|
510
|
+
if (nChar < 43 || nChar > 128) {
|
|
511
|
+
throw new Error(`PKCE Code Verifier (length) must be between 43 and 128 characters`);
|
|
512
|
+
}
|
|
513
|
+
// Check for window
|
|
514
|
+
if (typeof window === 'undefined') {
|
|
515
|
+
try {
|
|
516
|
+
const getRandomValues = require('crypto').getRandomValues;
|
|
517
|
+
const unreservedCharacters = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-._~";
|
|
518
|
+
let randomString = Array.from(getRandomValues(new Uint32Array(nChar)))
|
|
519
|
+
.map((x) => unreservedCharacters[x % unreservedCharacters.length])
|
|
520
|
+
.join('');
|
|
521
|
+
return randomString;
|
|
522
|
+
} catch (err) {
|
|
523
|
+
throw new Error(`Crypto module is missing/not supported.`);
|
|
524
|
+
}
|
|
525
|
+
} else {
|
|
526
|
+
const unreservedCharacters = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-._~";
|
|
527
|
+
let randomString = Array.from(crypto.getRandomValues(new Uint32Array(nChar)))
|
|
528
|
+
.map((x) => unreservedCharacters[x % unreservedCharacters.length])
|
|
529
|
+
.join('');
|
|
530
|
+
return randomString;
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
/**
|
|
535
|
+
* @description Compute Base64Url PKCE Code Challenge from Code Verifier.
|
|
536
|
+
* @param {string} code - code verifier used to generate the code challenge
|
|
537
|
+
*/
|
|
538
|
+
computePKCECodeChallenge(code) {
|
|
539
|
+
if (code.length < 43 || code.length > 128) {
|
|
540
|
+
throw new Error(`PKCE Code Verifier (length) must be between 43 and 128 characters`);
|
|
541
|
+
}
|
|
542
|
+
// Check for window
|
|
543
|
+
if (typeof window === 'undefined') {
|
|
544
|
+
// nodejs
|
|
545
|
+
try {
|
|
546
|
+
const createHash = require('crypto').createHash;
|
|
547
|
+
const utf8 = new TextEncoder().encode(code);
|
|
548
|
+
return new Promise((resolve, reject) => {
|
|
549
|
+
const hashHex = createHash('sha256').update(utf8).digest();
|
|
550
|
+
const hashBase64Url = Buffer.from(hashHex).toString('base64url');
|
|
551
|
+
resolve(hashBase64Url);
|
|
552
|
+
});
|
|
553
|
+
} catch (err) {
|
|
554
|
+
throw new Error(`Crypto module is missing/not supported.`);
|
|
555
|
+
}
|
|
556
|
+
} else {
|
|
557
|
+
// browser
|
|
558
|
+
const utf8 = new TextEncoder().encode(code);
|
|
559
|
+
return new Promise((resolve, reject) => {
|
|
560
|
+
window.crypto.subtle.digest("SHA-256", utf8).then((hashBuffer) => {
|
|
561
|
+
const hashBase64 = Buffer.from(hashBuffer).toString('base64');
|
|
562
|
+
let hashBase64Url = hashBase64.replaceAll("+", "-").replaceAll("/", "_");
|
|
563
|
+
hashBase64Url = hashBase64Url.split("=")[0];
|
|
564
|
+
resolve(hashBase64Url);
|
|
565
|
+
})
|
|
566
|
+
.catch((error) => {
|
|
567
|
+
// Handle failure
|
|
568
|
+
return reject(new Error(`Code Challenge Error ${error}`));
|
|
569
|
+
});
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
/**
|
|
575
|
+
* @description Initiates the pkce auth code grant login flow. Will attempt to load the token from local storage, if enabled.
|
|
576
|
+
* @param {string} clientId - The client ID of an OAuth Implicit Grant client
|
|
577
|
+
* @param {string} redirectUri - The redirect URI of the OAuth Implicit Grant client
|
|
578
|
+
* @param {object} opts - (optional) Additional options
|
|
579
|
+
* @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.
|
|
580
|
+
* @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.
|
|
581
|
+
* @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.
|
|
582
|
+
* @param {string} codeVerifier - (optional) code verifier used to generate the code challenge
|
|
583
|
+
*/
|
|
584
|
+
loginPKCEGrant(clientId, redirectUri, opts, codeVerifier) {
|
|
585
|
+
// Need Local Storage or non null codeVerifier as parameter
|
|
586
|
+
if (!this.hasLocalStorage && !codeVerifier) {
|
|
587
|
+
throw new Error(`loginPKCEGrant requires Local Storage or codeVerifier as input parameter`);
|
|
588
|
+
}
|
|
589
|
+
// Check for auth code in query
|
|
590
|
+
const query = this._setValuesFromUrlQuery();
|
|
591
|
+
|
|
592
|
+
this.clientId = clientId;
|
|
593
|
+
this.redirectUri = redirectUri;
|
|
594
|
+
|
|
595
|
+
this.codeVerifier = codeVerifier;
|
|
596
|
+
|
|
597
|
+
if (!opts) opts = {};
|
|
598
|
+
|
|
599
|
+
return new Promise((resolve, reject) => {
|
|
600
|
+
// Abort if org and provider are not set together
|
|
601
|
+
if (opts.org && !opts.provider) {
|
|
602
|
+
reject(new Error('opts.provider must be set if opts.org is set'));
|
|
603
|
+
} else if (opts.provider && !opts.org) {
|
|
604
|
+
reject(new Error('opts.org must be set if opts.provider is set'));
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
// Abort on auth error
|
|
608
|
+
if (query && query.error) {
|
|
609
|
+
// remove codeVerifier from session storage
|
|
610
|
+
if (this.hasLocalStorage) {
|
|
611
|
+
sessionStorage.removeItem(`genesys_cloud_sdk_pkce_code_verifier`);
|
|
612
|
+
}
|
|
613
|
+
// reset access token if any was stored
|
|
614
|
+
this._saveSettings({ accessToken: undefined });
|
|
615
|
+
return reject(new Error(`[${query.error}] ${query.error_description}`));
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
// Get token on auth code
|
|
619
|
+
if (query && query.code) {
|
|
620
|
+
if (!this.codeVerifier) {
|
|
621
|
+
// load codeVerifier from session storage
|
|
622
|
+
if (this.hasLocalStorage) {
|
|
623
|
+
this.codeVerifier = sessionStorage.getItem(`genesys_cloud_sdk_pkce_code_verifier`);
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
this.authorizePKCEGrant(this.clientId, this.codeVerifier, query.code, this.redirectUri)
|
|
627
|
+
.then(() => {
|
|
628
|
+
// Do authenticated things
|
|
629
|
+
this._testTokenAccess()
|
|
630
|
+
.then(() => {
|
|
631
|
+
if (!this.authData.state && query.state)
|
|
632
|
+
this.authData.state = query.state;
|
|
633
|
+
// remove codeVerifier from session storage
|
|
634
|
+
if (this.hasLocalStorage) {
|
|
635
|
+
sessionStorage.removeItem(`genesys_cloud_sdk_pkce_code_verifier`);
|
|
636
|
+
}
|
|
637
|
+
resolve(this.authData);
|
|
638
|
+
})
|
|
639
|
+
.catch((error) => {
|
|
640
|
+
// Handle failure response
|
|
641
|
+
this._saveSettings({ accessToken: undefined});
|
|
642
|
+
// remove codeVerifier from session storage
|
|
643
|
+
if (this.hasLocalStorage) {
|
|
644
|
+
sessionStorage.removeItem(`genesys_cloud_sdk_pkce_code_verifier`);
|
|
645
|
+
}
|
|
646
|
+
return reject(new Error(`[${error.name}] ${error.msg}`));
|
|
647
|
+
});
|
|
648
|
+
})
|
|
649
|
+
.catch((error) => {
|
|
650
|
+
// Handle failure response
|
|
651
|
+
this._saveSettings({ accessToken: undefined});
|
|
652
|
+
// remove codeVerifier from session storage
|
|
653
|
+
if (this.hasLocalStorage) {
|
|
654
|
+
sessionStorage.removeItem(`genesys_cloud_sdk_pkce_code_verifier`);
|
|
655
|
+
}
|
|
656
|
+
return reject(new Error(`[${error.name}] ${error.msg}`));
|
|
657
|
+
});
|
|
658
|
+
} else {
|
|
659
|
+
// Test token (if previously stored) and proceed with login
|
|
660
|
+
this._testTokenAccess()
|
|
661
|
+
.then(() => {
|
|
662
|
+
if (!this.authData.state && opts.state)
|
|
663
|
+
this.authData.state = opts.state;
|
|
664
|
+
resolve(this.authData);
|
|
665
|
+
})
|
|
666
|
+
.catch((error) => {
|
|
667
|
+
if (!this.codeVerifier) {
|
|
668
|
+
this.codeVerifier = this.generatePKCECodeVerifier(128);
|
|
669
|
+
// save codeVerifier in session storage
|
|
670
|
+
if (this.hasLocalStorage) {
|
|
671
|
+
sessionStorage.setItem(`genesys_cloud_sdk_pkce_code_verifier`, this.codeVerifier);
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
this.computePKCECodeChallenge(this.codeVerifier)
|
|
675
|
+
.then((codeChallenge) => {
|
|
676
|
+
var tokenQuery = {
|
|
677
|
+
client_id: encodeURIComponent(this.clientId),
|
|
678
|
+
redirect_uri: encodeURIComponent(this.redirectUri),
|
|
679
|
+
code_challenge: encodeURIComponent(codeChallenge),
|
|
680
|
+
response_type: 'code',
|
|
681
|
+
code_challenge_method: 'S256'
|
|
682
|
+
};
|
|
683
|
+
if (opts.state) tokenQuery.state = encodeURIComponent(opts.state);
|
|
684
|
+
if (opts.org) tokenQuery.org = encodeURIComponent(opts.org);
|
|
685
|
+
if (opts.provider) tokenQuery.provider = encodeURIComponent(opts.provider);
|
|
686
|
+
|
|
687
|
+
var url = this._buildAuthUrl('oauth/authorize', tokenQuery);
|
|
688
|
+
window.location.replace(url);
|
|
689
|
+
})
|
|
690
|
+
.catch((err) => {
|
|
691
|
+
return reject(new Error(`[${err.name}]`));
|
|
692
|
+
});
|
|
693
|
+
});
|
|
694
|
+
}
|
|
695
|
+
});
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
/**
|
|
699
|
+
* @description Parses the URL Query, grabs the code, and clears the query param. If no code is found, no action is taken.
|
|
700
|
+
*/
|
|
701
|
+
_setValuesFromUrlQuery() {
|
|
702
|
+
// Check for window
|
|
703
|
+
if (!(typeof window !== 'undefined' && window.location.search)) return;
|
|
704
|
+
|
|
705
|
+
// Process query string
|
|
706
|
+
let query = {};
|
|
707
|
+
let queryParams = new URLSearchParams(window.location.search);
|
|
708
|
+
let code = queryParams.get('code');
|
|
709
|
+
let error = queryParams.get('error');
|
|
710
|
+
let errorDescription = queryParams.get('error_description');
|
|
711
|
+
let state = queryParams.get('state');
|
|
712
|
+
|
|
713
|
+
// Check for error
|
|
714
|
+
if (error) {
|
|
715
|
+
query.error = error;
|
|
716
|
+
if (errorDescription) {
|
|
717
|
+
query.error_description = errorDescription;
|
|
718
|
+
}
|
|
719
|
+
return query;
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
// Everything goes in here because we only want to act if we found an access token
|
|
723
|
+
if (code) {
|
|
724
|
+
query.code = code;
|
|
725
|
+
if (state) {
|
|
726
|
+
query.state = state;
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
// Remove code from URL
|
|
731
|
+
// Credit: https://stackoverflow.com/questions/1397329/how-to-remove-the-hash-from-window-location-with-javascript-without-page-refresh/5298684#5298684
|
|
732
|
+
var scrollV, scrollH, loc = window.location;
|
|
733
|
+
if ('replaceState' in history) {
|
|
734
|
+
history.replaceState('', document.title, loc.pathname);
|
|
735
|
+
} else {
|
|
736
|
+
// Prevent scrolling by storing the page's current scroll offset
|
|
737
|
+
scrollV = document.body.scrollTop;
|
|
738
|
+
scrollH = document.body.scrollLeft;
|
|
739
|
+
|
|
740
|
+
// Remove code
|
|
741
|
+
history.pushState('', document.title, loc.pathname);
|
|
742
|
+
|
|
743
|
+
// Restore the scroll offset, should be flicker free
|
|
744
|
+
document.body.scrollTop = scrollV;
|
|
745
|
+
document.body.scrollLeft = scrollH;
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
return query;
|
|
749
|
+
}
|
|
750
|
+
|
|
418
751
|
/**
|
|
419
752
|
* @description Initiates the Code Authorization. Only available in node apps.
|
|
420
753
|
* @param {string} clientId - The client ID of an OAuth Code Authorization Grant client
|
|
@@ -5,7 +5,7 @@ class ArchitectApi {
|
|
|
5
5
|
/**
|
|
6
6
|
* Architect service.
|
|
7
7
|
* @module purecloud-platform-client-v2/api/ArchitectApi
|
|
8
|
-
* @version
|
|
8
|
+
* @version 185.0.0
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -3252,7 +3252,7 @@ class ArchitectApi {
|
|
|
3252
3252
|
|
|
3253
3253
|
/**
|
|
3254
3254
|
* Create a new row entry for the datatable.
|
|
3255
|
-
* Will add the passed in row entry to the datatable with the given datatableId after verifying it against the schema. The DataTableRow should be a json-ized stream of key -> value pairs { "Field1": "XYZZY", "Field2": false, "KEY": "27272" }
|
|
3255
|
+
* Will add the passed in row entry to the datatable with the given datatableId after verifying it against the schema. When building the request body within API Explorer, Pro mode should be used. The DataTableRow should be a json-ized stream of key -> value pairs { "Field1": "XYZZY", "Field2": false, "KEY": "27272" }
|
|
3256
3256
|
* @param {String} datatableId id of datatable
|
|
3257
3257
|
* @param {Object.<String, {String: Object}>} dataTableRow
|
|
3258
3258
|
*/
|
|
@@ -3744,7 +3744,7 @@ class ArchitectApi {
|
|
|
3744
3744
|
|
|
3745
3745
|
/**
|
|
3746
3746
|
* Update a row entry
|
|
3747
|
-
* Updates a row with the given rowId (the value of the key field) to the new values. The DataTableRow should be a json-ized stream of key -> value pairs { "Field1": "XYZZY", "Field2": false, "KEY": "27272" }
|
|
3747
|
+
* Updates a row with the given rowId (the value of the key field) to the new values. When building the request body within API Explorer, Pro mode should be used. The DataTableRow should be a json-ized stream of key -> value pairs { "Field1": "XYZZY", "Field2": false, "KEY": "27272" }
|
|
3748
3748
|
* @param {String} datatableId id of datatable
|
|
3749
3749
|
* @param {String} rowId the key for the row
|
|
3750
3750
|
* @param {Object} opts Optional parameters
|
|
@@ -5,7 +5,7 @@ class AuthorizationApi {
|
|
|
5
5
|
/**
|
|
6
6
|
* Authorization service.
|
|
7
7
|
* @module purecloud-platform-client-v2/api/AuthorizationApi
|
|
8
|
-
* @version
|
|
8
|
+
* @version 185.0.0
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -388,7 +388,7 @@ class AuthorizationApi {
|
|
|
388
388
|
* Get the organization role specified by its ID.
|
|
389
389
|
* @param {String} roleId Role ID
|
|
390
390
|
* @param {Object} opts Optional parameters
|
|
391
|
-
* @param {Object} opts.userCount Fetch the count of users who have this role granted in at least one division (default to true)
|
|
391
|
+
* @param {Object} opts.userCount Fetch the count of users who have this role granted in at least one division. Setting this value or defaulting to 'true' can lead to slower load times or timeouts for role queries with large member counts. (default to true)
|
|
392
392
|
* @param {Array.<String>} opts.expand Which fields, if any, to expand. unusedPermissions returns the permissions not used for the role
|
|
393
393
|
*/
|
|
394
394
|
getAuthorizationRole(roleId, opts) {
|