Documentation ¶
Index ¶
- Constants
- Variables
- func IRIf(i pub.IRI, t CollectionType) pub.IRI
- func ValidActivityCollection(typ CollectionType) bool
- func ValidCollection(typ CollectionType) bool
- func ValidCollectionIRI(i pub.IRI) bool
- func ValidObjectCollection(typ CollectionType) bool
- type ActivityHandlerFn
- type CollectionHandlerFn
- type CollectionType
- type CollectionTyper
- type CollectionTypes
- type CtxtKey
- type ItemHandlerFn
- type MethodValidator
- type RequestValidator
Constants ¶
const ( Unknown = CollectionType("") Outbox = CollectionType("outbox") Inbox = CollectionType("inbox") Replies = CollectionType("replies") // activitystreams Following = CollectionType("following") Followers = CollectionType("followers") Liked = CollectionType("liked") Likes = CollectionType("likes") )
Variables ¶
var ( OnObject = CollectionTypes{ Likes, Shares, Replies, } OnActor = CollectionTypes{ Outbox, Inbox, Liked, Following, Followers, } ActivityPubCollections = CollectionTypes{ Outbox, Inbox, Liked, Following, Followers, Likes, Shares, Replies, } )
var RepositoryKey = CtxtKey("__repo")
Functions ¶
func IRIf ¶
func IRIf(i pub.IRI, t CollectionType) pub.IRI
IRIf formats an IRI from an existing IRI and the collection type
func ValidActivityCollection ¶
func ValidActivityCollection(typ CollectionType) bool
ValidActivityCollection shows if the current ActivityPub end-point type is a valid one for handling Activities
func ValidCollection ¶
func ValidCollection(typ CollectionType) bool
func ValidCollectionIRI ¶
func ValidObjectCollection ¶
func ValidObjectCollection(typ CollectionType) bool
ValidActivityCollection shows if the current ActivityPub end-point type is a valid one for handling Objects
Types ¶
type ActivityHandlerFn ¶
ActivityHandlerFn is the type that we're using to represent handlers that process requests containing an ActivityStreams Activity. It needs to implement the http.Handler interface.
It is considered that following the execution of the handler, we return a pair formed of a HTTP status together with
an IRI representing a new Object - in the case of transitive activities that had a side effect, or an error.
In the case of intransitive activities the iri will always be empty.
func (ActivityHandlerFn) ServeHTTP ¶
func (a ActivityHandlerFn) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements the http.Handler interface for the ActivityHandlerFn type
func (ActivityHandlerFn) ValidMethod ¶
func (a ActivityHandlerFn) ValidMethod(r *http.Request) bool
ValidMethod validates if the current handler can process the current request
func (ActivityHandlerFn) ValidateRequest ¶
func (a ActivityHandlerFn) ValidateRequest(r *http.Request) (int, error)
ValidateRequest validates if the current handler can process the current request
type CollectionHandlerFn ¶
type CollectionHandlerFn func(CollectionType, *http.Request, storage.ReadStore) (pub.CollectionInterface, error)
CollectionHandlerFn is the type that we're using to represent handlers that will return ActivityStreams Collection or OrderedCollection objects. It needs to implement the http.Handler interface.
func (CollectionHandlerFn) ServeHTTP ¶
func (c CollectionHandlerFn) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements the http.Handler interface for the CollectionHandlerFn type
func (CollectionHandlerFn) ValidMethod ¶
func (c CollectionHandlerFn) ValidMethod(r *http.Request) bool
ValidMethod validates if the current handler can process the current request
func (CollectionHandlerFn) ValidateRequest ¶
func (c CollectionHandlerFn) ValidateRequest(r *http.Request) (int, error)
ValidateRequest validates if the current handler can process the current request
type CollectionType ¶
type CollectionType string
CollectionType
func Split ¶
func Split(i pub.IRI) (pub.IRI, CollectionType)
Split returns the base IRI of received i, if i represents an IRI matching collection type t
func (CollectionType) AddTo ¶
AddTo adds collection type IRI on the corresponding property of the i Item
func (CollectionType) IRI ¶
func (t CollectionType) IRI(i pub.Item) pub.IRI
IRI gives us the IRI of the t collection type corresponding to the i Item, or generates a new one if not found.
type CollectionTyper ¶
type CollectionTyper interface {
Type(r *http.Request) CollectionType
}
CollectionTyper allows external packages to tell us which collection the current HTTP request addresses
var Typer CollectionTyper = pathTyper{}
Typer is the static package variable that determines a collection type for a particular request It can be overloaded from outside packages. @TODO(marius): This should be moved as a property on an instantiable package object, instead of keeping it here
type CollectionTypes ¶
type CollectionTypes []CollectionType
CollectionTypes
func (CollectionTypes) Contains ¶
func (t CollectionTypes) Contains(typ CollectionType) bool
func (CollectionTypes) Split ¶
func (t CollectionTypes) Split(i pub.IRI) (pub.IRI, CollectionType)
Split splits the IRI in an actor IRI and its collection if the collection is found in the elements in the t CollectionTypes slice
type CtxtKey ¶
type CtxtKey string
CtxtKey type alias for the key under which we're storing the Collection Storage in the Request's context
type ItemHandlerFn ¶
ItemHandlerFn is the type that we're using to represent handlers that return ActivityStreams objects. It needs to implement the http.Handler interface
func (ItemHandlerFn) ServeHTTP ¶
func (i ItemHandlerFn) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements the http.Handler interface for the ItemHandlerFn type
func (ItemHandlerFn) ValidMethod ¶
func (i ItemHandlerFn) ValidMethod(r *http.Request) bool
ValidMethod validates if the current handler can process the current request
func (ItemHandlerFn) ValidateRequest ¶
func (i ItemHandlerFn) ValidateRequest(r *http.Request) (int, error)
ValidateRequest validates if the current handler can process the current request
type MethodValidator ¶
MethodValidator is the interface need to be implemented to specify if an HTTP request's method is supported by the implementor object