Documentation ¶
Index ¶
- Constants
- type ACharge
- type ACheckout
- func (a *ACheckout) Create(data interface{}) (checkout APICheckout, err error)
- func (a *ACheckout) Delete(id string) (err error)
- func (a *ACheckout) Get(id string) (checkout APICheckout, err error)
- func (a *ACheckout) List() (checkouts APICheckouts, err error)
- func (a *ACheckout) Update(id string, data interface{}) (checkout APICheckout, err error)
- type AEvent
- type APICharge
- type APIChargeData
- type APICharges
- type APIChargesRequest
- type APICheckout
- type APICheckoutData
- type APICheckouts
- type APICheckoutsRequest
- type APIClient
- type APIError
- type APIEvent
- type APIEventData
- type APIEvents
- type APIEventsRequest
- type APIPagination
- type APIWebHook
- type Money
Constants ¶
const ( // ENDPOINT defaults to https://api.commerce.coinbase.com // but can be overridden for test purposes ENDPOINT = "https://api.commerce.coinbase.com" // API_VERSION since version two you have to // specify a API version in your http request headers API_VERSION = "2018-03-22" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ACharge ¶
type ACharge struct {
Api *APIClient
}
ACharge is a class hosted inside the APIClient providing methods about charge
func (*ACharge) List ¶
func (a *ACharge) List() (charges APICharges, err error)
List create a APICharges object with a list of APICharge instance.
type ACheckout ¶
type ACheckout struct {
Api *APIClient
}
func (*ACheckout) Create ¶
func (a *ACheckout) Create(data interface{}) (checkout APICheckout, err error)
Create a new charge and return his golang instance
func (*ACheckout) Get ¶
func (a *ACheckout) Get(id string) (checkout APICheckout, err error)
Get provides the APICharge instance of the given charge id.
func (*ACheckout) List ¶
func (a *ACheckout) List() (checkouts APICheckouts, err error)
List create a APICharges object with a list of APICharge instance.
type APICharge ¶
type APICharge struct { Data APIChargeData `json:"data,omitempty"` Errors []APIError `json:"errors,omitempty"` // contains filtered or unexported fields }
APICharge is the object API object returned by the api routes.
type APIChargeData ¶
type APIChargeData struct { Id string `json:"id,omitempty"` Ressource string `json:"ressource,omitempty"` Code string `json:"code,omitempty"` Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` Logo_url string `json:"logo_url,omitempty"` Redirect_url string `json:"redirect_url,omitempty"` Hosted_url string `json:"Hosted_url,omitempty"` Created_at *time.Time `json:"created_at,omitempty"` Updated_at *time.Time `json:"updated_at,omitempty"` Confirmed_at *time.Time `json:"confirmed_at,omitempty"` Checkout struct { Id string `json:"id,omitempty"` } `json:"checkout,omitempty"` Timeline []struct { Time *time.Time `json:"id,omitempty"` Status string `json:"status,omitempty"` Context string `json:"context,omitempty"` } `json:"timeline,omitempty"` Metadata map[string]interface{} `json:"metadata,omitempty"` Pricing_type string `json:"pricing_type,omitempty"` Pricing struct { Local Money `json:"local,omitempty"` Bitcoin Money `json:"bitcoin,omitempty"` Bitcoincash Money `json:"bitcoincash,omitempty"` Ethereum Money `json:"ethereum,omitempty"` Litecoin Money `json:"litecoin,omitempty"` } `json:"pricing,omitempty"` Payments []struct { Network string `json:"network,omitempty"` Transaction_id string `json:"transaction_id,omitempty"` Status string `json:"status,omitempty"` Value struct { Local struct { Amount string `json:"amount,omitempty"` Currency string `json:"currency,omitempty"` } Crypto struct { Amount string `json:"amount,omitempty"` Currency string `json:"currency,omitempty"` } `json:"crypto,omitempty"` } `json:"value,omitempty"` Block struct { Height int `json:"height,omitempty"` Hash string `json:"hash,omitempty"` Confirmations_accumulated int `json:"confirmations_accumulated ,omitempty"` Confirmations_required int `json:"confirmations_required,omitempty"` } `json:"block,omitempty"` } `json:"payments,omitempty"` Addresses struct { Bitcoin string `json:"bitcoin,omitempty"` Bitcoincash string `json:"bitcoincash,omitempty"` Ethereum string `json:"ethereum,omitempty"` Litecoin string `json:"litecoin,omitempty"` } `json:"addresses,omitempty"` Local_price Money `json:"local_price,omitempty"` }
APIChargeData is the golang struct equivalent of the Charge resource. It's findable inside APICharge object
type APICharges ¶
type APICharges struct { Pagination APIPagination `json:"pagination,omitempty"` Charges []APICharge `json:"data,omitempty"` Errors []APIError `json:"errors,omitempty"` }
APICharges is the object API object filled with a list of APICharge object alongside of Pagination information and a list of Errors.
type APIChargesRequest ¶
type APIChargesRequest struct { Pagination APIPagination `json:"pagination,omitempty"` Data []APIChargeData `json:"data,omitempty"` Errors []APIError `json:"errors,omitempty"` }
APICharge is the golang struct equivalent of the List charges routes
type APICheckout ¶
type APICheckout struct { Data APICheckoutData `json:"data,omitempty"` Errors []APIError `json:"errors,omitempty"` // contains filtered or unexported fields }
func (*APICheckout) Refresh ¶
func (a *APICheckout) Refresh() (err error)
Refresh will update attributes and all nested data by making a fresh GET request to the relevant API endpoint.
func (*APICheckout) Save ¶
func (a *APICheckout) Save() (err error)
Save is the object method equivalent of update.
type APICheckoutData ¶
type APICheckoutData struct { Id string `json:"id,omitempty"` Resource string `json:"ressource,omitempty"` Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` Logo_url string `json:"logo_url,omitempty"` Requested_info []string `json:"requested_info,omitempty"` Pricing_type string `json:"pricing_type,omitempty"` Local_price Money `json:"local_price,omitempty"` }
type APICheckouts ¶
type APICheckouts struct { Pagination APIPagination `json:"pagination,omitempty"` Checkouts []APICheckout `json:"data,omitempty"` Errors []APIError `json:"errors,omitempty"` }
type APICheckoutsRequest ¶
type APICheckoutsRequest struct { Pagination APIPagination `json:"pagination,omitempty"` Data []APICheckoutData `json:"data,omitempty"` Errors []APIError `json:"errors,omitempty"` }
type APIClient ¶
type APIClient struct { Key string Endpoint string ApiVersion string Checkout *ACheckout Charge *ACharge Event *AEvent }
APIClient is the interface for most of the API calls If Endpoint or ApiVersion aren't defined the library will use the default https://api.commerce.coinbase.com
type APIEvent ¶
type APIEvent struct { Data APIEventData `json:"data,omitempty"` Errors []APIError `json:"errors,omitempty"` // contains filtered or unexported fields }
type APIEventData ¶
type APIEvents ¶
type APIEvents struct { Pagination APIPagination `json:"pagination,omitempty"` Events []APIEvent `json:"data,omitempty"` Errors []APIError `json:"errors,omitempty"` }
type APIEventsRequest ¶
type APIEventsRequest struct { Pagination APIPagination `json:"pagination,omitempty"` Data []APIEventData `json:"data,omitempty"` Errors []APIError `json:"errors,omitempty"` }
type APIPagination ¶
type APIWebHook ¶
type APIWebHook struct { Attempt_number int `json:"attempt_number,omitempty"` Data APIEventData `json:"event,omitempty"` Errors []APIError `json:"errors,omitempty"` // contains filtered or unexported fields }