Skip to content

Commit b7ef230

Browse files
author
PureCloud Jenkins
committed
113.1.0
1 parent ed7fc7f commit b7ef230

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+3232
-34957
lines changed

README.md

Lines changed: 15 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ For direct use in a browser script:
2727

2828
```{"language":"html"}
2929
<!-- Include the CJS SDK -->
30-
<script src="https://sdk-cdn.mypurecloud.com/javascript/113.0.0/purecloud-platform-client-v2.min.js"></script>
30+
<script src="https://sdk-cdn.mypurecloud.com/javascript/113.1.0/purecloud-platform-client-v2.min.js"></script>
3131
3232
<script type="text/javascript">
3333
// Obtain a reference to the platformClient object
@@ -44,7 +44,7 @@ For direct use in a browser script:
4444
4545
<script type="text/javascript">
4646
// Obtain a reference to the platformClient object
47-
requirejs(['https://sdk-cdn.mypurecloud.com/javascript/amd/113.0.0/purecloud-platform-client-v2.min.js'], (platformClient) => {
47+
requirejs(['https://sdk-cdn.mypurecloud.com/javascript/amd/113.1.0/purecloud-platform-client-v2.min.js'], (platformClient) => {
4848
console.log(platformClient);
4949
});
5050
</script>
@@ -126,12 +126,12 @@ client.loginCodeAuthorizationGrant(clientId,clientSecret,authCode,redirectUri)
126126
});
127127
```
128128

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-
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.
129+
By default the SDK will transparently request a new access token when it expires. 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 _refreshTokenWaitTime_ field of the _ApiClient_ object.
130+
If you wish to apply the refresh logic yourself, set _shouldRefreshAccessToken_ 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.
131131

132132
```{"language":"javascript"}
133133
const client = platformClient.ApiClient.instance;
134-
client.config.refresh_access_token = false;
134+
client.shouldRefreshAccessToken = false;
135135
client.loginCodeAuthorizationGrant(clientId,clientSecret,authCode,redirectUri)
136136
.then((authData) => {
137137
refreshToken = authData.refreshToken;
@@ -189,83 +189,6 @@ client.setAccessToken(yourAccessToken);
189189

190190
When authenticating in a browser using `loginClientCredentialsGrant(...)`, if the user completes the authentication process but their session is unable to be authorized, they will still be redirected back to the redirect URI. When `loginClientCredentialsGrant(...)` is invoked after the failure redirect, the promise returned will be rejected with an error message built from the `error` and `error_description`. The error information, as well as the state, can be accessed via `platformClient.ApiClient.instance.authData`. The application is expected to identify these login failures and interact with the user in a manner appropriate for the application.
191191

192-
## SDK Logging
193-
194-
Logging of API requests and responses can be controlled by a number of parameters on the `Configuration`'s `Logger` instance.
195-
196-
`log_level` values:
197-
1. LTrace (HTTP Method, URL, Request Body, HTTP Status Code, Request Headers, Response Headers)
198-
2. LDebug (HTTP Method, URL, Request Body, HTTP Status Code, Request Headers)
199-
3. LError (HTTP Method, URL, Request Body, Response Body, HTTP Status Code, Request Headers, Response Headers)
200-
4. LNone - default
201-
202-
`log_format` values:
203-
1. JSON
204-
2. TEXT - default
205-
206-
By default, the request and response bodies are not logged because these can contain PII. Be mindful of this data if choosing to log it.
207-
To log to a file, provide a `log_file_path` value. SDK users are responsible for the rotation of the log file.
208-
209-
Example logging configuration:
210-
```{"language":"javascript"}
211-
client.config.logger.log_level = client.config.logger.logLevelEnum.level.LTrace;
212-
client.config.logger.log_format = client.config.logger.logFormatEnum.formats.JSON;
213-
client.config.logger.log_request_body = true;
214-
client.config.logger.log_response_body = true;
215-
client.config.logger.log_to_console = true;
216-
client.config.logger.log_file_path = "/var/log/javascriptsdk.log";
217-
218-
client.config.logger.setLogger(); // To apply above changes
219-
```
220-
221-
#### Configuration file
222-
223-
A number of configuration parameters can be applied using a configuration file. There are two sources for this file:
224-
225-
1. The SDK will look for `%USERPROFILE%\.genesyscloudjavascript\config` on Windows if the environment variable USERPROFILE is defined, otherwise uses the path to the profile directory of the current user as home, or `$HOME/.genesyscloudjavascript/config` on Unix.
226-
2. Provide a valid file path to `client.config.setConfigPath()`
227-
228-
The SDK will constantly check to see if the config file has been updated, regardless of whether a config file was present at start-up. To disable this behaviour, set `client.config.live_reload_config` to false.
229-
INI and JSON formats are supported. See below for examples of configuration values in both formats:
230-
231-
INI:
232-
```{"language":"ini"}
233-
[logging]
234-
log_level = trace
235-
log_format = text
236-
log_to_console = false
237-
log_file_path = /var/log/javascriptsdk.log
238-
log_response_body = false
239-
log_request_body = false
240-
[reauthentication]
241-
refresh_access_token = true
242-
refresh_token_wait_max = 10
243-
[general]
244-
live_reload_config = true
245-
host = https://api.mypurecloud.com
246-
```
247-
248-
JSON:
249-
```{"language":"json"}
250-
{
251-
"logging": {
252-
"log_level": "trace",
253-
"log_format": "text",
254-
"log_to_console": false,
255-
"log_file_path": "/var/log/javascriptsdk.log",
256-
"log_response_body": false,
257-
"log_request_body": false
258-
},
259-
"reauthentication": {
260-
"refresh_access_token": true,
261-
"refresh_token_wait_max": 10
262-
},
263-
"general": {
264-
"live_reload_config": true,
265-
"host": "https://api.mypurecloud.com"
266-
}
267-
}
268-
```
269192

270193
## Environments
271194

@@ -428,6 +351,16 @@ Example error response object:
428351
```
429352

