Documentation ¶
Index ¶
- Constants
- type Countries
- type CountryItem
- type Currencies
- type CurrencyConverter
- func (c *CurrencyConverter) Convert(from, to string) (map[string]float64, error)
- func (c *CurrencyConverter) ConvertMany(currencies []string) (map[string]float64, error)
- func (c *CurrencyConverter) GetCountries() (map[string]CountryItem, error)
- func (c *CurrencyConverter) GetRates(baseCurrency, symbols string) (map[string]float64, error)
- func (c *CurrencyConverter) GetSupportedCurrencies() ([]string, error)
- func (c *CurrencyConverter) SendHTTPRequest(endPoint string, values url.Values, result interface{}) error
- func (c *CurrencyConverter) Setup(config base.Settings) error
- type CurrencyItem
- type Error
Constants ¶
const ( APIEndpointURL = "https://currencyconverterapi.com/api/" APIEndpointFreeURL = "https://free.currencyconverterapi.com/api/" APIEndpointVersion = "v5" APIEndpointConvert = "convert" APIEndpointCurrencies = "currencies" APIEndpointCountries = "countries" APIEndpointUsage = "usage" )
const declarations consist of endpoints
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Countries ¶
type Countries struct {
Results map[string]CountryItem
}
Countries stores the country result data
type CountryItem ¶
type CountryItem struct { Alpha3 string `json:"alpha3"` CurrencyID string `json:"currencyId"` CurrencyName string `json:"currencyName"` CurrencySymbol string `json:"currencySymbol"` ID string `json:"ID"` Name string `json:"Name"` }
CountryItem stores variables related to the country response
type Currencies ¶
type Currencies struct {
Results map[string]CurrencyItem
}
Currencies stores the currency result data
type CurrencyConverter ¶
CurrencyConverter stores the struct for the CurrencyConverter API
func (*CurrencyConverter) Convert ¶
func (c *CurrencyConverter) Convert(from, to string) (map[string]float64, error)
Convert gets the conversion rate for the supplied currencies
func (*CurrencyConverter) ConvertMany ¶
func (c *CurrencyConverter) ConvertMany(currencies []string) (map[string]float64, error)
ConvertMany takes 2 or more currencies depending on if using the free or paid API
func (*CurrencyConverter) GetCountries ¶
func (c *CurrencyConverter) GetCountries() (map[string]CountryItem, error)
GetCountries returns a list of the supported countries and their symbols
func (*CurrencyConverter) GetRates ¶
func (c *CurrencyConverter) GetRates(baseCurrency, symbols string) (map[string]float64, error)
GetRates is a wrapper function to return rates
func (*CurrencyConverter) GetSupportedCurrencies ¶
func (c *CurrencyConverter) GetSupportedCurrencies() ([]string, error)
GetSupportedCurrencies returns a list of the supported currencies
func (*CurrencyConverter) SendHTTPRequest ¶
func (c *CurrencyConverter) SendHTTPRequest(endPoint string, values url.Values, result interface{}) error
SendHTTPRequest sends a HTTP request, if account is not free it automatically upgrades request to SSL.
type CurrencyItem ¶
type CurrencyItem struct { CurrencyName string `json:"currencyName"` CurrencySymbol string `json:"currencySymbol"` ID string `json:"ID"` }
CurrencyItem stores variables related to the currency response