-
Notifications
You must be signed in to change notification settings - Fork 251
/
types.go
81 lines (67 loc) · 1.79 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
// This source code file is AUTO-GENERATED by github.com/taskcluster/jsonschema2go
package tcnotifyevents
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"`
}
// This can be pretty much anything you want it to be.
NotificationMessage struct {
// Arbitrary message.
//
// Additional properties allowed
Message json.RawMessage `json:"message"`
// Message version
//
// Possible values:
// * 1
Version int64 `json:"version,omitempty"`
}
// Request to post a message on IRC.
//
// One of:
// * ChannelMessage
// * PrivateMessage
PostIRCMessageRequest json.RawMessage
// 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"`
}
)
// 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
}