Documentation
¶
Index ¶
Constants ¶
View Source
const ( HttpSenderType senderType = "http-sender" MattermostSenderType senderType = "mattermost" SingleMessageFormat pushMessageFormat = "single" MultipleMessageFormat pushMessageFormat = "multi" )
View Source
const ApplicationJson = "application/json"
Variables ¶
This section is empty.
Functions ¶
func DetermineMessageFormat ¶
func DetermineMessageFormat(numberOfMessages int64) pushMessageFormat
DetermineMessageFormat decides what message format should be used depending on the number of messages
Types ¶
type HttpSender ¶
type HttpSender struct {
// contains filtered or unexported fields
}
HttpSender delivers data to any http endpoint
func NewHttpSender ¶
func NewHttpSender(endpoint, authz string, client *http.Client) *HttpSender
NewHttpSender initialises and returns a new http sender
func (*HttpSender) Destination ¶
func (s *HttpSender) Destination() string
Destination returns the http endpoint where data is being sent
type MattermostError ¶
type MattermostError struct {
Id string `json:"id"`
Message string `json:"message"`
DetailedError string `json:"detailed_error"`
RequestId string `json:"request_id"`
StatusCode int `json:"status_code"`
}
func (*MattermostError) Error ¶
func (m *MattermostError) Error() string
type MattermostMessage ¶
type MattermostSender ¶
type MattermostSender struct {
// contains filtered or unexported fields
}
HttpSender delivers data to any http endpoint
func NewMattermostSender ¶
func NewMattermostSender(webhookUrl, username, channel string, client *http.Client) *MattermostSender
NewMattermostSender initialises and returns a new mattermost sender
func (*MattermostSender) Destination ¶
func (s *MattermostSender) Destination() string
Destination returns the http webhook where data is being sent
type MockMattermostRoundTripper ¶
type MockMattermostRoundTripper struct {
RequestBodyBytes []byte
Message MattermostMessage
}
type MockSender ¶
func (*MockSender) Destination ¶
func (s *MockSender) Destination() string
type MockSenderRoundTripper ¶
type MockSenderRoundTripper struct {
RequestBodyBytes []byte
}
type PushMsg ¶
type PushMsg struct {
// the actual message
Msg ams.Message `json:"message"`
// the source
Sub string `json:"subscription"`
}
PushMsg holds data to be send to a remote endpoint
type PushMsgs ¶
type PushMsgs struct {
// the actual messages
Messages []PushMsg `json:"messages"`
}
PushMsgs holds data to be send to a remote endpoint(multiple messages grouped together)
type Sender ¶
type Sender interface {
// Send sends the data to a remote destination
Send(ctx context.Context, msgs PushMsgs, format pushMessageFormat) error
// Destination returns the target destination where the sender sends the data
Destination() string
}
Sender is responsible for delivering data to remote destinations
Click to show internal directories.
Click to hide internal directories.