api

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2018 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HandlerError int = -1
	BadRequest   int = -2
)
View Source
const (
	REFERENCE = "reference"
	SEED      = "seed"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Params

type Params struct {
	QType     string `json:"query_type"`
	Name      string `json:"name"`
	Reference string `json:"reference"`
	From      string `json:"from"`
	To        string `json:"to"`
	Method    string `json:"method"`
	Requester string `json:"requester"`
	Target    string `json:"target"`
	QID       string `json:"qid"`
	Amount    uint   `json:"amount"`
	PublicKey string `json:"public_key"`
	Role      string `json:"role"`
}

Params contains supported query params

func PreprocessRequest added in v0.6.0

func PreprocessRequest(req *http.Request) (*Params, error)

PreprocessRequest extracts params from requests

type QueryType

type QueryType int

QueryType represents type of query

const (
	UNDEFINED QueryType = iota
	CreateMember
	DumpUserInfo
	GetBalance
	SendMoney
	DumpAllUsers
	RegisterNode
	IsAuth
	GetSeed
)

Supported query types

func QTypeFromString

func QTypeFromString(strQType string) QueryType

QTypeFromString converts string representation to enum

type RequestHandler

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

RequestHandler encapsulate processing of request

func NewRequestHandler

func NewRequestHandler(params *Params, messageBus core.MessageBus, nc core.NetworkCoordinator, rootDomainReference core.RecordRef, smanager *seedmanager.SeedManager) *RequestHandler

NewRequestHandler creates new query handler

func (*RequestHandler) ProcessCreateMember

func (rh *RequestHandler) ProcessCreateMember() (map[string]interface{}, error)

ProcessCreateMember processes CreateMember query type

func (*RequestHandler) ProcessDumpUsers

func (rh *RequestHandler) ProcessDumpUsers(all bool) (map[string]interface{}, error)

ProcessDumpUsers processes Dump users query type

func (*RequestHandler) ProcessGetBalance

func (rh *RequestHandler) ProcessGetBalance() (map[string]interface{}, error)

ProcessGetBalance processes get_balance query type

func (*RequestHandler) ProcessGetSeed added in v0.5.0

func (rh *RequestHandler) ProcessGetSeed() (map[string]interface{}, error)

ProcessGetSeed processes get seed request

func (*RequestHandler) ProcessIsAuthorized added in v0.4.0

func (rh *RequestHandler) ProcessIsAuthorized() (map[string]interface{}, error)

ProcessIsAuthorized processes is_auth query type

func (*RequestHandler) ProcessRegisterNode added in v0.3.0

func (rh *RequestHandler) ProcessRegisterNode() (map[string]interface{}, error)

func (*RequestHandler) ProcessSendMoney

func (rh *RequestHandler) ProcessSendMoney() (map[string]interface{}, error)

ProcessSendMoney processes send_money query type

type Runner

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

Runner implements Component for API

func NewRunner

func NewRunner(cfg *configuration.APIRunner) (*Runner, error)

NewRunner is C-tor for API Runner

func (*Runner) Start

func (ar *Runner) Start(c core.Components) error

Start runs api server

func (*Runner) Stop

func (ar *Runner) Stop() error

Stop stops api server

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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