Documentation
¶
Index ¶
- Constants
- Variables
- func GenerateEmailFromPayload(templateName string, recipients []*types.PrincipalInfo, ...) (*mailer.Payload, error)
- func GetHTMLBody(templateName string, data interface{}) ([]byte, error)
- func GetSubjectPullRequest(repoIdentifier string, prNum int64, prTitle string) string
- func LoadTemplates() error
- func RetrieveEmailsFromPrincipals(principals []*types.PrincipalInfo) []string
- type BasePullReqPayload
- type Client
- type CommentPayload
- type Config
- type MailClient
- func (m MailClient) SendCommentMentions(ctx context.Context, recipients []*types.PrincipalInfo, ...) error
- func (m MailClient) SendCommentPRAuthor(ctx context.Context, recipients []*types.PrincipalInfo, ...) error
- func (m MailClient) SendCommentParticipants(ctx context.Context, recipients []*types.PrincipalInfo, ...) error
- func (m MailClient) SendPullReqBranchUpdated(ctx context.Context, recipients []*types.PrincipalInfo, ...) error
- func (m MailClient) SendPullReqStateChanged(ctx context.Context, recipients []*types.PrincipalInfo, ...) error
- func (m MailClient) SendReviewSubmitted(ctx context.Context, recipients []*types.PrincipalInfo, ...) error
- func (m MailClient) SendReviewerAdded(ctx context.Context, recipients []*types.PrincipalInfo, ...) error
- type PullReqBranchUpdatedPayload
- type PullReqState
- type PullReqStateChangedPayload
- type ReviewSubmittedPayload
- type ReviewerAddedPayload
- type Service
Constants ¶
View Source
const ( TemplateReviewerAdded = "reviewer_added.html" TemplateCommentPRAuthor = "comment_pr_author.html" TemplateCommentMentions = "comment_mentions.html" TemplateCommentParticipants = "comment_participants.html" TemplatePullReqBranchUpdated = "pullreq_branch_updated.html" TemplateNameReviewSubmitted = "review_submitted.html" TemplatePullReqStateChanged = "pullreq_state_changed.html" )
Variables ¶
View Source
var WireSet = wire.NewSet( ProvideMailClient, ProvideNotificationService, )
Functions ¶
func GenerateEmailFromPayload ¶
func GenerateEmailFromPayload( templateName string, recipients []*types.PrincipalInfo, base *BasePullReqPayload, payload interface{}, ) (*mailer.Payload, error)
func GetHTMLBody ¶
func GetSubjectPullRequest ¶
func LoadTemplates ¶
func LoadTemplates() error
func RetrieveEmailsFromPrincipals ¶
func RetrieveEmailsFromPrincipals(principals []*types.PrincipalInfo) []string
Types ¶
type BasePullReqPayload ¶
type BasePullReqPayload struct {
Repo *types.Repository
PullReq *types.PullReq
Author *types.PrincipalInfo
PullReqURL string
}
type Client ¶
type Client interface {
SendCommentPRAuthor(
ctx context.Context,
recipients []*types.PrincipalInfo,
payload *CommentPayload,
) error
SendCommentMentions(
ctx context.Context,
recipients []*types.PrincipalInfo,
payload *CommentPayload,
) error
SendCommentParticipants(
ctx context.Context,
recipients []*types.PrincipalInfo,
payload *CommentPayload,
) error
SendReviewerAdded(
ctx context.Context,
recipients []*types.PrincipalInfo,
payload *ReviewerAddedPayload,
) error
SendPullReqBranchUpdated(
ctx context.Context,
recipients []*types.PrincipalInfo,
payload *PullReqBranchUpdatedPayload,
) error
SendReviewSubmitted(
ctx context.Context,
recipients []*types.PrincipalInfo,
payload *ReviewSubmittedPayload,
) error
SendPullReqStateChanged(
ctx context.Context,
recipients []*types.PrincipalInfo,
payload *PullReqStateChangedPayload,
) error
}
Client is an interface for sending notifications, such as emails, Slack messages etc. It is implemented by MailClient and in future we can have other implementations for other channels like Slack etc.
func ProvideMailClient ¶
type CommentPayload ¶
type CommentPayload struct {
Base *BasePullReqPayload
Commenter *types.PrincipalInfo
Text string
}
type MailClient ¶
func NewMailClient ¶
func NewMailClient(mailer mailer.Mailer) MailClient
func (MailClient) SendCommentMentions ¶
func (m MailClient) SendCommentMentions( ctx context.Context, recipients []*types.PrincipalInfo, payload *CommentPayload, ) error
func (MailClient) SendCommentPRAuthor ¶
func (m MailClient) SendCommentPRAuthor( ctx context.Context, recipients []*types.PrincipalInfo, payload *CommentPayload, ) error
func (MailClient) SendCommentParticipants ¶
func (m MailClient) SendCommentParticipants( ctx context.Context, recipients []*types.PrincipalInfo, payload *CommentPayload, ) error
func (MailClient) SendPullReqBranchUpdated ¶
func (m MailClient) SendPullReqBranchUpdated( ctx context.Context, recipients []*types.PrincipalInfo, payload *PullReqBranchUpdatedPayload, ) error
func (MailClient) SendPullReqStateChanged ¶
func (m MailClient) SendPullReqStateChanged( ctx context.Context, recipients []*types.PrincipalInfo, payload *PullReqStateChangedPayload, ) error
func (MailClient) SendReviewSubmitted ¶
func (m MailClient) SendReviewSubmitted( ctx context.Context, recipients []*types.PrincipalInfo, payload *ReviewSubmittedPayload, ) error
func (MailClient) SendReviewerAdded ¶
func (m MailClient) SendReviewerAdded( ctx context.Context, recipients []*types.PrincipalInfo, payload *ReviewerAddedPayload, ) error
type PullReqBranchUpdatedPayload ¶
type PullReqBranchUpdatedPayload struct {
Base *BasePullReqPayload
Committer *types.PrincipalInfo
NewSHA string
}
type PullReqState ¶
type PullReqState string
const ( PullReqStateMerged PullReqState = "merged" PullReqStateClosed PullReqState = "closed" PullReqStateReopened PullReqState = "reopened" )
type PullReqStateChangedPayload ¶
type PullReqStateChangedPayload struct {
Base *BasePullReqPayload
ChangedBy *types.PrincipalInfo
State PullReqState
}
type ReviewSubmittedPayload ¶
type ReviewSubmittedPayload struct {
Base *BasePullReqPayload
Author *types.PrincipalInfo
Reviewer *types.PrincipalInfo
Decision enum.PullReqReviewDecision
}
type ReviewerAddedPayload ¶
type ReviewerAddedPayload struct {
Base *BasePullReqPayload
Reviewer *types.PrincipalInfo
}
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService( ctx context.Context, config Config, notificationClient Client, prReaderFactory *events.ReaderFactory[*pullreqevents.Reader], pullReqStore store.PullReqStore, repoStore store.RepoStore, principalInfoView store.PrincipalInfoView, principalInfoCache store.PrincipalInfoCache, pullReqReviewersStore store.PullReqReviewerStore, pullReqActivityStore store.PullReqActivityStore, spacePathStore store.SpacePathStore, urlProvider url.Provider, ) (*Service, error)
func ProvideNotificationService ¶
func ProvideNotificationService( ctx context.Context, notificationClient Client, pullReqConfig Config, prReaderFactory *events.ReaderFactory[*pullreqevents.Reader], pullReqStore store.PullReqStore, repoStore store.RepoStore, principalInfoView store.PrincipalInfoView, principalInfoCache store.PrincipalInfoCache, pullReqReviewersStore store.PullReqReviewerStore, pullReqActivityStore store.PullReqActivityStore, spacePathStore store.SpacePathStore, urlProvider url.Provider, ) (*Service, error)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.