Documentation
¶
Index ¶
- Constants
- func Scan(ctx context.Context, user string, c Client, s *NotifyingStore, ...) error
- func WebhookHandler(store *NotifyingStore) func(ctx context.Context, stargazer github.Stargazer) error
- type Client
- type Notifier
- type Notifiers
- type NotifyingStore
- type SlackNotifier
- type SlogNotifier
- type Store
Constants ¶
const StoreFilename = "stargazers.json"
Variables ¶
This section is empty.
Functions ¶
func Scan ¶ added in v0.3.0
func Scan(ctx context.Context, user string, c Client, s *NotifyingStore, includeArchived bool) error
Scan retrieves all repositories for the user, gets the stars for each repository and adds new ones to the Store.
func WebhookHandler ¶ added in v0.3.2
func WebhookHandler(store *NotifyingStore) func(ctx context.Context, stargazer github.Stargazer) error
WebhookHandler returns a webhook handler for GitHub star events.
Types ¶
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
Add adds new stargazers to a repository. Notifies the Notifier if there were any new 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.
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.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store contains all stars for all repositories
func (*Store) Add ¶
Add adds new stargazers to a repository. Returns the new stargazers and an error if there was a problem saving the store to disk.