-
Notifications
You must be signed in to change notification settings - Fork 14
/
activities.go
47 lines (41 loc) · 1 KB
/
activities.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
package activities
import (
"github.com/davecheney/pub/models"
)
const (
FOLLOW = "Follow"
LIKE = "Like"
UNDO = "Undo"
)
func Follow(actor, object *models.Actor) map[string]any {
return map[string]any{
"@context": "https://www.w3.org/ns/activitystreams",
"type": FOLLOW,
"actor": actor.URI(),
"object": object.URI(),
}
}
func Like(actor *models.Actor, object string) map[string]any {
return map[string]any{
"@context": "https://www.w3.org/ns/activitystreams",
"type": LIKE,
"actor": actor.URI(),
"object": object,
}
}
func Unfollow(actor, object *models.Actor) map[string]any {
return map[string]any{
"@context": "https://www.w3.org/ns/activitystreams",
"type": UNDO,
"actor": actor.URI(),
"object": Follow(actor, object),
}
}
func Unlike(actor *models.Actor, object string) map[string]any {
return map[string]any{
"@context": "https://www.w3.org/ns/activitystreams",
"type": UNDO,
"actor": actor.URI(),
"object": Like(actor, object),
}
}