-
Notifications
You must be signed in to change notification settings - Fork 7
/
feed.go
54 lines (41 loc) · 1.18 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package getstream
import ()
type Feed struct {
*Client
slug Slug
}
func (f *Feed) Slug() Slug { return f.slug }
func (f *Feed) AddActivity(activity *Activity) (*Activity, error) {
activity = SignActivity(f.secret, activity)
result := &Activity{}
e := f.post(result, f.url(), f.slug, activity)
return result, e
}
func (f *Feed) AddActivities(activities []*Activity) error {
signeds := make([]*Activity, len(activities), len(activities))
for i, activity := range activities {
signeds[i] = SignActivity(f.secret, activity)
}
// TODO: A result type to recieve the listing result.
panic("not yet implemented.")
}
func (f *Feed) Activities(opt *Options) ([]*Activity, error) {
result := ActivitiesResult{}
e := f.get(&result, f.url(), f.slug)
return result.Results, e
}
func (f *Feed) RemoveActivity(id string) error {
return f.del(f.url()+id+"/", f.slug)
}
func (f *Feed) Follow(feed, id string) error {
panic("not implemented.")
}
func (f *Feed) Unfollow(feed, id string) error {
panic("not implemented.")
}
func (f *Feed) Followers(opt *Options) ([]*Feed, error) {
panic("not implemented.")
}
func (f *Feed) url() string {
return "feed/" + f.slug.Slug + "/" + f.slug.ID + "/"
}