api

package
v0.37.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNegativeCount           = errors.New("the count must be a positive integer")
	ErrInternal                = errors.New("internal error")
	ErrInvalidCount            = errors.New("the count must be an integer giving the requested number of redirects")
	ErrInvalidOrNegativeCursor = errors.New("the redirects cursor was invalid. It must be a positive integer")
	ErrInvalidBase64Id         = errors.New("the base64 id provided is invalid")
	ErrNotFound                = errors.New("not found")
	ErrInvalidRequestBody      = errors.New("the request body provided is invalid")
	ErrIDFromMismatch          = errors.New("the 'from' field does not match the base64 id")
	ErrFromToNotRelative       = errors.New("'from' and 'to' must be relative paths starting with '/'")
	ErrCircularPaths           = errors.New("'from' and 'to' cannot be the same")
)

A list of error messages for Redirect API

Functions

This section is empty.

Types

type RedirectAPI added in v0.3.0

type RedirectAPI struct {
	Router        *mux.Router
	RedirectStore *store.Datastore
	// contains filtered or unexported fields
}

RedirectAPI provides a struct to wrap the api around

func Setup

func Setup(ctx context.Context, r *mux.Router, dataStore *store.Datastore, auth authorisation.Middleware, cfg *config.Config) *RedirectAPI

Setup function sets up the api and returns an api

func (*RedirectAPI) DeleteRedirect added in v0.3.3

func (api *RedirectAPI) DeleteRedirect(w http.ResponseWriter, r *http.Request)

DeleteRedirect handles the deletion of a redirect

func (*RedirectAPI) UpsertRedirect added in v0.3.2

func (api *RedirectAPI) UpsertRedirect(w http.ResponseWriter, r *http.Request)

UpsertRedirect handles the creation or update of redirects

Jump to

Keyboard shortcuts

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