mirror of
https://github.com/miniflux/v2.git
synced 2025-08-01 17:38:37 +00:00
API: Add the possibility to filter entries by a list of statuses
This commit is contained in:
parent
1c103337fe
commit
04c4890124
3 changed files with 36 additions and 9 deletions
|
@ -7,6 +7,7 @@ package request // import "miniflux.app/http/request"
|
|||
import (
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
)
|
||||
|
@ -52,6 +53,23 @@ func QueryStringParam(r *http.Request, param, defaultValue string) string {
|
|||
return value
|
||||
}
|
||||
|
||||
// QueryStringParamList returns all values associated to the parameter.
|
||||
func QueryStringParamList(r *http.Request, param string) []string {
|
||||
var results []string
|
||||
values := r.URL.Query()
|
||||
|
||||
if _, found := values[param]; found {
|
||||
for _, value := range values[param] {
|
||||
value = strings.TrimSpace(value)
|
||||
if value != "" {
|
||||
results = append(results, value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return results
|
||||
}
|
||||
|
||||
// QueryIntParam returns a query string parameter as integer.
|
||||
func QueryIntParam(r *http.Request, param string, defaultValue int) int {
|
||||
return int(QueryInt64Param(r, param, int64(defaultValue)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue