openbazaar-go/api

Version: 0.12.4

Source: https://github.com/OpenBazaar/openbazaar-go/

import "github.com/OpenBazaar/openbazaar-go/api"

Overview

Index

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)

type Gateway

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

Gateway represents an HTTP API gateway

func NewGateway

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

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"`
}

Generated by godoc2md