murmur

package
v0.0.0-...-ba82f87 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SinkConfigs = map[SinkType]func(*Config) SinkConfig{
	TwitterSinkType: func(c *Config) SinkConfig { return c.Sink.Twitter },
}
View Source
var SourceConfigs = map[SourceType]func(*Config) SourceConfig{
	GoogleCalendarSourceType: func(c *Config) SourceConfig { return c.Source.GoogleCalendar },
	FeedSourceType:           func(c *Config) SourceConfig { return c.Source.Feed },
}

Functions

func Execute

func Execute(config *Config) error

Types

type Config

type Config struct {
	Source struct {
		Type           SourceType                  `yaml:"type"`
		GoogleCalendar *GoogleCalendarSourceConfig `yaml:"google_calendar"`
		Feed           *FeedSourceConfig           `yaml:"feed"`
	} `yaml:"source"`
	Sink struct {
		Type    SinkType           `yaml:"type"`
		Twitter *TwitterSinkConfig `yaml:"twitter"`
	} `yaml:"sink"`
}

func LoadBulkConfig

func LoadBulkConfig(reader io.Reader) ([]*Config, error)

func LoadConfig

func LoadConfig(reader io.Reader) (*Config, error)

func (*Config) NewSink

func (c *Config) NewSink() (Sink, error)

func (*Config) NewSource

func (c *Config) NewSource() (Source, error)

type FeedSource

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

func (*FeedSource) Items

func (s *FeedSource) Items() ([]*Item, error)

type FeedSourceConfig

type FeedSourceConfig struct {
	Url      string `yaml:"url"`
	Template string `yaml:"template"`
}

func (*FeedSourceConfig) NewSource

func (c *FeedSourceConfig) NewSource() (Source, error)

type GoogleCalendarSource

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

func (*GoogleCalendarSource) Items

func (s *GoogleCalendarSource) Items() ([]*Item, error)

type GoogleCalendarSourceConfig

type GoogleCalendarSourceConfig struct {
	ClientCredentials string `yaml:"client_credentials"`
	CalendarId        string `yaml:"calendar_id"`
	Template          string `yaml:"template"`
	EndedMessage      string `yaml:"ended_message"`
	TimeZone          string `yaml:"time_zone"`
}

func (*GoogleCalendarSourceConfig) NewSource

func (c *GoogleCalendarSourceConfig) NewSource() (Source, error)

type Item

type Item struct {
	Summary string
	Url     string
}

type Notifier

type Notifier struct {
	Source Source
	Sink   Sink
}

func NewNotifier

func NewNotifier(source Source, sink Sink) *Notifier

func (*Notifier) Notify

func (n *Notifier) Notify() error

type Sink

type Sink interface {
	Close()
	RecentUrls() ([]string, error)
	Output(item *Item) error
}

type SinkConfig

type SinkConfig interface {
	NewSink() (Sink, error)
}

type SinkType

type SinkType string
const (
	TwitterSinkType SinkType = "twitter"
)

type Source

type Source interface {
	Items() ([]*Item, error)
}

type SourceConfig

type SourceConfig interface {
	NewSource() (Source, error)
}

type SourceType

type SourceType string
const (
	GoogleCalendarSourceType SourceType = "google_calendar"
	FeedSourceType           SourceType = "feed"
)

type TwitterSink

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

func (*TwitterSink) Close

func (s *TwitterSink) Close()

func (*TwitterSink) Output

func (s *TwitterSink) Output(item *Item) error

func (*TwitterSink) RecentUrls

func (s *TwitterSink) RecentUrls() ([]string, error)

type TwitterSinkConfig

type TwitterSinkConfig struct {
	ConsumerKey      string `yaml:"consumer_key"`
	ConsumerSecret   string `yaml:"consumer_secret"`
	OAuthToken       string `yaml:"oauth_token"`
	OAuthTokenSecret string `yaml:"oauth_token_secret"`
}

func (*TwitterSinkConfig) NewSink

func (c *TwitterSinkConfig) NewSink() (Sink, error)

Jump to

Keyboard shortcuts

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