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"`
Dogecoin Money `json:"dogecoin,omitempty"`
Litecoin Money `json:"litecoin,omitempty"`
Tether Money `json:"tether,omitempty"`
Shibainu Money `json:"shibainu,omitempty"`
Apecoin Money `json:"apecoin,omitempty"`
Dai Money `json:"dai,omitempty"`
Usdc Money `json:"usdc,omitempty"`
Polygon Money `json:"polygon,omitempty"`
Pusdc Money `json:"pusdc,omitempty"`
Pweth Money `json:"pweth,omitempty"`
} `json:"pricing,omitempty"`
Payments []struct {
Network string `json:"network,omitepty"`
Transaction_id string `json:"transaction_id,omitepty"`
Status string `json:"status,omitepty"`
Value struct {
Local struct {
Amount string `json:"amount,omitepty"`
Currency string `json:"currency,omitepty"`
}
Crypto struct {
Amount string `json:"amount,omitepty"`
Currency string `json:"currency,omitepty"`
} `json:"crypto,omitepty"`
} `json:"value,omitepty"`
Block struct {
Height int `json:"height,omitepty"`
Hash string `json:"hash,omitepty"`
Confirmations_accumulated int `json:"confirmations_accumulated ,omitepty"`
Confirmations_required int `json:"confirmations_required,omitepty"`
} `json:"block,omitepty"`
} `json:"payments,omitempty"`
Addresses struct {
Ethereum string `json:"ethereum,omitempty"`
Usdc string `json:"usdc,omitempty"`
Dai string `json:"dai,omitempty"`
Apecoin string `json:"apecoin,omitempty"`
Shibainu string `json:"shibainu,omitempty"`
Tether string `json:"tether,omitempty"`
Bitcoincash string `json:"bitcoincash,omitempty"`
Dogecoin string `json:"dogecoin,omitempty"`
Litecoin string `json:"litecoin,omitempty"`
Bitcoin string `json:"bitcoin,omitempty"`
Polygon string `json:"polygon,omitempty"`
Pusdc string `json:"pusdc,omitempty"`
Pweth string `json:"pweth,omitempty"`
} `json:"addresses,omitempty"`
ExchangeRates struct {
ETHUSD string `json:"ETH-USD,omitempty"`
BTCUSD string `json:"BTC-USD,omitempty"`
LTCUSD string `json:"LTC-USD,omitempty"`
DOGEUSD string `json:"DOGE-USD,omitempty"`
BCHUSD string `json:"BCH-USD,omitempty"`
USDCUSD string `json:"USDC-USD,omitempty"`
DAIUSD string `json:"DAI-USD,omitempty"`
APEUSD string `json:"APE-USD,omitempty"`
SHIBUSD string `json:"SHIB-USD,omitempty"`
USDTUSD string `json:"USDT-USD,omitempty"`
PMATICUSD string `json:"PMATIC-USD,omitempty"`
PUSDCUSD string `json:"PUSDC-USD,omitempty"`
PWETHUSD string `json:"PWETH-USD,omitempty"`
} `json:"exchange_rates,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
}