api

package
v0.0.0-...-c57a2f4 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2019 License: AGPL-3.0 Imports: 48 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorResponse

func ErrorResponse(w http.ResponseWriter, errorCode int, reason string)

func JSONErrorResponse

func JSONErrorResponse(w http.ResponseWriter, errorCode int, err error)

func RenderJSONOrStringError

func RenderJSONOrStringError(w http.ResponseWriter, errorCode int, err error)

func SanitizeJSON

func SanitizeJSON(s []byte) ([]byte, error)

func SanitizeProtobuf

func SanitizeProtobuf(jsonEncodedProtobuf string, m proto.Message) ([]byte, error)

func SanitizedResponse

func SanitizedResponse(w http.ResponseWriter, response string)

func SanitizedResponseM

func SanitizedResponseM(w http.ResponseWriter, response string, m proto.Message)

Types

type Gateway

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

Gateway represents an HTTP API gateway

func NewGateway

func NewGateway(n *core.EvenNode, authCookie http.Cookie, l net.Listener, config schema.APIConfig, logger logging.Backend, options ...corehttp.ServeOption) (*Gateway, error)

NewGateway instantiates a new `Gateway`

func (*Gateway) Close

func (g *Gateway) Close() error

Close shutsdown the Gateway listener

func (*Gateway) Serve

func (g *Gateway) Serve() error

Serve begins listening on the configured address

type JSONAPIConfig

type JSONAPIConfig struct {
	Headers       map[string]interface{}
	Enabled       bool
	Cors          *string
	Authenticated bool
	AllowedIPs    map[string]bool
	Cookie        http.Cookie
	Username      string
	Password      string
}

type TransactionQuery

type TransactionQuery struct {
	OrderStates     []int    `json:"states"`
	SearchTerm      string   `json:"search"`
	SortByAscending bool     `json:"sortByAscending"`
	SortByRead      bool     `json:"sortByRead"`
	Limit           int      `json:"limit"`
	Exclude         []string `json:"exclude"`
}

Jump to

Keyboard shortcuts

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