Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Handler ¶ added in v0.3.0
func Handler(store *NotifyingStore) http.Handler
Types ¶
type Notifier ¶
type Notifier interface {
Notify(ctx context.Context, added bool, repo *github.Repository, stargazers ...*github.Stargazer)
}
Notifier notifies about added/removed stargazers.
type NotifyingStore ¶ added in v0.3.0
NotifyingStore is a Store that notifies a Notifier when stargazers are added or removed.
func NewNotifyingStore ¶ added in v0.3.0
func NewNotifyingStore(databaseDirectory string, notifiers Notifiers) (*NotifyingStore, error)
NewNotifyingStore creates a new NotifyingStore.
func (NotifyingStore) Add ¶ added in v0.3.0
func (s NotifyingStore) Add(ctx context.Context, repo *github.Repository, stargazers ...*github.Stargazer) error
Add adds new stargazers to a repository. Notifies the Notifier if there were any new stargazers.
func (NotifyingStore) Delete ¶ added in v0.3.0
func (s NotifyingStore) Delete(ctx context.Context, repo *github.Repository, stargazers ...*github.Stargazer) error
Delete removes stargazers from a repository. Notifies the Notifier if there were any removed stargazers.
type SlackNotifier ¶ added in v0.3.0
type SlackNotifier struct {
// WebHookURL is the URL to the slack webhook
WebHookURL string
// MaximumUsers is the maximum number of users to notify about. Default is 5.
// If the number of stargazers is greater than this, SlackNotifier only notifies the number of users.
MaximumUsers int
}
SlackNotifier is a Notifier that posts added/removed stargazers to a Slack channel using a webhook.
func (SlackNotifier) Notify ¶ added in v0.3.0
func (s SlackNotifier) Notify(ctx context.Context, added bool, repo *github.Repository, stargazers ...*github.Stargazer)
type SlogNotifier ¶ added in v0.3.0
type SlogNotifier struct{}
SlogNotifier is a Notifier that logs the added/removed stargazers to a slog.Logger stored in the context.
func (SlogNotifier) Notify ¶ added in v0.3.0
func (s SlogNotifier) Notify(ctx context.Context, added bool, repo *github.Repository, stargazers ...*github.Stargazer)
type Store ¶
type Store struct {
Repos map[string]RepoStars
DatabasePath string
// contains filtered or unexported fields
}
Store contains all stars for all repositories
Click to show internal directories.
Click to hide internal directories.