-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfeed.go
38 lines (35 loc) · 1.01 KB
/
feed.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package feedly
import (
"fmt"
"net/url"
)
// FeedResponse : GET /v3/feeds/:feedId
type FeedResponse struct {
Language string `json:"language"`
Curated bool `json:"curated"`
Topics []string `json:"topics"`
Subscribers int `json:"subscribers"`
Featured bool `json:"featured"`
Title string `json:"title"`
Velocity float64 `json:"velocity"`
State string `json:"state"`
Website string `json:"website"`
ID string `json:"id"`
Sponsored bool `json:"sponsored"`
}
// Feed : https://developer.feedly.com/v3/feeds/
func (f *Feedly) Feed(feedID string, options ...url.Values) (FeedResponse, error) {
result := &FeedResponse{}
if feedID == "" {
return *result, fmt.Errorf("feedID is required")
}
option := url.Values{}
for _, input := range options {
if err := f.setOption(&option, input); err != nil {
return *result, err
}
}
u := feedURL + "/" + url.QueryEscape(feedID)
_, err := f.request("GET", u, result, option)
return *result, err
}