-
Notifications
You must be signed in to change notification settings - Fork 41
/
util.js
54 lines (49 loc) · 1.26 KB
/
util.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import {createTestUser, removeTestUser} from '@webex/test-users';
import Webex from 'webex';
/**
* Creates a test user
* @param {object} [options={}] See https://github.com/webex/webex-js-sdk/blob/master/packages/node_modules/%40webex/test-users/src/index.js#L117
* @returns {Promise<object>}
*/
export async function createUser(options = {}) {
options = {
clientId: process.env.WEBEX_CLIENT_ID,
clientSecret: process.env.WEBEX_CLIENT_SECRET,
idbrokerUrl: process.env.IDBROKER_BASE_URL,
cigServiceUrl: process.env.WEBEX_TEST_USERS_CI_GATEWAY_SERVICE_URL,
...options,
};
const user = await createTestUser(options);
return user;
}
/**
* Creates a new SDK instance
* @param {string} accessToken
* @returns {Webex} The new instance
*/
export function createSdkInstance(accessToken) {
return new Webex({
credentials: {
access_token: process.env.WEBEX_ACCESS_TOKEN || accessToken,
},
config: {
meetings: {
experimental: {
enableUnifiedMeetings: true,
enableAdhocMeetings: true
},
},
logger: {
level: 'error',
},
},
});
}
/**
* Removes a user
* @param {object} user
* @returns {Promise}
*/
export function removeUser(user) {
return removeTestUser(user);
}