api

package
v2.0.34 Latest Latest
Warning

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

Go to latest
Published: May 26, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package api provides common api functionality

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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

Jump to

Keyboard shortcuts

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