events

package
v0.0.0-...-7f41272 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2017 License: BSD-2-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	RawEvent  *github.Event
	CreatedAt time.Time // CreatedAt is the time the event was created.
	Type      string    // Type such as "CommitCommentEvent".
	Public    bool      // Public is whether GitHub event was public.

	// Discarded is true when an event has been filtered and should be ignored.
	Discarded bool

	Actor   string // Actor is the person who did an action, such as "bradleyfalzon".
	Action  string // Action is the action performed on a subject, such as "commented".
	Subject string // Subject is something that an action was performed on, such as "golang/go".

	Title string // Title is a short description of the event, such as "[golang/go] bradleyfalzon commented on abcdef1234"
	Body  string // Body contains more context and may be blank.
}

func ParseEvent

func ParseEvent(ghe *github.Event) (*Event, error)

func (*Event) Filter

func (e *Event) Filter(filters []db.Filter, defaultDiscard bool)

func (*Event) String

func (e *Event) String() string

type Events

type Events []*Event

func ListNewEvents

func ListNewEvents(ctx context.Context, logger *logrus.Entry, client *github.Client, githubUser string, lastCreatedAt time.Time) (events Events, pollInterval time.Duration, err error)

func (Events) Filter

func (e Events) Filter(filters []db.Filter, defaultDiscard bool)

type Notifier

type Notifier interface {
	Notify(event *Event) error
}

Notifier sends a notification about a GitHub Event.

type Poller

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

func NewPoller

func NewPoller(logger *logrus.Entry, db db.DB, notifier Notifier, rt http.RoundTripper) *Poller

func (*Poller) Poll

func (p *Poller) Poll(ctx context.Context, interval time.Duration) error

Poll calls PollUsers every interval. Blocks until context is cancelled.

func (*Poller) PollUser

func (p *Poller) PollUser(ctx context.Context, logger *logrus.Entry, user db.User) error

func (*Poller) PollUsers

func (p *Poller) PollUsers(ctx context.Context) error

PollUsers looks for users and checks their events.

Jump to

Keyboard shortcuts

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