Add basic Note and Activity types

This commit is contained in:
Matt Baer
2018-06-24 21:06:26 -04:00
parent e7db291bd3
commit d16108618b
2 changed files with 85 additions and 0 deletions
+27
View File
@@ -1,5 +1,7 @@
package activitystreams
import "fmt"
type (
BaseObject struct {
Context []string `json:"@context"`
@@ -41,3 +43,28 @@ func NewOrderedCollection(accountRoot string, items int) *OrderedCollection {
}
return &oc
}
type OrderedCollectionPage struct {
BaseObject
TotalItems int `json:"totalItems"`
PartOf string `json:"partOf"`
Next string `json:"next,omitempty"`
Prev string `json:"prev,omitempty"`
OrderedItems []Activity `json:"orderedItems"`
}
func NewOrderedCollectionPage(accountRoot string, items, page int) *OrderedCollectionPage {
ocp := OrderedCollectionPage{
BaseObject: BaseObject{
Context: []string{
"https://www.w3.org/ns/activitystreams",
},
ID: fmt.Sprintf("%s/outbox?page=%d", accountRoot, page),
Type: "OrderedCollectionPage",
},
TotalItems: items,
PartOf: accountRoot + "/outbox",
Next: fmt.Sprintf("%s/outbox?page=%d", accountRoot, page+1),
}
return &ocp
}