api

package
v0.0.0-...-d62bb73 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2016 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EmptyAccount = Account{}

EmptyAccount result

View Source
var EmptyAccounts = []Account{}

EmptyAccounts result

View Source
var EmptyTransaction = Transaction{}

EmptyTransaction result

View Source
var EmptyTransactions = []Transaction{}

EmptyTransactions result

View Source
var ErrAccountNotFound = errors.New("account not found")

ErrAccountNotFound is thrown when a acc with the given id was not found

Functions

This section is empty.

Types

type Account

type Account struct {
	ID            string `json:"id"`
	Name          string `json:"name"`
	Primary       bool   `json:"primary"`
	Currency      string `json:"currency"`
	Balance       Money  `json:"balance"`
	NativeBalance Money  `json:"native_balance"`
}

Account JSON

type Client

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

Client to coinbase api

func New

func New(key, secret string) (*Client, error)

New secure client

func (*Client) Accounts

func (c *Client) Accounts() ([]Account, error)

Accounts get all accs

func (*Client) Epoch

func (c *Client) Epoch() (string, error)

Epoch of the server

func (*Client) Get

func (c *Client) Get(path string) (*http.Response, error)

Get a path, signed

func (*Client) Post

func (c *Client) Post(path string, body interface{}) (*http.Response, error)

Post a path, signed

func (*Client) Send

func (c *Client) Send(
	from, to, amount, currency, description string,
) (Transaction, error)

Send money from an acc to a btc addr

func (*Client) Transactions

func (c *Client) Transactions(accountID string) ([]Transaction, error)

Transactions for a given account

func (*Client) Transfer

func (c *Client) Transfer(
	from, to, amount, currency, description string,
) (Transaction, error)

Transfer money from an acc to another

func (*Client) UnsignedGet

func (c *Client) UnsignedGet(path string) (*http.Response, error)

UnsignedGet a path, not signed

type Errors

type Errors struct {
	List []struct {
		ID      string `json:"id"`
		Message string `json:"message"`
	} `json:"errors"`
}

Errors to include in any JSON response object

type Money

type Money struct {
	Amount   string `json:"amount"`
	Currency string `json:"currency"`
}

Money json

type Request

type Request struct {
	Type        string `json:"type"`
	To          string `json:"to"`
	Amount      string `json:"amount"`
	Currency    string `json:"currency"`
	Description string `json:"description"`
	Idem        string `json:"idem"`
}

Request JSON

type Transaction

type Transaction struct {
	ID           string    `json:"id"`
	Type         string    `json:"type"`
	Status       string    `json:"status"`
	Description  string    `json:"description"`
	Amount       Money     `json:"amount"`
	NativeAmount Money     `json:"native_amount"`
	Created      time.Time `json:"created_at"`
	Updated      time.Time `json:"updated_at"`
	To           struct {
		Resource string `json:"resource"`
		Email    string `json:"email"`
		ID       string `json:"id"`
	} `json:"to"`
}

Transaction JSON

Jump to

Keyboard shortcuts

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