api

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2026 License: MIT Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var APIRouteSpecs = []RouteContractSpec{
	{
		Method: http.MethodGet,
		Path:   "/auth/api/v1/user",
		Errors: UserGetErrors,
	},
	{
		Method: http.MethodPost,
		Path:   "/auth/api/v1/sessions/refresh",
		Errors: RefreshPostErrors,
	},
	{
		Method: http.MethodPost,
		Path:   "/auth/api/v1/sessions/logout",
		Errors: LogoutPostErrors,
	},
}
View Source
var LogoutPostErrors = map[response.ErrorCode]response.ErrorSpec{}

Functions

This section is empty.

Types

type APIHandler

type APIHandler struct {
	Auth    *auth.Service
	Session *session.Service
	Limiter ratelimiter.AuthLimiter
	Logger  *slog.Logger
	Google  *google.Client

	AccessTTL  time.Duration
	RefreshTTL time.Duration
}

func NewAPIHandler

func NewAPIHandler(d authhandler.Deps) *APIHandler

func (*APIHandler) CSRFGet

func (h *APIHandler) CSRFGet(w http.ResponseWriter, r *http.Request)

func (*APIHandler) ChangeUsername

func (h *APIHandler) ChangeUsername(w http.ResponseWriter, r *http.Request)

func (*APIHandler) DeleteUser

func (h *APIHandler) DeleteUser(w http.ResponseWriter, r *http.Request)

func (*APIHandler) LoginPost

func (h *APIHandler) LoginPost(w http.ResponseWriter, r *http.Request)

func (*APIHandler) LogoutPost

func (h *APIHandler) LogoutPost(w http.ResponseWriter, r *http.Request)

func (*APIHandler) RefreshPost

func (h *APIHandler) RefreshPost(w http.ResponseWriter, r *http.Request)

func (*APIHandler) SignupPost

func (h *APIHandler) SignupPost(w http.ResponseWriter, r *http.Request)

func (*APIHandler) UserGet

func (h *APIHandler) UserGet(w http.ResponseWriter, r *http.Request)

type RouteContractSpec

type RouteContractSpec struct {
	Method string
	Path   string
	Errors map[response.ErrorCode]response.ErrorSpec
}

Jump to

Keyboard shortcuts

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