diff options
Diffstat (limited to 'recipes/hipchat/index.js')
-rw-r--r-- | recipes/hipchat/index.js | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/recipes/hipchat/index.js b/recipes/hipchat/index.js deleted file mode 100644 index e786bcb..0000000 --- a/recipes/hipchat/index.js +++ /dev/null | |||
@@ -1,57 +0,0 @@ | |||
1 | function _asyncToGenerator(fn) { | ||
2 | return function () { | ||
3 | const gen = Reflect.apply(fn, this, arguments); | ||
4 | return new Promise((resolve, reject) => { | ||
5 | function step(key, arg) { | ||
6 | try { | ||
7 | var info = gen[key](arg); | ||
8 | var value = info.value; | ||
9 | } catch (error) { | ||
10 | reject(error); | ||
11 | return; | ||
12 | } | ||
13 | if (info.done) { | ||
14 | resolve(value); | ||
15 | } else { | ||
16 | // eslint-disable-next-line consistent-return | ||
17 | return Promise.resolve(value).then( | ||
18 | value => { | ||
19 | step('next', value); | ||
20 | }, | ||
21 | error => { | ||
22 | step('throw', error); | ||
23 | }, | ||
24 | ); | ||
25 | } | ||
26 | } | ||
27 | return step('next'); | ||
28 | }); | ||
29 | }; | ||
30 | } | ||
31 | |||
32 | module.exports = Ferdium => | ||
33 | class HipChat extends Ferdium { | ||
34 | validateUrl(url) { | ||
35 | return _asyncToGenerator(function* () { | ||
36 | try { | ||
37 | const resp = yield window.fetch(`${url}/api/features`, { | ||
38 | method: 'GET', | ||
39 | headers: { | ||
40 | 'Content-Type': 'application/json', | ||
41 | }, | ||
42 | }); | ||
43 | const data = yield resp.json(); | ||
44 | |||
45 | return Object.hasOwnProperty.call(data, 'features'); | ||
46 | } catch (error) { | ||
47 | console.error(error); | ||
48 | } | ||
49 | |||
50 | return false; | ||
51 | })(); | ||
52 | } | ||
53 | |||
54 | buildUrl(url) { | ||
55 | return `${url}/chat`; | ||
56 | } | ||
57 | }; | ||