Documentation ¶
Index ¶
- func Deliver(t *models.HookTask) error
- func DeliverHooks(ctx context.Context)
- func GetDingtalkPayload(p api.Payloader, event models.HookEventType, meta string) (api.Payloader, error)
- func GetDiscordPayload(p api.Payloader, event models.HookEventType, meta string) (api.Payloader, error)
- func GetFeishuPayload(p api.Payloader, event models.HookEventType, meta string) (api.Payloader, error)
- func GetMSTeamsPayload(p api.Payloader, event models.HookEventType, meta string) (api.Payloader, error)
- func GetMatrixPayload(p api.Payloader, event models.HookEventType, meta string) (api.Payloader, error)
- func GetSlackPayload(p api.Payloader, event models.HookEventType, meta string) (api.Payloader, error)
- func GetTelegramPayload(p api.Payloader, event models.HookEventType, meta string) (api.Payloader, error)
- func InitDeliverHooks()
- func MatrixLinkFormatter(url string, text string) string
- func MatrixLinkToRef(repoURL, ref string) string
- 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
- func (d *DingtalkPayload) Create(p *api.CreatePayload) (api.Payloader, error)
- func (d *DingtalkPayload) Delete(p *api.DeletePayload) (api.Payloader, error)
- func (d *DingtalkPayload) Fork(p *api.ForkPayload) (api.Payloader, error)
- func (d *DingtalkPayload) Issue(p *api.IssuePayload) (api.Payloader, error)
- func (d *DingtalkPayload) IssueComment(p *api.IssueCommentPayload) (api.Payloader, error)
- func (d *DingtalkPayload) JSONPayload() ([]byte, error)
- func (d *DingtalkPayload) PullRequest(p *api.PullRequestPayload) (api.Payloader, error)
- func (d *DingtalkPayload) Push(p *api.PushPayload) (api.Payloader, error)
- func (d *DingtalkPayload) Release(p *api.ReleasePayload) (api.Payloader, error)
- func (d *DingtalkPayload) Repository(p *api.RepositoryPayload) (api.Payloader, error)
- func (d *DingtalkPayload) Review(p *api.PullRequestPayload, event models.HookEventType) (api.Payloader, error)
- func (d *DingtalkPayload) SetSecret(_ string)
- type DiscordEmbed
- type DiscordEmbedAuthor
- type DiscordEmbedField
- type DiscordEmbedFooter
- type DiscordMeta
- type DiscordPayload
- func (d *DiscordPayload) Create(p *api.CreatePayload) (api.Payloader, error)
- func (d *DiscordPayload) Delete(p *api.DeletePayload) (api.Payloader, error)
- func (d *DiscordPayload) Fork(p *api.ForkPayload) (api.Payloader, error)
- func (d *DiscordPayload) Issue(p *api.IssuePayload) (api.Payloader, error)
- func (d *DiscordPayload) IssueComment(p *api.IssueCommentPayload) (api.Payloader, error)
- func (d *DiscordPayload) JSONPayload() ([]byte, error)
- func (d *DiscordPayload) PullRequest(p *api.PullRequestPayload) (api.Payloader, error)
- func (d *DiscordPayload) Push(p *api.PushPayload) (api.Payloader, error)
- func (d *DiscordPayload) Release(p *api.ReleasePayload) (api.Payloader, error)
- func (d *DiscordPayload) Repository(p *api.RepositoryPayload) (api.Payloader, error)
- func (d *DiscordPayload) Review(p *api.PullRequestPayload, event models.HookEventType) (api.Payloader, error)
- func (d *DiscordPayload) SetSecret(_ string)
- type FeishuPayload
- func (f *FeishuPayload) Create(p *api.CreatePayload) (api.Payloader, error)
- func (f *FeishuPayload) Delete(p *api.DeletePayload) (api.Payloader, error)
- func (f *FeishuPayload) Fork(p *api.ForkPayload) (api.Payloader, error)
- func (f *FeishuPayload) Issue(p *api.IssuePayload) (api.Payloader, error)
- func (f *FeishuPayload) IssueComment(p *api.IssueCommentPayload) (api.Payloader, error)
- func (f *FeishuPayload) JSONPayload() ([]byte, error)
- func (f *FeishuPayload) PullRequest(p *api.PullRequestPayload) (api.Payloader, error)
- func (f *FeishuPayload) Push(p *api.PushPayload) (api.Payloader, error)
- func (f *FeishuPayload) Release(p *api.ReleasePayload) (api.Payloader, error)
- func (f *FeishuPayload) Repository(p *api.RepositoryPayload) (api.Payloader, error)
- func (f *FeishuPayload) Review(p *api.PullRequestPayload, event models.HookEventType) (api.Payloader, error)
- func (f *FeishuPayload) SetSecret(_ string)
- type MSTeamsAction
- type MSTeamsActionTarget
- type MSTeamsFact
- type MSTeamsPayload
- func (m *MSTeamsPayload) Create(p *api.CreatePayload) (api.Payloader, error)
- func (m *MSTeamsPayload) Delete(p *api.DeletePayload) (api.Payloader, error)
- func (m *MSTeamsPayload) Fork(p *api.ForkPayload) (api.Payloader, error)
- func (m *MSTeamsPayload) Issue(p *api.IssuePayload) (api.Payloader, error)
- func (m *MSTeamsPayload) IssueComment(p *api.IssueCommentPayload) (api.Payloader, error)
- func (m *MSTeamsPayload) JSONPayload() ([]byte, error)
- func (m *MSTeamsPayload) PullRequest(p *api.PullRequestPayload) (api.Payloader, error)
- func (m *MSTeamsPayload) Push(p *api.PushPayload) (api.Payloader, error)
- func (m *MSTeamsPayload) Release(p *api.ReleasePayload) (api.Payloader, error)
- func (m *MSTeamsPayload) Repository(p *api.RepositoryPayload) (api.Payloader, error)
- func (m *MSTeamsPayload) Review(p *api.PullRequestPayload, event models.HookEventType) (api.Payloader, error)
- func (m *MSTeamsPayload) SetSecret(_ string)
- type MSTeamsSection
- type MatrixMeta
- type MatrixPayloadSafe
- type MatrixPayloadUnsafe
- func (m *MatrixPayloadUnsafe) Create(p *api.CreatePayload) (api.Payloader, error)
- func (m *MatrixPayloadUnsafe) Delete(p *api.DeletePayload) (api.Payloader, error)
- func (m *MatrixPayloadUnsafe) Fork(p *api.ForkPayload) (api.Payloader, error)
- func (m *MatrixPayloadUnsafe) Issue(p *api.IssuePayload) (api.Payloader, error)
- func (m *MatrixPayloadUnsafe) IssueComment(p *api.IssueCommentPayload) (api.Payloader, error)
- func (m *MatrixPayloadUnsafe) JSONPayload() ([]byte, error)
- func (m *MatrixPayloadUnsafe) PullRequest(p *api.PullRequestPayload) (api.Payloader, error)
- func (m *MatrixPayloadUnsafe) Push(p *api.PushPayload) (api.Payloader, error)
- func (m *MatrixPayloadUnsafe) Release(p *api.ReleasePayload) (api.Payloader, error)
- func (m *MatrixPayloadUnsafe) Repository(p *api.RepositoryPayload) (api.Payloader, error)
- func (m *MatrixPayloadUnsafe) Review(p *api.PullRequestPayload, event models.HookEventType) (api.Payloader, error)
- func (m *MatrixPayloadUnsafe) SetSecret(_ string)
- type PayloadConvertor
- type SlackAttachment
- type SlackMeta
- type SlackPayload
- func (s *SlackPayload) Create(p *api.CreatePayload) (api.Payloader, error)
- func (s *SlackPayload) Delete(p *api.DeletePayload) (api.Payloader, error)
- func (s *SlackPayload) Fork(p *api.ForkPayload) (api.Payloader, error)
- func (s *SlackPayload) Issue(p *api.IssuePayload) (api.Payloader, error)
- func (s *SlackPayload) IssueComment(p *api.IssueCommentPayload) (api.Payloader, error)
- func (s *SlackPayload) JSONPayload() ([]byte, error)
- func (s *SlackPayload) PullRequest(p *api.PullRequestPayload) (api.Payloader, error)
- func (s *SlackPayload) Push(p *api.PushPayload) (api.Payloader, error)
- func (s *SlackPayload) Release(p *api.ReleasePayload) (api.Payloader, error)
- func (s *SlackPayload) Repository(p *api.RepositoryPayload) (api.Payloader, error)
- func (s *SlackPayload) Review(p *api.PullRequestPayload, event models.HookEventType) (api.Payloader, error)
- func (s *SlackPayload) SetSecret(_ string)
- type TelegramMeta
- type TelegramPayload
- func (t *TelegramPayload) Create(p *api.CreatePayload) (api.Payloader, error)
- func (t *TelegramPayload) Delete(p *api.DeletePayload) (api.Payloader, error)
- func (t *TelegramPayload) Fork(p *api.ForkPayload) (api.Payloader, error)
- func (t *TelegramPayload) Issue(p *api.IssuePayload) (api.Payloader, error)
- func (t *TelegramPayload) IssueComment(p *api.IssueCommentPayload) (api.Payloader, error)
- func (t *TelegramPayload) JSONPayload() ([]byte, error)
- func (t *TelegramPayload) PullRequest(p *api.PullRequestPayload) (api.Payloader, error)
- func (t *TelegramPayload) Push(p *api.PushPayload) (api.Payloader, error)
- func (t *TelegramPayload) Release(p *api.ReleasePayload) (api.Payloader, error)
- func (t *TelegramPayload) Repository(p *api.RepositoryPayload) (api.Payloader, error)
- func (t *TelegramPayload) Review(p *api.PullRequestPayload, event models.HookEventType) (api.Payloader, error)
- func (t *TelegramPayload) SetSecret(_ string)
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 GetDingtalkPayload ¶
func GetDingtalkPayload(p api.Payloader, event models.HookEventType, meta string) (api.Payloader, error)
GetDingtalkPayload converts a ding talk webhook into a DingtalkPayload
func GetDiscordPayload ¶
func GetDiscordPayload(p api.Payloader, event models.HookEventType, meta string) (api.Payloader, error)
GetDiscordPayload converts a discord webhook into a DiscordPayload
func GetFeishuPayload ¶ added in v1.12.0
func GetFeishuPayload(p api.Payloader, event models.HookEventType, meta string) (api.Payloader, error)
GetFeishuPayload converts a ding talk webhook into a FeishuPayload
func GetMSTeamsPayload ¶
func GetMSTeamsPayload(p api.Payloader, event models.HookEventType, meta string) (api.Payloader, error)
GetMSTeamsPayload converts a MSTeams webhook into a MSTeamsPayload
func GetMatrixPayload ¶ added in v1.12.0
func GetMatrixPayload(p api.Payloader, event models.HookEventType, meta string) (api.Payloader, error)
GetMatrixPayload converts a Matrix webhook into a MatrixPayloadUnsafe
func GetSlackPayload ¶
func GetSlackPayload(p api.Payloader, event models.HookEventType, meta string) (api.Payloader, error)
GetSlackPayload converts a slack webhook into a SlackPayload
func GetTelegramPayload ¶
func GetTelegramPayload(p api.Payloader, event models.HookEventType, meta string) (api.Payloader, error)
GetTelegramPayload converts a telegram webhook into a TelegramPayload
func MatrixLinkFormatter ¶ added in v1.12.0
MatrixLinkFormatter creates a link compatible with Matrix
func MatrixLinkToRef ¶ added in v1.12.0
MatrixLinkToRef Matrix-formatter link to a repo ref
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 (*DingtalkPayload) Create ¶ added in v1.13.0
func (d *DingtalkPayload) Create(p *api.CreatePayload) (api.Payloader, error)
Create implements PayloadConvertor Create method
func (*DingtalkPayload) Delete ¶ added in v1.13.0
func (d *DingtalkPayload) Delete(p *api.DeletePayload) (api.Payloader, error)
Delete implements PayloadConvertor Delete method
func (*DingtalkPayload) Fork ¶ added in v1.13.0
func (d *DingtalkPayload) Fork(p *api.ForkPayload) (api.Payloader, error)
Fork implements PayloadConvertor Fork method
func (*DingtalkPayload) Issue ¶ added in v1.13.0
func (d *DingtalkPayload) Issue(p *api.IssuePayload) (api.Payloader, error)
Issue implements PayloadConvertor Issue method
func (*DingtalkPayload) IssueComment ¶ added in v1.13.0
func (d *DingtalkPayload) IssueComment(p *api.IssueCommentPayload) (api.Payloader, error)
IssueComment implements PayloadConvertor IssueComment method
func (*DingtalkPayload) JSONPayload ¶
func (d *DingtalkPayload) JSONPayload() ([]byte, error)
JSONPayload Marshals the DingtalkPayload to json
func (*DingtalkPayload) PullRequest ¶ added in v1.13.0
func (d *DingtalkPayload) PullRequest(p *api.PullRequestPayload) (api.Payloader, error)
PullRequest implements PayloadConvertor PullRequest method
func (*DingtalkPayload) Push ¶ added in v1.13.0
func (d *DingtalkPayload) Push(p *api.PushPayload) (api.Payloader, error)
Push implements PayloadConvertor Push method
func (*DingtalkPayload) Release ¶ added in v1.13.0
func (d *DingtalkPayload) Release(p *api.ReleasePayload) (api.Payloader, error)
Release implements PayloadConvertor Release method
func (*DingtalkPayload) Repository ¶ added in v1.13.0
func (d *DingtalkPayload) Repository(p *api.RepositoryPayload) (api.Payloader, error)
Repository implements PayloadConvertor Repository method
func (*DingtalkPayload) Review ¶ added in v1.13.0
func (d *DingtalkPayload) Review(p *api.PullRequestPayload, event models.HookEventType) (api.Payloader, error)
Review implements PayloadConvertor Review method
func (*DingtalkPayload) SetSecret ¶
func (d *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 (*DiscordPayload) Create ¶ added in v1.13.0
func (d *DiscordPayload) Create(p *api.CreatePayload) (api.Payloader, error)
Create implements PayloadConvertor Create method
func (*DiscordPayload) Delete ¶ added in v1.13.0
func (d *DiscordPayload) Delete(p *api.DeletePayload) (api.Payloader, error)
Delete implements PayloadConvertor Delete method
func (*DiscordPayload) Fork ¶ added in v1.13.0
func (d *DiscordPayload) Fork(p *api.ForkPayload) (api.Payloader, error)
Fork implements PayloadConvertor Fork method
func (*DiscordPayload) Issue ¶ added in v1.13.0
func (d *DiscordPayload) Issue(p *api.IssuePayload) (api.Payloader, error)
Issue implements PayloadConvertor Issue method
func (*DiscordPayload) IssueComment ¶ added in v1.13.0
func (d *DiscordPayload) IssueComment(p *api.IssueCommentPayload) (api.Payloader, error)
IssueComment implements PayloadConvertor IssueComment method
func (*DiscordPayload) JSONPayload ¶
func (d *DiscordPayload) JSONPayload() ([]byte, error)
JSONPayload Marshals the DiscordPayload to json
func (*DiscordPayload) PullRequest ¶ added in v1.13.0
func (d *DiscordPayload) PullRequest(p *api.PullRequestPayload) (api.Payloader, error)
PullRequest implements PayloadConvertor PullRequest method
func (*DiscordPayload) Push ¶ added in v1.13.0
func (d *DiscordPayload) Push(p *api.PushPayload) (api.Payloader, error)
Push implements PayloadConvertor Push method
func (*DiscordPayload) Release ¶ added in v1.13.0
func (d *DiscordPayload) Release(p *api.ReleasePayload) (api.Payloader, error)
Release implements PayloadConvertor Release method
func (*DiscordPayload) Repository ¶ added in v1.13.0
func (d *DiscordPayload) Repository(p *api.RepositoryPayload) (api.Payloader, error)
Repository implements PayloadConvertor Repository method
func (*DiscordPayload) Review ¶ added in v1.13.0
func (d *DiscordPayload) Review(p *api.PullRequestPayload, event models.HookEventType) (api.Payloader, error)
Review implements PayloadConvertor Review method
func (*DiscordPayload) SetSecret ¶
func (d *DiscordPayload) SetSecret(_ string)
SetSecret sets the discord secret
type FeishuPayload ¶ added in v1.12.0
type FeishuPayload struct { MsgType string `json:"msg_type"` // text / post / image / share_chat / interactive Content struct { Text string `json:"text"` } `json:"content"` }
FeishuPayload represents
func (*FeishuPayload) Create ¶ added in v1.13.0
func (f *FeishuPayload) Create(p *api.CreatePayload) (api.Payloader, error)
Create implements PayloadConvertor Create method
func (*FeishuPayload) Delete ¶ added in v1.13.0
func (f *FeishuPayload) Delete(p *api.DeletePayload) (api.Payloader, error)
Delete implements PayloadConvertor Delete method
func (*FeishuPayload) Fork ¶ added in v1.13.0
func (f *FeishuPayload) Fork(p *api.ForkPayload) (api.Payloader, error)
Fork implements PayloadConvertor Fork method
func (*FeishuPayload) Issue ¶ added in v1.13.0
func (f *FeishuPayload) Issue(p *api.IssuePayload) (api.Payloader, error)
Issue implements PayloadConvertor Issue method
func (*FeishuPayload) IssueComment ¶ added in v1.13.0
func (f *FeishuPayload) IssueComment(p *api.IssueCommentPayload) (api.Payloader, error)
IssueComment implements PayloadConvertor IssueComment method
func (*FeishuPayload) JSONPayload ¶ added in v1.12.0
func (f *FeishuPayload) JSONPayload() ([]byte, error)
JSONPayload Marshals the FeishuPayload to json
func (*FeishuPayload) PullRequest ¶ added in v1.13.0
func (f *FeishuPayload) PullRequest(p *api.PullRequestPayload) (api.Payloader, error)
PullRequest implements PayloadConvertor PullRequest method
func (*FeishuPayload) Push ¶ added in v1.13.0
func (f *FeishuPayload) Push(p *api.PushPayload) (api.Payloader, error)
Push implements PayloadConvertor Push method
func (*FeishuPayload) Release ¶ added in v1.13.0
func (f *FeishuPayload) Release(p *api.ReleasePayload) (api.Payloader, error)
Release implements PayloadConvertor Release method
func (*FeishuPayload) Repository ¶ added in v1.13.0
func (f *FeishuPayload) Repository(p *api.RepositoryPayload) (api.Payloader, error)
Repository implements PayloadConvertor Repository method
func (*FeishuPayload) Review ¶ added in v1.13.0
func (f *FeishuPayload) Review(p *api.PullRequestPayload, event models.HookEventType) (api.Payloader, error)
Review implements PayloadConvertor Review method
func (*FeishuPayload) SetSecret ¶ added in v1.12.0
func (f *FeishuPayload) SetSecret(_ string)
SetSecret sets the Feishu 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 (*MSTeamsPayload) Create ¶ added in v1.13.0
func (m *MSTeamsPayload) Create(p *api.CreatePayload) (api.Payloader, error)
Create implements PayloadConvertor Create method
func (*MSTeamsPayload) Delete ¶ added in v1.13.0
func (m *MSTeamsPayload) Delete(p *api.DeletePayload) (api.Payloader, error)
Delete implements PayloadConvertor Delete method
func (*MSTeamsPayload) Fork ¶ added in v1.13.0
func (m *MSTeamsPayload) Fork(p *api.ForkPayload) (api.Payloader, error)
Fork implements PayloadConvertor Fork method
func (*MSTeamsPayload) Issue ¶ added in v1.13.0
func (m *MSTeamsPayload) Issue(p *api.IssuePayload) (api.Payloader, error)
Issue implements PayloadConvertor Issue method
func (*MSTeamsPayload) IssueComment ¶ added in v1.13.0
func (m *MSTeamsPayload) IssueComment(p *api.IssueCommentPayload) (api.Payloader, error)
IssueComment implements PayloadConvertor IssueComment method
func (*MSTeamsPayload) JSONPayload ¶
func (m *MSTeamsPayload) JSONPayload() ([]byte, error)
JSONPayload Marshals the MSTeamsPayload to json
func (*MSTeamsPayload) PullRequest ¶ added in v1.13.0
func (m *MSTeamsPayload) PullRequest(p *api.PullRequestPayload) (api.Payloader, error)
PullRequest implements PayloadConvertor PullRequest method
func (*MSTeamsPayload) Push ¶ added in v1.13.0
func (m *MSTeamsPayload) Push(p *api.PushPayload) (api.Payloader, error)
Push implements PayloadConvertor Push method
func (*MSTeamsPayload) Release ¶ added in v1.13.0
func (m *MSTeamsPayload) Release(p *api.ReleasePayload) (api.Payloader, error)
Release implements PayloadConvertor Release method
func (*MSTeamsPayload) Repository ¶ added in v1.13.0
func (m *MSTeamsPayload) Repository(p *api.RepositoryPayload) (api.Payloader, error)
Repository implements PayloadConvertor Repository method
func (*MSTeamsPayload) Review ¶ added in v1.13.0
func (m *MSTeamsPayload) Review(p *api.PullRequestPayload, event models.HookEventType) (api.Payloader, error)
Review implements PayloadConvertor Review method
func (*MSTeamsPayload) SetSecret ¶
func (m *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 MatrixMeta ¶ added in v1.12.0
type MatrixMeta struct { HomeserverURL string `json:"homeserver_url"` Room string `json:"room_id"` AccessToken string `json:"access_token"` MessageType int `json:"message_type"` }
MatrixMeta contains the Matrix metadata
func GetMatrixHook ¶ added in v1.12.0
func GetMatrixHook(w *models.Webhook) *MatrixMeta
GetMatrixHook returns Matrix metadata
type MatrixPayloadSafe ¶ added in v1.12.0
type MatrixPayloadSafe struct { Body string `json:"body"` MsgType string `json:"msgtype"` Format string `json:"format"` FormattedBody string `json:"formatted_body"` Commits []*api.PayloadCommit `json:"io.gitea.commits,omitempty"` }
MatrixPayloadSafe contains (safe) payload for a Matrix room
type MatrixPayloadUnsafe ¶ added in v1.12.0
type MatrixPayloadUnsafe struct { MatrixPayloadSafe AccessToken string `json:"access_token"` }
MatrixPayloadUnsafe contains the (unsafe) payload for a Matrix room
func (*MatrixPayloadUnsafe) Create ¶ added in v1.13.0
func (m *MatrixPayloadUnsafe) Create(p *api.CreatePayload) (api.Payloader, error)
Create implements PayloadConvertor Create method
func (*MatrixPayloadUnsafe) Delete ¶ added in v1.13.0
func (m *MatrixPayloadUnsafe) Delete(p *api.DeletePayload) (api.Payloader, error)
Delete composes Matrix payload for delete a branch or tag.
func (*MatrixPayloadUnsafe) Fork ¶ added in v1.13.0
func (m *MatrixPayloadUnsafe) Fork(p *api.ForkPayload) (api.Payloader, error)
Fork composes Matrix payload for forked by a repository.
func (*MatrixPayloadUnsafe) Issue ¶ added in v1.13.0
func (m *MatrixPayloadUnsafe) Issue(p *api.IssuePayload) (api.Payloader, error)
Issue implements PayloadConvertor Issue method
func (*MatrixPayloadUnsafe) IssueComment ¶ added in v1.13.0
func (m *MatrixPayloadUnsafe) IssueComment(p *api.IssueCommentPayload) (api.Payloader, error)
IssueComment implements PayloadConvertor IssueComment method
func (*MatrixPayloadUnsafe) JSONPayload ¶ added in v1.12.0
func (m *MatrixPayloadUnsafe) JSONPayload() ([]byte, error)
JSONPayload Marshals the MatrixPayloadUnsafe to json
func (*MatrixPayloadUnsafe) PullRequest ¶ added in v1.13.0
func (m *MatrixPayloadUnsafe) PullRequest(p *api.PullRequestPayload) (api.Payloader, error)
PullRequest implements PayloadConvertor PullRequest method
func (*MatrixPayloadUnsafe) Push ¶ added in v1.13.0
func (m *MatrixPayloadUnsafe) Push(p *api.PushPayload) (api.Payloader, error)
Push implements PayloadConvertor Push method
func (*MatrixPayloadUnsafe) Release ¶ added in v1.13.0
func (m *MatrixPayloadUnsafe) Release(p *api.ReleasePayload) (api.Payloader, error)
Release implements PayloadConvertor Release method
func (*MatrixPayloadUnsafe) Repository ¶ added in v1.13.0
func (m *MatrixPayloadUnsafe) Repository(p *api.RepositoryPayload) (api.Payloader, error)
Repository implements PayloadConvertor Repository method
func (*MatrixPayloadUnsafe) Review ¶ added in v1.13.0
func (m *MatrixPayloadUnsafe) Review(p *api.PullRequestPayload, event models.HookEventType) (api.Payloader, error)
Review implements PayloadConvertor Review method
func (*MatrixPayloadUnsafe) SetSecret ¶ added in v1.12.0
func (m *MatrixPayloadUnsafe) SetSecret(_ string)
SetSecret sets the Matrix secret
type PayloadConvertor ¶ added in v1.13.0
type PayloadConvertor interface { api.Payloader Create(*api.CreatePayload) (api.Payloader, error) Delete(*api.DeletePayload) (api.Payloader, error) Fork(*api.ForkPayload) (api.Payloader, error) Issue(*api.IssuePayload) (api.Payloader, error) IssueComment(*api.IssueCommentPayload) (api.Payloader, error) Push(*api.PushPayload) (api.Payloader, error) PullRequest(*api.PullRequestPayload) (api.Payloader, error) Review(*api.PullRequestPayload, models.HookEventType) (api.Payloader, error) Repository(*api.RepositoryPayload) (api.Payloader, error) Release(*api.ReleasePayload) (api.Payloader, error) }
PayloadConvertor defines the interface to convert system webhook payload to external payload
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"` Color string `json:"-"` 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 (*SlackPayload) Create ¶ added in v1.13.0
func (s *SlackPayload) Create(p *api.CreatePayload) (api.Payloader, error)
Create implements PayloadConvertor Create method
func (*SlackPayload) Delete ¶ added in v1.13.0
func (s *SlackPayload) Delete(p *api.DeletePayload) (api.Payloader, error)
Delete composes Slack payload for delete a branch or tag.
func (*SlackPayload) Fork ¶ added in v1.13.0
func (s *SlackPayload) Fork(p *api.ForkPayload) (api.Payloader, error)
Fork composes Slack payload for forked by a repository.
func (*SlackPayload) Issue ¶ added in v1.13.0
func (s *SlackPayload) Issue(p *api.IssuePayload) (api.Payloader, error)
Issue implements PayloadConvertor Issue method
func (*SlackPayload) IssueComment ¶ added in v1.13.0
func (s *SlackPayload) IssueComment(p *api.IssueCommentPayload) (api.Payloader, error)
IssueComment implements PayloadConvertor IssueComment method
func (*SlackPayload) JSONPayload ¶
func (s *SlackPayload) JSONPayload() ([]byte, error)
JSONPayload Marshals the SlackPayload to json
func (*SlackPayload) PullRequest ¶ added in v1.13.0
func (s *SlackPayload) PullRequest(p *api.PullRequestPayload) (api.Payloader, error)
PullRequest implements PayloadConvertor PullRequest method
func (*SlackPayload) Push ¶ added in v1.13.0
func (s *SlackPayload) Push(p *api.PushPayload) (api.Payloader, error)
Push implements PayloadConvertor Push method
func (*SlackPayload) Release ¶ added in v1.13.0
func (s *SlackPayload) Release(p *api.ReleasePayload) (api.Payloader, error)
Release implements PayloadConvertor Release method
func (*SlackPayload) Repository ¶ added in v1.13.0
func (s *SlackPayload) Repository(p *api.RepositoryPayload) (api.Payloader, error)
Repository implements PayloadConvertor Repository method
func (*SlackPayload) Review ¶ added in v1.13.0
func (s *SlackPayload) Review(p *api.PullRequestPayload, event models.HookEventType) (api.Payloader, error)
Review implements PayloadConvertor Review method
func (*SlackPayload) SetSecret ¶
func (s *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 (*TelegramPayload) Create ¶ added in v1.13.0
func (t *TelegramPayload) Create(p *api.CreatePayload) (api.Payloader, error)
Create implements PayloadConvertor Create method
func (*TelegramPayload) Delete ¶ added in v1.13.0
func (t *TelegramPayload) Delete(p *api.DeletePayload) (api.Payloader, error)
Delete implements PayloadConvertor Delete method
func (*TelegramPayload) Fork ¶ added in v1.13.0
func (t *TelegramPayload) Fork(p *api.ForkPayload) (api.Payloader, error)
Fork implements PayloadConvertor Fork method
func (*TelegramPayload) Issue ¶ added in v1.13.0
func (t *TelegramPayload) Issue(p *api.IssuePayload) (api.Payloader, error)
Issue implements PayloadConvertor Issue method
func (*TelegramPayload) IssueComment ¶ added in v1.13.0
func (t *TelegramPayload) IssueComment(p *api.IssueCommentPayload) (api.Payloader, error)
IssueComment implements PayloadConvertor IssueComment method
func (*TelegramPayload) JSONPayload ¶
func (t *TelegramPayload) JSONPayload() ([]byte, error)
JSONPayload Marshals the TelegramPayload to json
func (*TelegramPayload) PullRequest ¶ added in v1.13.0
func (t *TelegramPayload) PullRequest(p *api.PullRequestPayload) (api.Payloader, error)
PullRequest implements PayloadConvertor PullRequest method
func (*TelegramPayload) Push ¶ added in v1.13.0
func (t *TelegramPayload) Push(p *api.PushPayload) (api.Payloader, error)
Push implements PayloadConvertor Push method
func (*TelegramPayload) Release ¶ added in v1.13.0
func (t *TelegramPayload) Release(p *api.ReleasePayload) (api.Payloader, error)
Release implements PayloadConvertor Release method
func (*TelegramPayload) Repository ¶ added in v1.13.0
func (t *TelegramPayload) Repository(p *api.RepositoryPayload) (api.Payloader, error)
Repository implements PayloadConvertor Repository method
func (*TelegramPayload) Review ¶ added in v1.13.0
func (t *TelegramPayload) Review(p *api.PullRequestPayload, event models.HookEventType) (api.Payloader, error)
Review implements PayloadConvertor Review method
func (*TelegramPayload) SetSecret ¶
func (t *TelegramPayload) SetSecret(_ string)
SetSecret sets the telegram secret