linstrom/ap/ordered-collection.go

26 lines
1.7 KiB
Go
Raw Normal View History

2024-01-30 11:26:41 +00:00
package ap
import "net/url"
2024-01-31 16:56:07 +00:00
// Ordered collection of things (paged)
2024-01-30 11:26:41 +00:00
type OrderedCollection struct {
2024-01-31 16:56:07 +00:00
Context map[string]any `json:"@context"` // Big chunk of hopefully don't give a fuck
ID url.URL `json:"id"` // URL to this resource
Type string `json:"type"` // Should always be "OrderedCollection"
TotalItems *int `json:"totalItems,omitempty"` // Number of resources in this collection, Akoma doesn't include this
First url.URL `json:"first"` // Link to the first resource in this collection, an OrderedCollectionPage object
Last url.URL `json:"last"` // Link to the last resource in this collection, an OrderedCollectionPage object
2024-01-30 11:26:41 +00:00
}
2024-01-31 16:56:07 +00:00
// One page of an ordered collection
2024-01-30 11:26:41 +00:00
type OrderedCollectionPage struct {
2024-01-31 16:56:07 +00:00
Context map[string]any `json:"@context"` // Big chunk of hopefully don't give a fuck
ID url.URL `json:"id"` // URL to this resource
PartOf url.URL `json:"partOf"` // URL to the collection this is a part of
Type string `json:"type"` // Should always be "OrderedCollectionPage"
TotalItems *int `json:"totalItems,omitempty"` // Number of resources in this collection. Mk yes, Masto no, Akoma no
OrderedItems []map[string]any `json:"orderedItems"` // Items in this list. Should all be AP objects/actions
Previous *url.URL `json:"prev"` // Previous page, empty if no items? I think?
Next *url.URL `json:"next"` // Next page
2024-01-30 11:26:41 +00:00
}