models

package
v0.0.0-...-9f76edf Latest Latest
Warning

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

Go to latest
Published: May 6, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package models is a collection of interfaces commonly used by mybot.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountProperties

type AccountProperties struct {
	ScreenNames []string `json:"screen_names" toml:"screen_names" bson:"screen_names" yaml:"screen_names"`
}

type Authenticator

type Authenticator interface {
	SetProvider(name string, r *http.Request)
	InitProvider(provider, callback, consumerKey, consumerSecret string)
	CompleteUserAuth(provider string, w http.ResponseWriter, r *http.Request) (goth.User, error)
	Login(user goth.User, w http.ResponseWriter, r *http.Request) error
	GetLoginUser(r *http.Request) (goth.User, error)
	Logout(w http.ResponseWriter, r *http.Request) error
}

type Channel

type Channel struct {
	ID   string `json:"id" toml:"id" bson:"id" yaml:"id"`
	Name string `json:"name" toml:"name" bson:"name" yaml:"name"`
}

type Context

type Context interface {
	String(key string) string
	Bool(key string) bool
	Int(key string) int
	Duration(key string) time.Duration
}

type DefaultMgoCollection

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

func (*DefaultMgoCollection) Find

func (c *DefaultMgoCollection) Find(query interface{}) MgoQuery

func (*DefaultMgoCollection) RemoveAll

func (c *DefaultMgoCollection) RemoveAll(selector interface{}) (*mgo.ChangeInfo, error)

func (*DefaultMgoCollection) Upsert

func (c *DefaultMgoCollection) Upsert(selector interface{}, update interface{}) (info *mgo.ChangeInfo, err error)

type FavoriteProperties

type FavoriteProperties struct {
}

func NewFavoriteProperties

func NewFavoriteProperties() FavoriteProperties

type FilterProperties

type FilterProperties struct {
	HasMedia           *bool  `json:"has_media,omitempty" toml:"has_media,omitempty" bson:"has_media,omitempty" yaml:"has_media,omitempty"`
	FavoriteThreshold  *int   `json:"favorite_threshold" toml:"favorite_threshold" bson:"favorite_threshold" yaml:"favorite_threshold"`
	RetweetedThreshold *int   `json:"retweeted_threshold" toml:"retweeted_threshold" bson:"retweeted_threshold" yaml:"retweeted_threshold"`
	Lang               string `json:"lang,omitempty" toml:"lang,omitempty" bson:"lang,omitempty" yaml:"lang,omitempty"`
}

type Group

type Group struct {
	ID   string `json:"id" toml:"id" bson:"id" yaml:"id"`
	Name string `json:"name" toml:"name" bson:"name" yaml:"name"`
}

type ImageCacheData

type ImageCacheData struct {
	VisionCacheProperties
}

type LanguageCondition

type LanguageCondition struct {
	MinSentiment *float64 `json:"min_sentiment,omitempty" toml:"min_sentiment,omitempty" bson:"min_sentiment,omitempty" yaml:"min_sentiment,omitempty"`
	MaxSentiment *float64 `json:"max_sentiment,omitempty" toml:"max_sentiment,omitempty" bson:"max_sentiment,omitempty" yaml:"max_sentiment,omitempty"`
}

func (*LanguageCondition) IsEmpty

func (c *LanguageCondition) IsEmpty() bool

func (*LanguageCondition) LanguageFeatures

func (c *LanguageCondition) LanguageFeatures() *language.Features

type MgoCollection

type MgoCollection interface {
	Find(query interface{}) MgoQuery
	RemoveAll(selector interface{}) (*mgo.ChangeInfo, error)
	Upsert(selector interface{}, update interface{}) (*mgo.ChangeInfo, error)
}

func NewMgoCollection

func NewMgoCollection(c *mgo.Collection) MgoCollection

type MgoQuery

type MgoQuery interface {
	Count() (int, error)
	One(result interface{}) error
}

type SearchProperties

type SearchProperties struct {
	Queries    []string `json:"queries" toml:"queries" bson:"queries" yaml:"queries"`
	ResultType string   `json:"result_type,omitempty" toml:"result_type,omitempty" bson:"result_type,omitempty" yaml:"result_type,omitempty"`
}

func NewSearchProperties

func NewSearchProperties() SearchProperties

type SlackAPI

type SlackAPI interface {
	PostMessage(ch, msg string, opts []slack.MsgOption) error
	CreateChannel(name string) error
	CreateGroup(group string) error
	NewRTM() *slack.RTM
	GetChannels(excludeArchived bool) ([]Channel, error)
	GetGroups(excludeArchived bool) ([]Group, error)
	AddPin(ch, timestamp string) error
	AddStar(ch, timestamp string) error
	AddReaction(ch, timestamp, name string) error
	AuthTest() (*slack.AuthTestResponse, error)
}

func NewSlackAPI

func NewSlackAPI(token string) SlackAPI

type SlackAPIImpl

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

func (*SlackAPIImpl) AddPin

func (s *SlackAPIImpl) AddPin(ch, timestamp string) error

func (*SlackAPIImpl) AddReaction

func (s *SlackAPIImpl) AddReaction(ch, timestamp, name string) error

func (*SlackAPIImpl) AddStar

func (s *SlackAPIImpl) AddStar(ch, timestamp string) error

func (*SlackAPIImpl) AuthTest

func (s *SlackAPIImpl) AuthTest() (*slack.AuthTestResponse, error)

func (*SlackAPIImpl) CreateChannel

func (s *SlackAPIImpl) CreateChannel(name string) error

