cleaner

package
v0.0.0-...-949dfb3 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeIssue            = "Issue"
	TypePullRequest      = "PullRequest"
	DefaultDaysThreshold = 30
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Cleaner

type Cleaner interface {
	Clean(ctx context.Context) error
}

Cleaner defines the interface for cleaning notifications.

type NotificationsCleaner

type NotificationsCleaner struct {
	GitHubClient  *github.Client
	OlderThanDays int
	DryRun        bool
}

NotificationsCleaner defines the cleaner struct.

func NewNotificationsCleaner

func NewNotificationsCleaner(opts ...Option) *NotificationsCleaner

NewNotificationsCleaner creates a new NotificationsCleaner instance with the provided options. It initializes with a default GitHubClient.

func (*NotificationsCleaner) Clean

func (nc *NotificationsCleaner) Clean(ctx context.Context) error

Clean performs cleaning notifications. It marks notifications as done if they are related to closed pull requests/issues or if they are older than the configured number of days.

type Option

type Option func(*NotificationsCleaner)

Option defines a functional option for NotificationsCleaner.

func WithDryRun

func WithDryRun(dryRun bool) Option

WithDryRun is an option to enable dry-run mode.

func WithGitHubClient

func WithGitHubClient(client *github.Client) Option

WithGitHubClient is an option to set a custom GitHub client.

func WithOlderThanDays

func WithOlderThanDays(days int) Option

WithOlderThanDays is an option to set the age threshold (in days) for cleaning notifications.

Jump to

Keyboard shortcuts

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