Documentation
¶
Overview ¶
Package api provides common api functionality
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Authorizer ¶
type Authorizer interface {
// AuthBasic handles basic authentication
AuthBasic(user string, pass string) (interface{}, error)
// AuthToken handles simple token or api key authentication
AuthToken(token string) (interface{}, error)
// AuthOauth handles Oauth 2.0 token authorization
AuthOauth(token string, scopes []string) (interface{}, error)
}
Authorizer is an api authorization interface
type Controller ¶
type Controller interface {
// DB returns the application database instance
DB() *sql.DB
// Options returns the application config kvdb
Options() jsondb.DB
// Authorizer returns the application api authorizer
Authorizer() Authorizer
}
Controller provided basic functions to an api
type Interface ¶ added in v2.0.34
type Interface interface {
// Handler returns the http handler for the api
Handler() http.Handler
// Name returns the api name
Name() string
}
Interface is the common api interface
type NewFunc ¶ added in v2.0.36
type NewFunc func(c Controller) (Interface, error)
NewFunc intializes the provider
Click to show internal directories.
Click to hide internal directories.