paths

package
v0.0.0-...-e28afbe Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2021 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserPathKey           PathKey = "users"
	InboxPathKey                  = "inbox"
	InboxFirstPathKey             = "inboxFirst"
	InboxLastPathKey              = "inboxLast"
	OutboxPathKey                 = "outbox"
	OutboxFirstPathKey            = "outboxFirst"
	OutboxLastPathKey             = "outboxLast"
	FollowersPathKey              = "followers"
	FollowersFirstPathKey         = "followersFirst"
	FollowersLastPathKey          = "followersLast"
	FollowingPathKey              = "following"
	FollowingFirstPathKey         = "followingFirst"
	FollowingLastPathKey          = "followingLast"
	LikedPathKey                  = "liked"
	LikedFirstPathKey             = "likedFirst"
	LikedLastPathKey              = "likedLast"
	HttpSigPubKeyKey              = "httpsigPubKey"
)

Variables

View Source
var AllActors []Actor = []Actor{InstanceActor}

Functions

func ActorIRIFor

func ActorIRIFor(scheme, host string, k PathKey, c Actor) *url.URL

func ActorPathFor

func ActorPathFor(k PathKey, c Actor) string

func AddPageParams

func AddPageParams(base *url.URL, offset, n int) *url.URL

AddPageParams overwrites the query string of a base URL and returns a copy with the pagination parameters set.

func GetNumOrDefault

func GetNumOrDefault(u *url.URL, def, max int) int

GetNumOrDefault returns the number requested in the IRI, or default if no value or an invalid value is specified. If the requested amount is greater than the max, the maximum is returned instead.

func GetOffsetOrDefault

func GetOffsetOrDefault(u *url.URL, def int) int

GetOffsetOrDefault returns the offset requested in the IRI, or default if no value or an invalid value is specified.

func IRIForActorID

func IRIForActorID(k PathKey, actorID *url.URL) (*url.URL, error)

func IsFollowersPath

func IsFollowersPath(id *url.URL) bool

func IsFollowingPath

func IsFollowingPath(id *url.URL) bool

func IsGetCollectionEnd

func IsGetCollectionEnd(u *url.URL) bool

IsGetCollectionEnd returns true when the IRI requests the last page for an OrderedCollection-style of IRI.

func IsGetCollectionPage

func IsGetCollectionPage(u *url.URL) bool

IsGetCollectionPage returns true when the IRI requests pagination for an OrderedCollection-style of IRI.

func IsInstanceActorPath

func IsInstanceActorPath(id *url.URL) bool

func IsLikedPath

func IsLikedPath(id *url.URL) bool

func IsUserPath

func IsUserPath(id *url.URL) bool

func Normalize

func Normalize(i *url.URL) *url.URL

func NormalizeAsIRI

func NormalizeAsIRI(s string) (*url.URL, error)

func Route

func Route(k PathKey) string

func UUIDIRIFor

func UUIDIRIFor(scheme string, host string, k PathKey, uuid UUID) *url.URL

func UUIDPathFor

func UUIDPathFor(k PathKey, uuid UUID) string

func UserIRIFor

func UserIRIFor(scheme, host string, k PathKey, c Actor) *url.URL

func UserPathFor

func UserPathFor(k PathKey, c Actor) string

Types

type Actor

type Actor string
const (
	InstanceActor Actor = "instance"
)

type PathKey

type PathKey string

type UUID

type UUID string

func UUIDFromUserPath

func UUIDFromUserPath(path string) (UUID, error)

Jump to

Keyboard shortcuts

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