coinbase-go: github.com/fabioberger/coinbase-go Index | Files | Directories

package coinbase

import "github.com/fabioberger/coinbase-go"

Coinbase-go is a convenient Go wrapper for the Coinbase API

Index

Package Files

Authenticator.go api_key_authentication.go client_oauth_authentication.go coinbase.go holders.go oauth.go params.go rpc.go service_oauth_authentication.go utils.go

type AddressParams Uses

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 Uses

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 Uses

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 Uses

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

Client is the struct from which all API requests are made

func ApiKeyClient Uses

func ApiKeyClient(key string, secret string) Client

ApiKeyClient instantiates the client with ApiKey Authentication

func OAuthClient Uses

func OAuthClient(tokens *oauthTokens) Client

OAuthClient instantiates the client with OAuth Authentication

func (Client) Buy Uses

func (c Client) Buy(amount float64, agreeBtcAmountVaries bool) (*transfer, error)

Buy an amount of BTC and bypass rate limits by setting agreeBtcAmountVaries to true

func (Client) CancelRequest Uses

func (c Client) CancelRequest(id string) (bool, error)

CancelRequest cancels a transaction request referenced by id

func (Client) CompleteRequest Uses

func (c Client) CompleteRequest(id string) (*transactionConfirmation, error)

CompleteRequest completes a money request referenced by id

func (Client) CreateButton Uses

func (c Client) CreateButton(params *Button) (*Button, error)

CreateButton gets a new payment button including EmbedHtml as a field on button struct

func (Client) CreateOrderFromButtonCode Uses

func (c Client) CreateOrderFromButtonCode(buttonCode string) (*order, error)

CreateOrderFromButtonCode creates an order for a given button code

func (Client) CreateUser Uses

func (c Client) CreateUser(email string, password string) (*user, error)

CreateUser creates a new user given an email and password

func (Client) Delete Uses

func (c Client) Delete(path string, params interface{}, holder interface{}) error

Delete sends a DELETE request and marshals response data into holder

func (Client) GenerateReceiveAddress Uses

func (c Client) GenerateReceiveAddress(params *AddressParams) (string, error)

GenerateReceiveAddress generates and returns a new bitcoin receive address

func (Client) Get Uses

func (c Client) Get(path string, params interface{}, holder interface{}) error

Get sends a GET request and marshals response data into holder

func (Client) GetAllAddresses Uses

func (c Client) GetAllAddresses(params *AddressesParams) (*addresses, error)

GetAllAddresses returns bitcoin addresses associated with client account

func (Client) GetBalance Uses

func (c Client) GetBalance() (float64, error)

GetBalance returns current balance in BTC

func (Client) GetBuyPrice Uses

func (c Client) GetBuyPrice(qty int) (*pricesHolder, error)

GetBuyPrice gets the current BTC buy price

func (Client) GetContacts Uses

func (c Client) GetContacts(params *ContactsParams) (*contactsHolder, error)

GetContacts gets a users contacts

func (Client) GetCurrencies Uses

func (c Client) GetCurrencies() ([]currency, error)

GetCurrencies gets all currency names and ISO's

func (Client) GetExchangeRate Uses

func (c Client) GetExchangeRate(from string, to string) (float64, error)

GetExchangeRate gets the exchange rate between two specified currencies

func (Client) GetExchangeRates Uses

func (c Client) GetExchangeRates() (map[string]string, error)

GetExchangeRates gets the current exchange rates

func (Client) GetOrder Uses

func (c Client) GetOrder(id string) (*order, error)

GetOrder gets a particular order referenced by id

func (Client) GetOrders Uses

func (c Client) GetOrders(page int) (*orders, error)

GetOrders gets orders associated with an account

func (Client) GetReceiveAddress Uses

func (c Client) GetReceiveAddress() (string, error)

GetReceiveAddress returns clients current bitcoin receive address

func (Client) GetSellPrice Uses

func (c Client) GetSellPrice(qty int) (*pricesHolder, error)

GetSellPrice gets the current BTC sell price

func (Client) GetTransaction Uses

func (c Client) GetTransaction(id string) (*transaction, error)

GetTransaction gets a particular transaction referenced by id

func (Client) GetTransactions Uses

func (c Client) GetTransactions(page int) (*transactions, error)

GetTransactions gets transactions associated with an account

func (Client) GetTransfers Uses

func (c Client) GetTransfers(page int) (*transfers, error)

GetTransfers get transfers associated with an account

func (Client) GetUser Uses

func (c Client) GetUser() (*user, error)

GetUser gets the user associated with the authentication

func (Client) Post Uses

func (c Client) Post(path string, params interface{}, holder interface{}) error

Post sends a POST request and marshals response data into holder

func (Client) Put Uses

func (c Client) Put(path string, params interface{}, holder interface{}) error

Put sends a PUT request and marshals response data into holder

func (Client) RequestMoney Uses

func (c Client) RequestMoney(params *TransactionParams) (*transactionConfirmation, error)

RequestMoney from either a bitcoin or email address

func (Client) ResendRequest Uses

func (c Client) ResendRequest(id string) (bool, error)

ResendRequest resends a transaction request referenced by id

func (Client) Sell Uses

func (c Client) Sell(amount float64) (*transfer, error)

Sell an amount of BTC

func (Client) SendMoney Uses

func (c Client) SendMoney(params *TransactionParams) (*transactionConfirmation, error)

SendMoney to either a bitcoin or email address

type ContactsParams Uses

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 Uses

type OAuth struct {
    ClientId     string
    ClientSecret string
    RedirectUri  string
    Rpc          rpc
}

OAuth handles all service oauth related functionality (i.e GetTokens(), RefreshTokens()

func OAuthService Uses

func OAuthService(clientId string, clientSecret string, redirectUri string) (*OAuth, error)

OAuthService Instantiates OAuth Struct in order to send service related OAuth requests

func (OAuth) CreateAuthorizeUrl Uses

func (o OAuth) CreateAuthorizeUrl(scope []string) string

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 Uses

func (o OAuth) GetTokens(code string, grantType string) (*oauthTokens, error)

GetTokens gets tokens for an OAuth user specifying a grantType (i.e authorization_code)

func (OAuth) NewTokens Uses

func (o OAuth) NewTokens(code string) (*oauthTokens, error)

NewTokens generates new tokens for an OAuth user

func (OAuth) NewTokensFromRequest Uses

func (o OAuth) NewTokensFromRequest(req *http.Request) (*oauthTokens, error)

NewTokensRequest generates new tokens for OAuth user given an http request containing the query parameter 'code'

func (OAuth) RefreshTokens Uses

func (o OAuth) RefreshTokens(oldTokens map[string]interface{}) (*oauthTokens, error)

RefreshTokens refreshes a users existing OAuth tokens

type TransactionParams Uses

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

Directories

PathSynopsis
config
example

Package coinbase imports 19 packages (graph) and is imported by 7 packages. Updated 2016-07-15. Refresh now. Tools for package owners.