430353

354+
## Debug Logging
355+
356+
There are hooks to trace requests and responses. To enable debug tracing, provide a log object. Optionally, specify a maximum number of lines. If specified, the response body trace will be truncated. If not specified, the entire response body will be traced out.
357+
358+
```{"language":"javascript"}
359+
const client = platformClient.ApiClient.instance;
360+
client.setDebugLog(console.log, 25);
361+
```
362+
363+
431364
## Versioning
432365

433366
The SDK's version is incremented according to the [Semantic Versioning Specification](https://semver.org/). The decision to increment version numbers is determined by [diffing the Platform API's swagger](https://github.com/purecloudlabs/platform-client-sdk-common/blob/master/modules/swaggerDiff.js) for automated builds, and optionally forcing a version bump when a build is triggered manually (e.g. releasing a bugfix).

build/README.md

Lines changed: 15 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ For direct use in a browser script:
2727

2828
```{"language":"html"}
2929
<!-- Include the CJS SDK -->
30-
<script src="https://sdk-cdn.mypurecloud.com/javascript/113.0.0/purecloud-platform-client-v2.min.js"></script>
30+
<script src="https://sdk-cdn.mypurecloud.com/javascript/113.1.0/purecloud-platform-client-v2.min.js"></script>
3131
3232
<script type="text/javascript">
3333
// Obtain a reference to the platformClient object
@@ -44,7 +44,7 @@ For direct use in a browser script:
4444
4545
<script type="text/javascript">
4646
// Obtain a reference to the platformClient object
47-
requirejs(['https://sdk-cdn.mypurecloud.com/javascript/amd/113.0.0/purecloud-platform-client-v2.min.js'], (platformClient) => {
47+
requirejs(['https://sdk-cdn.mypurecloud.com/javascript/amd/113.1.0/purecloud-platform-client-v2.min.js'], (platformClient) => {
4848
console.log(platformClient);
4949
});
5050
</script>
@@ -126,12 +126,12 @@ client.loginCodeAuthorizationGrant(clientId,clientSecret,authCode,redirectUri)
126126
});
127127
```
128128

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-
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.
129+
By default the SDK will transparently request a new access token when it expires. 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 _refreshTokenWaitTime_ field of the _ApiClient_ object.
130+
If you wish to apply the refresh logic yourself, set _shouldRefreshAccessToken_ 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.
131131

132132
```{"language":"javascript"}
133133
const client = platformClient.ApiClient.instance;
134-
client.config.refresh_access_token = false;
134+
client.shouldRefreshAccessToken = false;
135135
client.loginCodeAuthorizationGrant(clientId,clientSecret,authCode,redirectUri)
136136
.then((authData) => {
137137
refreshToken = authData.refreshToken;
@@ -189,83 +189,6 @@ client.setAccessToken(yourAccessToken);
189189

190190
When authenticating in a browser using `loginClientCredentialsGrant(...)`, if the user completes the authentication process but their session is unable to be authorized, they will still be redirected back to the redirect URI. When `loginClientCredentialsGrant(...)` is invoked after the failure redirect, the promise returned will be rejected with an error message built from the `error` and `error_description`. The error information, as well as the state, can be accessed via `platformClient.ApiClient.instance.authData`. The application is expected to identify these login failures and interact with the user in a manner appropriate for the application.
191191

192-
## SDK Logging
193-
194-
Logging of API requests and responses can be controlled by a number of parameters on the `Configuration`'s `Logger` instance.
195-
196-
`log_level` values:
197-
1. LTrace (HTTP Method, URL, Request Body, HTTP Status Code, Request Headers, Response Headers)
198-
2. LDebug (HTTP Method, URL, Request Body, HTTP Status Code, Request Headers)
199-
3. LError (HTTP Method, URL, Request Body, Response Body, HTTP Status Code, Request Headers, Response Headers)
200-
4. LNone - default
201-
202-
`log_format` values:
203-
1. JSON
204-
2. TEXT - default
205-
206-
By default, the request and response bodies are not logged because these can contain PII. Be mindful of this data if choosing to log it.
207-
To log to a file, provide a `log_file_path` value. SDK users are responsible for the rotation of the log file.
208-
209-
Example logging configuration:
210-
```{"language":"javascript"}
211-
client.config.logger.log_level = client.config.logger.logLevelEnum.level.LTrace;
212-
client.config.logger.log_format = client.config.logger.logFormatEnum.formats.JSON;
213-
client.config.logger.log_request_body = true;
214-
client.config.logger.log_response_body = true;
215-
client.config.logger.log_to_console = true;
216-
client.config.logger.log_file_path = "/var/log/javascriptsdk.log";
217-
218-
client.config.logger.setLogger(); // To apply above changes
219-
```
220-
221-
#### Configuration file
222-
223-
A number of configuration parameters can be applied using a configuration file. There are two sources for this file:
224-
225-
1. The SDK will look for `%USERPROFILE%\.genesyscloudjavascript\config` on Windows if the environment variable USERPROFILE is defined, otherwise uses the path to the profile directory of the current user as home, or `$HOME/.genesyscloudjavascript/config` on Unix.
226-
2. Provide a valid file path to `client.config.setConfigPath()`
227-
228-
The SDK will constantly check to see if the config file has been updated, regardless of whether a config file was present at start-up. To disable this behaviour, set `client.config.live_reload_config` to false.
229-
INI and JSON formats are supported. See below for examples of configuration values in both formats:
230-
231-
INI:
232-
```{"language":"ini"}
233-
[logging]
234-
log_level = trace
235-
log_format = text
236-
log_to_console = false
237-
log_file_path = /var/log/javascriptsdk.log
238-
log_response_body = false
239-
log_request_body = false
240-
[reauthentication]
241-
refresh_access_token = true
242-
refresh_token_wait_max = 10
243-
[general]
244-
live_reload_config = true
245-
host = https://api.mypurecloud.com
246-
```
247-
248-
JSON:
249-
```{"language":"json"}
250-
{
251-
"logging": {
252-
"log_level": "trace",
253-
"log_format": "text",
254-
"log_to_console": false,
255-
"log_file_path": "/var/log/javascriptsdk.log",
256-
"log_response_body": false,
257-
"log_request_body": false
258-
},
259-
"reauthentication": {
260-
"refresh_access_token": true,
261-
"refresh_token_wait_max": 10
262-
},
263-
"general": {
264-
"live_reload_config": true,
265-
"host": "https://api.mypurecloud.com"
266-
}
267-
}
268-
```
269192

270193
## Environments
271194

@@ -428,6 +351,16 @@ Example error response object:
428351
```
429352

430353

354+
## Debug Logging
355+
356+
There are hooks to trace requests and responses. To enable debug tracing, provide a log object. Optionally, specify a maximum number of lines. If specified, the response body trace will be truncated. If not specified, the entire response body will be traced out.
357+
358+
```{"language":"javascript"}
359+
const client = platformClient.ApiClient.instance;
360+
client.setDebugLog(console.log, 25);
361+
```
362+
363+
431364
## Versioning
432365

433366
The SDK's version is incremented according to the [Semantic Versioning Specification](https://semver.org/). The decision to increment version numbers is determined by [diffing the Platform API's swagger](https://github.com/purecloudlabs/platform-client-sdk-common/blob/master/modules/swaggerDiff.js) for automated builds, and optionally forcing a version bump when a build is triggered manually (e.g. releasing a bugfix).

0 commit comments

Comments
 (0)