-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathintegrations.go
80 lines (59 loc) · 1.58 KB
/
integrations.go
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package tdproto
// Integration form field
type IntegrationField struct {
// Label
Label string `json:"label"`
// Is field readonly
Readonly bool `json:"readonly"`
// Current value
Value string `json:"value"`
}
// Integration form
type IntegrationForm struct {
// Api key field, if any
ApiKey *IntegrationField `json:"api_key,omitempty"`
// Webhook url, if any
WebhookUrl *IntegrationField `json:"webhook_url,omitempty"`
// Url, if any
Url *IntegrationField `json:"url,omitempty"`
}
// Integration for concrete chat
type Integration struct {
// Id
Uid string `json:"uid,omitempty"`
// Comment, if any
Comment string `json:"comment"`
// Creation datetime, iso
Created ISODateTimeString `json:"created,omitempty"`
// Integration enabled
Enabled bool `json:"enabled"`
// Integration form
Form IntegrationForm `json:"form"`
// Chat id
Group JID `json:"group"`
// Full description
Help string `json:"help,omitempty"`
// Unique integration name
Kind string `json:"kind"`
Title string `json:"-"`
}
// Integration kind
type IntegrationKind struct {
// Integration unique name
Kind string `json:"kind"`
// Plugin title
Title string `json:"title"`
// Integration template
Template Integration `json:"template"`
// Path to icon
Icon string `json:"icon"`
// Plugin description
Description string `json:"description"`
}
// Complete integrations data, as received from server
type Integrations struct {
// Currently existing integrations
Integrations []Integration `json:"integrations"`
// Types of integrations available for setup
Kinds []IntegrationKind `json:"kinds"`
}