-
Notifications
You must be signed in to change notification settings - Fork 250
/
types.go
154 lines (126 loc) · 3.73 KB
/
types.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
// This source code file is AUTO-GENERATED by github.com/taskcluster/jsonschema2go
package tcnotify
import (
"encoding/json"
"errors"
)
type (
// Request to post a message on IRC.
ChannelMessage struct {
// Channel to post the message in.
//
// Syntax: ^[#&][^ ,\u0007]{1,199}$
// Min length: 1
Channel string `json:"channel"`
// IRC message to send as plain text.
//
// Min length: 1
// Max length: 510
Message string `json:"message"`
}
// Optional link that can be added as a button to the email.
Link struct {
// Where the link should point to.
//
// Min length: 1
// Max length: 1024
Href string `json:"href"`
// Text to display on link.
//
// Min length: 1
// Max length: 40
Text string `json:"text"`
}
// List of notification addresses.
ListOfNotificationAdresses struct {
Addresses []NotificationTypeAndAddress `json:"addresses"`
// A continuation token is returned if there are more results than listed
// here. You can optionally provide the token in the request payload to
// load the additional results.
ContinuationToken string `json:"continuationToken,omitempty"`
}
// Type of notification and its corresponding address.
NotificationTypeAndAddress struct {
NotificationAddress string `json:"notificationAddress"`
// Possible values:
// * "email"
// * "pulse"
// * "irc-user"
// * "irc-channel"
NotificationType string `json:"notificationType"`
}
// Request to post a message on IRC.
//
// One of:
// * ChannelMessage
// * PrivateMessage
PostIRCMessageRequest json.RawMessage
// Request to post a message on pulse.
PostPulseMessageRequest struct {
// Pulse message to send as plain text.
//
// Additional properties allowed
Message json.RawMessage `json:"message"`
// Routing-key to use when posting the message.
//
// Max length: 255
RoutingKey string `json:"routingKey"`
}
// Request to post a message on IRC.
PrivateMessage struct {
// IRC message to send as plain text.
//
// Min length: 1
// Max length: 510
Message string `json:"message"`
// User to post the message to.
//
// Syntax: ^[A-Za-z\[\]\\~_\^{|}][A-Za-z0-9\-\[\]\\~_\^{|}]{0,254}$
// Min length: 1
// Max length: 255
User string `json:"user"`
}
// Request to send an email
SendEmailRequest struct {
// E-mail address to which the message should be sent
Address string `json:"address"`
// Content of the e-mail as **markdown**, will be rendered to HTML before
// the email is sent. Notice that markdown allows for a few HTML tags, but
// won't allow inclusion of script tags and other unpleasantries.
//
// Min length: 1
// Max length: 102400
Content string `json:"content"`
// Optional link that can be added as a button to the email.
Link Link `json:"link,omitempty"`
// Reply-to e-mail (this property is optional)
ReplyTo string `json:"replyTo,omitempty"`
// Subject line of the e-mail, this is plain-text
//
// Min length: 1
// Max length: 255
Subject string `json:"subject"`
// E-mail html template used to format your content.
//
// Possible values:
// * "simple"
// * "fullscreen"
//
// Default: "simple"
Template string `json:"template,omitempty"`
}
)
// MarshalJSON calls json.RawMessage method of the same name. Required since
// PostIRCMessageRequest is of type json.RawMessage...
func (this *PostIRCMessageRequest) MarshalJSON() ([]byte, error) {
x := json.RawMessage(*this)
return (&x).MarshalJSON()
}
// UnmarshalJSON is a copy of the json.RawMessage implementation.
func (this *PostIRCMessageRequest) UnmarshalJSON(data []byte) error {
if this == nil {
return errors.New("PostIRCMessageRequest: UnmarshalJSON on nil pointer")
}
*this = append((*this)[0:0], data...)
return nil
}