1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-07-22 17:18:37 +00:00

Add API endpoint to import OPML file

This commit is contained in:
Frédéric Guillot 2018-04-29 18:56:40 -07:00
parent 7a1653a2e9
commit 5cacae6cf2
9 changed files with 96 additions and 23 deletions

View file

@ -7,6 +7,7 @@ package miniflux
import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/url"
"strconv"
@ -230,6 +231,12 @@ func (c *Client) Export() ([]byte, error) {
return opml, nil
}
// Import imports an OPML file.
func (c *Client) Import(f io.ReadCloser) error {
_, err := c.request.PostFile("/v1/import", f)
return err
}
// Feed gets a feed.
func (c *Client) Feed(feedID int64) (*Feed, error) {
body, err := c.request.Get(fmt.Sprintf("/v1/feeds/%d", feedID))