Conversation
687ef52 to
9a27efb
Compare
| } | ||
|
|
||
| type event struct { | ||
| Type string `json:"type"` |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
notifications/notifications.go
Outdated
|
|
||
| eventBytes, err := json.Marshal(e) | ||
| if err != nil { | ||
| return errors.Wrapf(err, "Cannot marshal event to []byte %v", msg) |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
| // BrowserMessage contains the required fields for formatting browser notifications | ||
| type BrowserMessage struct { | ||
| Type string `json:"type"` | ||
| Text string `json:"text"` |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
notifications/notifications.go
Outdated
|
|
||
| // SlackMessage contains the required fields for formatting slack messages | ||
| type SlackMessage struct { | ||
| Text string `json:"text"` |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
| }, | ||
| Slack: notifications.SlackMessage{ | ||
| Text: markdown, | ||
| }, |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
notifications/notifications.go
Outdated
|
|
||
| defer resp.Body.Close() | ||
|
|
||
| if err != nil { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
9a27efb to
17721dd
Compare
17721dd to
cfda9dd
Compare
| resp, err := http.DefaultClient.Do(req) | ||
| if err != nil { | ||
| return errors.Wrap(err, "Failed to POST event") | ||
| } |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
notifications/notifications.go
Outdated
| } | ||
|
|
||
| // SendEvent sends an event to the notification service. | ||
| func (s *Sender) SendEvent(et string, instance string, t time.Time, msg *Message) error { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
notifications/notifications.go
Outdated
| Type string `json:"type"` | ||
| InstanceID string `json:"instance_id"` | ||
| Timestamp time.Time `json:"timestamp"` | ||
| Messages *Message `json:"messages"` |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
|
|
||
| eventBytes, err := json.Marshal(e) | ||
| if err != nil { | ||
| return errors.Wrapf(err, "Cannot marshal event to []byte %s", err) |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
Migrate ZeroSample and ZeroSamplePair to model
Fixes https://github.com/weaveworks/notification/issues/21
Adds a first iteration of a client library for notifications. This intentionally contains very little abstraction and only be used for an initial non-customer-facing service, such as
service-ui-kicker.