-
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
package activitypub
type ActorCollection = []Actor
type Actor struct {
BaseObject
Inbox InboxStream
Outbox OutboxStream
Following FollowingCollection
Followers FollowersCollection
Liked LikedCollection
PreferredUsername NaturalLanguageValue
Url Url
Summary NaturalLanguageValue
Icon Url
/*/
streams
preferredUsername
endpoints {
uploadMedia
oauthAuthorizationEndpoint
oauthTokenEndpoint
provideClientKey
signClientKey
sharedInbox
}
/**/
}
var validActorTypes = [...]string{
ApplicationType,
GroupType,
OrganizationType,
PersonType,
ServiceType,
}
func ValidActorType(_type string) bool {
for _, v := range validActorTypes {
if v == _type {
return true
}
}
return false
}
func ActorNew(id ObjectId, _type string) Actor {
if !ValidActorType(_type) {
_type = ActorType
}
o := BaseObject{Id: id, Type: _type}
return Actor{BaseObject: o}
}
func ApplicationNew(id ObjectId) Actor {
return ActorNew(id, ApplicationType)
}
func GroupNew(id ObjectId) Actor {
return ActorNew(id, GroupType)
}
func OrganizationNew(id ObjectId) Actor {
return ActorNew(id, OrganizationType)
}
func PersonNew(id ObjectId) Actor {
return ActorNew(id, PersonType)
}
func ServiceNew(id ObjectId) Actor {
return ActorNew(id, ServiceType)
}