Browse Source

Add basic activitystreams.Person type

master
Matt Baer 5 years ago
parent
commit
e99c8d6b4d
2 changed files with 49 additions and 0 deletions
  1. +15
    -0
      activitystreams/data.go
  2. +34
    -0
      activitystreams/person.go

+ 15
- 0
activitystreams/data.go View File

@@ -0,0 +1,15 @@
package activitystreams

type (
PublicKey struct {
ID string `json:"id"`
Owner string `json:"owner"`
PublicKeyPEM string `json:"publicKeyPem"`
}

Image struct {
Type string `json:"type"`
MediaType string `json:"mediaType"`
URL string `json:"url"`
}
)

+ 34
- 0
activitystreams/person.go View File

@@ -0,0 +1,34 @@
package activitystreams

type Person struct {
Context []string `json:"@context"`
Type string `json:"type"`
ID string `json:"id"`
Inbox string `json:"inbox"`
Outbox string `json:"outbox"`
PreferredUsername string `json:"preferredUsername"`
URL string `json:"url"`
Name string `json:"name"`
Icon Image `json:"icon"`
Following string `json:"following"`
Followers string `json:"followers"`
Summary string `json:"summary"`
PublicKey PublicKey `json:"publicKey"`
}

func NewPerson(accountRoot string) *Person {
p := Person{
Type: "Person",
Context: []string{
"https://www.w3.org/ns/activitystreams",
},
ID: accountRoot,
URL: accountRoot,
Following: accountRoot + "/following",
Followers: accountRoot + "/followers",
Inbox: accountRoot + "/inbox",
Outbox: accountRoot + "/outbox",
}

return &p
}

Loading…
Cancel
Save