Documentation ¶
Index ¶
- Variables
- func DoFetch(ctx context.Context, client Client, mentionChannel chan Mention, ...) error
- func DoPersist(fetchedMentions []Mention, s *sync.WaitGroup, persistable Persistable) error
- func Save(filepath string, mentions []Mention) error
- type Author
- type Client
- type Content
- type FetchWorker
- type Fetchable
- type FileReader
- type FileWriter
- type Getter
- type Loader
- type Mention
- type MentionObserver
- type MetricsObserver
- type MetricsResponse
- type Persistable
- type PersistenceWorker
- type Response
- type Saver
Constants ¶
This section is empty.
Variables ¶
View Source
var BaseUrl = "https://webmention.io/api/mentions.jf2" // API endpoint
View Source
var LoadFunc = LoadMentions
View Source
var ReadFileFunc = os.ReadFile
View Source
var SaveFunc = Save
View Source
var WriteFileFunc = os.WriteFile
Functions ¶
Types ¶
type Client ¶
type Client struct { Domain string Token string SinceID int PageSize int // contains filtered or unexported fields }
func (*Client) GetMentions ¶
type FetchWorker ¶
type FetchWorker struct {
// contains filtered or unexported fields
}
func (*FetchWorker) AddObserver ¶
func (fetchWorker *FetchWorker) AddObserver(observer MentionObserver)
func (*FetchWorker) AddObservers ¶
func (fetchWorker *FetchWorker) AddObservers(observers []MentionObserver)
type FileReader ¶
type FileWriter ¶
FileWriter defines the WriteFile method for saving data to the filesystem.
type Mention ¶
type Mention struct { Type string `json:"type" faker:"oneof: entry"` Author Author `json:"author"` URL string `json:"url" faker:"url"` Published time.Time `json:"published"` WMReceived time.Time `json:"wm-received"` WMID int `json:"wm-id" faker:"unique"` WMSource string `json:"wm-source" faker:"url"` WMTarget string `json:"wm-target" faker:"url"` WMProtocol string `json:"wm-protocol"` Name string `json:"name"` Content Content `json:"content"` InReplyTo string `json:"in-reply-to" faker:"url"` WMProperty string `json:"wm-property" faker:"oneof: in-reply-to"` WMPrivate bool `json:"wm-private"` }
func InsertMention ¶
func LoadMentions ¶
func (*Mention) GenerateSlug ¶
GenerateSlug creates a slug based on the WMTarget URL
type MentionObserver ¶
type MentionObserver interface {
Update(mention Mention)
}
type MetricsObserver ¶
type MetricsObserver struct { MaxID int EarliestReceived time.Time LatestReceived time.Time AllSenders []string MentionsSeen int UniqueMentions []int // contains filtered or unexported fields }
func (*MetricsObserver) GetMetrics ¶
func (m *MetricsObserver) GetMetrics() MetricsResponse
func (*MetricsObserver) Update ¶
func (m *MetricsObserver) Update(mention Mention)
Update performs the necessary operations on an observed mention to main it's set of metrics.
type MetricsResponse ¶
type PersistenceWorker ¶
type PersistenceWorker struct {
// contains filtered or unexported fields
}
func (*PersistenceWorker) AddObserver ¶
func (w *PersistenceWorker) AddObserver(observer MentionObserver)
Click to show internal directories.
Click to hide internal directories.