1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-01 17:38:37 +00:00

Improve API

This commit is contained in:
Frédéric Guillot 2017-11-24 22:29:20 -08:00
parent 747da03e4c
commit 71bf7e4358
15 changed files with 40 additions and 63 deletions

View file

@ -7,8 +7,9 @@ package payload
import (
"encoding/json"
"fmt"
"github.com/miniflux/miniflux2/model"
"io"
"github.com/miniflux/miniflux2/model"
)
type EntriesResponse struct {
@ -41,18 +42,19 @@ func DecodeURLPayload(data io.Reader) (string, error) {
return p.URL, nil
}
func DecodeEntryStatusPayload(data io.Reader) (string, error) {
func DecodeEntryStatusPayload(data io.Reader) ([]int64, string, error) {
type payload struct {
Status string `json:"status"`
EntryIDs []int64 `json:"entry_ids"`
Status string `json:"status"`
}
var p payload
decoder := json.NewDecoder(data)
if err := decoder.Decode(&p); err != nil {
return "", fmt.Errorf("invalid JSON payload: %v", err)
return nil, "", fmt.Errorf("invalid JSON payload: %v", err)
}
return p.Status, nil
return p.EntryIDs, p.Status, nil
}
func DecodeFeedCreationPayload(data io.Reader) (string, int64, error) {