patroller

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package patroller provides functionality for iterating through unpatrolled revisions in a MediaWiki backlog.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Opts

type Opts struct {
	// If true, the patroller will start with the latest unpatrolled revision and work backwards.
	// If false, it will start with the oldest unpatrolled revision and work forwards.
	Latest bool

	// If non-empty, the patroller will only return revisions in this namespace.
	Namespace string

	// If non-empty, the patroller will only return revisions made by this user.
	User string
}

Opts provides the options for configuring a Patroller.

type Patroller

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

A Patroller iterates through unpatrolled revisions in a MediaWiki backlog, provides information about each revision, and allows the caller to mark revisions as patrolled.

func New

func New(mwclient *mediawiki.Client, opts Opts) (*Patroller, error)

New returns a new Patroller.

func (*Patroller) Comment

func (p *Patroller) Comment() string

Comment returns the comment of the revision the patroller is currently on.

func (*Patroller) Diff

func (p *Patroller) Diff(ctx context.Context) (string, error)

Diff returns a unified diff of the revision the patroller is currently on.

func (*Patroller) Err

func (p *Patroller) Err() error

Err returns the first non-EOF error that was encountered by the Patroller, if any.

func (*Patroller) LogAction

func (p *Patroller) LogAction() string

LogAction returns the string "upload" if the current revision is a new file upload, "overwrite" if it's an upload on an existing file, or an empty string if it's a regular edit.

func (*Patroller) MarkPatrolled

func (p *Patroller) MarkPatrolled(ctx context.Context) error

MarkPatrolled marks the revision the patroller is currently on as patrolled.

func (*Patroller) Next

func (p *Patroller) Next(ctx context.Context) bool

Next advances to the next unpatrolled revision in the backlog. It returns false when there are no more revisions to patrol, or if an error occurred querying the MediaWiki API. After Next returns false, the Patroller.Err method will return the first error that occurred.

func (*Patroller) RevisionID

func (p *Patroller) RevisionID() int

RevisionID returns the revision ID of the revision the patroller is currently on.

func (*Patroller) RevisionType

func (p *Patroller) RevisionType() string

RevisionType returns the type of the revision the patroller is currently on (e.g. "edit", "new", "log").

func (*Patroller) Timestamp

func (p *Patroller) Timestamp() time.Time

Timestamp returns the timestamp of the revision the patroller is currently on.

func (*Patroller) Title

func (p *Patroller) Title() string

Title returns the page title of the revision the patroller is currently on.

func (*Patroller) URL

func (p *Patroller) URL() (string, error)

URL returns a URL to the diff of the revision the patroller is currently on.

func (*Patroller) User

func (p *Patroller) User() string

User returns the user of the revision the patroller is currently on.

Jump to

Keyboard shortcuts

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