handler

package
v0.0.0-...-7b7c10a Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2022 License: Apache-2.0 Imports: 1 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth int

Auth handler auth type.

const (
	// AuthNone no auth.
	AuthNone Auth = iota
	// AuthHTTPSig http sig auth.
	AuthHTTPSig
	// AuthToken static token.
	AuthToken
)

type HTTPHandler

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

HTTPHandler contains REST API handling details which can be used to build routers for http requests for given path.

func NewHTTPHandler

func NewHTTPHandler(path, method string, handle http.HandlerFunc, opts ...HTTPHandlerOpts) *HTTPHandler

NewHTTPHandler returns instance of HTTPHandler which can be used to handle http requests.

func (*HTTPHandler) Auth

func (h *HTTPHandler) Auth() Auth

Auth returns http request auth type.

func (*HTTPHandler) Handle

func (h *HTTPHandler) Handle() http.HandlerFunc

Handle returns http request handle func.

func (*HTTPHandler) Method

func (h *HTTPHandler) Method() string

Method returns http request method type.

func (*HTTPHandler) Path

func (h *HTTPHandler) Path() string

Path returns http request path.

type HTTPHandlerOpts

type HTTPHandlerOpts func(opts *httpHandlerOpts)

HTTPHandlerOpts are the http handler additional options.

func WithAuth

func WithAuth(auth Auth) HTTPHandlerOpts

WithAuth option enable auth for http handler.

type Handler

type Handler interface {
	Path() string
	Method() string
	Handle() http.HandlerFunc
	Auth() Auth
}

Handler http handler for each controller API endpoint.

Jump to

Keyboard shortcuts

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