@webex/plugin-teams 2.59.1 → 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 CHANGED
@@ -1,6 +1,6 @@
1
- const config = {
2
- root: true,
3
- extends: ['@webex/eslint-config-legacy'],
4
- };
5
-
6
- module.exports = config;
1
+ const config = {
2
+ root: true,
3
+ extends: ['@webex/eslint-config-legacy'],
4
+ };
5
+
6
+ module.exports = config;
package/README.md CHANGED
@@ -1,50 +1,50 @@
1
- # @webex/plugin-teams
2
-
3
- [![standard-readme compliant](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)
4
-
5
- > Teams plugin for the Cisco Webex JS SDK.
6
-
7
- - [Install](#install)
8
- - [Usage](#usage)
9
- - [Contribute](#contribute)
10
- - [Maintainers](#maintainers)
11
- - [License](#license)
12
-
13
- ## Install
14
-
15
- ```bash
16
- npm install --save @webex/plugin-teams
17
- ```
18
-
19
- ## Usage
20
-
21
- This is a plugin for the Cisco Webex JS SDK . Please see our [developer portal](https://developer.webex.com/) and the [API docs](https://webex.github.io/webex-js-sdk/api/) for full details.
22
-
23
- ## Install
24
-
25
- ```bash
26
- npm install --save @webex/plugin-teams
27
- ```
28
-
29
- ## Usage
30
-
31
- ```js
32
- const Webex = require('webex');
33
-
34
- const webex = Webex.init();
35
- webex.teams.get(id).then((team) => {
36
- console.log(team);
37
- });
38
- ```
39
-
40
- ## Maintainers
41
-
42
- This package is maintained by [Cisco Webex for Developers](https://developer.webex.com/).
43
-
44
- ## Contribute
45
-
46
- Pull requests welcome. Please see [CONTRIBUTING.md](https://github.com/webex/webex-js-sdk/blob/master/CONTRIBUTING.md) for more details.
47
-
48
- ## License
49
-
50
- © 2016-2020 Cisco and/or its affiliates. All Rights Reserved.
1
+ # @webex/plugin-teams
2
+
3
+ [![standard-readme compliant](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)
4
+
5
+ > Teams plugin for the Cisco Webex JS SDK.
6
+
7
+ - [Install](#install)
8
+ - [Usage](#usage)
9
+ - [Contribute](#contribute)
10
+ - [Maintainers](#maintainers)
11
+ - [License](#license)
12
+
13
+ ## Install
14
+
15
+ ```bash
16
+ npm install --save @webex/plugin-teams
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ This is a plugin for the Cisco Webex JS SDK . Please see our [developer portal](https://developer.webex.com/) and the [API docs](https://webex.github.io/webex-js-sdk/api/) for full details.
22
+
23
+ ## Install
24
+
25
+ ```bash
26
+ npm install --save @webex/plugin-teams
27
+ ```
28
+
29
+ ## Usage
30
+
31
+ ```js
32
+ const Webex = require('webex');
33
+
34
+ const webex = Webex.init();
35
+ webex.teams.get(id).then((team) => {
36
+ console.log(team);
37
+ });
38
+ ```
39
+
40
+ ## Maintainers
41
+
42
+ This package is maintained by [Cisco Webex for Developers](https://developer.webex.com/).
43
+
44
+ ## Contribute
45
+
46
+ Pull requests welcome. Please see [CONTRIBUTING.md](https://github.com/webex/webex-js-sdk/blob/master/CONTRIBUTING.md) for more details.
47
+
48
+ ## License
49
+
50
+ © 2016-2020 Cisco and/or its affiliates. All Rights Reserved.
package/babel.config.js CHANGED
@@ -1,3 +1,3 @@
1
- const babelConfigLegacy = require('@webex/babel-config-legacy');
2
-
3
- module.exports = babelConfigLegacy;
1
+ const babelConfigLegacy = require('@webex/babel-config-legacy');
2
+
3
+ module.exports = babelConfigLegacy;
package/dist/index.js CHANGED
@@ -8,8 +8,8 @@ _Object$defineProperty(exports, "__esModule", {
8
8
  exports.default = void 0;
9
9
  var _webexCore = require("@webex/webex-core");
10
10
  var _teams = _interopRequireDefault(require("./teams"));
11
- /*!
12
- * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
11
+ /*!
12
+ * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
13
13
  */
14
14
 
15
15
  (0, _webexCore.registerPlugin)('teams', _teams.default);
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["_webexCore","require","_teams","_interopRequireDefault","registerPlugin","Teams","_default","exports","default"],"sources":["index.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {registerPlugin} from '@webex/webex-core';\n\nimport Teams from './teams';\n\nregisterPlugin('teams', Teams);\n\nexport default Teams;\n"],"mappings":";;;;;;;;AAIA,IAAAA,UAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AANA;AACA;AACA;;AAMA,IAAAG,yBAAc,EAAC,OAAO,EAAEC,cAAK,CAAC;AAAC,IAAAC,QAAA,GAEhBD,cAAK;AAAAE,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
1
+ {"version":3,"names":["_webexCore","require","_teams","_interopRequireDefault","registerPlugin","Teams","_default","exports","default"],"sources":["index.js"],"sourcesContent":["/*!\r\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\r\n */\r\n\r\nimport {registerPlugin} from '@webex/webex-core';\r\n\r\nimport Teams from './teams';\r\n\r\nregisterPlugin('teams', Teams);\r\n\r\nexport default Teams;\r\n"],"mappings":";;;;;;;;AAIA,IAAAA,UAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AANA;AACA;AACA;;AAMA,IAAAG,yBAAc,EAAC,OAAO,EAAEC,cAAK,CAAC;AAAC,IAAAC,QAAA,GAEhBD,cAAK;AAAAE,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
package/dist/teams.js CHANGED
@@ -6,38 +6,38 @@ _Object$defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = void 0;
8
8
  var _webexCore = require("@webex/webex-core");
9
- /*!
10
- * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
9
+ /*!
10
+ * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
11
11
  */
12
12
 
13
- /**
14
- * @typedef {Object} TeamObject
15
- * @property {string} id - (server generated) Unique identifier for the team
16
- * @property {string} name - The name of the team
17
- * @property {isoDate} created - (server generated) The date and time that the
18
- * team was created
13
+ /**
14
+ * @typedef {Object} TeamObject
15
+ * @property {string} id - (server generated) Unique identifier for the team
16
+ * @property {string} name - The name of the team
17
+ * @property {isoDate} created - (server generated) The date and time that the
18
+ * team was created
19
19
  */
20
20
 
21
- /**
22
- * @class
21
+ /**
22
+ * @class
23
23
  */
24
24
  var Teams = _webexCore.WebexPlugin.extend({
25
- /**
26
- * Create a new team.
27
- * @instance
28
- * @param {TeamObject} team
29
- * @returns {Promise<TeamObject>}
30
- * @memberof Teams
31
- * @example
32
- * webex.teams.create({name: 'Create Team Example'})
33
- * .then(function(team) {
34
- * var assert = require('assert');
35
- * assert(team.id);
36
- * assert(team.name);
37
- * assert(team.created);
38
- * return 'success';
39
- * });
40
- * // => success
25
+ /**
26
+ * Create a new team.
27
+ * @instance
28
+ * @param {TeamObject} team
29
+ * @returns {Promise<TeamObject>}
30
+ * @memberof Teams
31
+ * @example
32
+ * webex.teams.create({name: 'Create Team Example'})
33
+ * .then(function(team) {
34
+ * var assert = require('assert');
35
+ * assert(team.id);
36
+ * assert(team.name);
37
+ * assert(team.created);
38
+ * return 'success';
39
+ * });
40
+ * // => success
41
41
  */
42
42
  create: function create(team) {
43
43
  return this.request({
@@ -49,26 +49,26 @@ var Teams = _webexCore.WebexPlugin.extend({
49
49
  return res.body;
50
50
  });
51
51
  },
52
- /**
53
- * Returns a single team
54
- * @instance
55
- * @param {TeamObject|string} team
56
- * @param {Object} options
57
- * @returns {Promise<TeamObject>}
58
- * @memberof Teams
59
- * @example
60
- * var team;
61
- * webex.teams.create({name: 'Get Team Example'})
62
- * .then(function(r) {
63
- * team = r;
64
- * return webex.teams.get(team.id);
65
- * })
66
- * .then(function(team2) {
67
- * var assert = require('assert');
68
- * assert.equal(team2.id, team.id);
69
- * return 'success';
70
- * });
71
- * // => success
52
+ /**
53
+ * Returns a single team
54
+ * @instance
55
+ * @param {TeamObject|string} team
56
+ * @param {Object} options
57
+ * @returns {Promise<TeamObject>}
58
+ * @memberof Teams
59
+ * @example
60
+ * var team;
61
+ * webex.teams.create({name: 'Get Team Example'})
62
+ * .then(function(r) {
63
+ * team = r;
64
+ * return webex.teams.get(team.id);
65
+ * })
66
+ * .then(function(team2) {
67
+ * var assert = require('assert');
68
+ * assert.equal(team2.id, team.id);
69
+ * return 'success';
70
+ * });
71
+ * // => success
72
72
  */
73
73
  get: function get(team, options) {
74
74
  var id = team.id || team;
@@ -80,36 +80,36 @@ var Teams = _webexCore.WebexPlugin.extend({
80
80
  return res.body.items || res.body;
81
81
  });
82
82
  },
83
- /**
84
- * List teams.
85
- * @instance
86
- * @param {object} options
87
- * @param {object} options.max Limit the maximum number of teams in the
88
- * response.
89
- * @returns {Promise<Page<TeamObject>>}
90
- * @memberof Teams
91
- * @example
92
- * var createdRooms;
93
- * Promise.all([
94
- * webex.teams.create({name: 'List Teams Example 1'}),
95
- * webex.teams.create({name: 'List Teams Example 2'}),
96
- * webex.teams.create({name: 'List Teams Example 3'})
97
- * ])
98
- * .then(function(r) {
99
- * createdRooms = r;
100
- * return webex.teams.list({max: 3});
101
- * })
102
- * .then(function(teams) {
103
- * var assert = require('assert');
104
- * assert(teams.length === 3);
105
- * for (var i = 0; i < teams.items.length; i+= 1) {
106
- * assert(createdRooms.filter(function(room) {
107
- * return room.id === teams.items[i].id;
108
- * }).length === 1);
109
- * }
110
- * return 'success';
111
- * });
112
- * // => success
83
+ /**
84
+ * List teams.
85
+ * @instance
86
+ * @param {object} options
87
+ * @param {object} options.max Limit the maximum number of teams in the
88
+ * response.
89
+ * @returns {Promise<Page<TeamObject>>}
90
+ * @memberof Teams
91
+ * @example
92
+ * var createdRooms;
93
+ * Promise.all([
94
+ * webex.teams.create({name: 'List Teams Example 1'}),
95
+ * webex.teams.create({name: 'List Teams Example 2'}),
96
+ * webex.teams.create({name: 'List Teams Example 3'})
97
+ * ])
98
+ * .then(function(r) {
99
+ * createdRooms = r;
100
+ * return webex.teams.list({max: 3});
101
+ * })
102
+ * .then(function(teams) {
103
+ * var assert = require('assert');
104
+ * assert(teams.length === 3);
105
+ * for (var i = 0; i < teams.items.length; i+= 1) {
106
+ * assert(createdRooms.filter(function(room) {
107
+ * return room.id === teams.items[i].id;
108
+ * }).length === 1);
109
+ * }
110
+ * return 'success';
111
+ * });
112
+ * // => success
113
113
  */
114
114
  list: function list(options) {
115
115
  var _this = this;
@@ -121,30 +121,30 @@ var Teams = _webexCore.WebexPlugin.extend({
121
121
  return new _webexCore.Page(res, _this.webex);
122
122
  });
123
123
  },
124
- /**
125
- * Update a team.
126
- * @instance
127
- * @param {TeamObject} team
128
- * @returns {Promise<TeamObject>}
129
- * @memberof Teams
130
- * @example
131
- * var teams;
132
- * webex.teams.create({name: 'Update Team Example'})
133
- * .then(function(r) {
134
- * teams = r;
135
- * teams.name = 'Teams Example (Updated Title)';
136
- * return webex.teams.update(teams);
137
- * })
138
- * .then(function() {
139
- * return webex.teams.get(teams.id);
140
- * })
141
- * .then(function(teams) {
142
- * var assert = require('assert');
143
- * assert.equal(teams.name, 'Teams Example (Updated Title)');
144
- * return 'success';
145
- * });
146
- * // => success
147
- */
124
+ /**
125
+ * Update a team.
126
+ * @instance
127
+ * @param {TeamObject} team
128
+ * @returns {Promise<TeamObject>}
129
+ * @memberof Teams
130
+ * @example
131
+ * var teams;
132
+ * webex.teams.create({name: 'Update Team Example'})
133
+ * .then(function(r) {
134
+ * teams = r;
135
+ * teams.name = 'Teams Example (Updated Title)';
136
+ * return webex.teams.update(teams);
137
+ * })
138
+ * .then(function() {
139
+ * return webex.teams.get(teams.id);
140
+ * })
141
+ * .then(function(teams) {
142
+ * var assert = require('assert');
143
+ * assert.equal(teams.name, 'Teams Example (Updated Title)');
144
+ * return 'success';
145
+ * });
146
+ * // => success
147
+ */
148
148
  update: function update(team) {
149
149
  var id = team.id;
150
150
  return this.request({
@@ -156,7 +156,7 @@ var Teams = _webexCore.WebexPlugin.extend({
156
156
  return res.body;
157
157
  });
158
158
  },
159
- version: "2.59.1"
159
+ version: "2.59.0"
160
160
  });
161
161
  var _default = Teams;
162
162
  exports.default = _default;
package/dist/teams.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["_webexCore","require","Teams","WebexPlugin","extend","create","team","request","method","service","resource","body","then","res","get","options","id","concat","qs","items","list","_this","Page","webex","update","version","_default","exports","default"],"sources":["teams.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {WebexPlugin, Page} from '@webex/webex-core';\n\n/**\n * @typedef {Object} TeamObject\n * @property {string} id - (server generated) Unique identifier for the team\n * @property {string} name - The name of the team\n * @property {isoDate} created - (server generated) The date and time that the\n * team was created\n */\n\n/**\n * @class\n */\nconst Teams = WebexPlugin.extend({\n /**\n * Create a new team.\n * @instance\n * @param {TeamObject} team\n * @returns {Promise<TeamObject>}\n * @memberof Teams\n * @example\n * webex.teams.create({name: 'Create Team Example'})\n * .then(function(team) {\n * var assert = require('assert');\n * assert(team.id);\n * assert(team.name);\n * assert(team.created);\n * return 'success';\n * });\n * // => success\n */\n create(team) {\n return this.request({\n method: 'POST',\n service: 'hydra',\n resource: 'teams',\n body: team,\n }).then((res) => res.body);\n },\n\n /**\n * Returns a single team\n * @instance\n * @param {TeamObject|string} team\n * @param {Object} options\n * @returns {Promise<TeamObject>}\n * @memberof Teams\n * @example\n * var team;\n * webex.teams.create({name: 'Get Team Example'})\n * .then(function(r) {\n * team = r;\n * return webex.teams.get(team.id);\n * })\n * .then(function(team2) {\n * var assert = require('assert');\n * assert.equal(team2.id, team.id);\n * return 'success';\n * });\n * // => success\n */\n get(team, options) {\n const id = team.id || team;\n\n return this.request({\n service: 'hydra',\n resource: `teams/${id}`,\n qs: options,\n }).then((res) => res.body.items || res.body);\n },\n\n /**\n * List teams.\n * @instance\n * @param {object} options\n * @param {object} options.max Limit the maximum number of teams in the\n * response.\n * @returns {Promise<Page<TeamObject>>}\n * @memberof Teams\n * @example\n * var createdRooms;\n * Promise.all([\n * webex.teams.create({name: 'List Teams Example 1'}),\n * webex.teams.create({name: 'List Teams Example 2'}),\n * webex.teams.create({name: 'List Teams Example 3'})\n * ])\n * .then(function(r) {\n * createdRooms = r;\n * return webex.teams.list({max: 3});\n * })\n * .then(function(teams) {\n * var assert = require('assert');\n * assert(teams.length === 3);\n * for (var i = 0; i < teams.items.length; i+= 1) {\n * assert(createdRooms.filter(function(room) {\n * return room.id === teams.items[i].id;\n * }).length === 1);\n * }\n * return 'success';\n * });\n * // => success\n */\n list(options) {\n return this.request({\n service: 'hydra',\n resource: 'teams/',\n qs: options,\n }).then((res) => new Page(res, this.webex));\n },\n\n /**\n * Update a team.\n * @instance\n * @param {TeamObject} team\n * @returns {Promise<TeamObject>}\n * @memberof Teams\n * @example\n * var teams;\n * webex.teams.create({name: 'Update Team Example'})\n * .then(function(r) {\n * teams = r;\n * teams.name = 'Teams Example (Updated Title)';\n * return webex.teams.update(teams);\n * })\n * .then(function() {\n * return webex.teams.get(teams.id);\n * })\n * .then(function(teams) {\n * var assert = require('assert');\n * assert.equal(teams.name, 'Teams Example (Updated Title)');\n * return 'success';\n * });\n * // => success\n\n */\n update(team) {\n const {id} = team;\n\n return this.request({\n method: 'PUT',\n service: 'hydra',\n resource: `teams/${id}`,\n body: team,\n }).then((res) => res.body);\n },\n});\n\nexport default Teams;\n"],"mappings":";;;;;;;AAIA,IAAAA,UAAA,GAAAC,OAAA;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAMC,KAAK,GAAGC,sBAAW,CAACC,MAAM,CAAC;EAC/B;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,MAAM,WAAAA,OAACC,IAAI,EAAE;IACX,OAAO,IAAI,CAACC,OAAO,CAAC;MAClBC,MAAM,EAAE,MAAM;MACdC,OAAO,EAAE,OAAO;MAChBC,QAAQ,EAAE,OAAO;MACjBC,IAAI,EAAEL;IACR,CAAC,CAAC,CAACM,IAAI,CAAC,UAACC,GAAG;MAAA,OAAKA,GAAG,CAACF,IAAI;IAAA,EAAC;EAC5B,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEG,GAAG,WAAAA,IAACR,IAAI,EAAES,OAAO,EAAE;IACjB,IAAMC,EAAE,GAAGV,IAAI,CAACU,EAAE,IAAIV,IAAI;IAE1B,OAAO,IAAI,CAACC,OAAO,CAAC;MAClBE,OAAO,EAAE,OAAO;MAChBC,QAAQ,WAAAO,MAAA,CAAWD,EAAE,CAAE;MACvBE,EAAE,EAAEH;IACN,CAAC,CAAC,CAACH,IAAI,CAAC,UAACC,GAAG;MAAA,OAAKA,GAAG,CAACF,IAAI,CAACQ,KAAK,IAAIN,GAAG,CAACF,IAAI;IAAA,EAAC;EAC9C,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACES,IAAI,WAAAA,KAACL,OAAO,EAAE;IAAA,IAAAM,KAAA;IACZ,OAAO,IAAI,CAACd,OAAO,CAAC;MAClBE,OAAO,EAAE,OAAO;MAChBC,QAAQ,EAAE,QAAQ;MAClBQ,EAAE,EAAEH;IACN,CAAC,CAAC,CAACH,IAAI,CAAC,UAACC,GAAG;MAAA,OAAK,IAAIS,eAAI,CAACT,GAAG,EAAEQ,KAAI,CAACE,KAAK,CAAC;IAAA,EAAC;EAC7C,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EAEEC,MAAM,WAAAA,OAAClB,IAAI,EAAE;IACX,IAAOU,EAAE,GAAIV,IAAI,CAAVU,EAAE;IAET,OAAO,IAAI,CAACT,OAAO,CAAC;MAClBC,MAAM,EAAE,KAAK;MACbC,OAAO,EAAE,OAAO;MAChBC,QAAQ,WAAAO,MAAA,CAAWD,EAAE,CAAE;MACvBL,IAAI,EAAEL;IACR,CAAC,CAAC,CAACM,IAAI,CAAC,UAACC,GAAG;MAAA,OAAKA,GAAG,CAACF,IAAI;IAAA,EAAC;EAC5B,CAAC;EAAAc,OAAA;AACH,CAAC,CAAC;AAAC,IAAAC,QAAA,GAEYxB,KAAK;AAAAyB,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
1
+ {"version":3,"names":["_webexCore","require","Teams","WebexPlugin","extend","create","team","request","method","service","resource","body","then","res","get","options","id","concat","qs","items","list","_this","Page","webex","update","version","_default","exports","default"],"sources":["teams.js"],"sourcesContent":["/*!\r\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\r\n */\r\n\r\nimport {WebexPlugin, Page} from '@webex/webex-core';\r\n\r\n/**\r\n * @typedef {Object} TeamObject\r\n * @property {string} id - (server generated) Unique identifier for the team\r\n * @property {string} name - The name of the team\r\n * @property {isoDate} created - (server generated) The date and time that the\r\n * team was created\r\n */\r\n\r\n/**\r\n * @class\r\n */\r\nconst Teams = WebexPlugin.extend({\r\n /**\r\n * Create a new team.\r\n * @instance\r\n * @param {TeamObject} team\r\n * @returns {Promise<TeamObject>}\r\n * @memberof Teams\r\n * @example\r\n * webex.teams.create({name: 'Create Team Example'})\r\n * .then(function(team) {\r\n * var assert = require('assert');\r\n * assert(team.id);\r\n * assert(team.name);\r\n * assert(team.created);\r\n * return 'success';\r\n * });\r\n * // => success\r\n */\r\n create(team) {\r\n return this.request({\r\n method: 'POST',\r\n service: 'hydra',\r\n resource: 'teams',\r\n body: team,\r\n }).then((res) => res.body);\r\n },\r\n\r\n /**\r\n * Returns a single team\r\n * @instance\r\n * @param {TeamObject|string} team\r\n * @param {Object} options\r\n * @returns {Promise<TeamObject>}\r\n * @memberof Teams\r\n * @example\r\n * var team;\r\n * webex.teams.create({name: 'Get Team Example'})\r\n * .then(function(r) {\r\n * team = r;\r\n * return webex.teams.get(team.id);\r\n * })\r\n * .then(function(team2) {\r\n * var assert = require('assert');\r\n * assert.equal(team2.id, team.id);\r\n * return 'success';\r\n * });\r\n * // => success\r\n */\r\n get(team, options) {\r\n const id = team.id || team;\r\n\r\n return this.request({\r\n service: 'hydra',\r\n resource: `teams/${id}`,\r\n qs: options,\r\n }).then((res) => res.body.items || res.body);\r\n },\r\n\r\n /**\r\n * List teams.\r\n * @instance\r\n * @param {object} options\r\n * @param {object} options.max Limit the maximum number of teams in the\r\n * response.\r\n * @returns {Promise<Page<TeamObject>>}\r\n * @memberof Teams\r\n * @example\r\n * var createdRooms;\r\n * Promise.all([\r\n * webex.teams.create({name: 'List Teams Example 1'}),\r\n * webex.teams.create({name: 'List Teams Example 2'}),\r\n * webex.teams.create({name: 'List Teams Example 3'})\r\n * ])\r\n * .then(function(r) {\r\n * createdRooms = r;\r\n * return webex.teams.list({max: 3});\r\n * })\r\n * .then(function(teams) {\r\n * var assert = require('assert');\r\n * assert(teams.length === 3);\r\n * for (var i = 0; i < teams.items.length; i+= 1) {\r\n * assert(createdRooms.filter(function(room) {\r\n * return room.id === teams.items[i].id;\r\n * }).length === 1);\r\n * }\r\n * return 'success';\r\n * });\r\n * // => success\r\n */\r\n list(options) {\r\n return this.request({\r\n service: 'hydra',\r\n resource: 'teams/',\r\n qs: options,\r\n }).then((res) => new Page(res, this.webex));\r\n },\r\n\r\n /**\r\n * Update a team.\r\n * @instance\r\n * @param {TeamObject} team\r\n * @returns {Promise<TeamObject>}\r\n * @memberof Teams\r\n * @example\r\n * var teams;\r\n * webex.teams.create({name: 'Update Team Example'})\r\n * .then(function(r) {\r\n * teams = r;\r\n * teams.name = 'Teams Example (Updated Title)';\r\n * return webex.teams.update(teams);\r\n * })\r\n * .then(function() {\r\n * return webex.teams.get(teams.id);\r\n * })\r\n * .then(function(teams) {\r\n * var assert = require('assert');\r\n * assert.equal(teams.name, 'Teams Example (Updated Title)');\r\n * return 'success';\r\n * });\r\n * // => success\r\n\r\n */\r\n update(team) {\r\n const {id} = team;\r\n\r\n return this.request({\r\n method: 'PUT',\r\n service: 'hydra',\r\n resource: `teams/${id}`,\r\n body: team,\r\n }).then((res) => res.body);\r\n },\r\n});\r\n\r\nexport default Teams;\r\n"],"mappings":";;;;;;;AAIA,IAAAA,UAAA,GAAAC,OAAA;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAMC,KAAK,GAAGC,sBAAW,CAACC,MAAM,CAAC;EAC/B;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,MAAM,WAAAA,OAACC,IAAI,EAAE;IACX,OAAO,IAAI,CAACC,OAAO,CAAC;MAClBC,MAAM,EAAE,MAAM;MACdC,OAAO,EAAE,OAAO;MAChBC,QAAQ,EAAE,OAAO;MACjBC,IAAI,EAAEL;IACR,CAAC,CAAC,CAACM,IAAI,CAAC,UAACC,GAAG;MAAA,OAAKA,GAAG,CAACF,IAAI;IAAA,EAAC;EAC5B,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEG,GAAG,WAAAA,IAACR,IAAI,EAAES,OAAO,EAAE;IACjB,IAAMC,EAAE,GAAGV,IAAI,CAACU,EAAE,IAAIV,IAAI;IAE1B,OAAO,IAAI,CAACC,OAAO,CAAC;MAClBE,OAAO,EAAE,OAAO;MAChBC,QAAQ,WAAAO,MAAA,CAAWD,EAAE,CAAE;MACvBE,EAAE,EAAEH;IACN,CAAC,CAAC,CAACH,IAAI,CAAC,UAACC,GAAG;MAAA,OAAKA,GAAG,CAACF,IAAI,CAACQ,KAAK,IAAIN,GAAG,CAACF,IAAI;IAAA,EAAC;EAC9C,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACES,IAAI,WAAAA,KAACL,OAAO,EAAE;IAAA,IAAAM,KAAA;IACZ,OAAO,IAAI,CAACd,OAAO,CAAC;MAClBE,OAAO,EAAE,OAAO;MAChBC,QAAQ,EAAE,QAAQ;MAClBQ,EAAE,EAAEH;IACN,CAAC,CAAC,CAACH,IAAI,CAAC,UAACC,GAAG;MAAA,OAAK,IAAIS,eAAI,CAACT,GAAG,EAAEQ,KAAI,CAACE,KAAK,CAAC;IAAA,EAAC;EAC7C,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EAEEC,MAAM,WAAAA,OAAClB,IAAI,EAAE;IACX,IAAOU,EAAE,GAAIV,IAAI,CAAVU,EAAE;IAET,OAAO,IAAI,CAACT,OAAO,CAAC;MAClBC,MAAM,EAAE,KAAK;MACbC,OAAO,EAAE,OAAO;MAChBC,QAAQ,WAAAO,MAAA,CAAWD,EAAE,CAAE;MACvBL,IAAI,EAAEL;IACR,CAAC,CAAC,CAACM,IAAI,CAAC,UAACC,GAAG;MAAA,OAAKA,GAAG,CAACF,IAAI;IAAA,EAAC;EAC5B,CAAC;EAAAc,OAAA;AACH,CAAC,CAAC;AAAC,IAAAC,QAAA,GAEYxB,KAAK;AAAAyB,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
package/jest.config.js CHANGED
@@ -1,3 +1,3 @@
1
- const config = require('@webex/jest-config-legacy');
2
-
3
- module.exports = config;
1
+ const config = require('@webex/jest-config-legacy');
2
+
3
+ module.exports = config;
package/package.json CHANGED
@@ -1,6 +1,5 @@
1
1
  {
2
2
  "name": "@webex/plugin-teams",
3
- "version": "2.59.1",
4
3
  "description": "",
5
4
  "license": "MIT",
6
5
  "main": "dist/index.js",
@@ -21,35 +20,37 @@
21
20
  },
22
21
  "devDependencies": {
23
22
  "@babel/core": "^7.17.10",
24
- "@webex/babel-config-legacy": "2.59.1",
25
- "@webex/eslint-config-legacy": "2.59.1",
26
- "@webex/jest-config-legacy": "2.59.1",
27
- "@webex/legacy-tools": "2.59.1",
28
- "@webex/test-helper-chai": "2.59.1",
29
- "@webex/test-helper-mocha": "2.59.1",
30
- "@webex/test-helper-mock-webex": "2.59.1",
31
- "@webex/test-helper-test-users": "2.59.1",
23
+ "@webex/babel-config-legacy": "^0.0.0",
24
+ "@webex/eslint-config-legacy": "^0.0.0",
25
+ "@webex/jest-config-legacy": "^0.0.0",
26
+ "@webex/legacy-tools": "^0.0.0",
27
+ "@webex/test-helper-chai": "^2.59.3-next.1",
28
+ "@webex/test-helper-mocha": "^2.59.3-next.1",
29
+ "@webex/test-helper-mock-webex": "^2.59.3-next.1",
30
+ "@webex/test-helper-test-users": "^2.59.3-next.1",
32
31
  "eslint": "^8.24.0",
33
32
  "prettier": "^2.7.1",
34
33
  "sinon": "^9.2.4"
35
34
  },
36
35
  "dependencies": {
37
- "@webex/internal-plugin-device": "2.59.1",
38
- "@webex/plugin-logger": "2.59.1",
39
- "@webex/plugin-memberships": "2.59.1",
40
- "@webex/plugin-rooms": "2.59.1",
41
- "@webex/test-helper-chai": "2.59.1",
42
- "@webex/test-helper-test-users": "2.59.1",
43
- "@webex/webex-core": "2.59.1",
36
+ "@webex/internal-plugin-device": "^2.59.3-next.1",
37
+ "@webex/plugin-logger": "^2.59.3-next.1",
38
+ "@webex/plugin-memberships": "^2.59.3-next.1",
39
+ "@webex/plugin-rooms": "^2.59.3-next.1",
40
+ "@webex/test-helper-chai": "^2.59.3-next.1",
41
+ "@webex/test-helper-test-users": "^2.59.3-next.1",
42
+ "@webex/webex-core": "^2.59.3-next.1",
44
43
  "lodash": "^4.17.21"
45
44
  },
46
45
  "scripts": {
47
46
  "build": "yarn build:src",
48
47
  "build:src": "webex-legacy-tools build -dest \"./dist\" -src \"./src\" -js -ts -maps",
48
+ "deploy:npm": "yarn npm publish",
49
49
  "test": "yarn test:style && yarn test:unit && yarn test:integration && yarn test:browser",
50
50
  "test:browser:broken": "webex-legacy-tools test --integration --unit --runner karma",
51
51
  "test:integration:broken": "webex-legacy-tools test --integration --runner mocha",
52
52
  "test:style": "eslint ./src/**/*.*",
53
53
  "test:unit": "webex-legacy-tools test --unit --runner jest"
54
- }
55
- }
54
+ },
55
+ "version": "2.59.3-next.1"
56
+ }
package/process CHANGED
@@ -1 +1 @@
1
- module.exports = {browser: true};
1
+ module.exports = {browser: true};
package/src/index.js CHANGED
@@ -1,11 +1,11 @@
1
- /*!
2
- * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
3
- */
4
-
5
- import {registerPlugin} from '@webex/webex-core';
6
-
7
- import Teams from './teams';
8
-
9
- registerPlugin('teams', Teams);
10
-
11
- export default Teams;
1
+ /*!
2
+ * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
3
+ */
4
+
5
+ import {registerPlugin} from '@webex/webex-core';
6
+
7
+ import Teams from './teams';
8
+
9
+ registerPlugin('teams', Teams);
10
+
11
+ export default Teams;
package/src/teams.js CHANGED
@@ -1,152 +1,152 @@
1
- /*!
2
- * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
3
- */
4
-
5
- import {WebexPlugin, Page} from '@webex/webex-core';
6
-
7
- /**
8
- * @typedef {Object} TeamObject
9
- * @property {string} id - (server generated) Unique identifier for the team
10
- * @property {string} name - The name of the team
11
- * @property {isoDate} created - (server generated) The date and time that the
12
- * team was created
13
- */
14
-
15
- /**
16
- * @class
17
- */
18
- const Teams = WebexPlugin.extend({
19
- /**
20
- * Create a new team.
21
- * @instance
22
- * @param {TeamObject} team
23
- * @returns {Promise<TeamObject>}
24
- * @memberof Teams
25
- * @example
26
- * webex.teams.create({name: 'Create Team Example'})
27
- * .then(function(team) {
28
- * var assert = require('assert');
29
- * assert(team.id);
30
- * assert(team.name);
31
- * assert(team.created);
32
- * return 'success';
33
- * });
34
- * // => success
35
- */
36
- create(team) {
37
- return this.request({
38
- method: 'POST',
39
- service: 'hydra',
40
- resource: 'teams',
41
- body: team,
42
- }).then((res) => res.body);
43
- },
44
-
45
- /**
46
- * Returns a single team
47
- * @instance
48
- * @param {TeamObject|string} team
49
- * @param {Object} options
50
- * @returns {Promise<TeamObject>}
51
- * @memberof Teams
52
- * @example
53
- * var team;
54
- * webex.teams.create({name: 'Get Team Example'})
55
- * .then(function(r) {
56
- * team = r;
57
- * return webex.teams.get(team.id);
58
- * })
59
- * .then(function(team2) {
60
- * var assert = require('assert');
61
- * assert.equal(team2.id, team.id);
62
- * return 'success';
63
- * });
64
- * // => success
65
- */
66
- get(team, options) {
67
- const id = team.id || team;
68
-
69
- return this.request({
70
- service: 'hydra',
71
- resource: `teams/${id}`,
72
- qs: options,
73
- }).then((res) => res.body.items || res.body);
74
- },
75
-
76
- /**
77
- * List teams.
78
- * @instance
79
- * @param {object} options
80
- * @param {object} options.max Limit the maximum number of teams in the
81
- * response.
82
- * @returns {Promise<Page<TeamObject>>}
83
- * @memberof Teams
84
- * @example
85
- * var createdRooms;
86
- * Promise.all([
87
- * webex.teams.create({name: 'List Teams Example 1'}),
88
- * webex.teams.create({name: 'List Teams Example 2'}),
89
- * webex.teams.create({name: 'List Teams Example 3'})
90
- * ])
91
- * .then(function(r) {
92
- * createdRooms = r;
93
- * return webex.teams.list({max: 3});
94
- * })
95
- * .then(function(teams) {
96
- * var assert = require('assert');
97
- * assert(teams.length === 3);
98
- * for (var i = 0; i < teams.items.length; i+= 1) {
99
- * assert(createdRooms.filter(function(room) {
100
- * return room.id === teams.items[i].id;
101
- * }).length === 1);
102
- * }
103
- * return 'success';
104
- * });
105
- * // => success
106
- */
107
- list(options) {
108
- return this.request({
109
- service: 'hydra',
110
- resource: 'teams/',
111
- qs: options,
112
- }).then((res) => new Page(res, this.webex));
113
- },
114
-
115
- /**
116
- * Update a team.
117
- * @instance
118
- * @param {TeamObject} team
119
- * @returns {Promise<TeamObject>}
120
- * @memberof Teams
121
- * @example
122
- * var teams;
123
- * webex.teams.create({name: 'Update Team Example'})
124
- * .then(function(r) {
125
- * teams = r;
126
- * teams.name = 'Teams Example (Updated Title)';
127
- * return webex.teams.update(teams);
128
- * })
129
- * .then(function() {
130
- * return webex.teams.get(teams.id);
131
- * })
132
- * .then(function(teams) {
133
- * var assert = require('assert');
134
- * assert.equal(teams.name, 'Teams Example (Updated Title)');
135
- * return 'success';
136
- * });
137
- * // => success
138
-
139
- */
140
- update(team) {
141
- const {id} = team;
142
-
143
- return this.request({
144
- method: 'PUT',
145
- service: 'hydra',
146
- resource: `teams/${id}`,
147
- body: team,
148
- }).then((res) => res.body);
149
- },
150
- });
151
-
152
- export default Teams;
1
+ /*!
2
+ * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
3
+ */
4
+
5
+ import {WebexPlugin, Page} from '@webex/webex-core';
6
+
7
+ /**
8
+ * @typedef {Object} TeamObject
9
+ * @property {string} id - (server generated) Unique identifier for the team
10
+ * @property {string} name - The name of the team
11
+ * @property {isoDate} created - (server generated) The date and time that the
12
+ * team was created
13
+ */
14
+
15
+ /**
16
+ * @class
17
+ */
18
+ const Teams = WebexPlugin.extend({
19
+ /**
20
+ * Create a new team.
21
+ * @instance
22
+ * @param {TeamObject} team
23
+ * @returns {Promise<TeamObject>}
24
+ * @memberof Teams
25
+ * @example
26
+ * webex.teams.create({name: 'Create Team Example'})
27
+ * .then(function(team) {
28
+ * var assert = require('assert');
29
+ * assert(team.id);
30
+ * assert(team.name);
31
+ * assert(team.created);
32
+ * return 'success';
33
+ * });
34
+ * // => success
35
+ */
36
+ create(team) {
37
+ return this.request({
38
+ method: 'POST',
39
+ service: 'hydra',
40
+ resource: 'teams',
41
+ body: team,
42
+ }).then((res) => res.body);
43
+ },
44
+
45
+ /**
46
+ * Returns a single team
47
+ * @instance
48
+ * @param {TeamObject|string} team
49
+ * @param {Object} options
50
+ * @returns {Promise<TeamObject>}
51
+ * @memberof Teams
52
+ * @example
53
+ * var team;
54
+ * webex.teams.create({name: 'Get Team Example'})
55
+ * .then(function(r) {
56
+ * team = r;
57
+ * return webex.teams.get(team.id);
58
+ * })
59
+ * .then(function(team2) {
60
+ * var assert = require('assert');
61
+ * assert.equal(team2.id, team.id);
62
+ * return 'success';
63
+ * });
64
+ * // => success
65
+ */
66
+ get(team, options) {
67
+ const id = team.id || team;
68
+
69
+ return this.request({
70
+ service: 'hydra',
71
+ resource: `teams/${id}`,
72
+ qs: options,
73
+ }).then((res) => res.body.items || res.body);
74
+ },
75
+
76
+ /**
77
+ * List teams.
78
+ * @instance
79
+ * @param {object} options
80
+ * @param {object} options.max Limit the maximum number of teams in the
81
+ * response.
82
+ * @returns {Promise<Page<TeamObject>>}
83
+ * @memberof Teams
84
+ * @example
85
+ * var createdRooms;
86
+ * Promise.all([
87
+ * webex.teams.create({name: 'List Teams Example 1'}),
88
+ * webex.teams.create({name: 'List Teams Example 2'}),
89
+ * webex.teams.create({name: 'List Teams Example 3'})
90
+ * ])
91
+ * .then(function(r) {
92
+ * createdRooms = r;
93
+ * return webex.teams.list({max: 3});
94
+ * })
95
+ * .then(function(teams) {
96
+ * var assert = require('assert');
97
+ * assert(teams.length === 3);
98
+ * for (var i = 0; i < teams.items.length; i+= 1) {
99
+ * assert(createdRooms.filter(function(room) {
100
+ * return room.id === teams.items[i].id;
101
+ * }).length === 1);
102
+ * }
103
+ * return 'success';
104
+ * });
105
+ * // => success
106
+ */
107
+ list(options) {
108
+ return this.request({
109
+ service: 'hydra',
110
+ resource: 'teams/',
111
+ qs: options,
112
+ }).then((res) => new Page(res, this.webex));
113
+ },
114
+
115
+ /**
116
+ * Update a team.
117
+ * @instance
118
+ * @param {TeamObject} team
119
+ * @returns {Promise<TeamObject>}
120
+ * @memberof Teams
121
+ * @example
122
+ * var teams;
123
+ * webex.teams.create({name: 'Update Team Example'})
124
+ * .then(function(r) {
125
+ * teams = r;
126
+ * teams.name = 'Teams Example (Updated Title)';
127
+ * return webex.teams.update(teams);
128
+ * })
129
+ * .then(function() {
130
+ * return webex.teams.get(teams.id);
131
+ * })
132
+ * .then(function(teams) {
133
+ * var assert = require('assert');
134
+ * assert.equal(teams.name, 'Teams Example (Updated Title)');
135
+ * return 'success';
136
+ * });
137
+ * // => success
138
+
139
+ */
140
+ update(team) {
141
+ const {id} = team;
142
+
143
+ return this.request({
144
+ method: 'PUT',
145
+ service: 'hydra',
146
+ resource: `teams/${id}`,
147
+ body: team,
148
+ }).then((res) => res.body);
149
+ },
150
+ });
151
+
152
+ export default Teams;
@@ -1,209 +1,209 @@
1
- /*!
2
- * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
3
- */
4
-
5
- import '@webex/internal-plugin-device';
6
- import '@webex/plugin-logger';
7
- import '@webex/plugin-memberships';
8
- import '@webex/plugin-rooms';
9
- import '@webex/plugin-teams';
10
- import WebexCore, {WebexHttpError} from '@webex/webex-core';
11
- import {assert} from '@webex/test-helper-chai';
12
- import sinon from 'sinon';
13
- import testUsers from '@webex/test-helper-test-users';
14
- import {find} from 'lodash';
15
-
16
- describe('plugin-teams', function () {
17
- this.timeout(60000);
18
-
19
- let webex, user;
20
-
21
- before(() =>
22
- testUsers.create({count: 1}).then(([u]) => {
23
- user = u;
24
- webex = new WebexCore({credentials: user.token});
25
- })
26
- );
27
-
28
- describe('#teams', () => {
29
- describe('#create()', () => {
30
- it('creates a team', () =>
31
- webex.teams
32
- .create({
33
- name: 'Webex Test Team (create)',
34
- })
35
- .then((team) => assert.isTeam(team)));
36
- });
37
-
38
- describe('#get()', () => {
39
- it('retrieves a specific team', () =>
40
- webex.teams
41
- .create({
42
- name: 'Webex Test Team (get)',
43
- })
44
- .then((team) => {
45
- assert.isTeam(team);
46
-
47
- return webex.teams.get({id: team.id}).then((result) => assert.deepEqual(result, team));
48
- }));
49
- });
50
-
51
- describe('#list()', () => {
52
- // Reminder: we can't run the next two creates in parallel because some of
53
- // the tests rely on ordering.
54
- let team0, team1;
55
-
56
- before(() =>
57
- webex.teams.create({name: 'Webex Test Team 1'}).then((team) => {
58
- team1 = team;
59
- })
60
- );
61
-
62
- before(() =>
63
- webex.teams.create({name: 'Webex Test Team 0'}).then((team) => {
64
- team0 = team;
65
- })
66
- );
67
-
68
- it('lists all of the teams to which I have access', () =>
69
- webex.teams.list().then((teams) => {
70
- assert.isAbove(teams.length, 1);
71
- for (const team of teams) {
72
- assert.isTeam(team);
73
- }
74
- }));
75
-
76
- it('lists a bounded, pageable set of teams to which I have access', () =>
77
- webex.teams.list({max: 1}).then((teams) => {
78
- assert.lengthOf(teams, 1);
79
- const spy = sinon.spy();
80
-
81
- return (function f(page) {
82
- for (const team of page) {
83
- spy(team.id);
84
- }
85
-
86
- if (page.hasNext()) {
87
- return page.next().then(f);
88
- }
89
-
90
- return Promise.resolve();
91
- })(teams).then(() => {
92
- assert.isAbove(spy.callCount, 1);
93
- assert.calledWith(spy, team0.id);
94
- assert.calledWith(spy, team1.id);
95
- });
96
- }));
97
- });
98
-
99
- describe('#update()', () => {
100
- it("updates a single team's name", () =>
101
- webex.teams
102
- .create({
103
- name: 'Webex Test Team',
104
- })
105
- .then((team) => {
106
- assert.isTeam(team);
107
-
108
- return webex.teams.update(Object.assign({}, team, {name: 'Webex Test Team (Updated)'}));
109
- })
110
- .then((team) => {
111
- assert.isTeam(team);
112
- assert.equal(team.name, 'Webex Test Team (Updated)');
113
- }));
114
- });
115
- });
116
-
117
- describe('#rooms', () => {
118
- let team;
119
-
120
- before(() =>
121
- webex.teams
122
- .create({
123
- name: 'Webex Test Team',
124
- })
125
- .then((t) => {
126
- team = t;
127
- })
128
- );
129
-
130
- describe('#create()', () => {
131
- // COLLAB-1104 create date don't match; Mike is working on a fix
132
- it.skip('creates a room that is part of a team', () =>
133
- webex.rooms
134
- .create({
135
- title: 'Team Room',
136
- teamId: team.id,
137
- })
138
- .then((room) => {
139
- assert.isTeamRoom(room);
140
- assert.equal(room.teamId, team.id);
141
- }));
142
- });
143
-
144
- describe('#get()', () => {
145
- it('retrieves a specific room that is part of a team', () =>
146
- webex.rooms
147
- .create({
148
- title: 'Team Room',
149
- teamId: team.id,
150
- })
151
- .then((room) => webex.rooms.get(room))
152
- .then((room) => {
153
- assert.isTeamRoom(room);
154
- assert.equal(room.teamId, team.id);
155
- }));
156
-
157
- describe("when the user leaves the team's general room", () => {
158
- let room, team;
159
-
160
- it("no longer returns the team's rooms", () =>
161
- webex.teams
162
- .create({
163
- name: 'Team Title',
164
- })
165
- .then((t) => {
166
- team = t;
167
-
168
- return webex.rooms.create({
169
- title: 'Room Title',
170
- teamId: team.id,
171
- });
172
- })
173
- .then((r) => {
174
- room = r;
175
-
176
- return webex.rooms.list({teamId: team.id});
177
- })
178
- .then((teamRooms) => {
179
- assert.lengthOf(teamRooms, 2);
180
- const generalRoom = find(teamRooms.items, (r) => r.id !== room.id);
181
-
182
- return webex.memberships.list({roomId: generalRoom.id, personId: user.id});
183
- })
184
- .then((memberships) => webex.memberships.remove(memberships.items[0]))
185
- .then(() => assert.isRejected(webex.rooms.get(room)))
186
- .then((reason) => {
187
- assert.instanceOf(reason, WebexHttpError.NotFound);
188
- }));
189
- });
190
- });
191
-
192
- describe('#list()', () => {
193
- it('lists all rooms in a team', () =>
194
- webex.rooms
195
- .create({
196
- title: 'Team Room',
197
- teamId: team.id,
198
- })
199
- .then(() => webex.rooms.list({teamId: team.id}))
200
- .then((rooms) => {
201
- assert.isAbove(rooms.length, 0);
202
- for (const room of rooms) {
203
- assert.isTeamRoom(room);
204
- assert.equal(room.teamId, team.id);
205
- }
206
- }));
207
- });
208
- });
209
- });
1
+ /*!
2
+ * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
3
+ */
4
+
5
+ import '@webex/internal-plugin-device';
6
+ import '@webex/plugin-logger';
7
+ import '@webex/plugin-memberships';
8
+ import '@webex/plugin-rooms';
9
+ import '@webex/plugin-teams';
10
+ import WebexCore, {WebexHttpError} from '@webex/webex-core';
11
+ import {assert} from '@webex/test-helper-chai';
12
+ import sinon from 'sinon';
13
+ import testUsers from '@webex/test-helper-test-users';
14
+ import {find} from 'lodash';
15
+
16
+ describe('plugin-teams', function () {
17
+ this.timeout(60000);
18
+
19
+ let webex, user;
20
+
21
+ before(() =>
22
+ testUsers.create({count: 1}).then(([u]) => {
23
+ user = u;
24
+ webex = new WebexCore({credentials: user.token});
25
+ })
26
+ );
27
+
28
+ describe('#teams', () => {
29
+ describe('#create()', () => {
30
+ it('creates a team', () =>
31
+ webex.teams
32
+ .create({
33
+ name: 'Webex Test Team (create)',
34
+ })
35
+ .then((team) => assert.isTeam(team)));
36
+ });
37
+
38
+ describe('#get()', () => {
39
+ it('retrieves a specific team', () =>
40
+ webex.teams
41
+ .create({
42
+ name: 'Webex Test Team (get)',
43
+ })
44
+ .then((team) => {
45
+ assert.isTeam(team);
46
+
47
+ return webex.teams.get({id: team.id}).then((result) => assert.deepEqual(result, team));
48
+ }));
49
+ });
50
+
51
+ describe('#list()', () => {
52
+ // Reminder: we can't run the next two creates in parallel because some of
53
+ // the tests rely on ordering.
54
+ let team0, team1;
55
+
56
+ before(() =>
57
+ webex.teams.create({name: 'Webex Test Team 1'}).then((team) => {
58
+ team1 = team;
59
+ })
60
+ );
61
+
62
+ before(() =>
63
+ webex.teams.create({name: 'Webex Test Team 0'}).then((team) => {
64
+ team0 = team;
65
+ })
66
+ );
67
+
68
+ it('lists all of the teams to which I have access', () =>
69
+ webex.teams.list().then((teams) => {
70
+ assert.isAbove(teams.length, 1);
71
+ for (const team of teams) {
72
+ assert.isTeam(team);
73
+ }
74
+ }));
75
+
76
+ it('lists a bounded, pageable set of teams to which I have access', () =>
77
+ webex.teams.list({max: 1}).then((teams) => {
78
+ assert.lengthOf(teams, 1);
79
+ const spy = sinon.spy();
80
+
81
+ return (function f(page) {
82
+ for (const team of page) {
83
+ spy(team.id);
84
+ }
85
+
86
+ if (page.hasNext()) {
87
+ return page.next().then(f);
88
+ }
89
+
90
+ return Promise.resolve();
91
+ })(teams).then(() => {
92
+ assert.isAbove(spy.callCount, 1);
93
+ assert.calledWith(spy, team0.id);
94
+ assert.calledWith(spy, team1.id);
95
+ });
96
+ }));
97
+ });
98
+
99
+ describe('#update()', () => {
100
+ it("updates a single team's name", () =>
101
+ webex.teams
102
+ .create({
103
+ name: 'Webex Test Team',
104
+ })
105
+ .then((team) => {
106
+ assert.isTeam(team);
107
+
108
+ return webex.teams.update(Object.assign({}, team, {name: 'Webex Test Team (Updated)'}));
109
+ })
110
+ .then((team) => {
111
+ assert.isTeam(team);
112
+ assert.equal(team.name, 'Webex Test Team (Updated)');
113
+ }));
114
+ });
115
+ });
116
+
117
+ describe('#rooms', () => {
118
+ let team;
119
+
120
+ before(() =>
121
+ webex.teams
122
+ .create({
123
+ name: 'Webex Test Team',
124
+ })
125
+ .then((t) => {
126
+ team = t;
127
+ })
128
+ );
129
+
130
+ describe('#create()', () => {
131
+ // COLLAB-1104 create date don't match; Mike is working on a fix
132
+ it.skip('creates a room that is part of a team', () =>
133
+ webex.rooms
134
+ .create({
135
+ title: 'Team Room',
136
+ teamId: team.id,
137
+ })
138
+ .then((room) => {
139
+ assert.isTeamRoom(room);
140
+ assert.equal(room.teamId, team.id);
141
+ }));
142
+ });
143
+
144
+ describe('#get()', () => {
145
+ it('retrieves a specific room that is part of a team', () =>
146
+ webex.rooms
147
+ .create({
148
+ title: 'Team Room',
149
+ teamId: team.id,
150
+ })
151
+ .then((room) => webex.rooms.get(room))
152
+ .then((room) => {
153
+ assert.isTeamRoom(room);
154
+ assert.equal(room.teamId, team.id);
155
+ }));
156
+
157
+ describe("when the user leaves the team's general room", () => {
158
+ let room, team;
159
+
160
+ it("no longer returns the team's rooms", () =>
161
+ webex.teams
162
+ .create({
163
+ name: 'Team Title',
164
+ })
165
+ .then((t) => {
166
+ team = t;
167
+
168
+ return webex.rooms.create({
169
+ title: 'Room Title',
170
+ teamId: team.id,
171
+ });
172
+ })
173
+ .then((r) => {
174
+ room = r;
175
+
176
+ return webex.rooms.list({teamId: team.id});
177
+ })
178
+ .then((teamRooms) => {
179
+ assert.lengthOf(teamRooms, 2);
180
+ const generalRoom = find(teamRooms.items, (r) => r.id !== room.id);
181
+
182
+ return webex.memberships.list({roomId: generalRoom.id, personId: user.id});
183
+ })
184
+ .then((memberships) => webex.memberships.remove(memberships.items[0]))
185
+ .then(() => assert.isRejected(webex.rooms.get(room)))
186
+ .then((reason) => {
187
+ assert.instanceOf(reason, WebexHttpError.NotFound);
188
+ }));
189
+ });
190
+ });
191
+
192
+ describe('#list()', () => {
193
+ it('lists all rooms in a team', () =>
194
+ webex.rooms
195
+ .create({
196
+ title: 'Team Room',
197
+ teamId: team.id,
198
+ })
199
+ .then(() => webex.rooms.list({teamId: team.id}))
200
+ .then((rooms) => {
201
+ assert.isAbove(rooms.length, 0);
202
+ for (const room of rooms) {
203
+ assert.isTeamRoom(room);
204
+ assert.equal(room.teamId, team.id);
205
+ }
206
+ }));
207
+ });
208
+ });
209
+ });