api

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateSessionHandlerFunc added in v0.2.0

func CreateSessionHandlerFunc(sessionCache Cache) http.HandlerFunc

CreateSessionHandlerFunc returns HTTP HandlerFunc for handling POST requests to create sessions.

func DeleteAllSessionsHandlerFunc added in v0.2.0

func DeleteAllSessionsHandlerFunc(cache Cache) http.HandlerFunc

func GetByEmailSessionHandlerFunc added in v1.0.0

func GetByEmailSessionHandlerFunc(sessionCache Cache, getVarsFunc GetVarsFunc) http.HandlerFunc

GetByEmailSessionHandlerFunc returns a HTTP HandlerFunc that attempts to retrieve an existing session by Email from the cache

func GetByIDSessionHandlerFunc added in v0.2.0

func GetByIDSessionHandlerFunc(sessionCache Cache, getVarsFunc GetVarsFunc) http.HandlerFunc

GetByIDSessionHandlerFunc returns a HTTP HandlerFunc that attempts to retrieve an existing session by ID from the cache

Types

type API

type API struct {
	Router *mux.Router
}

API provides a struct to wrap the api around

func Setup

func Setup(ctx context.Context, r *mux.Router, permissions AuthHandler, cache Cache) *API

func (*API) Close

func (*API) Close(ctx context.Context) error

type AuthHandler added in v0.2.0

type AuthHandler interface {
	Require(required auth.Permissions, handler http.HandlerFunc) http.HandlerFunc
}

AuthHandler interface for adding auth to endpoints

type Cache added in v0.2.0

type Cache cache.SessionCache

type GetVarsFunc added in v0.2.0

type GetVarsFunc func(r *http.Request) map[string]string

GetVarsFunc is a helper function that returns a map of request variables and parameters

type SessionUpdater added in v0.2.0

type SessionUpdater interface {
	Update(email string) (*session.Session, error)
}

SessionUpdater interface for updating a session

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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