Documentation ¶
Index ¶
Constants ¶
const ( // DefaultURL is the URL of the Wikimedia EventStreams service (sans any stream endpoints) DefaultURL string = "https://stream.wikimedia.org/v2/stream" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { BaseURL string Predicates map[string]interface{} Since string // contains filtered or unexported fields }
Client is used to subscribe to the Wikimedia EventStreams service
func (*Client) LastTimestamp ¶
LastTimestamp returns the ISO8601 formatted timestamp of the last event received.
func (*Client) Match ¶
Match adds a new predicate. Predicates are used to used to establish a match based on the JSON attribute name. Events match only when all predicates do.
func (*Client) RecentChanges ¶
func (client *Client) RecentChanges(handler func(evt RecentChangeEvent)) error
RecentChanges subscribes to the recent changes feed. The handler is invoked with a RecentChangeEvent once for every matching event received.
type RecentChangeEvent ¶
type RecentChangeEvent struct { ID int `json:"id"` Meta meta `json:"meta"` Type string `json:"type"` Namespace int `json:"namespace"` Title string `json:"title"` Comment string `json:"comment"` Timestamp int `json:"timestamp"` User string `json:"user"` Bot bool `json:"bot"` Minor bool `json:"minor"` Patrolled bool `json:"patrolled"` Length struct { Old int New int } Revision struct { Old int New int } ServerURL string `json:"server_url"` ServerName string `json:"server_name"` ServerScriptPath string `json:"server_script_path"` Wiki string `json:"wiki"` ParsedComment string `json:"parsedcomment"` // contains filtered or unexported fields }
RecentChangeEvent corresponds to the JSON event objects returned by the recent changes stream (see: https://github.com/wikimedia/mediawiki-event-schemas/blob/master/jsonschema/mediawiki/recentchange/1.0.0.yaml).