|
|
@@ -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 |
|
|
|
} |