-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentry.go
More file actions
70 lines (66 loc) · 1.92 KB
/
entry.go
File metadata and controls
70 lines (66 loc) · 1.92 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package feedly
import (
"fmt"
"net/url"
)
// EntriesResponse : GET /v3/entries/:entryId
type EntriesResponse []struct {
ID string `json:"id"`
Keywords []string `json:"keywords"`
OriginID string `json:"originId"`
Fingerprint string `json:"fingerprint"`
Origin struct {
StreamID string `json:"streamId"`
Title string `json:"title"`
HTMLURL string `json:"htmlUrl"`
} `json:"origin"`
Content struct {
Content string `json:"content"`
Direction string `json:"direction"`
} `json:"content"`
Title string `json:"title"`
Published int64 `json:"published"`
Crawled int64 `json:"crawled"`
Alternate []struct {
Type string `json:"type"`
Href string `json:"href"`
} `json:"alternate"`
Author string `json:"author"`
Summary struct {
Content string `json:"content"`
Direction string `json:"direction"`
} `json:"summary"`
Visual struct {
Processor string `json:"processor"`
URL string `json:"url"`
Width int `json:"width"`
Height int `json:"height"`
ContentType string `json:"contentType"`
} `json:"visual"`
Unread bool `json:"unread"`
}
// Entry : https://developer.feedly.com/v3/entries/
func (f *Feedly) Entry(entryID string, options ...url.Values) (EntriesResponse, error) {
result := &EntriesResponse{}
option := url.Values{}
for _, input := range options {
f.setOption(&option, input)
}
_, e := f.request("GET", fmt.Sprintf(entryURL, entryID), result, option)
return *result, e
}
// Entries : https://developer.feedly.com/v3/entries/
func (f *Feedly) Entries(entryIDs []string, options ...url.Values) ([]EntriesResponse, error) {
result := &([]EntriesResponse{})
option := url.Values{}
for _, entryID := range entryIDs {
option.Add("data", entryID)
}
for _, input := range options {
if err := f.setOption(&option, input); err != nil {
return *result, err
}
}
_, e := f.request("POST", entriesURL, result, option)
return *result, e
}