resthandler

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2021 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// PublicKeysPath specifies the service's "keys" endpoint.
	PublicKeysPath = "/keys/{id}"
	// FollowersPath specifies the service's 'followers' endpoint.
	FollowersPath = "/followers"
	// FollowingPath specifies the service's 'following' endpoint.
	FollowingPath = "/following"
	// OutboxPath specifies the service's 'outbox' endpoint.
	OutboxPath = "/outbox"
	// InboxPath specifies the service's 'inbox' endpoint.
	InboxPath = "/inbox"
	// WitnessesPath specifies the service's 'witnesses' endpoint.
	WitnessesPath = "/witnesses"
	// WitnessingPath specifies the service's 'witnessing' endpoint.
	WitnessingPath = "/witnessing"
	// LikedPath specifies the service's 'liked' endpoint.
	LikedPath = "/liked"
	// SharesPath specifies the object's 'shares' endpoint.
	SharesPath = "/{id}/shares"
	// LikesPath specifies the object's 'likes' endpoint.
	LikesPath = "/{id}/likes"
)
View Source
const MainKeyID = "main-key"

MainKeyID is the ID of the service's public key.

Variables

This section is empty.

Functions

This section is empty.

Types

type Activities

type Activities struct {
	// contains filtered or unexported fields
}

Activities implements a REST handler that retrieves activities.

func NewActivities

func NewActivities(path string, refType spi.ReferenceType, cfg *Config, activityStore spi.Store,
	getObjectIRI getObjectIRIFunc, getID getIDFunc, verifier signatureVerifier) *Activities

NewActivities returns a new activities REST handler.

func NewInbox

func NewInbox(cfg *Config, activityStore spi.Store, verifier signatureVerifier) *Activities

NewInbox returns a new 'inbox' REST handler that retrieves a service's inbox.

func NewLiked

func NewLiked(cfg *Config, activityStore spi.Store, verifier signatureVerifier) *Activities

NewLiked returns a new 'liked' REST handler that retrieves a service's 'Like' activities, i.e. the Like activities that were posted by the given service.

func NewLikes

func NewLikes(cfg *Config, activityStore spi.Store, verifier signatureVerifier) *Activities

NewLikes returns a new 'likes' REST handler that retrieves an object's 'Like' activities.

func NewOutbox

func NewOutbox(cfg *Config, activityStore spi.Store, verifier signatureVerifier) *Activities

NewOutbox returns a new 'outbox' REST handler that retrieves a service's outbox.

func NewShares

func NewShares(cfg *Config, activityStore spi.Store, verifier signatureVerifier) *Activities

NewShares returns a new 'shares' REST handler that retrieves an object's 'Announce' activities.

func (Activities) Handler

func (h Activities) Handler() common.HTTPRequestHandler

Handler returns the handler that should be invoked when an HTTP GET is requested to the target endpoint. This handler must be registered with an HTTP server.

func (Activities) Method

func (h Activities) Method() string

Method returns the HTTP method, which is always GET.

func (Activities) Params

func (h Activities) Params() map[string]string

Params returns the accepted parameters.

func (Activities) Path

func (h Activities) Path() string

Path returns the base path of the target URL for this handler.

type Config

type Config struct {
	BasePath  string
	ObjectIRI *url.URL
	PageSize  int
}

Config contains configuration parameters for the handler.

type Outbox

type Outbox struct {
	*Config
	// contains filtered or unexported fields
}

Outbox implements a REST handler for posts to a service's outbox.

func NewPostOutbox

func NewPostOutbox(cfg *Config, ob outbox, verifier signatureVerifier) *Outbox

NewPostOutbox returns a new REST handler to post activities to the outbox.

func (*Outbox) Handler

func (h *Outbox) Handler() common.HTTPRequestHandler

Handler returns the handler that should be invoked when an HTTP POST is requested to the target endpoint. This handler must be registered with an HTTP server.

func (*Outbox) Method

func (h *Outbox) Method() string

Method returns the HTTP method, which is always POST.

func (*Outbox) Path

func (h *Outbox) Path() string

Path returns the base path of the target URL for this handler.

type Reference

type Reference struct {
	// contains filtered or unexported fields
}

Reference implements a REST handler that retrieves references as a collection of IRIs.

func NewFollowers

func NewFollowers(cfg *Config, activityStore spi.Store, verifier signatureVerifier) *Reference

NewFollowers returns a new 'followers' REST handler that retrieves a service's list of followers.

func NewFollowing

func NewFollowing(cfg *Config, activityStore spi.Store, verifier signatureVerifier) *Reference

NewFollowing returns a new 'following' REST handler that retrieves a service's list of following.

func NewReference

func NewReference(path string, refType spi.ReferenceType, sortOrder spi.SortOrder, ordered bool,
	cfg *Config, activityStore spi.Store, getObjectIRI getObjectIRIFunc, getID getIDFunc,
	verifier signatureVerifier) *Reference

NewReference returns a new reference REST handler.

func NewWitnesses

func NewWitnesses(cfg *Config, activityStore spi.Store, verifier signatureVerifier) *Reference

NewWitnesses returns a new 'witnesses' REST handler that retrieves a service's list of witnesses.

func NewWitnessing

func NewWitnessing(cfg *Config, activityStore spi.Store, verifier signatureVerifier) *Reference

NewWitnessing returns a new 'witnessing' REST handler that retrieves collection of the services that the local service is witnessing.

func (Reference) Handler

func (h Reference) Handler() common.HTTPRequestHandler

Handler returns the handler that should be invoked when an HTTP GET is requested to the target endpoint. This handler must be registered with an HTTP server.

func (Reference) Method

func (h Reference) Method() string

Method returns the HTTP method, which is always GET.

func (Reference) Params

func (h Reference) Params() map[string]string

Params returns the accepted parameters.

func (Reference) Path

func (h Reference) Path() string

Path returns the base path of the target URL for this handler.

type Services

type Services struct {
	// contains filtered or unexported fields
}

Services implements the 'services' REST handler to retrieve a given ActivityPub service (actor).

func NewPublicKeys

func NewPublicKeys(cfg *Config, activityStore spi.Store, publicKey *vocab.PublicKeyType) *Services

NewPublicKeys returns a new public keys REST handler.

func NewServices

func NewServices(cfg *Config, activityStore spi.Store, publicKey *vocab.PublicKeyType) *Services

NewServices returns a new 'services' REST handler.

func (Services) Handler

func (h Services) Handler() common.HTTPRequestHandler

Handler returns the handler that should be invoked when an HTTP GET is requested to the target endpoint. This handler must be registered with an HTTP server.

func (Services) Method

func (h Services) Method() string

Method returns the HTTP method, which is always GET.

func (Services) Params

func (h Services) Params() map[string]string

Params returns the accepted parameters.

func (Services) Path

func (h Services) Path() string

Path returns the base path of the target URL for this handler.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL