Documentation ¶
Overview ¶
Package models is a collection of interfaces commonly used by mybot.
Index ¶
- type AccountProperties
- type Authenticator
- type Channel
- type Context
- type DefaultMgoCollection
- type FavoriteProperties
- type FilterProperties
- type Group
- type ImageCacheData
- type LanguageCondition
- type MgoCollection
- type MgoQuery
- type SearchProperties
- type SlackAPI
- type SlackAPIImpl
- func (s *SlackAPIImpl) AddPin(ch, timestamp string) error
- func (s *SlackAPIImpl) AddReaction(ch, timestamp, name string) error
- func (s *SlackAPIImpl) AddStar(ch, timestamp string) error
- func (s *SlackAPIImpl) AuthTest() (*slack.AuthTestResponse, error)
- func (s *SlackAPIImpl) CreateChannel(name string) error
- func (s *SlackAPIImpl) CreateGroup(group string) error
- func (s *SlackAPIImpl) GetChannels(excludeArchived bool) ([]Channel, error)
- func (s *SlackAPIImpl) GetGroups(excludeArchived bool) ([]Group, error)
- func (s *SlackAPIImpl) NewRTM() *slack.RTM
- func (s *SlackAPIImpl) PostMessage(ch string, msg string, opts []slack.MsgOption) error
- type SlackActionProperties
- type SourceProperties
- type TimelineProperties
- type TwitterAPI
- type TwitterActionProperties
- type VisionCacheProperties
- type VisionCondition
- type VisionFaceCondition
- type Worker
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 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 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 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 ¶
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 ¶
type SlackActionProperties ¶
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 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"` Logo []string `json:"logo,omitempty" toml:"logo,omitempty" bson:"logo,omitempty" yaml:"logo,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.
Click to show internal directories.
Click to hide internal directories.