Documentation
¶
Overview ¶
Coinbase-go is a convenient Go wrapper for the Coinbase API
Index ¶
- type AddressParams
- type AddressesParams
- type Button
- type Client
- func (c Client) Buy(amount float64, agreeBtcAmountVaries bool) (*transfer, error)
- func (c Client) CancelRequest(id string) (bool, error)
- func (c Client) CompleteRequest(id string) (*transactionConfirmation, error)
- func (c Client) CreateButton(params *Button) (*Button, error)
- func (c Client) CreateOrderFromButtonCode(buttonCode string) (*order, error)
- func (c Client) CreateUser(email string, password string) (*user, error)
- func (c Client) Delete(path string, params interface{}, holder interface{}) error
- func (c Client) GenerateReceiveAddress(params *AddressParams) (string, error)
- func (c Client) Get(path string, params interface{}, holder interface{}) error
- func (c Client) GetAllAddresses(params *AddressesParams) (*addresses, error)
- func (c Client) GetBalance() (float64, error)
- func (c Client) GetBuyPrice(qty int) (*pricesHolder, error)
- func (c Client) GetContacts(params *ContactsParams) (*contactsHolder, error)
- func (c Client) GetCurrencies() ([]currency, error)
- func (c Client) GetExchangeRate(from string, to string) (float64, error)
- func (c Client) GetExchangeRates() (map[string]string, error)
- func (c Client) GetOrder(id string) (*order, error)
- func (c Client) GetOrders(page int) (*orders, error)
- func (c Client) GetReceiveAddress() (string, error)
- func (c Client) GetSellPrice(qty int) (*pricesHolder, error)
- func (c Client) GetTransaction(id string) (*transaction, error)
- func (c Client) GetTransactions(page int) (*transactions, error)
- func (c Client) GetTransfers(page int) (*transfers, error)
- func (c Client) GetUser() (*user, error)
- func (c Client) Post(path string, params interface{}, holder interface{}) error
- func (c Client) Put(path string, params interface{}, holder interface{}) error
- func (c Client) RequestMoney(params *TransactionParams) (*transactionConfirmation, error)
- func (c Client) ResendRequest(id string) (bool, error)
- func (c Client) Sell(amount float64) (*transfer, error)
- func (c Client) SendMoney(params *TransactionParams) (*transactionConfirmation, error)
- type ContactsParams
- type OAuth
- func (o OAuth) CreateAuthorizeUrl(scope []string) string
- func (o OAuth) GetTokens(code string, grantType string) (*oauthTokens, error)
- func (o OAuth) NewTokens(code string) (*oauthTokens, error)
- func (o OAuth) NewTokensFromRequest(req *http.Request) (*oauthTokens, error)
- func (o OAuth) RefreshTokens(oldTokens map[string]interface{}) (*oauthTokens, error)
- type TransactionParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddressParams ¶
type AddressParams struct {
Label string `json:"label,omitempty"`
CallbackUrl string `json:"callback_url,omitempty"`
}
Parameter Struct for POST /api/v1/account/generate_receive_address Requests
type AddressesParams ¶
type AddressesParams struct {
Page int64 `json:"page,omitempty"`
Limit int64 `json:"limit,omitempty"`
AccountId string `json:"account_id,omitempty"`
Query string `json:"query,omitempty"`
}
Parameter Struct for GET /api/v1/addresses Requests
type Button ¶
type Button struct {
Name string `json:"name,omitempty"`
PriceString string `json:"price_string,omitempty"`
PriceCurrencyIso string `json:"price_currency_iso,omitempty"`
Type string `json:"type,omitempty"`
Subscription bool `json:"subscription,omitempty"`
Repeat string `json:"repeat,omitempty"`
Style string `json:"style,omitempty"`
Text string `json:"text,omitempty"`
Description string `json:"description,omitempty"`
Custom string `json:"custom,omitempty"`
CustomSecure bool `json:"custom_secure,omitempty"`
CallbackUrl string `json:"callback_url,omitempty"`
SuccessUrl string `json:"success_url,omitempty"`
CancelUrl string `json:"cancel_url,omitempty"`
InfoUrl string `json:"info_url,omitempty"`
AutoRedirect bool `json:"auto_redirect,omitempty"`
AutoRedirectSuccess bool `json:"auto_redirect_success,omitempty"`
AutoRedirectCancel bool `json:"auto_redirect_cancel,omitempty"`
VariablePrice bool `json:"variable_price,omitempty"`
ChoosePrice bool `json:"choose_price,omitempty"`
IncludeAddress bool `json:"include_address,omitempty"`
IncludeEmail bool `json:"include_email,omitempty"`
Price1 string `json:"price1,omitempty"`
Price2 string `json:"price2,omitempty"`
Price3 string `json:"price3,omitempty"`
Price4 string `json:"price4,omitempty"`
Price5 string `json:"price5,omitempty"`
Code string `json:"code,omitempty"`
Price fee `json:"price,omitempty"`
Id string `json:"id,omitempty"`
EmbedHtml string `json:"embed_html"` //Added embed_html for convenience
}
The return response from CreateButton
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the struct from which all API requests are made
func ApiKeyClient ¶
ApiKeyClient instantiates the client with ApiKey Authentication
func OAuthClient ¶
func OAuthClient(tokens *oauthTokens) Client
OAuthClient instantiates the client with OAuth Authentication
func (Client) Buy ¶
Buy an amount of BTC and bypass rate limits by setting agreeBtcAmountVaries to true
func (Client) CancelRequest ¶
CancelRequest cancels a transaction request referenced by id
func (Client) CompleteRequest ¶
CompleteRequest completes a money request referenced by id
func (Client) CreateButton ¶
CreateButton gets a new payment button including EmbedHtml as a field on button struct
func (Client) CreateOrderFromButtonCode ¶
CreateOrderFromButtonCode creates an order for a given button code
func (Client) CreateUser ¶
CreateUser creates a new user given an email and password
func (Client) GenerateReceiveAddress ¶
func (c Client) GenerateReceiveAddress(params *AddressParams) (string, error)
GenerateReceiveAddress generates and returns a new bitcoin receive address
func (Client) GetAllAddresses ¶
func (c Client) GetAllAddresses(params *AddressesParams) (*addresses, error)
GetAllAddresses returns bitcoin addresses associated with client account
func (Client) GetBalance ¶
GetBalance returns current balance in BTC
func (Client) GetBuyPrice ¶
GetBuyPrice gets the current BTC buy price
func (Client) GetContacts ¶
func (c Client) GetContacts(params *ContactsParams) (*contactsHolder, error)
GetContacts gets a users contacts
func (Client) GetCurrencies ¶
GetCurrencies gets all currency names and ISO's
func (Client) GetExchangeRate ¶
GetExchangeRate gets the exchange rate between two specified currencies
func (Client) GetExchangeRates ¶
GetExchangeRates gets the current exchange rates
func (Client) GetReceiveAddress ¶
GetReceiveAddress returns clients current bitcoin receive address
func (Client) GetSellPrice ¶
GetSellPrice gets the current BTC sell price
func (Client) GetTransaction ¶
GetTransaction gets a particular transaction referenced by id
func (Client) GetTransactions ¶
GetTransactions gets transactions associated with an account
func (Client) GetTransfers ¶
GetTransfers get transfers associated with an account
func (Client) RequestMoney ¶
func (c Client) RequestMoney(params *TransactionParams) (*transactionConfirmation, error)
RequestMoney from either a bitcoin or email address
func (Client) ResendRequest ¶
ResendRequest resends a transaction request referenced by id
func (Client) SendMoney ¶
func (c Client) SendMoney(params *TransactionParams) (*transactionConfirmation, error)
SendMoney to either a bitcoin or email address
type ContactsParams ¶
type ContactsParams struct {
Page int64 `json:"page,omitempty"`
Limit int64 `json:"limit,omitempty"`
Query string `json:"query,omitempty"`
}
Parameter Struct for GET /api/v1/contacts Requests
type OAuth ¶
OAuth handles all service oauth related functionality (i.e GetTokens(), RefreshTokens()
func OAuthService ¶
OAuthService Instantiates OAuth Struct in order to send service related OAuth requests
func (OAuth) CreateAuthorizeUrl ¶
CreateAuthorizeUrl create the Authorize Url used to redirect users for coinbase app authorization. The scope parameter includes the specific permissions one wants to ask from the user
func (OAuth) GetTokens ¶
GetTokens gets tokens for an OAuth user specifying a grantType (i.e authorization_code)
func (OAuth) NewTokensFromRequest ¶
NewTokensRequest generates new tokens for OAuth user given an http request containing the query parameter 'code'
func (OAuth) RefreshTokens ¶
RefreshTokens refreshes a users existing OAuth tokens
type TransactionParams ¶
type TransactionParams struct {
To string `json:"to,omitempty"`
From string `json:"from,omitempty"`
Amount string `json:"amount,omitempty"`
AmountString string `json:"amount_string,omitempty"`
AmountCurrencyIso string `json:"amount_currency_iso,omitempty"`
Notes string `json:"notes,omitempty"`
UserFee string `json:"user_fee,omitempty"`
ReferrerId string `json:"refferer_id,omitempty"`
Idem string `json:"idem,omitempty"`
InstantBuy bool `json:"instant_buy,omitempty"`
OrderId string `json:"order_id,omitempty"`
}
Parameter Struct for POST /api/v1/transactions/(request_money,send_money) Requests