Skip to content

Commit 130e4d7

Browse files
author
PureCloud Jenkins
committed
43.0.1
1 parent 8803ceb commit 130e4d7

File tree

101 files changed

+15981
-17076
lines changed

Some content is hidden

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

101 files changed

+15981
-17076
lines changed

README.md

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -13,41 +13,41 @@ A JavaScript library to interface with the PureCloud Platform API. View the docu
1313

1414
For node.js via [NPM](https://www.npmjs.com/package/purecloud-platform-client-v2):
1515

16-
~~~ sh
16+
```{"language":"sh"}
1717
npm install purecloud-platform-client-v2
18-
~~~
18+
```
1919

20-
~~~ javascript
20+
```{"language":"javascript"}
2121
// Obtain a reference to the platformClient object
2222
const platformClient = require('purecloud-platform-client-v2');
23-
~~~
23+
```
2424

2525
For direct use in a browser script:
2626

27-
~~~ html
27+
```{"language":"html"}
2828
<!-- Include the CJS SDK -->
29-
<script src="https://sdk-cdn.mypurecloud.com/javascript/43.0.0/purecloud-platform-client-v2.min.js"></script>
29+
<script src="https://sdk-cdn.mypurecloud.com/javascript/43.0.1/purecloud-platform-client-v2.min.js"></script>
3030
3131
<script type="text/javascript">
3232
// Obtain a reference to the platformClient object
3333
const platformClient = require('platformClient');
3434
</script>
35-
~~~
35+
```
3636

3737

3838
## AMD
3939

40-
~~~ html
40+
```{"language":"html"}
4141
<!-- Include requirejs -->
4242
<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.5/require.min.js"></script>
4343
4444
<script type="text/javascript">
4545
// Obtain a reference to the platformClient object
46-
requirejs(['https://sdk-cdn.mypurecloud.com/javascript/amd/43.0.0/purecloud-platform-client-v2.min.js'], (platformClient) => {
46+
requirejs(['https://sdk-cdn.mypurecloud.com/javascript/amd/43.0.1/purecloud-platform-client-v2.min.js'], (platformClient) => {
4747
console.log(platformClient);
4848
});
4949
</script>
50-
~~~
50+
```
5151

5252
## ES6 Classes and Other Entry Points
5353

@@ -74,7 +74,7 @@ After authentication has completed, the access token is stored on the `ApiClient
7474

7575
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.
7676

77-
~~~ javascript
77+
```{"language":"javascript"}
7878
const client = platformClient.ApiClient.instance;
7979
client.loginClientCredentialsGrant(clientId, clientSecret)
8080
.then(() => {
@@ -84,7 +84,7 @@ client.loginClientCredentialsGrant(clientId, clientSecret)
8484
// Handle failure response
8585
console.log(err);
8686
});
87-
~~~
87+
```
8888

8989
**Web** [Implicit grant](https://developer.mypurecloud.com/api/rest/authorization/use-implicit-grant.html)
9090

@@ -94,7 +94,7 @@ Optional parameters may be specified in the optional third parameter for `loginI
9494

9595
* `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.
9696

97-
~~~ javascript
97+
```{"language":"javascript"}
9898
const client = platformClient.ApiClient.instance;
9999
client.loginImplicitGrant(clientId, redirectUri, { state: state })
100100
.then((data) => {
@@ -105,35 +105,35 @@ client.loginImplicitGrant(clientId, redirectUri, { state: state })
105105
// Handle failure response
106106
console.log(err);
107107
});
108-
~~~
108+
```
109109

110110
**Any platform** Provide an existing auth token
111111

112-
~~~ javascript
112+
```{"language":"javascript"}
113113
const client = platformClient.ApiClient.instance;
114114
client.setAccessToken(yourAccessToken);
115115
// Do authenticated things; no authentication function needed
116-
~~~
116+
```
117117

118118

119119
## Environments
120120

121121
If connecting to a PureCloud environment other than mypurecloud.com (e.g. mypurecloud.ie), set the environment on the `ApiClient` instance.
122122

123-
~~~ js
123+
```{"language":"javascript"}
124124
const client = platformClient.ApiClient.instance;
125125
client.setEnvironment('mypurecloud.ie');
126-
~~~
126+
```
127127

128128

129129
## Access Token persistence
130130

131131
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`.
132132

133-
~~~ js
133+
```{"language":"javascript"}
134134
const client = platformClient.ApiClient.instance;
135135
client.setPersistSettings(true, 'optional_prefix');
136-
~~~
136+
```
137137

138138

139139
## Making Requests
@@ -142,7 +142,7 @@ All API requests return a Promise which resolves to the response body, otherwise
142142

143143
**Node.js**
144144

145-
~~~ js
145+
```{"language":"javascript"}
146146
// Create API instance
147147
const authorizationApi = new platformClient.AuthorizationApi();
148148
@@ -160,11 +160,11 @@ client.loginClientCredentialsGrant(clientId, clientSecret)
160160
// Handle failure response
161161
console.log(err);
162162
});
163-
~~~
163+
```
164164

165165
**Web**
166166

167-
~~~ js
167+
```{"language":"javascript"}
168168
// Create API instance
169169
const usersApi = new platformClient.UsersApi();
170170
@@ -182,21 +182,21 @@ client.loginImplicitGrant(clientId, redirectUri)
182182
// Handle failure response
183183
console.log(err);
184184
});
185-
~~~
185+
```
186186

187187

188188
### Extended Responses
189189

190190
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:
191191

192-
~~~ js
192+
```{"language":"javascript"}
193193
const client = platformClient.ApiClient.instance;
194194
client.setReturnExtendedResponses(true);
195-
~~~
195+
```
196196

197197
Extended response object example (`body` and `text` have been truncated):
198198

199-
~~~ json
199+
```{"language":"json"}
200200
{
201201
"status": 200,
202202
"statusText": "",
@@ -214,7 +214,7 @@ Extended response object example (`body` and `text` have been truncated):
214214
"text": "",
215215
"error": null
216216
}
217-
~~~
217+
```
218218

219219

220220
### Using a Proxy (Node.js only)
@@ -228,7 +228,7 @@ After both steps have been completed, the configured proxy server will be used f
228228

229229
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.
230230

231-
~~~ js
231+
```{"language":"javascript"}
232232
const client = platformClient.ApiClient.instance;
233233
require('superagent-proxy')(client.superagent);
234234
// Configure settings for your proxy here
@@ -238,7 +238,7 @@ client.proxy = {
238238
port: 443,
239239
protocol: 'https',
240240
};
241-
~~~
241+
```
242242

243243

244244
### Error Responses
@@ -247,7 +247,7 @@ Error responses will always be thrown as an extended response object. Note that
247247

248248
Example error response object:
249249

250-
~~~ json
250+
```{"language":"json"}
251251
{
252252
"status": 404,
253253
"statusText": "",
@@ -274,17 +274,17 @@ Example error response object:
274274
"original": null
275275
}
276276
}
277-
~~~
277+
```
278278

279279

280280
## Debug Logging
281281

282282
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.
283283

284-
~~~ js
284+
```{"language":"javascript"}
285285
const client = platformClient.ApiClient.instance;
286286
client.setDebugLog(console.log, 25);
287-
~~~
287+
```
288288

289289

290290
## Versioning

0 commit comments

Comments
 (0)