handler

package
v2.2.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAccountDetailsHandler added in v1.2.0

func GetAccountDetailsHandler(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

GetAccountDetailsHandler uses BaseAPI for get conversion details by it id. Query parameters ID is required.

func GetAccountsHandler added in v1.2.0

func GetAccountsHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

GetAccountsHandler uses BaseAPI for search and list accounts. Query parameters: Query, Limit, Offset can be optional. Query - MongoDB query string. Limit - maximum 500 items. Offset - default 0.

func GetPayloadDetailsHandler

func GetPayloadDetailsHandler(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

GetPayloadDetailsHandler uses BaseAPI for get payload details by it id. Query parameters ID is required.

func GetPayloadsHandler

func GetPayloadsHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

GetPayloadsHandler uses BaseAPI for search and list transaction data. Query parameters: Query, Limit, Offset can be optional. Query - MongoDB query string. Limit - maximum 500 items. Offset - default 0.

func PostAccountsHandler

func PostAccountsHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

PostAccountsHandler uses FastAPI for sends new accounts requests in async mode to blockchain

func PostPayloadsHandler

func PostPayloadsHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

PostPayloadsHandler uses FastAPI for sends new transaction data requests in async mode to blockchain.

func SetEndpoint

func SetEndpoint(addr string)

SetEndpoint method defines validator GRPC address.

Types

type Account

type Account struct {
	ID   string `json:"_id"`
	Priv string `json:"private_key"`
	Pub  string `json:"public_key"`
}

Account struct describes account related fields

ID - unique identifier of account in blockchain Priv - private key of account Pub - public key of account

type Payload

type Payload struct {
	ID              string         `json:"_id,omitempty" mapstructure:"_id"`
	SenderAccountID string         `json:"sender_account_id,omitempty" mapstructure:"sender_account_id"`
	PublicData      interface{}    `json:"public_data,omitempty" mapstructure:"public_data"`
	PrivateData     []*PrivateData `json:"private_data,omitempty" mapstructure:"private_data"`
	CreatedAt       float64        `json:"created_at,omitempty" mapstructure:"created_at"`
}

Payload struct keeps transaction data related fields.

  • PublicData keeps open data of any structure;
  • PrivateData keeps encrypted by affiliate's public key with ECDH algorithm data and represented as base64 string;
  • CreatedAt is date of object creation in UNIX time (milliseconds).

type PrivateData

type PrivateData struct {
	ReceiverAccountID string      `json:"receiver_account_id" mapstructure:"receiver_account_id"`
	Data              interface{} `json:"data" mapstructure:"data"`
}

PrivateData keeps information about receiver and data, encrypted by receiver's public key

type Request

type Request struct {
	AccountID string      `json:"account_id,omitempty"`
	PrivKey   string      `json:"private_key,omitempty"`
	PubKey    string      `json:"public_key,omitempty"`
	Data      interface{} `json:"data"`
}

Request struct represents request related fields.

AccountID - unique identifier of request-maker in blockchain PrivKey - private key of account PubKey - public key of account Data - arbitrary passed data (maybe any supported in system)

type Result

type Result struct {
	Code int         `json:"code"`
	Msg  string      `json:"msg"`
	Data interface{} `json:"data"`
}

Result struct represents response from Anychaindb API.

Jump to

Keyboard shortcuts

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