api

package
v0.14.0-rc4 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2020 License: MIT Imports: 52 Imported by: 2

Documentation

Index

Constants

View Source
const OfflineMessageScanInterval = 1 * time.Minute

Variables

This section is empty.

Functions

func ErrorResponse added in v0.2.0

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

func JSONErrorResponse added in v0.12.0

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

func RenderJSONOrStringError added in v0.12.0

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

func SanitizeJSON added in v0.5.1

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

func SanitizeProtobuf added in v0.5.6

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

func SanitizedResponse added in v0.5.1

func SanitizedResponse(w http.ResponseWriter, response string)

func SanitizedResponseM added in v0.5.1

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

Types

type APIError added in v0.14.0

type APIError struct {
	Success bool   `json:"success"`
	Reason  string `json:"reason"`
}

type Gateway added in v0.3.0

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

Gateway represents an HTTP API gateway

func NewGateway added in v0.3.0

func NewGateway(n *core.OpenBazaarNode, 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 added in v0.3.0

func (g *Gateway) Close() error

Close shutsdown the Gateway listener

func (*Gateway) Serve added in v0.3.0

func (g *Gateway) Serve() error

Serve begins listening on the configured address

type JSONAPIConfig added in v0.13.0

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 added in v0.6.0

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