blob: 43a3450b1e1ca130c6170f3d4b1bdb9a40800483 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
export default class Recipe {
id = '';
name = '';
author = '';
description = '';
version = '1.0';
path = '';
serviceURL = '';
hasDirectMessages = true;
hasIndirectMessages = false;
hasNotificationSound = false;
hasTeamId = false;
hasPredefinedUrl = false;
hasCustomUrl = false;
urlInputPrefix = '';
urlInputSuffix = '';
message = '';
constructor(data) {
if (!data) {
throw Error('Recipe config not valid');
}
if (!data.id) {
throw Error('Recipe requires Id');
}
this.id = data.id || this.id;
this.name = data.name || this.name;
this.author = data.author || this.author;
this.description = data.description || this.description;
this.version = data.version || this.version;
this.path = data.path;
this.serviceURL = data.config.serviceURL || this.serviceURL;
this.hasDirectMessages = data.config.hasDirectMessages || this.hasDirectMessages;
this.hasIndirectMessages = data.config.hasIndirectMessages || this.hasIndirectMessages;
this.hasNotificationSound = data.config.hasNotificationSound || this.hasNotificationSound;
this.hasTeamId = data.config.hasTeamId || this.hasTeamId;
this.hasPredefinedUrl = data.config.hasPredefinedUrl || this.hasPredefinedUrl;
this.hasCustomUrl = data.config.hasCustomUrl || this.hasCustomUrl;
this.urlInputPrefix = data.config.urlInputPrefix || this.urlInputPrefix;
this.urlInputSuffix = data.config.urlInputSuffix || this.urlInputSuffix;
this.message = data.config.message || this.message;
}
}
|