changetosend

package
v0.0.0-...-5c09a0a Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SendMessagesInParallel

func SendMessagesInParallel(ctx context.Context, sender Sender, changes []ChangeToSend) error

Types

type ChangeToSend

type ChangeToSend struct {
	Channel           string    // Which Slack channel to send the notification to
	Users             []string  // Users to tag in the notification
	Groups            []string  // Groups to tag in the notification
	ModifiedFiles     []string  // Files that were modified
	PullRequestNumber int       // Only set if this is a pull request
	Branch            string    // Only set if this is a commit in a branch
	CommitSha         string    // Only set if this is not a pull request, but a commit
	Creator           string    // The user that created the pull request or commit
	Timestamp         time.Time // The time the pull request or commit was created
	LinkToChange      string    // Link to the pull request or commit
	LinkToAuthor      string    // Link to the user that created the pull request or commit
	Messages          []string  // The message to send (Extra part of the Slack notification)
}

func MergeCommon

func MergeCommon(changes []ChangeToSend) []ChangeToSend

type Creator

type Creator struct {
	NotificationMerger *notification.Merger
	// contains filtered or unexported fields
}

func NewCreator

func NewCreator(cfg config.Config, ghClient *ghclient.GhClient, annotatedInfo annotatedinfo.Fetch, notificationMerger *notification.Merger, logger logger.Logger) *Creator

func (*Creator) CreateChanges

func (c *Creator) CreateChanges(ctx context.Context, changedFiles []string) ([]ChangeToSend, error)

func (*Creator) CreateChangesForFile

func (c *Creator) CreateChangesForFile(ctx context.Context, file string) (*ChangeToSend, error)

type Sender

type Sender interface {
	SendMessage(ctx context.Context, change ChangeToSend) error
}

type SlackDestination

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

func NewSlackDestination

func NewSlackDestination(logger logger.Logger, cfg config.Config) (*SlackDestination, error)

func (*SlackDestination) SendMessage

func (s *SlackDestination) SendMessage(ctx context.Context, change ChangeToSend) error

Jump to

Keyboard shortcuts

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