-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstream.go
More file actions
87 lines (82 loc) · 2.44 KB
/
stream.go
File metadata and controls
87 lines (82 loc) · 2.44 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
package feedly
import (
"fmt"
"net/url"
)
// StreamIDsResponse : GET /v3/streams/ids?streamId=:streamId
type StreamIDsResponse struct {
Ids []string `json:"ids"`
Continuation string `json:"continuation"`
}
// StreamContentsResponse : GET /v3/streams/:streamId/contents
type StreamContentsResponse struct {
Continuation string `json:"continuation"`
Updated int64 `json:"updated"`
Title string `json:"title"`
Alternate []struct {
Type string `json:"type"`
Href string `json:"href"`
} `json:"alternate"`
Self []struct {
Href string `json:" href"`
} `json:"self"`
Direction string `json:"direction"`
ID string `json:"id"`
Items []struct {
Author string `json:"author"`
Crawled int64 `json:"crawled"`
Updated int64 `json:"updated"`
Title string `json:"title"`
Content struct {
Content string `json:"content"`
Direction string `json:"direction"`
} `json:"content"`
Published int64 `json:"published"`
Tags []struct {
Label string `json:"label"`
ID string `json:"id"`
} `json:"tags"`
Categories []struct {
Label string `json:"label"`
ID string `json:"id"`
} `json:"categories"`
Alternate []struct {
Type string `json:"type"`
Href string `json:"href"`
} `json:"alternate"`
Origin struct {
StreamID string `json:"streamId"`
Title string `json:"title"`
HTMLURL string `json:"htmlUrl"`
} `json:"origin"`
Engagement int `json:"engagement"`
Unread bool `json:"unread"`
ID string `json:"id"`
} `json:"items"`
}
// StreamID : https://developer.feedly.com/v3/streams/
func (f *Feedly) StreamID(streamID string, options ...url.Values) (StreamIDsResponse, error) {
result := &StreamIDsResponse{}
option := url.Values{}
for _, input := range options {
if err := f.setOption(&option, input); err != nil {
return *result, err
}
}
esid := url.QueryEscape(streamID)
_, e := f.request("GET", fmt.Sprintf(streamIDURL, esid), result, option)
return *result, e
}
// StreamContent : https://developer.feedly.com/v3/streams/
func (f *Feedly) StreamContent(streamID string, options ...url.Values) (StreamContentsResponse, error) {
result := &StreamContentsResponse{}
option := url.Values{}
for _, input := range options {
if err := f.setOption(&option, input); err != nil {
return *result, err
}
}
esid := url.QueryEscape(streamID)
_, e := f.request("GET", fmt.Sprintf(streamContentURL, esid), result, option)
return *result, e
}