streams

package
v0.0.0-...-9387b4f Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
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 NewClient

func NewClient(event string) *Client

NewClient returns an initialized Client

func (*Client) GetStreamData

func (client *Client) GetStreamData(stream string, handlerFunc interface{}) error

RecentChanges subscribes to the recent changes feed. The handler is invoked with a RecentChangeEvent once for every matching event received.

func (*Client) LastTimestamp

func (client *Client) LastTimestamp() string

LastTimestamp returns the ISO8601 formatted timestamp of the last event received.

func (*Client) Match

func (client *Client) Match(attribute string, value interface{}) *Client

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) UnmarshalJSONBasedOnStream

func (client *Client) UnmarshalJSONBasedOnStream(stream string, handlerFunc interface{}, lastSub *time.Time) error

Jump to

Keyboard shortcuts

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