1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-06-27 16:36:00 +00:00

Add more filters for API call /entries

New filters:

- before (unix timestamp)
- before_entry_id
- after
- after_entry_id
- starred (boolean)
This commit is contained in:
Frédéric Guillot 2018-06-09 19:13:41 -07:00
parent c5373ff2bf
commit 36dab8b518
7 changed files with 99 additions and 17 deletions

View file

@ -477,6 +477,26 @@ func buildFilterQueryString(path string, filter *Filter) string {
values.Set("offset", strconv.Itoa(filter.Offset))
}
if filter.After > 0 {
values.Set("after", strconv.FormatInt(filter.After, 10))
}
if filter.AfterEntryID > 0 {
values.Set("after_entry_id", strconv.FormatInt(filter.AfterEntryID, 10))
}
if filter.Before > 0 {
values.Set("before", strconv.FormatInt(filter.Before, 10))
}
if filter.BeforeEntryID > 0 {
values.Set("before_entry_id", strconv.FormatInt(filter.BeforeEntryID, 10))
}
if filter.Starred {
values.Set("starred", "1")
}
path = fmt.Sprintf("%s?%s", path, values.Encode())
}

View file

@ -127,11 +127,16 @@ type Enclosures []*Enclosure
// Filter is used to filter entries.
type Filter struct {
Status string
Offset int
Limit int
Order string
Direction string
Status string
Offset int
Limit int
Order string
Direction string
Starred bool
Before int64
After int64
BeforeEntryID int64
AfterEntryID int64
}
// EntryResultSet represents the response when fetching entries.