@webex/internal-plugin-lyra 2.59.2 → 2.59.3-next.1
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/.eslintrc.js +6 -6
- package/README.md +42 -42
- package/babel.config.js +3 -3
- package/dist/config.js +2 -2
- package/dist/config.js.map +1 -1
- package/dist/device.js +50 -50
- package/dist/device.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/lyra.js +23 -23
- package/dist/lyra.js.map +1 -1
- package/dist/space.js +83 -83
- package/dist/space.js.map +1 -1
- package/jest.config.js +3 -3
- package/package.json +20 -19
- package/process +1 -1
- package/src/config.js +7 -7
- package/src/device.js +127 -127
- package/src/index.js +20 -20
- package/src/lyra.js +53 -53
- package/src/space.js +367 -367
- package/test/integration/spec/device.js +203 -203
- package/test/integration/spec/space.js +232 -232
- package/test/unit/spec/device.js +65 -65
- package/test/unit/spec/lyra.js +45 -45
- package/test/unit/spec/space.js +189 -189
package/src/device.js
CHANGED
|
@@ -1,127 +1,127 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import {WebexPlugin} from '@webex/webex-core';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @class
|
|
9
|
-
* @extends {Lyra}
|
|
10
|
-
* @memberof Lyra
|
|
11
|
-
*/
|
|
12
|
-
const Device = WebexPlugin.extend({
|
|
13
|
-
namespace: 'Lyra',
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Gets the audio state of the device
|
|
17
|
-
* @param {Types~LyraSpace} space
|
|
18
|
-
* @param {string} space.url
|
|
19
|
-
* @returns {Promise<LyraAudioState>} {volume, microphones, url}
|
|
20
|
-
*/
|
|
21
|
-
getAudioState(space) {
|
|
22
|
-
return this.webex
|
|
23
|
-
.request({
|
|
24
|
-
method: 'GET',
|
|
25
|
-
uri: `${space.url}/audio`,
|
|
26
|
-
})
|
|
27
|
-
.then((res) => res.body);
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Updates audio state for lyra device, should be called every 10 minutes or
|
|
32
|
-
* when mic or volume state is changed
|
|
33
|
-
* @param {Types~LyraSpace} space
|
|
34
|
-
* @param {string} space.url
|
|
35
|
-
* @param {Types~LyraAudioState} audioState
|
|
36
|
-
* @param {object} audioState.volume optional
|
|
37
|
-
* @param {boolean} audioState.volume.level
|
|
38
|
-
* @param {object} audioState.microphones optional
|
|
39
|
-
* @param {boolean} audioState.microphones.muted
|
|
40
|
-
* @param {string} audioState.deviceUrl
|
|
41
|
-
* @returns {Promise}
|
|
42
|
-
*/
|
|
43
|
-
putAudioState(space, audioState = {}) {
|
|
44
|
-
if (!audioState.deviceUrl) {
|
|
45
|
-
return Promise.reject(new Error('audioState.deviceUrl is required'));
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return this.webex
|
|
49
|
-
.request({
|
|
50
|
-
method: 'PUT',
|
|
51
|
-
uri: `${space.url}/audio`,
|
|
52
|
-
body: audioState,
|
|
53
|
-
})
|
|
54
|
-
.then((res) => res.body);
|
|
55
|
-
},
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Mutes lyra device
|
|
59
|
-
* @param {Types~LyraSpace} space
|
|
60
|
-
* @param {string} space.url
|
|
61
|
-
* @returns {Promise}
|
|
62
|
-
*/
|
|
63
|
-
mute(space) {
|
|
64
|
-
return this.webex.request({
|
|
65
|
-
method: 'POST',
|
|
66
|
-
uri: `${space.url}/audio/microphones/actions/mute/invoke`,
|
|
67
|
-
});
|
|
68
|
-
},
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Unmutes lyra device
|
|
72
|
-
* @param {Types~LyraSpace} space
|
|
73
|
-
* @param {string} space.url
|
|
74
|
-
* @returns {Promise}
|
|
75
|
-
*/
|
|
76
|
-
unmute(space) {
|
|
77
|
-
return this.webex.request({
|
|
78
|
-
method: 'POST',
|
|
79
|
-
uri: `${space.url}/audio/microphones/actions/un-mute/invoke`,
|
|
80
|
-
});
|
|
81
|
-
},
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Increases lyra device's volume
|
|
85
|
-
* @param {Types~LyraSpace} space
|
|
86
|
-
* @param {string} space.url
|
|
87
|
-
* @returns {Promise}
|
|
88
|
-
*/
|
|
89
|
-
increaseVolume(space) {
|
|
90
|
-
return this.webex.request({
|
|
91
|
-
method: 'POST',
|
|
92
|
-
uri: `${space.url}/audio/volume/actions/increase/invoke`,
|
|
93
|
-
});
|
|
94
|
-
},
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Decreases lyra device's volume
|
|
98
|
-
* @param {Types~LyraSpace} space
|
|
99
|
-
* @param {string} space.url
|
|
100
|
-
* @returns {Promise}
|
|
101
|
-
*/
|
|
102
|
-
decreaseVolume(space) {
|
|
103
|
-
return this.webex.request({
|
|
104
|
-
method: 'POST',
|
|
105
|
-
uri: `${space.url}/audio/volume/actions/decrease/invoke`,
|
|
106
|
-
});
|
|
107
|
-
},
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Sets lyra device's volume but should use increase and decrease api instead
|
|
111
|
-
* @param {Types~LyraSpace} space
|
|
112
|
-
* @param {string} space.url
|
|
113
|
-
* @param {integer} level to be set
|
|
114
|
-
* @returns {Promise}
|
|
115
|
-
*/
|
|
116
|
-
setVolume(space, level = 0) {
|
|
117
|
-
return this.webex.request({
|
|
118
|
-
method: 'POST',
|
|
119
|
-
uri: `${space.url}/audio/volume/actions/set/invoke`,
|
|
120
|
-
body: {
|
|
121
|
-
level,
|
|
122
|
-
},
|
|
123
|
-
});
|
|
124
|
-
},
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
export default Device;
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import {WebexPlugin} from '@webex/webex-core';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @class
|
|
9
|
+
* @extends {Lyra}
|
|
10
|
+
* @memberof Lyra
|
|
11
|
+
*/
|
|
12
|
+
const Device = WebexPlugin.extend({
|
|
13
|
+
namespace: 'Lyra',
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Gets the audio state of the device
|
|
17
|
+
* @param {Types~LyraSpace} space
|
|
18
|
+
* @param {string} space.url
|
|
19
|
+
* @returns {Promise<LyraAudioState>} {volume, microphones, url}
|
|
20
|
+
*/
|
|
21
|
+
getAudioState(space) {
|
|
22
|
+
return this.webex
|
|
23
|
+
.request({
|
|
24
|
+
method: 'GET',
|
|
25
|
+
uri: `${space.url}/audio`,
|
|
26
|
+
})
|
|
27
|
+
.then((res) => res.body);
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Updates audio state for lyra device, should be called every 10 minutes or
|
|
32
|
+
* when mic or volume state is changed
|
|
33
|
+
* @param {Types~LyraSpace} space
|
|
34
|
+
* @param {string} space.url
|
|
35
|
+
* @param {Types~LyraAudioState} audioState
|
|
36
|
+
* @param {object} audioState.volume optional
|
|
37
|
+
* @param {boolean} audioState.volume.level
|
|
38
|
+
* @param {object} audioState.microphones optional
|
|
39
|
+
* @param {boolean} audioState.microphones.muted
|
|
40
|
+
* @param {string} audioState.deviceUrl
|
|
41
|
+
* @returns {Promise}
|
|
42
|
+
*/
|
|
43
|
+
putAudioState(space, audioState = {}) {
|
|
44
|
+
if (!audioState.deviceUrl) {
|
|
45
|
+
return Promise.reject(new Error('audioState.deviceUrl is required'));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return this.webex
|
|
49
|
+
.request({
|
|
50
|
+
method: 'PUT',
|
|
51
|
+
uri: `${space.url}/audio`,
|
|
52
|
+
body: audioState,
|
|
53
|
+
})
|
|
54
|
+
.then((res) => res.body);
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Mutes lyra device
|
|
59
|
+
* @param {Types~LyraSpace} space
|
|
60
|
+
* @param {string} space.url
|
|
61
|
+
* @returns {Promise}
|
|
62
|
+
*/
|
|
63
|
+
mute(space) {
|
|
64
|
+
return this.webex.request({
|
|
65
|
+
method: 'POST',
|
|
66
|
+
uri: `${space.url}/audio/microphones/actions/mute/invoke`,
|
|
67
|
+
});
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Unmutes lyra device
|
|
72
|
+
* @param {Types~LyraSpace} space
|
|
73
|
+
* @param {string} space.url
|
|
74
|
+
* @returns {Promise}
|
|
75
|
+
*/
|
|
76
|
+
unmute(space) {
|
|
77
|
+
return this.webex.request({
|
|
78
|
+
method: 'POST',
|
|
79
|
+
uri: `${space.url}/audio/microphones/actions/un-mute/invoke`,
|
|
80
|
+
});
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Increases lyra device's volume
|
|
85
|
+
* @param {Types~LyraSpace} space
|
|
86
|
+
* @param {string} space.url
|
|
87
|
+
* @returns {Promise}
|
|
88
|
+
*/
|
|
89
|
+
increaseVolume(space) {
|
|
90
|
+
return this.webex.request({
|
|
91
|
+
method: 'POST',
|
|
92
|
+
uri: `${space.url}/audio/volume/actions/increase/invoke`,
|
|
93
|
+
});
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Decreases lyra device's volume
|
|
98
|
+
* @param {Types~LyraSpace} space
|
|
99
|
+
* @param {string} space.url
|
|
100
|
+
* @returns {Promise}
|
|
101
|
+
*/
|
|
102
|
+
decreaseVolume(space) {
|
|
103
|
+
return this.webex.request({
|
|
104
|
+
method: 'POST',
|
|
105
|
+
uri: `${space.url}/audio/volume/actions/decrease/invoke`,
|
|
106
|
+
});
|
|
107
|
+
},
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Sets lyra device's volume but should use increase and decrease api instead
|
|
111
|
+
* @param {Types~LyraSpace} space
|
|
112
|
+
* @param {string} space.url
|
|
113
|
+
* @param {integer} level to be set
|
|
114
|
+
* @returns {Promise}
|
|
115
|
+
*/
|
|
116
|
+
setVolume(space, level = 0) {
|
|
117
|
+
return this.webex.request({
|
|
118
|
+
method: 'POST',
|
|
119
|
+
uri: `${space.url}/audio/volume/actions/set/invoke`,
|
|
120
|
+
body: {
|
|
121
|
+
level,
|
|
122
|
+
},
|
|
123
|
+
});
|
|
124
|
+
},
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
export default Device;
|
package/src/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import '@webex/internal-plugin-mercury';
|
|
6
|
-
import '@webex/internal-plugin-encryption';
|
|
7
|
-
import '@webex/internal-plugin-conversation';
|
|
8
|
-
import '@webex/internal-plugin-feature';
|
|
9
|
-
|
|
10
|
-
import {registerInternalPlugin} from '@webex/webex-core';
|
|
11
|
-
|
|
12
|
-
import Lyra from './lyra';
|
|
13
|
-
import config from './config';
|
|
14
|
-
|
|
15
|
-
registerInternalPlugin('lyra', Lyra, {
|
|
16
|
-
config,
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
export {default} from './lyra';
|
|
20
|
-
export {config};
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import '@webex/internal-plugin-mercury';
|
|
6
|
+
import '@webex/internal-plugin-encryption';
|
|
7
|
+
import '@webex/internal-plugin-conversation';
|
|
8
|
+
import '@webex/internal-plugin-feature';
|
|
9
|
+
|
|
10
|
+
import {registerInternalPlugin} from '@webex/webex-core';
|
|
11
|
+
|
|
12
|
+
import Lyra from './lyra';
|
|
13
|
+
import config from './config';
|
|
14
|
+
|
|
15
|
+
registerInternalPlugin('lyra', Lyra, {
|
|
16
|
+
config,
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export {default} from './lyra';
|
|
20
|
+
export {config};
|
package/src/lyra.js
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import {WebexPlugin} from '@webex/webex-core';
|
|
6
|
-
|
|
7
|
-
import Space from './space';
|
|
8
|
-
import Device from './device';
|
|
9
|
-
|
|
10
|
-
const Lyra = WebexPlugin.extend({
|
|
11
|
-
/**
|
|
12
|
-
* @typedef {Object} Endpoint
|
|
13
|
-
* @property {Object} advertiser
|
|
14
|
-
* @property {string} advertiser.id
|
|
15
|
-
* @property {string} advertiser.displayName
|
|
16
|
-
* @property {string} advertiser.orgId
|
|
17
|
-
* @property {Object} links
|
|
18
|
-
* @property {Object} links.addMeToSpace
|
|
19
|
-
* @property {string} links.addMeToSpace.href
|
|
20
|
-
* @property {string} links.addMeToSpace.method
|
|
21
|
-
* @property {Object} links.lyra_space
|
|
22
|
-
* @property {string} links.lyra_space.href
|
|
23
|
-
* @property {string} links.lyra_space.method
|
|
24
|
-
* @property {string} proof
|
|
25
|
-
* @property {Object} token
|
|
26
|
-
* @property {string} token.value
|
|
27
|
-
*/
|
|
28
|
-
namespace: 'Lyra',
|
|
29
|
-
children: {
|
|
30
|
-
space: Space,
|
|
31
|
-
device: Device,
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Get the endpoint information
|
|
36
|
-
* @param {string} token - ultrasound token decoded
|
|
37
|
-
* @returns {Promise<Endpoint>}
|
|
38
|
-
*/
|
|
39
|
-
getAdvertisedEndpoint(token) {
|
|
40
|
-
return this.webex
|
|
41
|
-
.request({
|
|
42
|
-
method: 'GET',
|
|
43
|
-
api: 'proximity',
|
|
44
|
-
resource: '/ultrasound/advertisements',
|
|
45
|
-
qs: {
|
|
46
|
-
token,
|
|
47
|
-
},
|
|
48
|
-
})
|
|
49
|
-
.then((res) => res.body);
|
|
50
|
-
},
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
export default Lyra;
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import {WebexPlugin} from '@webex/webex-core';
|
|
6
|
+
|
|
7
|
+
import Space from './space';
|
|
8
|
+
import Device from './device';
|
|
9
|
+
|
|
10
|
+
const Lyra = WebexPlugin.extend({
|
|
11
|
+
/**
|
|
12
|
+
* @typedef {Object} Endpoint
|
|
13
|
+
* @property {Object} advertiser
|
|
14
|
+
* @property {string} advertiser.id
|
|
15
|
+
* @property {string} advertiser.displayName
|
|
16
|
+
* @property {string} advertiser.orgId
|
|
17
|
+
* @property {Object} links
|
|
18
|
+
* @property {Object} links.addMeToSpace
|
|
19
|
+
* @property {string} links.addMeToSpace.href
|
|
20
|
+
* @property {string} links.addMeToSpace.method
|
|
21
|
+
* @property {Object} links.lyra_space
|
|
22
|
+
* @property {string} links.lyra_space.href
|
|
23
|
+
* @property {string} links.lyra_space.method
|
|
24
|
+
* @property {string} proof
|
|
25
|
+
* @property {Object} token
|
|
26
|
+
* @property {string} token.value
|
|
27
|
+
*/
|
|
28
|
+
namespace: 'Lyra',
|
|
29
|
+
children: {
|
|
30
|
+
space: Space,
|
|
31
|
+
device: Device,
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Get the endpoint information
|
|
36
|
+
* @param {string} token - ultrasound token decoded
|
|
37
|
+
* @returns {Promise<Endpoint>}
|
|
38
|
+
*/
|
|
39
|
+
getAdvertisedEndpoint(token) {
|
|
40
|
+
return this.webex
|
|
41
|
+
.request({
|
|
42
|
+
method: 'GET',
|
|
43
|
+
api: 'proximity',
|
|
44
|
+
resource: '/ultrasound/advertisements',
|
|
45
|
+
qs: {
|
|
46
|
+
token,
|
|
47
|
+
},
|
|
48
|
+
})
|
|
49
|
+
.then((res) => res.body);
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
export default Lyra;
|