Documentation ¶
Index ¶
Constants ¶
const ( ColorInfo = "#439FE0" ColorGood = "good" ColorWarning = "warning" ColorDanger = "danger" )
Reserved colors in Slack API
Variables ¶
This section is empty.
Functions ¶
func GitHubHTTPClient ¶
GitHubHTTPClient returns a *http.Client to access Internet with GitHub personal access token. It returns *http.Client of ProxyHTTPClient() when token does not exist.
func LocalHTTPClient ¶
LocalHTTPClient returns a *http.Client to access intranet services.
Types ¶
type Attachment ¶
type Attachment struct { Fallback string `json:"fallback,omitempty"` Color string `json:"color,omitempty"` Pretext string `json:"pretext,omitempty"` AuthorName string `json:"author_name,omitempty"` AuthorLink string `json:"author_link,omitempty"` AuthorIcon string `json:"author_icon,omitempty"` Title string `json:"title,omitempty"` TitleLink string `json:"title_link,omitempty"` Text string `json:"text,omitempty"` Fields []AttachmentField `json:"fields,omitempty"` ImageURL string `json:"image_url,omitempty"` ThumbURL string `json:"thumb_url,omitempty"` }
Attachment represents an attachment in the slack payload
type AttachmentField ¶
type AttachmentField struct { Title string `json:"title,omitempty"` Value string `json:"value,omitempty"` Short bool `json:"short,omitempty"` }
AttachmentField represents fields in a Attachment
type Notifier ¶
type Notifier interface { NotifyInfo(req neco.UpdateRequest, message string) error NotifySucceeded(req neco.UpdateRequest) error NotifyFailure(req neco.UpdateRequest, message string) error }
Notifier notifies the result of update to the outside.
type Payload ¶
type Payload struct {
Attachments []Attachment `json:"attachments"`
}
Payload represents a slack payload
type SlackClient ¶
SlackClient is a slack client
func (SlackClient) NotifyFailure ¶
func (c SlackClient) NotifyFailure(req neco.UpdateRequest, message string) error
NotifyFailure sends a failure notification about the update process
func (SlackClient) NotifyInfo ¶
func (c SlackClient) NotifyInfo(req neco.UpdateRequest, message string) error
NotifyInfo sends a notification about the beginning of the update process
func (SlackClient) NotifySucceeded ¶
func (c SlackClient) NotifySucceeded(req neco.UpdateRequest) error
NotifySucceeded sends a successful notification about the update process
func (SlackClient) PostWebHook ¶
func (c SlackClient) PostWebHook(payload Payload) error
PostWebHook posts a payload to slack