purecloud-platform-client-v2 134.0.0 → 136.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 +32 -29
- package/dist/node/purecloud-platform-client-v2.js +388 -214
- package/dist/web-amd/purecloud-platform-client-v2.js +388 -214
- package/dist/web-amd/purecloud-platform-client-v2.min.js +1 -1
- package/dist/web-cjs/bundle.js +388 -214
- package/dist/web-cjs/purecloud-platform-client-v2.js +398 -225
- package/dist/web-cjs/purecloud-platform-client-v2.min.js +1 -1
- package/index.d.ts +364 -35
- package/package.json +1 -1
- package/src/purecloud-platform-client-v2/ApiClient.js +2 -2
- 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 +5 -5
- 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 +29 -29
- 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 +11 -9
- 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 +26 -1
- package/src/purecloud-platform-client-v2/api/PresenceApi.js +1 -51
- package/src/purecloud-platform-client-v2/api/QualityApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/RecordingApi.js +132 -5
- package/src/purecloud-platform-client-v2/api/ResponseManagementApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/RoutingApi.js +7 -3
- package/src/purecloud-platform-client-v2/api/SCIMApi.js +1 -1
- package/src/purecloud-platform-client-v2/api/ScriptsApi.js +69 -3
- 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 +2 -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 +51 -51
- package/src/purecloud-platform-client-v2/index.js +1 -1
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ title: Platform API Client SDK - JavaScript
|
|
|
4
4
|
|
|
5
5
|
# Platform API Javascript Client
|
|
6
6
|
|
|
7
|
-
A JavaScript library to interface with the Genesys Cloud Platform API. View the documentation on the [Genesys Cloud Developer Center](https://developer.
|
|
7
|
+
A JavaScript library to interface with the Genesys Cloud Platform API. View the documentation on the [Genesys Cloud Developer Center](https://developer.genesys.cloud/devapps/sdk/docexplorer/purecloudjavascript/). Browse the source code on [Github](https://github.com/MyPureCloud/platform-client-sdk-javascript).
|
|
8
8
|
|
|
9
9
|
[](https://github.com/MyPureCloud/platform-client-sdk-javascript)
|
|
10
10
|
[](https://www.npmjs.com/package/purecloud-platform-client-v2)
|
|
@@ -14,20 +14,20 @@ A JavaScript library to interface with the Genesys Cloud Platform API. View the
|
|
|
14
14
|
|
|
15
15
|
For node.js via [NPM](https://www.npmjs.com/package/purecloud-platform-client-v2):
|
|
16
16
|
|
|
17
|
-
```
|
|
17
|
+
```sh
|
|
18
18
|
npm install purecloud-platform-client-v2
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
```
|
|
21
|
+
```javascript
|
|
22
22
|
// Obtain a reference to the platformClient object
|
|
23
23
|
const platformClient = require('purecloud-platform-client-v2');
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
For direct use in a browser script:
|
|
27
27
|
|
|
28
|
-
```
|
|
28
|
+
```html
|
|
29
29
|
<!-- Include the CJS SDK -->
|
|
30
|
-
<script src="https://sdk-cdn.mypurecloud.com/javascript/
|
|
30
|
+
<script src="https://sdk-cdn.mypurecloud.com/javascript/136.0.0/purecloud-platform-client-v2.min.js"></script>
|
|
31
31
|
|
|
32
32
|
<script type="text/javascript">
|
|
33
33
|
// Obtain a reference to the platformClient object
|
|
@@ -38,13 +38,13 @@ For direct use in a browser script:
|
|
|
38
38
|
|
|
39
39
|
## AMD
|
|
40
40
|
|
|
41
|
-
```
|
|
41
|
+
```html
|
|
42
42
|
<!-- Include requirejs -->
|
|
43
43
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.5/require.min.js"></script>
|
|
44
44
|
|
|
45
45
|
<script type="text/javascript">
|
|
46
46
|
// Obtain a reference to the platformClient object
|
|
47
|
-
requirejs(['https://sdk-cdn.mypurecloud.com/javascript/amd/
|
|
47
|
+
requirejs(['https://sdk-cdn.mypurecloud.com/javascript/amd/136.0.0/purecloud-platform-client-v2.min.js'], (platformClient) => {
|
|
48
48
|
console.log(platformClient);
|
|
49
49
|
});
|
|
50
50
|
</script>
|
|
@@ -77,11 +77,11 @@ Want your app to always use the most recent version of the SDK? To do this, simp
|
|
|
77
77
|
|
|
78
78
|
After authentication has completed, the access token is stored on the `ApiClient` instance and the access token will be sent with all API requests.
|
|
79
79
|
|
|
80
|
-
**Node.js** [Client Credentials grant](https://developer.
|
|
80
|
+
**Node.js** [Client Credentials grant](https://developer.genesys.cloud/authorization/platform-auth/use-client-credentials)
|
|
81
81
|
|
|
82
82
|
The Client Credentials grant only works when used in node.js. This is restricted intentionally because it is impossible for client credentials to be handled securely in a browser application.
|
|
83
83
|
|
|
84
|
-
```
|
|
84
|
+
```javascript
|
|
85
85
|
const client = platformClient.ApiClient.instance;
|
|
86
86
|
client.loginClientCredentialsGrant(clientId,clientSecret)
|
|
87
87
|
.then(()=> {
|
|
@@ -94,11 +94,11 @@ client.loginClientCredentialsGrant(clientId,clientSecret)
|
|
|
94
94
|
|
|
95
95
|
```
|
|
96
96
|
|
|
97
|
-
**Node.js** [Saml2bearer Grant](https://developer.
|
|
97
|
+
**Node.js** [Saml2bearer Grant](https://developer.genesys.cloud/authorization/platform-auth/use-saml2-bearer)
|
|
98
98
|
|
|
99
99
|
The Saml2bearer grant only works when used in node.js. This is restricted intentionally because it is impossible for client credentials to be handled securely in a browser application.
|
|
100
100
|
|
|
101
|
-
```
|
|
101
|
+
```javascript
|
|
102
102
|
const client = platformClient.ApiClient.instance;
|
|
103
103
|
client.loginSaml2BearerGrant(clientId,clientSecret,orgName,encodedAssertionString)
|
|
104
104
|
.then(() => {
|
|
@@ -110,11 +110,11 @@ client.loginSaml2BearerGrant(clientId,clientSecret,orgName,encodedAssertionStrin
|
|
|
110
110
|
});
|
|
111
111
|
```
|
|
112
112
|
|
|
113
|
-
**Node.js** [Authorization Code Grant](https://developer.
|
|
113
|
+
**Node.js** [Authorization Code Grant](https://developer.genesys.cloud/authorization/platform-auth/use-authorization-code)
|
|
114
114
|
|
|
115
115
|
The Authorization Code grant only works when used in node.js. This is restricted intentionally because it is impossible for client credentials to be handled securely in a browser application.
|
|
116
116
|
|
|
117
|
-
```
|
|
117
|
+
```javascript
|
|
118
118
|
const client = platformClient.ApiClient.instance;
|
|
119
119
|
client.loginCodeAuthorizationGrant(clientId,clientSecret,authCode,redirectUri)
|
|
120
120
|
.then(() => {
|
|
@@ -129,7 +129,7 @@ client.loginCodeAuthorizationGrant(clientId,clientSecret,authCode,redirectUri)
|
|
|
129
129
|
By default the SDK will transparently request a new access token when it expires. If multiple threads are running 1 thread will request a new token, other threads will wait a maximum of 10 seconds for the token refresh to complete, this time can be overriden with the _client.config.refresh_token_wait_max_ field of the _Configuration_ object within ApiClient.
|
|
130
130
|
If you wish to apply the refresh logic yourself, set _client.config.refresh_access_token_ to false and store the refresh token. The _tokenExpiryTime_ can be used to preemptively request a new token. Use _refreshCodeAuthorizationGrant_ to request a new token when necessary.
|
|
131
131
|
|
|
132
|
-
```
|
|
132
|
+
```javascript
|
|
133
133
|
const client = platformClient.ApiClient.instance;
|
|
134
134
|
client.config.refresh_access_token = false;
|
|
135
135
|
client.loginCodeAuthorizationGrant(clientId,clientSecret,authCode,redirectUri)
|
|
@@ -156,7 +156,7 @@ client.refreshCodeAuthorizationGrant(clientId,clientSecret,refreshToken)
|
|
|
156
156
|
});
|
|
157
157
|
```
|
|
158
158
|
|
|
159
|
-
**Web** [Implicit grant](https://developer.
|
|
159
|
+
**Web** [Implicit grant](https://developer.genesys.cloud/authorization/platform-auth/use-implicit-grant)
|
|
160
160
|
|
|
161
161
|
The Implicit grant only works when used in a browser. This is because a node.js application does not have a browser interface that can display the Genesys Cloud login window.
|
|
162
162
|
|
|
@@ -164,7 +164,7 @@ Optional parameters may be specified in the optional third parameter for `loginI
|
|
|
164
164
|
|
|
165
165
|
* `state` - An arbitrary string used to associate a login request with a login response. This value will be provided in the `state` property on the object when the promise is resolved. The state in the resolved promise will be identical to what was passed into `loginImplicitGrant`, except when the state is retrieved from the auth hash upon completing a login; in that case, the state from the auth hash will override the passed in state.
|
|
166
166
|
|
|
167
|
-
```
|
|
167
|
+
```javascript
|
|
168
168
|
const client = platformClient.ApiClient.instance;
|
|
169
169
|
client.loginImplicitGrant(clientId, redirectUri, { state: state })
|
|
170
170
|
.then((data) => {
|
|
@@ -179,7 +179,7 @@ client.loginImplicitGrant(clientId, redirectUri, { state: state })
|
|
|
179
179
|
|
|
180
180
|
**Any platform** Provide an existing auth token
|
|
181
181
|
|
|
182
|
-
```
|
|
182
|
+
```javascript
|
|
183
183
|
const client = platformClient.ApiClient.instance;
|
|
184
184
|
client.setAccessToken(yourAccessToken);
|
|
185
185
|
// Do authenticated things; no authentication function needed
|
|
@@ -207,7 +207,8 @@ By default, the request and response bodies are not logged because these can con
|
|
|
207
207
|
To log to a file, provide a `log_file_path` value. SDK users are responsible for the rotation of the log file. This feature is not available in browser-based applications.
|
|
208
208
|
|
|
209
209
|
Example logging configuration:
|
|
210
|
-
|
|
210
|
+
|
|
211
|
+
```javascript
|
|
211
212
|
client.config.logger.log_level = client.config.logger.logLevelEnum.level.LTrace;
|
|
212
213
|
client.config.logger.log_format = client.config.logger.logFormatEnum.formats.JSON;
|
|
213
214
|
client.config.logger.log_request_body = true;
|
|
@@ -235,7 +236,8 @@ When using `Jest` to test projects containing this SDK you must set `client.conf
|
|
|
235
236
|
> ReferenceError: You are trying to import a file after the Jest environment has been torn down
|
|
236
237
|
|
|
237
238
|
INI:
|
|
238
|
-
|
|
239
|
+
|
|
240
|
+
```ini
|
|
239
241
|
[logging]
|
|
240
242
|
log_level = trace
|
|
241
243
|
log_format = text
|
|
@@ -252,7 +254,8 @@ host = https://api.mypurecloud.com
|
|
|
252
254
|
```
|
|
253
255
|
|
|
254
256
|
JSON:
|
|
255
|
-
|
|
257
|
+
|
|
258
|
+
```json
|
|
256
259
|
{
|
|
257
260
|
"logging": {
|
|
258
261
|
"log_level": "trace",
|
|
@@ -277,7 +280,7 @@ JSON:
|
|
|
277
280
|
|
|
278
281
|
If connecting to a Genesys Cloud environment other than mypurecloud.com (e.g. mypurecloud.ie), set the environment on the `ApiClient` instance with the PureCloudRegionHosts object.
|
|
279
282
|
|
|
280
|
-
```
|
|
283
|
+
```javascript
|
|
281
284
|
const client = platformClient.ApiClient.instance;
|
|
282
285
|
client.setEnvironment(platformClient.PureCloudRegionHosts.eu_west_1);
|
|
283
286
|
```
|
|
@@ -287,7 +290,7 @@ client.setEnvironment(platformClient.PureCloudRegionHosts.eu_west_1);
|
|
|
287
290
|
|
|
288
291
|
In a web environment, it is possible to persist the access token to prevent an authentication request from being made on each page load. To enable this function, simply enable settings persistence prior to attempting a login. To maintain multiple auth tokens in storage, specify the prefix to use for storage/retrieval when enabling persistence. Otherwise, the prefix is optional and will default to `purecloud`.
|
|
289
292
|
|
|
290
|
-
```
|
|
293
|
+
```javascript
|
|
291
294
|
const client = platformClient.ApiClient.instance;
|
|
292
295
|
client.setPersistSettings(true, 'optional_prefix');
|
|
293
296
|
```
|
|
@@ -299,7 +302,7 @@ All API requests return a Promise which resolves to the response body, otherwise
|
|
|
299
302
|
|
|
300
303
|
**Node.js**
|
|
301
304
|
|
|
302
|
-
```
|
|
305
|
+
```javascript
|
|
303
306
|
// Create API instance
|
|
304
307
|
const authorizationApi = new platformClient.AuthorizationApi();
|
|
305
308
|
|
|
@@ -321,7 +324,7 @@ client.loginClientCredentialsGrant(clientId, clientSecret)
|
|
|
321
324
|
|
|
322
325
|
**Web**
|
|
323
326
|
|
|
324
|
-
```
|
|
327
|
+
```javascript
|
|
325
328
|
// Create API instance
|
|
326
329
|
const usersApi = new platformClient.UsersApi();
|
|
327
330
|
|
|
@@ -346,14 +349,14 @@ client.loginImplicitGrant(clientId, redirectUri)
|
|
|
346
349
|
|
|
347
350
|
By default, the SDK will return only the response body as the result of an API function call. To retrieve additional information about the response, enable extended responses. This will return the extended response for all API function calls:
|
|
348
351
|
|
|
349
|
-
```
|
|
352
|
+
```javascript
|
|
350
353
|
const client = platformClient.ApiClient.instance;
|
|
351
354
|
client.setReturnExtendedResponses(true);
|
|
352
355
|
```
|
|
353
356
|
|
|
354
357
|
Extended response object example (`body` and `text` have been truncated):
|
|
355
358
|
|
|
356
|
-
```
|
|
359
|
+
```json
|
|
357
360
|
{
|
|
358
361
|
"status": 200,
|
|
359
362
|
"statusText": "",
|
|
@@ -382,7 +385,7 @@ After both steps have been completed, the configured proxy server will be used f
|
|
|
382
385
|
|
|
383
386
|
NOTE: SDK proxy configuration is only available in the node.js package due to `superagent-proxy`'s incompatibility with browserify. Additionally, `superagent-proxy` is not included a dependency of the SDK and must be provided by your node application's dependencies.
|
|
384
387
|
|
|
385
|
-
```
|
|
388
|
+
```javascript
|
|
386
389
|
const client = platformClient.ApiClient.instance;
|
|
387
390
|
require('superagent-proxy')(client.superagent);
|
|
388
391
|
// Configure settings for your proxy here
|
|
@@ -401,7 +404,7 @@ Error responses will always be thrown as an extended response object. Note that
|
|
|
401
404
|
|
|
402
405
|
Example error response object:
|
|
403
406
|
|
|
404
|
-
```
|
|
407
|
+
```json
|
|
405
408
|
{
|
|
406
409
|
"status": 404,
|
|
407
410
|
"statusText": "",
|
|
@@ -437,4 +440,4 @@ The SDK's version is incremented according to the [Semantic Versioning Specifica
|
|
|
437
440
|
|
|
438
441
|
This package is intended to be forwards compatible with v2 of Genesys Cloud's Platform API. While the general policy for the API is not to introduce breaking changes, there are certain additions and changes to the API that cause breaking changes for the SDK, often due to the way the API is expressed in its swagger definition. Because of this, the SDK can have a major version bump while the API remains at major version 2. While the SDK is intended to be forward compatible, patches will only be released to the latest version. For these reasons, it is strongly recommended that all applications using this SDK are kept up to date and use the latest version of the SDK.
|
|
439
442
|
|
|
440
|
-
For any issues, questions, or suggestions for the SDK, visit the [Genesys Cloud Developer Forum](https://developer.
|
|
443
|
+
For any issues, questions, or suggestions for the SDK, visit the [Genesys Cloud Developer Forum](https://developer.genesys.cloud/forum/).
|