summaryrefslogtreecommitdiff
path: root/internal/ap/interfaces.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2023-09-23 18:28:12 +0100
committerLibravatar GitHub <noreply@github.com>2023-09-23 18:28:12 +0100
commit9f9fcf743dfc914f0e40f67e4f77177bb471b968 (patch)
tree5d04c99c652711d335bf99e244f9f79293d4c52b /internal/ap/interfaces.go
parent[chore] deinterface the typeutils.Converter and update to use state structure... (diff)
downloadgotosocial-9f9fcf743dfc914f0e40f67e4f77177bb471b968.tar.xz
[bugfix] support both CollectionPage AND OrderedCollectionPage in status replies (#2220)
Diffstat (limited to 'internal/ap/interfaces.go')
-rw-r--r--internal/ap/interfaces.go38
1 files changed, 31 insertions, 7 deletions
diff --git a/internal/ap/interfaces.go b/internal/ap/interfaces.go
index 611f4bde0..5372eb01e 100644
--- a/internal/ap/interfaces.go
+++ b/internal/ap/interfaces.go
@@ -17,7 +17,11 @@
package ap
-import "github.com/superseriousbusiness/activity/streams/vocab"
+import (
+ "net/url"
+
+ "github.com/superseriousbusiness/activity/streams/vocab"
+)
// Accountable represents the minimum activitypub interface for representing an 'account'.
// This interface is fulfilled by: Person, Application, Organization, Service, and Group
@@ -153,14 +157,23 @@ type ReplyToable interface {
WithInReplyTo
}
-// CollectionPageable represents the minimum interface for an activitystreams 'CollectionPage' object.
-type CollectionPageable interface {
+// CollectionPageIterator represents the minimum interface for interacting with a wrapped
+// CollectionPage or OrderedCollectionPage in order to access both next / prev pages and items.
+type CollectionPageIterator interface {
WithJSONLDId
WithTypeName
- WithNext
- WithPartOf
- WithItems
+ NextPage() WithIRI
+ PrevPage() WithIRI
+
+ NextItem() IteratorItemable
+ PrevItem() IteratorItemable
+}
+
+// IteratorItemable represents the minimum interface for an item in an iterator.
+type IteratorItemable interface {
+ WithIRI
+ WithType
}
// Flaggable represents the minimum interface for an activitystreams 'Flag' activity.
@@ -173,11 +186,22 @@ type Flaggable interface {
WithObject
}
-// WithJSONLDId represents an activity with JSONLDIdProperty
+// WithJSONLDId represents an activity with JSONLDIdProperty.
type WithJSONLDId interface {
GetJSONLDId() vocab.JSONLDIdProperty
}
+// WithIRI represents an object (possibly) representable as an IRI.
+type WithIRI interface {
+ GetIRI() *url.URL
+ IsIRI() bool
+}
+
+// WithType ...
+type WithType interface {
+ GetType() vocab.Type
+}
+
// WithTypeName represents an activity with a type name
type WithTypeName interface {
GetTypeName() string