twitter

package
v1.0.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TwitterSource

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

TwitterSource implements the hermod.Source interface for polling Twitter (X) tweets.

func NewTwitterSource

func NewTwitterSource(token, query string, interval time.Duration, mode string) *TwitterSource

NewTwitterSource creates a new TwitterSource.

func (*TwitterSource) Ack

func (s *TwitterSource) Ack(ctx context.Context, msg hermod.Message) error

Ack acknowledges a message.

func (*TwitterSource) Close

func (s *TwitterSource) Close() error

Close closes the Twitter source.

func (*TwitterSource) GetState

func (s *TwitterSource) GetState() map[string]string

GetState returns the current state of the source.

func (*TwitterSource) Ping

func (s *TwitterSource) Ping(ctx context.Context) error

Ping checks the connection to Twitter.

func (*TwitterSource) Read

func (s *TwitterSource) Read(ctx context.Context) (hermod.Message, error)

Read reads the next tweet from Twitter.

func (*TwitterSource) SetBaseURL

func (s *TwitterSource) SetBaseURL(u string)

SetBaseURL overrides the vendor endpoint this connector talks to.

The hostname is hardcoded in the constructor, which made the connector impossible to exercise without dialling the live API -- so it sat outside the conformance suite, untested, while connectors that took an address were covered. This is the seam that closes that gap: point it at a test server or a dead address and the contract can be checked offline.

An empty string leaves the default in place, so a caller that has nothing to override does not have to special-case it.

func (*TwitterSource) SetState

func (s *TwitterSource) SetState(state map[string]string)

SetState sets the current state of the source.

Jump to

Keyboard shortcuts

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