api

package
v0.0.0-...-304b888 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2017 License: BSD-3-Clause Imports: 7 Imported by: 2

Documentation

Index

Constants

View Source
const (
	GET    = "GET"
	PUT    = "PUT"
	POST   = "POST"
	DELETE = "DELETE"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

func NewAPI

func NewAPI() *API

func (*API) AddResource

func (api *API) AddResource(resource Resource, path string)

func (*API) Start

func (api *API) Start(port int, debug bool)

type DeleteNotAllowed

type DeleteNotAllowed struct{}

func (DeleteNotAllowed) Delete

func (DeleteNotAllowed) Delete(ctx context.Context, vals url.Values) (HdrReply, chan Reply)

type GetNotAllowed

type GetNotAllowed struct{}

func (GetNotAllowed) Get

func (GetNotAllowed) Get(ctx context.Context, vals url.Values) (HdrReply, chan Reply)

type HdrReply

type HdrReply struct {
	Code  int
	Extra string
}

we now need to wrap the integer HTTP Reply code in this struct to be able to support the correct ID for the continuous pulling scheme

type PostNotAllowed

type PostNotAllowed struct{}

func (PostNotAllowed) Post

func (PostNotAllowed) Post(ctx context.Context, vals url.Values) (HdrReply, chan Reply)

type PutNotAllowed

type PutNotAllowed struct{}

func (PutNotAllowed) Put

func (PutNotAllowed) Put(ctx context.Context, vals url.Values) (HdrReply, chan Reply)

type Reply

type Reply struct {
	Data []byte
	Err  error
}

type Resource

type Resource interface {
	Get(context.Context, url.Values) (HdrReply, chan Reply)
	Put(context.Context, url.Values) (HdrReply, chan Reply)
	Post(context.Context, url.Values) (HdrReply, chan Reply)
	Delete(context.Context, url.Values) (HdrReply, chan Reply)
}

Jump to

Keyboard shortcuts

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