Documentation
¶
Index ¶
- type NotificationScore
- type ScoreFactors
- type ScoreFilter
- type Scorer
- func (s *Scorer) Score(ctx context.Context, notifications []*github.Notification) (map[string]*NotificationScore, error)
- func (s *Scorer) WithBatchSize(batchSize int) *Scorer
- func (s *Scorer) WithConcurrency(concurrency int) *Scorer
- func (s *Scorer) WithTimeout(timeout time.Duration) *Scorer
- func (s *Scorer) WithUsername(username string) *Scorer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NotificationScore ¶
type NotificationScore struct {
// Total is the total score (0-100)
Total int `json:"total"`
// Components are the individual score components
Components map[string]float64 `json:"components"`
// Factors are the factors used to calculate the score
Factors *ScoreFactors `json:"factors"`
}
NotificationScore represents the score of a notification
type ScoreFactors ¶
type ScoreFactors struct {
// Age factor weights
AgeWeight float64 `json:"age_weight"`
// Age decay (how quickly score decreases with age)
AgeDecay float64 `json:"age_decay"`
// Maximum age in hours to consider
MaxAge float64 `json:"max_age"`
// Activity factor weights
ActivityWeight float64 `json:"activity_weight"`
// Comment count weight
CommentWeight float64 `json:"comment_weight"`
// Reaction count weight
ReactionWeight float64 `json:"reaction_weight"`
// User involvement factor weights
InvolvementWeight float64 `json:"involvement_weight"`
// Author weight
AuthorWeight float64 `json:"author_weight"`
// Assignee weight
AssigneeWeight float64 `json:"assignee_weight"`
// Mention weight
MentionWeight float64 `json:"mention_weight"`
// Review request weight
ReviewWeight float64 `json:"review_weight"`
// Type factor weights
TypeWeight float64 `json:"type_weight"`
// Pull request weight
PRWeight float64 `json:"pr_weight"`
// Issue weight
IssueWeight float64 `json:"issue_weight"`
// Discussion weight
DiscussionWeight float64 `json:"discussion_weight"`
// Release weight
ReleaseWeight float64 `json:"release_weight"`
// Commit weight
CommitWeight float64 `json:"commit_weight"`
// Reason factor weights
ReasonWeight float64 `json:"reason_weight"`
// Assign reason weight
AssignReasonWeight float64 `json:"assign_reason_weight"`
// Author reason weight
AuthorReasonWeight float64 `json:"author_reason_weight"`
// Comment reason weight
CommentReasonWeight float64 `json:"comment_reason_weight"`
// Mention reason weight
MentionReasonWeight float64 `json:"mention_reason_weight"`
// Review request reason weight
ReviewReasonWeight float64 `json:"review_reason_weight"`
// State change reason weight
StateChangeReasonWeight float64 `json:"state_change_reason_weight"`
// Subscribed reason weight
SubscribedReasonWeight float64 `json:"subscribed_reason_weight"`
// Team mention reason weight
TeamMentionReasonWeight float64 `json:"team_mention_reason_weight"`
// Repository factor weights
RepoWeight float64 `json:"repo_weight"`
// Custom repository weights (repo name -> weight)
CustomRepoWeights map[string]float64 `json:"custom_repo_weights"`
}
ScoreFactors contains the configurable factors for scoring notifications
func DefaultScoreFactors ¶
func DefaultScoreFactors() *ScoreFactors
DefaultScoreFactors returns the default score factors
type ScoreFilter ¶
type ScoreFilter struct {
// MinScore is the minimum score to match (inclusive)
MinScore int
// MaxScore is the maximum score to match (inclusive)
MaxScore int
// Scorer is the scorer to use
Scorer *Scorer
// Scores is a cache of notification scores
Scores map[string]*NotificationScore
}
ScoreFilter filters notifications by score
func (*ScoreFilter) Apply ¶
func (f *ScoreFilter) Apply(n *github.Notification) bool
Apply applies the score filter to a notification
func (*ScoreFilter) Description ¶
func (f *ScoreFilter) Description() string
Description returns a human-readable description of the filter
func (*ScoreFilter) GetScores ¶
func (f *ScoreFilter) GetScores() map[string]*NotificationScore
GetScores gets the scores for notifications
func (*ScoreFilter) SetScores ¶
func (f *ScoreFilter) SetScores(scores map[string]*NotificationScore)
SetScores sets the scores for notifications
type Scorer ¶
type Scorer struct {
// Factors are the configurable factors for scoring
Factors *ScoreFactors
// Concurrency is the number of goroutines to use
Concurrency int
// BatchSize is the size of notification batches
BatchSize int
// Timeout is the maximum time to spend scoring
Timeout time.Duration
// Username is the current user's GitHub username
Username string
}
Scorer calculates scores for notifications
func (*Scorer) Score ¶
func (s *Scorer) Score(ctx context.Context, notifications []*github.Notification) (map[string]*NotificationScore, error)
Score calculates scores for notifications
func (*Scorer) WithBatchSize ¶
WithBatchSize sets the batch size for the scorer
func (*Scorer) WithConcurrency ¶
WithConcurrency sets the concurrency for the scorer
func (*Scorer) WithTimeout ¶
WithTimeout sets the timeout for the scorer
func (*Scorer) WithUsername ¶
WithUsername sets the username for the scorer