Documentation
¶
Index ¶
- Variables
- func GetFoldersMap(db *server.DB) (map[string]*common.Folder, error)
- type Account
- type Attachment
- type AttachmentMeta
- type AttachmentSize
- type BlueSkyPoller
- func (m *BlueSkyPoller) APICall(ctx context.Context, method, path string, params map[string]string) ([]byte, error)
- func (m *BlueSkyPoller) Authorize(ctx context.Context) error
- func (m *BlueSkyPoller) GetAccount(ctx context.Context) (*bluesky.Account, error)
- func (m *BlueSkyPoller) GetDID(ctx context.Context) (string, error)
- func (m *BlueSkyPoller) GetTimelineHome(ctx context.Context, pagination *bluesky.Pagination) ([]*bsky.FeedDefs_FeedViewPost, error)
- func (m *BlueSkyPoller) GrabTimeline()
- type BlueskyPost
- type Feed
- type ID
- type MastodonPoller
- func (m *MastodonPoller) APICall(ctx context.Context, method, path string, params map[string]string) ([]byte, error)
- func (m *MastodonPoller) Authorize(ctx context.Context, accessToken string) error
- func (m *MastodonPoller) GetAccount(ctx context.Context) (*Account, error)
- func (m *MastodonPoller) GetFollowedTags(ctx context.Context) (map[string]Tag, error)
- func (m *MastodonPoller) GetTimelineHome(ctx context.Context, pagination *Pagination) ([]*Status, error)
- func (m *MastodonPoller) GrabTimeline()
- func (m *MastodonPoller) HandleHTTP(c *gin.Context)
- type Pagination
- type PollerData
- type RssItem
- type RssPoller
- type Status
- type Tag
- type Toot
Constants ¶
This section is empty.
Variables ¶
var ErrNotModified = errors.New("not modified")
Functions ¶
Types ¶
type Attachment ¶ added in v0.4.0
type Attachment struct { ID ID `json:"id"` Type string `json:"type"` URL string `json:"url"` Meta AttachmentMeta `json:"meta"` }
type AttachmentMeta ¶ added in v0.4.0
type AttachmentMeta struct { Original AttachmentSize `json:"original"` Small AttachmentSize `json:"small"` }
type AttachmentSize ¶ added in v0.4.0
type BlueSkyPoller ¶ added in v0.5.0
type BlueSkyPoller struct {
// contains filtered or unexported fields
}
BlueSkyPoller represents a polling client for the BlueSky social network. It manages authentication, connection details, and handles data streaming through channels. The struct maintains client state including tokens, account information, and database connections.
func NewBlueSkyPoller ¶ added in v0.5.0
func NewBlueSkyPoller(cfg *common.Config, db *server.DB, newCh chan common.AggregatorItem) (*BlueSkyPoller, error)
NewBlueSkyPoller creates a new instance of BlueSkyPoller with the provided configuration, database connection, and channel for new items. It returns a pointer to the BlueSkyPoller and an error if initialization fails.
func (*BlueSkyPoller) APICall ¶ added in v0.5.0
func (m *BlueSkyPoller) APICall(ctx context.Context, method, path string, params map[string]string) ([]byte, error)
APICall makes an HTTP request to the BlueSky API with the specified method, path, and parameters. It handles both GET and POST requests, automatically managing authentication tokens and request formatting. The method refreshes the access token if it's close to expiration. Returns the raw response body as bytes and any error encountered.
func (*BlueSkyPoller) Authorize ¶ added in v0.5.0
func (m *BlueSkyPoller) Authorize(ctx context.Context) error
Authorize performs the authentication process with the BlueSky API. It retrieves the DID, creates a session, and obtains access and refresh tokens. It also loads the current account information after successful authorization.
func (*BlueSkyPoller) GetAccount ¶ added in v0.5.0
GetAccount retrieves the account profile information for the current handle by making a request to the BlueSky API. It returns a populated Account struct.
func (*BlueSkyPoller) GetDID ¶ added in v0.5.0
func (m *BlueSkyPoller) GetDID(ctx context.Context) (string, error)
GetDID retrieves the Decentralized Identifier (DID) for the account handle by making a request to the BlueSky API. It caches the DID in the poller instance.
func (*BlueSkyPoller) GetTimelineHome ¶ added in v0.5.0
func (m *BlueSkyPoller) GetTimelineHome(ctx context.Context, pagination *bluesky.Pagination) ([]*bsky.FeedDefs_FeedViewPost, error)
GetTimelineHome retrieves the home timeline posts for the authenticated user. It accepts pagination parameters and returns a slice of FeedViewPost objects.
func (*BlueSkyPoller) GrabTimeline ¶ added in v0.5.0
func (m *BlueSkyPoller) GrabTimeline()
GrabTimeline continuously polls the BlueSky timeline for new posts. It maintains the last seen post timestamp, handles initial and subsequent calls, and sends new posts to a channel for processing. It includes error handling and implements a polling delay between requests.
type BlueskyPost ¶ added in v0.5.0
type BlueskyPost struct { *bsky.FeedDefs_PostView `binding:"required"` User *bluesky.Account // contains filtered or unexported fields }
BlueskyPost represents a post from the Bluesky social network, containing the post view, reason for display, and associated user account
type MastodonPoller ¶
type MastodonPoller struct {
// contains filtered or unexported fields
}
func NewMastodonPoller ¶
func NewMastodonPoller(cfg *common.Config, db *server.DB, newCh chan common.AggregatorItem) (*MastodonPoller, error)
func (*MastodonPoller) Authorize ¶ added in v0.4.0
func (m *MastodonPoller) Authorize(ctx context.Context, accessToken string) error
func (*MastodonPoller) GetAccount ¶ added in v0.4.0
func (m *MastodonPoller) GetAccount(ctx context.Context) (*Account, error)
func (*MastodonPoller) GetFollowedTags ¶ added in v0.4.0
func (*MastodonPoller) GetTimelineHome ¶ added in v0.4.0
func (m *MastodonPoller) GetTimelineHome(ctx context.Context, pagination *Pagination) ([]*Status, error)
func (*MastodonPoller) GrabTimeline ¶
func (m *MastodonPoller) GrabTimeline()
func (*MastodonPoller) HandleHTTP ¶
func (m *MastodonPoller) HandleHTTP(c *gin.Context)
type Pagination ¶ added in v0.4.0
type PollerData ¶
type PollerData struct { ID int `json:"id,omitempty"` Type string `json:"type"` Kind string `json:"kind"` Skey string `json:"skey"` LastSeenStr string `json:"last_seen_str"` LastSeenInt int64 `json:"last_seen_int"` }
func GetRunData ¶
func GetRunData(db *server.DB, skey string) *PollerData
func (*PollerData) GetID ¶
func (p *PollerData) GetID() int
func (*PollerData) SetID ¶
func (p *PollerData) SetID(id int)
type RssItem ¶
type RssPoller ¶
type RssPoller struct {
// contains filtered or unexported fields
}
func NewRssPoller ¶
func (*RssPoller) GetFromURL ¶
Calls the feed url with conditional headers. See https://github.com/mmcdole/gofeed/issues/111#issuecomment-450956821
func (*RssPoller) HandleHTTP ¶
func (*RssPoller) HandleNewSubs ¶
func (r *RssPoller) HandleNewSubs()
type Status ¶
type Status struct { ID ID `json:"id"` URI string `json:"uri"` URL string `json:"url"` Account Account `json:"account"` Reblog *Status `json:"reblog"` Content string `json:"content"` CreatedAt time.Time `json:"created_at"` Reblogged interface{} `json:"reblogged"` Muted interface{} `json:"muted"` MediaAttachments []Attachment `json:"media_attachments"` Tags []Tag `json:"tags"` Card *common.Card `json:"card"` Filtered []interface{} }