Documentation ¶
Index ¶
- Constants
- Variables
- func String(length int) string
- func StringWithCharset(length int, charset string) string
- type List
- type MastodonBackend
- func (c *MastodonBackend) Boost(id mastodon.ID, boost bool) error
- func (c *MastodonBackend) ClearSearch() error
- func (c *MastodonBackend) GenerateConfigWithCode(code string) error
- func (c *MastodonBackend) GenerateOAuthLoginURL(instanceURL string) (string, error)
- func (c *MastodonBackend) GetAccountIDByUserName(username string) (interface{}, interface{})
- func (c *MastodonBackend) GetLists() ([]*mastodon.List, error)
- func (c *MastodonBackend) GetThread(statusID int64) ([]mastodon.Status, error)
- func (c *MastodonBackend) GetTimeline(timelineID string) ([]mastodon.Status, error)
- func (c *MastodonBackend) LoginWithOAuth2() error
- func (c *MastodonBackend) LoginWithPassword(username string, password string) error
- func (c *MastodonBackend) Logoff() error
- func (c *MastodonBackend) Post(msg string, replyStatusID mastodon.ID) error
- func (c *MastodonBackend) RefreshMessagesCallback(e events.Event) error
- func (c *MastodonBackend) Search(query string) (*mastodon.Results, error)
- func (c *MastodonBackend) SetFavourite(id mastodon.ID, fav bool) error
- type TimelineCache
- func (tc *TimelineCache) AddToTimeline(timeline string, clearExisting bool, messages []mastodon.Status, ...) error
- func (tc *TimelineCache) ClearTimeline(timeline string) error
- func (tc *TimelineCache) GetAllStatusForTimeline(timelineID string) []mastodon.Status
- func (tc *TimelineCache) GetTimelineDetails(timelineID string) (TimelineDetails, bool)
- func (tc *TimelineCache) LogCacheDetails()
- func (tc *TimelineCache) PrintStats() error
- func (tc *TimelineCache) UpdateTimeline(timelineID string, sinceID mastodon.ID, messages []mastodon.ID)
- type TimelineDetails
Constants ¶
const ( AppName = "shipdon" AppWebsite = "https://github.com/kpfaulkner/shipdon" // get 20 messages at a time. MastodonLimit = 20 MastodonSleepMS = 100 )
Variables ¶
var (
AccountID mastodon.ID
)
Functions ¶
func StringWithCharset ¶
Types ¶
type MastodonBackend ¶
type MastodonBackend struct {
// contains filtered or unexported fields
}
func NewMastodonBackend ¶
func NewMastodonBackend(eventListener *events.EventListener, config *config.Config) (*MastodonBackend, error)
func (*MastodonBackend) Boost ¶
func (c *MastodonBackend) Boost(id mastodon.ID, boost bool) error
Boost or unboost a toot
func (*MastodonBackend) ClearSearch ¶
func (c *MastodonBackend) ClearSearch() error
clear search results.
func (*MastodonBackend) GenerateConfigWithCode ¶
func (c *MastodonBackend) GenerateConfigWithCode(code string) error
generateConfigWithCode generates the config for Shipdon.
func (*MastodonBackend) GenerateOAuthLoginURL ¶
func (c *MastodonBackend) GenerateOAuthLoginURL(instanceURL string) (string, error)
generateOAuthLoginURL will create a URL for the user to visit to authenticate.
func (*MastodonBackend) GetAccountIDByUserName ¶
func (c *MastodonBackend) GetAccountIDByUserName(username string) (interface{}, interface{})
GetAccountIDByUserName get the account ID by username.
func (*MastodonBackend) GetLists ¶
func (c *MastodonBackend) GetLists() ([]*mastodon.List, error)
GetLists get all the lists that we're subscribed to.
func (*MastodonBackend) GetThread ¶
func (c *MastodonBackend) GetThread(statusID int64) ([]mastodon.Status, error)
GetThread (ie list of status which are related by replies
func (*MastodonBackend) GetTimeline ¶
func (c *MastodonBackend) GetTimeline(timelineID string) ([]mastodon.Status, error)
GetTimeline get all messages for main timeline.
func (*MastodonBackend) LoginWithOAuth2 ¶
func (c *MastodonBackend) LoginWithOAuth2() error
LoginWithOAuth2 login to Mastodon using OAuth2 Can only log in if the config file has appID, appSecret, instance and Token info
func (*MastodonBackend) LoginWithPassword ¶
func (c *MastodonBackend) LoginWithPassword(username string, password string) error
LoginWithPassword logs in to Mastodon using username + password combination The username/password are stored in PLAIN TEXT in the config file. It is NOT recommended to use this method. TODO(kpfaulkner) secure password in SOME fashion.
func (*MastodonBackend) Post ¶
func (c *MastodonBackend) Post(msg string, replyStatusID mastodon.ID) error
Post new message to Mastodon
func (*MastodonBackend) RefreshMessagesCallback ¶
func (c *MastodonBackend) RefreshMessagesCallback(e events.Event) error
RefreshMessagesCallback refreshes the messages for a specific timeline. If the RefreshEvent.GetOlder is set, then we actually want to get older messages (due to user having scrolled back and wanting to see older messages) Was originally going to try and get all timelines... but will just do whatever the timeline passed in in the event. Will just trigger multiple events... one per timeline
func (*MastodonBackend) Search ¶
func (c *MastodonBackend) Search(query string) (*mastodon.Results, error)
func (*MastodonBackend) SetFavourite ¶
func (c *MastodonBackend) SetFavourite(id mastodon.ID, fav bool) error
Favourite a toot
type TimelineCache ¶
type TimelineCache struct {
// contains filtered or unexported fields
}
func NewTimelineCache ¶
func NewTimelineCache() *TimelineCache
func (*TimelineCache) AddToTimeline ¶
func (tc *TimelineCache) AddToTimeline(timeline string, clearExisting bool, messages []mastodon.Status, shouldSort bool) error
func (*TimelineCache) ClearTimeline ¶
func (tc *TimelineCache) ClearTimeline(timeline string) error
func (*TimelineCache) GetAllStatusForTimeline ¶
func (tc *TimelineCache) GetAllStatusForTimeline(timelineID string) []mastodon.Status
func (*TimelineCache) GetTimelineDetails ¶
func (tc *TimelineCache) GetTimelineDetails(timelineID string) (TimelineDetails, bool)
func (*TimelineCache) LogCacheDetails ¶
func (tc *TimelineCache) LogCacheDetails()
func (*TimelineCache) PrintStats ¶ added in v0.1.2
func (tc *TimelineCache) PrintStats() error
func (*TimelineCache) UpdateTimeline ¶
func (tc *TimelineCache) UpdateTimeline(timelineID string, sinceID mastodon.ID, messages []mastodon.ID)
type TimelineDetails ¶
type TimelineDetails struct {
// contains filtered or unexported fields
}