Documentation ¶
Index ¶
- func Deliver(t *models.HookTask) error
- func DeliverHooks(ctx context.Context)
- func InitDeliverHooks()
- func PrepareWebhook(w *models.Webhook, repo *models.Repository, event models.HookEventType, ...) error
- func PrepareWebhooks(repo *models.Repository, event models.HookEventType, p api.Payloader) error
- func SlackLinkFormatter(url string, text string) string
- func SlackLinkToRef(repoURL, ref string) string
- func SlackShortTextFormatter(s string) string
- func SlackTextFormatter(s string) string
- type DingtalkPayload
- type DiscordEmbed
- type DiscordEmbedAuthor
- type DiscordEmbedField
- type DiscordEmbedFooter
- type DiscordMeta
- type DiscordPayload
- type MSTeamsAction
- type MSTeamsActionTarget
- type MSTeamsFact
- type MSTeamsPayload
- type MSTeamsSection
- type SlackAttachment
- type SlackMeta
- type SlackPayload
- type TelegramMeta
- type TelegramPayload
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeliverHooks ¶
DeliverHooks checks and delivers undelivered hooks. FIXME: graceful: This would likely benefit from either a worker pool with dummy queue or a full queue. Then more hooks could be sent at same time.
func PrepareWebhook ¶
func PrepareWebhook(w *models.Webhook, repo *models.Repository, event models.HookEventType, p api.Payloader) error
PrepareWebhook adds special webhook to task queue for given payload.
func PrepareWebhooks ¶
func PrepareWebhooks(repo *models.Repository, event models.HookEventType, p api.Payloader) error
PrepareWebhooks adds new webhooks to task queue for given payload.
func SlackLinkFormatter ¶
SlackLinkFormatter creates a link compatible with slack
func SlackLinkToRef ¶
SlackLinkToRef slack-formatter link to a repo ref
func SlackShortTextFormatter ¶
SlackShortTextFormatter replaces &, <, > with HTML characters
func SlackTextFormatter ¶
SlackTextFormatter replaces &, <, > with HTML characters see: https://api.slack.com/docs/formatting
Types ¶
type DingtalkPayload ¶
DingtalkPayload represents
func GetDingtalkPayload ¶
func GetDingtalkPayload(p api.Payloader, event models.HookEventType, meta string) (*DingtalkPayload, error)
GetDingtalkPayload converts a ding talk webhook into a DingtalkPayload
func (*DingtalkPayload) JSONPayload ¶
func (p *DingtalkPayload) JSONPayload() ([]byte, error)
JSONPayload Marshals the DingtalkPayload to json
func (*DingtalkPayload) SetSecret ¶
func (p *DingtalkPayload) SetSecret(_ string)
SetSecret sets the dingtalk secret
type DiscordEmbed ¶
type DiscordEmbed struct { Title string `json:"title"` Description string `json:"description"` URL string `json:"url"` Color int `json:"color"` Author DiscordEmbedAuthor `json:"author"` Fields []DiscordEmbedField `json:"fields"` }
DiscordEmbed is for Embed Structure
type DiscordEmbedAuthor ¶
type DiscordEmbedAuthor struct { Name string `json:"name"` URL string `json:"url"` IconURL string `json:"icon_url"` }
DiscordEmbedAuthor for Embed Author Structure
type DiscordEmbedField ¶
DiscordEmbedField for Embed Field Structure
type DiscordEmbedFooter ¶
type DiscordEmbedFooter struct {
}DiscordEmbedFooter for Embed Footer Structure.
type DiscordMeta ¶
DiscordMeta contains the discord metadata
func GetDiscordHook ¶
func GetDiscordHook(w *models.Webhook) *DiscordMeta
GetDiscordHook returns discord metadata
type DiscordPayload ¶
type DiscordPayload struct { Wait bool `json:"wait"` Content string `json:"content"` Username string `json:"username"` AvatarURL string `json:"avatar_url"` TTS bool `json:"tts"` Embeds []DiscordEmbed `json:"embeds"` }
DiscordPayload represents
func GetDiscordPayload ¶
func GetDiscordPayload(p api.Payloader, event models.HookEventType, meta string) (*DiscordPayload, error)
GetDiscordPayload converts a discord webhook into a DiscordPayload
func (*DiscordPayload) JSONPayload ¶
func (p *DiscordPayload) JSONPayload() ([]byte, error)
JSONPayload Marshals the DiscordPayload to json
func (*DiscordPayload) SetSecret ¶
func (p *DiscordPayload) SetSecret(_ string)
SetSecret sets the discord secret
type MSTeamsAction ¶
type MSTeamsAction struct { Type string `json:"@type"` Name string `json:"name"` Targets []MSTeamsActionTarget `json:"targets,omitempty"` }
MSTeamsAction is an action (creates buttons, links etc)
type MSTeamsActionTarget ¶
MSTeamsActionTarget is the actual link to follow, etc
type MSTeamsFact ¶
MSTeamsFact for Fact Structure
type MSTeamsPayload ¶
type MSTeamsPayload struct { Type string `json:"@type"` Context string `json:"@context"` ThemeColor string `json:"themeColor"` Title string `json:"title"` Summary string `json:"summary"` Sections []MSTeamsSection `json:"sections"` PotentialAction []MSTeamsAction `json:"potentialAction"` }
MSTeamsPayload is the parent object
func GetMSTeamsPayload ¶
func GetMSTeamsPayload(p api.Payloader, event models.HookEventType, meta string) (*MSTeamsPayload, error)
GetMSTeamsPayload converts a MSTeams webhook into a MSTeamsPayload
func (*MSTeamsPayload) JSONPayload ¶
func (p *MSTeamsPayload) JSONPayload() ([]byte, error)
JSONPayload Marshals the MSTeamsPayload to json
func (*MSTeamsPayload) SetSecret ¶
func (p *MSTeamsPayload) SetSecret(_ string)
SetSecret sets the MSTeams secret
type MSTeamsSection ¶
type MSTeamsSection struct { ActivityTitle string `json:"activityTitle"` ActivitySubtitle string `json:"activitySubtitle"` ActivityImage string `json:"activityImage"` Facts []MSTeamsFact `json:"facts"` Text string `json:"text"` }
MSTeamsSection is a MessageCard section
type SlackAttachment ¶
type SlackAttachment struct { Fallback string `json:"fallback"` Color string `json:"color"` Title string `json:"title"` TitleLink string `json:"title_link"` Text string `json:"text"` }
SlackAttachment contains the slack message
type SlackMeta ¶
type SlackMeta struct { Channel string `json:"channel"` Username string `json:"username"` IconURL string `json:"icon_url"` Color string `json:"color"` }
SlackMeta contains the slack metadata
func GetSlackHook ¶
GetSlackHook returns slack metadata
type SlackPayload ¶
type SlackPayload struct { Channel string `json:"channel"` Text string `json:"text"` Username string `json:"username"` IconURL string `json:"icon_url"` UnfurlLinks int `json:"unfurl_links"` LinkNames int `json:"link_names"` Attachments []SlackAttachment `json:"attachments"` }
SlackPayload contains the information about the slack channel
func GetSlackPayload ¶
func GetSlackPayload(p api.Payloader, event models.HookEventType, meta string) (*SlackPayload, error)
GetSlackPayload converts a slack webhook into a SlackPayload
func (*SlackPayload) JSONPayload ¶
func (p *SlackPayload) JSONPayload() ([]byte, error)
JSONPayload Marshals the SlackPayload to json
func (*SlackPayload) SetSecret ¶
func (p *SlackPayload) SetSecret(_ string)
SetSecret sets the slack secret
type TelegramMeta ¶
TelegramMeta contains the telegram metadata
func GetTelegramHook ¶
func GetTelegramHook(w *models.Webhook) *TelegramMeta
GetTelegramHook returns telegram metadata
type TelegramPayload ¶
type TelegramPayload struct { Message string `json:"text"` ParseMode string `json:"parse_mode"` DisableWebPreview bool `json:"disable_web_page_preview"` }
TelegramPayload represents
func GetTelegramPayload ¶
func GetTelegramPayload(p api.Payloader, event models.HookEventType, meta string) (*TelegramPayload, error)
GetTelegramPayload converts a telegram webhook into a TelegramPayload
func (*TelegramPayload) JSONPayload ¶
func (p *TelegramPayload) JSONPayload() ([]byte, error)
JSONPayload Marshals the TelegramPayload to json
func (*TelegramPayload) SetSecret ¶
func (p *TelegramPayload) SetSecret(_ string)
SetSecret sets the telegram secret