diff options
author | 2019-09-28 12:10:25 +0200 | |
---|---|---|
committer | 2019-09-28 12:10:25 +0200 | |
commit | 728d339739b63e9bb59e457e4a84fe9a65b93fc9 (patch) | |
tree | a0fc6180ea26fa9ef397458e8eb6491031d6437d /uncompressed/hipchat/index.js | |
parent | Add list of recipes (diff) | |
download | ferdium-recipes-728d339739b63e9bb59e457e4a84fe9a65b93fc9.tar.gz ferdium-recipes-728d339739b63e9bb59e457e4a84fe9a65b93fc9.tar.zst ferdium-recipes-728d339739b63e9bb59e457e4a84fe9a65b93fc9.zip |
Add uncompressed recipes
Diffstat (limited to 'uncompressed/hipchat/index.js')
-rw-r--r-- | uncompressed/hipchat/index.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/uncompressed/hipchat/index.js b/uncompressed/hipchat/index.js new file mode 100644 index 0000000..f90186a --- /dev/null +++ b/uncompressed/hipchat/index.js | |||
@@ -0,0 +1,30 @@ | |||
1 | 'use strict'; | ||
2 | |||
3 | function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } | ||
4 | |||
5 | module.exports = Franz => class HipChat extends Franz { | ||
6 | validateUrl(url) { | ||
7 | return _asyncToGenerator(function* () { | ||
8 | try { | ||
9 | const resp = yield window.fetch(`${url}/api/features`, { | ||
10 | method: 'GET', | ||
11 | headers: { | ||
12 | 'Content-Type': 'application/json' | ||
13 | } | ||
14 | }); | ||
15 | const data = yield resp.json(); | ||
16 | |||
17 | return Object.hasOwnProperty.call(data, 'features'); | ||
18 | } catch (err) { | ||
19 | console.error(err); | ||
20 | } | ||
21 | |||
22 | return false; | ||
23 | })(); | ||
24 | } | ||
25 | |||
26 | buildUrl(url) { | ||
27 | return `${url}/chat`; | ||
28 | } | ||
29 | }; | ||
30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