aboutsummaryrefslogtreecommitdiffstats
path: root/src/models/Recipe.js
diff options
context:
space:
mode:
authorLibravatar Stefan Malzner <stefan@adlk.io>2017-10-13 12:29:40 +0200
committerLibravatar Stefan Malzner <stefan@adlk.io>2017-10-13 12:29:40 +0200
commit58cda9cc7fb79ca9df6746de7f9662bc08dc156a (patch)
tree1211600c2a5d3b5f81c435c6896618111a611720 /src/models/Recipe.js
downloadferdium-app-58cda9cc7fb79ca9df6746de7f9662bc08dc156a.tar.gz
ferdium-app-58cda9cc7fb79ca9df6746de7f9662bc08dc156a.tar.zst
ferdium-app-58cda9cc7fb79ca9df6746de7f9662bc08dc156a.zip
initial commit
Diffstat (limited to 'src/models/Recipe.js')
-rw-r--r--src/models/Recipe.js52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/models/Recipe.js b/src/models/Recipe.js
new file mode 100644
index 000000000..43a3450b1
--- /dev/null
+++ b/src/models/Recipe.js
@@ -0,0 +1,52 @@
1export default class Recipe {
2 id = '';
3 name = '';
4 author = '';
5 description = '';
6 version = '1.0';
7 path = '';
8
9 serviceURL = '';
10
11 hasDirectMessages = true;
12 hasIndirectMessages = false;
13 hasNotificationSound = false;
14 hasTeamId = false;
15 hasPredefinedUrl = false;
16 hasCustomUrl = false;
17 urlInputPrefix = '';
18 urlInputSuffix = '';
19
20 message = '';
21
22 constructor(data) {
23 if (!data) {
24 throw Error('Recipe config not valid');
25 }
26
27 if (!data.id) {
28 throw Error('Recipe requires Id');
29 }
30
31 this.id = data.id || this.id;
32 this.name = data.name || this.name;
33 this.author = data.author || this.author;
34 this.description = data.description || this.description;
35 this.version = data.version || this.version;
36 this.path = data.path;
37
38 this.serviceURL = data.config.serviceURL || this.serviceURL;
39
40 this.hasDirectMessages = data.config.hasDirectMessages || this.hasDirectMessages;
41 this.hasIndirectMessages = data.config.hasIndirectMessages || this.hasIndirectMessages;
42 this.hasNotificationSound = data.config.hasNotificationSound || this.hasNotificationSound;
43 this.hasTeamId = data.config.hasTeamId || this.hasTeamId;
44 this.hasPredefinedUrl = data.config.hasPredefinedUrl || this.hasPredefinedUrl;
45 this.hasCustomUrl = data.config.hasCustomUrl || this.hasCustomUrl;
46
47 this.urlInputPrefix = data.config.urlInputPrefix || this.urlInputPrefix;
48 this.urlInputSuffix = data.config.urlInputSuffix || this.urlInputSuffix;
49
50 this.message = data.config.message || this.message;
51 }
52}