coinbase

package module
v0.0.0-...-d125873 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2018 License: BSD-3-Clause Imports: 12 Imported by: 0

README

GoDoc

go-coinbase

Go (golang) Client for the Coinbase API https://developers.coinbase.com/api/v2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIKeyClient

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

func NewAPIKeyClient

func NewAPIKeyClient(secret, key string) *APIKeyClient

func (APIKeyClient) Account

func (c APIKeyClient) Account(ID string) (Account, error)

func (APIKeyClient) Accounts

func (c APIKeyClient) Accounts(p ...PaginationParams) *AccountIterator

func (APIKeyClient) Request

func (c APIKeyClient) Request(
	method string,
	url string,
	params interface{},
	result interface{},
) (res *http.Response, err error)

func (APIKeyClient) User

func (c APIKeyClient) User() (*User, error)

type Account

type Account struct {
	Balance struct {
		Amount   string `json:"amount"`
		Currency string `json:"currency"`
	} `json:"balance"`
	CreatedAt time.Time `json:"created_at"`
	Currency  struct {
		AddressRegex string `json:"address_regex"`
		Code         string `json:"code"`
		Color        string `json:"color"`
		Exponent     int    `json:"exponent"`
		Name         string `json:"name"`
		Type         string `json:"type"`
	} `json:"currency"`
	ID           string    `json:"id"`
	Name         string    `json:"name"`
	Primary      bool      `json:"primary"`
	Resource     string    `json:"resource"`
	ResourcePath string    `json:"resource_path"`
	Type         string    `json:"type"`
	UpdatedAt    time.Time `json:"updated_at"`
	// contains filtered or unexported fields
}

func (Account) Buy

func (a Account) Buy(buyID string) (Buy, error)

func (Account) Buys

func (a Account) Buys(p ...PaginationParams) *BuyIterator

func (Account) Transaction

func (a Account) Transaction(transactionID string) (Transaction, error)

func (Account) Transactions

func (a Account) Transactions(p ...PaginationParams) *TransactionIterator

type AccountIterator

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

func (*AccountIterator) Next

func (it *AccountIterator) Next() (Account, error)

func (*AccountIterator) PageInfo

func (it *AccountIterator) PageInfo() *iterator.PageInfo

type Buy

type Buy struct {
	ID            string `json:"id"`
	Status        string `json:"status"`
	PaymentMethod struct {
		ID           string `json:"id"`
		Resource     string `json:"resource"`
		ResourcePath string `json:"resource_path"`
	} `json:"payment_method"`
	Transaction struct {
		ID           string `json:"id"`
		Resource     string `json:"resource"`
		ResourcePath string `json:"resource_path"`
	} `json:"transaction"`
	Amount struct {
		Amount   string `json:"amount"`
		Currency string `json:"currency"`
	} `json:"amount"`
	Total struct {
		Amount   string `json:"amount"`
		Currency string `json:"currency"`
	} `json:"total"`
	Subtotal struct {
		Amount   string `json:"amount"`
		Currency string `json:"currency"`
	} `json:"subtotal"`
	CreatedAt    string `json:"created_at"`
	UpdatedAt    string `json:"updated_at"`
	Resource     string `json:"resource"`
	ResourcePath string `json:"resource_path"`
	Committed    bool   `json:"committed"`
	Instant      bool   `json:"instant"`
	Fee          struct {
		Amount   string `json:"amount"`
		Currency string `json:"currency"`
	} `json:"fee"`
	PayoutAt string `json:"payout_at"`
}

type BuyIterator

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

func (*BuyIterator) Next

func (it *BuyIterator) Next() (Buy, error)

func (*BuyIterator) PageInfo

func (it *BuyIterator) PageInfo() *iterator.PageInfo

type Error

type Error struct {
	Message string `json:"message"`
}

func (Error) Error

func (e Error) Error() string

type OAuthClient

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

func NewOAuthClient

func NewOAuthClient(clientID, clientSecret, redirectURL string) *OAuthClient

func (OAuthClient) Account

func (c OAuthClient) Account(ID string) (Account, error)

