model

package
v0.0.0-...-90c59a5 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2018 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FirstError

func FirstError(err error, apiError *APIError) error

FirstError returns the first error among err and apiError which is non-nil (or non-Empty in the case of apiError) or nil if neither represent errors.

A common use case is an API which prefers to return any a network error, if any, and return an API error in the absence of network errors.

Types

type APIError

type APIError struct {
	Errors []ErrorDetail `json:"errors"`
}

APIError represents a Digits API Error response

func (APIError) Empty

func (e APIError) Empty() bool

Empty returns true if the Errors slice is empty, false otherwise.

func (*APIError) Error

func (e *APIError) Error() string

type AssetPair

type AssetPair struct {
	AmountAsset string `json:"amountAsset"`
	PriceAsset  string `json:"priceAsset"`
}

type Assets

type Assets struct {
	Address  string     `json:"address"`
	Balances []Balances `json:"balances"`
}

Assets is asset response body

type Balances

type Balances struct {
	Address string `json:"address,omitempty"`
	AssetID string `json:"assetId"`
	Issued  bool   `json:"issued,omitempty"`
	Balance int    `json:"balance,omitempty"`
}

Balances represent balances

type Blocks

type Blocks struct {
	Version          int            `json:"version"`
	Timestamp        int64          `json:"timestamp"`
	Reference        string         `json:"reference"`
	NxtCconsensus    NxtCconsensus  `json:"nxt-consensus"`
	Features         []int          `json:"features"`
	Generator        string         `json:"generator"`
	Signature        string         `json:"signature"`
	Blocksize        int            `json:"blocksize"`
	TransactionCount int            `json:"transactionCount"`
	Fee              int64          `json:"fee"`
	Transactions     []Transactions `json:"transactions"`
	Height           int64          `json:"height"`
}

Transactions is transaction response body

type ErrorDetail

type ErrorDetail struct {
	Message string `json:"message"`
	Code    int    `json:"code"`
}

ErrorDetail represents an individual error in an APIError.

type NxtCconsensus

type NxtCconsensus struct {
	BaseTarget          int64  `json:"base-target"`
	GenerationSignature string `json:"generation-signature"`
}

type Order

type Order struct {
	Type             int       `json:"type"`
	ID               string    `json:"id"`
	SenderPublicKey  string    `json:"senderPublicKey"`
	MatcherPublicKey string    `json:"matcherPublicKey,omitempty"`
	AssetPair        AssetPair `json:"assetPair,omitempty"`

	OrderType  string `json:"orderType,omitempty"`
	Price      int    `json:"price,omitempty"`
	Expiration int    `json:"expiration,omitempty"`
	MatcherFee int    `json:"matcherFee,omitempty"`
	Signature  string `json:"signature"`

	Amount    int64 `json:"amount"`
	Timestamp int64 `json:"timestamp"`
}

type Transactions

type Transactions struct {
	Type            int    `json:"type"`
	ID              string `json:"id"`
	Sender          string `json:"sender"`
	SenderPublicKey string `json:"senderPublicKey"`
	Recipient       string `json:"recipient"`
	AssetID         string `json:"assetId"`
	Amount          int64  `json:"amount"`
	FeeAsset        string `json:"feeAsset"`
	Fee             int64  `json:"fee"`
	Timestamp       int64  `json:"timestamp"`
	Attachment      string `json:"attachment"`
	Signature       string `json:"signature"`
	Height          int64  `json:"height"`

	// Blocks
	OrderType  AssetPair `json:"orderType,omitempty"`
	Price      int       `json:"price,omitempty"`
	Expiration int       `json:"expiration,omitempty"`
	MatcherFee int       `json:"matcherFee,omitempty"`

	Order1 Order `json:"order1,omitempty"`
	Order2 Order `json:"order2,omitempty"`

	BuyMatcherFee  int64 `json:"buyMatcherFee,omitempty"`
	SellMatcherFee int64 `json:"sellMatcherFee,omitempty"`
}

Transactions is transaction response body

Jump to

Keyboard shortcuts

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