worker

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GitLabPuller

type GitLabPuller struct {
	// contains filtered or unexported fields
}

func NewGitLabPuller

func NewGitLabPuller(pullPeriod time.Duration, after time.Time, gitlab GitlabClient, handler MergeRequestHandler, projectID int) (*GitLabPuller, error)

func (*GitLabPuller) Close

func (g *GitLabPuller) Close()

func (*GitLabPuller) Run

func (g *GitLabPuller) Run()

type GitlabClient

type GitlabClient interface {
	MergeRequestsByProject(projectID int, createdAfter time.Time) ([]*ds.MergeRequest, error)
}

type MergeRequestHandler

type MergeRequestHandler func(mr *ds.MergeRequest) error

type NotificationService

type NotificationService interface {
	GetAuthoredReviewedMRs(team *ds.Team, users []*ds.User) (authorToMR, reviewerToMR map[int][]*ds.MergeRequest, err error)
	UserNotification(user *ds.User, team *ds.Team, authorToMR, reviewerToMR map[int][]*ds.MergeRequest) (message string, err error)
	TeamNotification(team *ds.Team, authorToMR, reviewerToMR map[int][]*ds.MergeRequest) (message string, err error)
}

type Notifications

type Notifications struct {
	// contains filtered or unexported fields
}

func NewNotificationsWorker

func NewNotificationsWorker(team *ds.Team, svc NotificationService, slack SlackClient) *Notifications

func (*Notifications) Run

func (n *Notifications) Run()

type Policy

type Policy interface {
	IsApproved(team *ds.Team, mr *ds.MergeRequest) bool
}

type SlackClient

type SlackClient interface {
	SendMessage(recipientID string, message string) error
}

type SlackMessage

type SlackMessage struct {
	RecipientID string
	Text        string
}

type SlackWorker

type SlackWorker struct {
	// contains filtered or unexported fields
}

func NewSlackWorker

func NewSlackWorker(svc NotificationService, r SlackWorkerRepository, slack SlackClient, events chan ds.UserEvent) *SlackWorker

func (*SlackWorker) Close

func (w *SlackWorker) Close()

func (*SlackWorker) Run

func (w *SlackWorker) Run()

type SlackWorkerRepository

type SlackWorkerRepository interface {
	UserBySlackID(slackID string) (*ds.User, *ds.Team, error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL