rss

package
v0.0.0-...-d726a1a Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2019 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const Identifier = "rss"

Variables

View Source
var ErrNotConfigured = errors.New("Feed type not configured")

Functions

func NewRSSModule

func NewRSSModule(t marvin.Team) marvin.Module

Types

type FacebookError

type FacebookError struct {
	Message   string `json:"message"`
	Type      string `json:"type"`
	Code      int    `json:"code"`
	FBTraceID string `json:"fbtrace_id"`
}

type FacebookFeed

type FacebookFeed struct {
	Name string
	Link string
	Feed struct {
		Data []FacebookFeedDataItem
	}
	ID string
}

func (*FacebookFeed) FeedID

func (f *FacebookFeed) FeedID() string

type FacebookFeedDataItem

type FacebookFeedDataItem struct {
	Message     string `json:"message"`
	Story       string `json:"story"`
	Description string `json:"description"`

	PermalinkURL string  `json:"permalink_url"`
	CreatedTime  PHPTime `json:"created_time"`
	FullPicture  string  `json:"full_picture"`
	From         struct {
		Name string `json:"name"`
	} `json:"from"`
	ID string `json:"id"`
}

func (FacebookFeedDataItem) ItemID

func (i FacebookFeedDataItem) ItemID() string

func (FacebookFeedDataItem) Render

type FacebookType

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

func (*FacebookType) Client

func (t *FacebookType) Client() (marvin.HTTPDoer, error)

func (*FacebookType) Domains

func (t *FacebookType) Domains() []string

func (*FacebookType) LoadFeed

func (t *FacebookType) LoadFeed(ctx context.Context, feedID string, lastSeen string) (FeedMeta, []Item, error)

func (*FacebookType) Name

func (t *FacebookType) Name() string

func (*FacebookType) OAuthConfig

func (t *FacebookType) OAuthConfig() (clientcredentials.Config, error)

func (*FacebookType) OnLoad

func (t *FacebookType) OnLoad(mod *RSSModule)

func (*FacebookType) TypeID

func (t *FacebookType) TypeID() TypeID

func (*FacebookType) VerifyFeedIdentifier

func (t *FacebookType) VerifyFeedIdentifier(ctx context.Context, input string) (string, error)

type FeedMeta

type FeedMeta interface {
	FeedID() string
}

FeedMeta is a flag interface for information shared between multiple feed items.

type FeedType

type FeedType interface {
	// Return the type ID used in the database
	TypeID() TypeID
	// Preferred user-visible name of the feed type
	Name() string
	// OnLoad sets up the ModuleConfig keys.
	OnLoad(mod *RSSModule)
	// Domains gives a list of domains on which this module has priority.
	Domains() []string
	// VerifyFeedIdentifier parses a command input into a canonical feed ID,
	// and checks whether the feed in fact exists at all.
	// If config keys are missing, it returns ErrNotConfigured.
	VerifyFeedIdentifier(ctx context.Context, input string) (string, error)
	// LoadFeed pulls the current content of the given feed.
	LoadFeed(ctx context.Context, feedID string, lastSeen string) (FeedMeta, []Item, error)
}

FeedType is the basic polymorphism type of the RSS module.

type Item

type Item interface {
	ItemID() string
	Render(FeedMeta) slack.OutgoingSlackMessage
}

An Item is something that has a per-feed item ID and can be rendered into a Slack message.

type PHPTime

type PHPTime struct{ time.Time }

func (*PHPTime) UnmarshalJSON

func (t *PHPTime) UnmarshalJSON(data []byte) error

type RSSModule

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

func (*RSSModule) CommandList

func (mod *RSSModule) CommandList(t marvin.Team, args *marvin.CommandArguments) marvin.CommandResult

func (*RSSModule) CommandRemove

func (mod *RSSModule) CommandRemove(t marvin.Team, args *marvin.CommandArguments) marvin.CommandResult

func (*RSSModule) CommandSubscribe

func (mod *RSSModule) CommandSubscribe(t marvin.Team, args *marvin.CommandArguments) marvin.CommandResult

func (*RSSModule) Config

func (mod *RSSModule) Config() marvin.ModuleConfig

func (*RSSModule) DB

func (mod *RSSModule) DB() *db

func (*RSSModule) Disable

func (mod *RSSModule) Disable(t marvin.Team)

func (*RSSModule) Enable

func (mod *RSSModule) Enable(t marvin.Team)

func (*RSSModule) GetFeedType

func (mod *RSSModule) GetFeedType(i TypeID) FeedType

func (*RSSModule) GetFeedTypeName

func (mod *RSSModule) GetFeedTypeName(i TypeID) string

func (*RSSModule) Identifier

func (mod *RSSModule) Identifier() marvin.ModuleID

func (*RSSModule) Load

func (mod *RSSModule) Load(t marvin.Team)

type TwitterError

type TwitterError struct {
	ResponseCode int `json:"-"`
	Errors       []struct {
		Message string `json:"message"`
		Code    int    `json:"code"`
	} `json:"errors"`
}

func (TwitterError) Error

func (e TwitterError) Error() string

type TwitterFeed

type TwitterFeed struct {
	FeedLogin string
	// contains filtered or unexported fields
}

func (*TwitterFeed) FeedID

func (f *TwitterFeed) FeedID() string

type TwitterFeedDataItem

type TwitterFeedDataItem struct {
	Tweet *twitter.Tweet
}

func (TwitterFeedDataItem) ItemID

func (i TwitterFeedDataItem) ItemID() string

func (TwitterFeedDataItem) Render

type TwitterType

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

func (*TwitterType) Client

func (t *TwitterType) Client() (marvin.HTTPDoer, error)

func (*TwitterType) Domains

func (t *TwitterType) Domains() []string

func (*TwitterType) LoadFeed

func (t *TwitterType) LoadFeed(ctx context.Context, feedID string, lastSeen string) (FeedMeta, []Item, error)

func (*TwitterType) Name

func (t *TwitterType) Name() string

func (*TwitterType) OnLoad

func (t *TwitterType) OnLoad(mod *RSSModule)

func (*TwitterType) TypeID

func (t *TwitterType) TypeID() TypeID

func (*TwitterType) VerifyFeedIdentifier

func (t *TwitterType) VerifyFeedIdentifier(ctx context.Context, input string) (string, error)

type TypeID

type TypeID byte

func (*TypeID) Scan

func (t *TypeID) Scan(value interface{}) error

func (TypeID) Value

func (t TypeID) Value() (driver.Value, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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