func (OAuthClient) Accounts

func (c OAuthClient) Accounts(p ...PaginationParams) *AccountIterator

func (*OAuthClient) CreateAuthorizeUrl

func (o *OAuthClient) CreateAuthorizeUrl(scope []string, state string) string

func (*OAuthClient) RefreshTokens

func (o *OAuthClient) RefreshTokens(refreshToken string) (*OAuthToken, error)

func (OAuthClient) Request

func (c OAuthClient) Request(
	method string,
	url string,
	params interface{},
	result interface{},
) (res *http.Response, err error)

func (*OAuthClient) SetToken

func (o *OAuthClient) SetToken(token string)

func (*OAuthClient) Tokens

func (o *OAuthClient) Tokens(code string) (*OAuthToken, error)

func (OAuthClient) User

func (c OAuthClient) User() (*User, error)

type OAuthToken

type OAuthToken struct {
	AccessToken  string `json:"access_token"`
	TokenType    string `json:"token_type"`
	ExpiresIn    int    `json:"expires_in"`
	RefreshToken string `json:"refresh_token"`
	Scope        string `json:"scope"`
}

type PaginationParams

type PaginationParams struct {
	Limit int
	Order SortOrder
}

type SortOrder

type SortOrder int
const (
	OrderNone SortOrder = iota
	OrderAscending
	OrderDescending
)

type Transaction

type Transaction struct {
	ID     string `json:"id"`
	Type   string `json:"type"`
	Status string `json:"status"`
	Amount struct {
		Amount   string `json:"amount"`
		Currency string `json:"currency"`
	} `json:"amount"`
	NativeAmount struct {
		Amount   string `json:"amount"`
		Currency string `json:"currency"`
	} `json:"native_amount"`
	Description  string `json:"description"`
	CreatedAt    string `json:"created_at"`
	UpdatedAt    string `json:"updated_at"`
	Resource     string `json:"resource"`
	ResourcePath string `json:"resource_path"`
	Buy          struct {
		ID           string `json:"id"`
		Resource     string `json:"resource"`
		ResourcePath string `json:"resource_path"`
	} `json:"buy,omitempty"`
	Details struct {
		Title    string `json:"title"`
		Subtitle string `json:"subtitle"`
	} `json:"details"`
	To struct {
		Resource string `json:"resource"`
		Email    string `json:"email"`
	} `json:"to,omitempty"`
	InstantExchange bool `json:"instant_exchange,omitempty"`
	Sell            struct {
		ID           string `json:"id"`
		Resource     string `json:"resource"`
		ResourcePath string `json:"resource_path"`
	} `json:"sell,omitempty"`
	Network struct {
		Status string `json:"status"`
		Name   string `json:"name"`
	} `json:"network,omitempty"`
}

type TransactionIterator

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

func (*TransactionIterator) Next

func (it *TransactionIterator) Next() (Transaction, error)

func (*TransactionIterator) PageInfo

func (it *TransactionIterator) PageInfo() *iterator.PageInfo

type User

type User struct {
	AvatarURL   string `json:"avatar_url"`
	BitcoinUnit string `json:"bitcoin_unit"`
	Country     struct {
		Code string `json:"code"`
		Name string `json:"name"`
	} `json:"country"`
	CreatedAt       time.Time `json:"created_at"`
	Email           string    `json:"email"`
	ID              string    `json:"id"`
	Name            string    `json:"name"`
	NativeCurrency  string    `json:"native_currency"`
	ProfileBio      string    `json:"profile_bio"`
	ProfileLocation string    `json:"profile_location"`
	ProfileURL      string    `json:"profile_url"`
	Resource        string    `json:"resource"`
	ResourcePath    string    `json:"resource_path"`
	State           string    `json:"state"`
	Tiers           struct {
		Body                 string `json:"body"`
		CompletedDescription string `json:"completed_description"`
		Header               string `json:"header"`
		UpgradeButtonText    string `json:"upgrade_button_text"`
	} `json:"tiers"`
	TimeZone string `json:"time_zone"`
	Username string `json:"username"`
}

Jump to

Keyboard shortcuts

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