api

package
v0.0.0-...-3d294e8 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package api implements reflection based http.Handler generation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	Router        *httprouter.Router
	Documentation *apidoc.Documentation
	// contains filtered or unexported fields
}

func New

func New(info *apidoc.Info, authorize AuthorizationHandler) *API

func (*API) Add

func (api *API) Add(op *apidoc.Operation, fn interface{})

type AuthorizationHandler

type AuthorizationHandler func(w http.ResponseWriter, r *http.Request) (string, error)

type Params

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

func (*Params) Boolean

func (p *Params) Boolean(name string) (bool, bool)

func (*Params) Integer

func (p *Params) Integer(name string) (int, bool)

func (*Params) Number

func (p *Params) Number(name string) (float64, bool)

func (*Params) String

func (p *Params) String(name string) (string, bool)

type Request

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

func (*Request) PathParam

func (r *Request) PathParam() *Params

func (*Request) QueryParam

func (r *Request) QueryParam() *Params

func (*Request) Username

func (r *Request) Username() string

type RequestBuilder

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

RequestBuilder simplifies the creation of api Requests for testing.

func NewRequest

func NewRequest(username string) *RequestBuilder

func (*RequestBuilder) Build

func (b *RequestBuilder) Build() *Request

func (*RequestBuilder) PathInteger

func (b *RequestBuilder) PathInteger(name string, value int) *RequestBuilder

Jump to

Keyboard shortcuts

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