-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathfollow_builder.go
More file actions
46 lines (38 loc) · 840 Bytes
/
Copy pathfollow_builder.go
File metadata and controls
46 lines (38 loc) · 840 Bytes
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
package activitystreams
import (
"net/url"
"time"
)
type FollowBuilder struct {
follow Follow
}
func NewFollow() *FollowBuilder {
return &FollowBuilder{
follow: Follow{Object: Object{Type: "Follow"}},
}
}
func (fb *FollowBuilder) AuthoringActorID(url string) *FollowBuilder {
fb.follow.Actor = &ObjectOrLinkOrString{
Target: ObjectOrLink{
Link{Type: "Link", Href: url},
},
}
return fb
}
func (fb *FollowBuilder) PayloadID(followID string) *FollowBuilder {
if _, err := url.Parse(followID); err == nil {
fb.follow.ActivityObject = &ObjectOrLinkOrString{
Target: ObjectOrLink{
Link{Type: "Link", Href: followID},
},
}
}
return fb
}
func (fb *FollowBuilder) Published(t *time.Time) *FollowBuilder {
fb.follow.Published = t
return fb
}
func (fb *FollowBuilder) Build() *Follow {
return &fb.follow
}