func (*SlackAPIImpl) CreateGroup

func (s *SlackAPIImpl) CreateGroup(group string) error

func (*SlackAPIImpl) GetChannels

func (s *SlackAPIImpl) GetChannels(excludeArchived bool) ([]Channel, error)

func (*SlackAPIImpl) GetGroups

func (s *SlackAPIImpl) GetGroups(excludeArchived bool) ([]Group, error)

func (*SlackAPIImpl) NewRTM

func (s *SlackAPIImpl) NewRTM() *slack.RTM

func (*SlackAPIImpl) PostMessage

func (s *SlackAPIImpl) PostMessage(ch string, msg string, opts []slack.MsgOption) error

type SlackActionProperties

type SlackActionProperties struct {
	Pin  bool `json:"pin" toml:"pin" bson:"pin" yaml:"pin"`
	Star bool `json:"star" toml:"star" bson:"star" yaml:"star"`
}

type SourceProperties

type SourceProperties struct {
	Count *int `json:"count,omitempty" toml:"count,omitempty" bson:"count,omitempty" yaml:"count,omitempty"`
}

type TimelineProperties

type TimelineProperties struct {
	ExcludeReplies bool `json:"exclude_replies" toml:"exclude_replies" bson:"exclude_replies" yaml:"exclude_replies"`
	IncludeRts     bool `json:"include_rts" toml:"include_rts" bson:"include_rts" yaml:"include_rts"`
}

func NewTimelineProperties

func NewTimelineProperties() TimelineProperties

type TwitterAPI

type TwitterAPI interface {
	VerifyCredentials() (bool, error)
	PostDMToScreenName(string, string) (anaconda.DirectMessage, error)
	GetCollectionListByUserId(int64, url.Values) (anaconda.CollectionListResult, error)
	PostTweet(string, url.Values) (anaconda.Tweet, error)
	GetFriendsList(url.Values) (anaconda.UserCursor, error)
	GetSelf(url.Values) (anaconda.User, error)
	GetUserTimeline(url.Values) ([]anaconda.Tweet, error)
	GetFavorites(url.Values) ([]anaconda.Tweet, error)
	GetSearch(string, url.Values) (anaconda.SearchResponse, error)
	Retweet(int64, bool) (anaconda.Tweet, error)
	Favorite(int64) (anaconda.Tweet, error)
	CreateCollection(string, url.Values) (anaconda.CollectionShowResult, error)
	AddEntryToCollection(string, int64, url.Values) (anaconda.CollectionEntryAddResult, error)
	GetUsersLookup(string, url.Values) ([]anaconda.User, error)
	PublicStreamFilter(url.Values) *anaconda.Stream
	UserStream(url.Values) *anaconda.Stream
	GetUsersShow(string, url.Values) (anaconda.User, error)
	GetUserSearch(string, url.Values) ([]anaconda.User, error)
}

type TwitterActionProperties

type TwitterActionProperties struct {
	Tweet    bool `json:"tweet" toml:"tweet" bson:"tweet" yaml:"tweet"`
	Retweet  bool `json:"retweet" toml:"retweet" bson:"retweet" yaml:"retweet"`
	Favorite bool `json:"favorite" toml:"favorite" bson:"favorite" yaml:"favorite"`
}

type VisionCacheProperties

type VisionCacheProperties struct {
	URL            string `json:"url" toml:"url" bson:"url" yaml:"url"`
	Src            string `json:"src" toml:"src" bson:"src" yaml:"src"`
	AnalysisResult string `json:"analysis_result" toml:"analysis_result" bson:"analysis_result" yaml:"analysis_result"`
	AnalysisDate   string `json:"analysis_date" toml:"analysis_date" bson:"analysis_date" yaml:"analysis_date"`
}

type VisionCondition

type VisionCondition struct {
	Label    []string            `json:"label,omitempty" toml:"label,omitempty" bson:"label,omitempty" yaml:"label,omitempty"`
	Face     VisionFaceCondition `json:"face,omitempty" toml:"face,omitempty" bson:"face,omitempty" yaml:"face,omitempty"`
	Text     []string            `json:"text,omitempty" toml:"text,omitempty" bson:"text,omitempty" yaml:"text,omitempty"`
	Landmark []string            `json:"landmark,omitempty" toml:"landmark,omitempty" bson:"landmark,omitempty" yaml:"landmark,omitempty"`
}

VisionCondition is a condition to check whether images match or not by using Google Vision API.

func NewVisionCondition

func NewVisionCondition() VisionCondition

func (*VisionCondition) IsEmpty

func (c *VisionCondition) IsEmpty() bool

func (*VisionCondition) VisionFeatures

func (cond *VisionCondition) VisionFeatures() []*vision.Feature

type VisionFaceCondition

type VisionFaceCondition struct {
	AngerLikelihood    string `` /* 135-byte string literal not displayed */
	BlurredLikelihood  string `` /* 143-byte string literal not displayed */
	HeadwearLikelihood string `` /* 147-byte string literal not displayed */
	JoyLikelihood      string `` /* 127-byte string literal not displayed */
}

func (*VisionFaceCondition) IsEmpty

func (c *VisionFaceCondition) IsEmpty() bool

type Worker

type Worker interface {
	// Start starts this worker blockingly.
	// To stop this worker, close the given channel.
	Start(ctx context.Context, outChan chan<- interface{}) error
	// Name returns a name of this Worker, to distinguish this from others.
	Name() string
}

Worker is worker which has its own operation and provides APIs to start/stop it.

Jump to

Keyboard shortcuts

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