generated from alecodes/base-template
feat: list entries to archive from miniflux
This commit is contained in:
parent
22b4abf73b
commit
43cd24e4d0
6 changed files with 30 additions and 14 deletions
|
|
@ -13,5 +13,11 @@ func Archive(minifluxConfig miniflux.MinifluxConfig, serviceConfig ServiceConfig
|
|||
logger.Fatal("Could not connect to the miniflux server: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println(mf)
|
||||
result, err := mf.GetEntries()
|
||||
if err != nil {
|
||||
logger.Fatal("Could not retrieve entries from the miniflux feed: %v", err)
|
||||
}
|
||||
|
||||
entry := result.Entries[0]
|
||||
fmt.Println(entry.Title, entry.Status, entry.Tags)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,9 +6,10 @@ import (
|
|||
)
|
||||
|
||||
type MinifluxConfig struct {
|
||||
Host string
|
||||
User string
|
||||
Token string
|
||||
Host string
|
||||
User string
|
||||
Token string
|
||||
FeedId int64
|
||||
}
|
||||
|
||||
type Miniflux struct {
|
||||
|
|
@ -16,6 +17,14 @@ type Miniflux struct {
|
|||
client *mfApi.Client
|
||||
}
|
||||
|
||||
func (mf *Miniflux) GetEntries() (*mfApi.EntryResultSet, error) {
|
||||
filter := &mfApi.Filter{
|
||||
Statuses: []string{mfApi.EntryStatusRead, mfApi.EntryStatusRemoved},
|
||||
}
|
||||
|
||||
return mf.client.FeedEntries(mf.FeedId, filter)
|
||||
}
|
||||
|
||||
func NewMiniflux(config MinifluxConfig) (*Miniflux, error) {
|
||||
mf := &Miniflux{
|
||||
MinifluxConfig: config,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue