Documentation ¶
Index ¶
- type AllOptions
- type CallingCodeOptions
- type CapitalOptions
- type CodesOptions
- type Country
- type CurrencyOptions
- type LanguageOptions
- type NameOptions
- type RegionOptions
- type RegionalBlocOptions
- type RestCountries
- func (r *RestCountries) All(options AllOptions) ([]Country, error)
- func (r *RestCountries) CallingCode(options CallingCodeOptions) ([]Country, error)
- func (r *RestCountries) Capital(options CapitalOptions) ([]Country, error)
- func (r *RestCountries) Codes(options CodesOptions) ([]Country, error)
- func (r *RestCountries) Currency(options CurrencyOptions) ([]Country, error)
- func (r *RestCountries) Language(options LanguageOptions) ([]Country, error)
- func (r *RestCountries) Name(options NameOptions) ([]Country, error)
- func (r *RestCountries) Region(options RegionOptions) ([]Country, error)
- func (r *RestCountries) RegionalBloc(options RegionalBlocOptions) ([]Country, error)
- func (r *RestCountries) SetApiRoot(url string)
- func (r *RestCountries) SetTimeout(timeout time.Duration)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AllOptions ¶
type AllOptions struct {
Fields []string
}
AllOptions represents options for the All() method
type CallingCodeOptions ¶
CallingCodeOptions represents options for the CallingCode() method
type CapitalOptions ¶
CapitalOptions represents options for the Capital() method
type CodesOptions ¶
CodesOptions represents options for the CodesOptions() method
type Country ¶
type Country struct { Name string `json:"name"` TopLevelDomain []string `json:"topLevelDomain"` Alpha2Code string `json:"alpha2Code"` Alpha3Code string `json:"alpha3Code"` CallingCodes []string `json:"callingCodes"` Capital string `json:"capital"` AltSpellings []string `json:"altSpellings"` Region string `json:"region"` Subregion string `json:"subregion"` Population int `json:"population"` Latlng []float64 `json:"latlng"` Demonym string `json:"demonym"` Area float64 `json:"area"` Gini float64 `json:"gini"` Timezones []string `json:"timezones"` Borders []string `json:"borders"` NativeName string `json:"nativeName"` NumericCode string `json:"numericCode"` Currencies []struct { Code string `json:"code"` Name string `json:"name"` Symbol string `json:"symbol"` } `json:"currencies"` Languages []struct { Iso6391 string `json:"iso639_1"` Iso6392 string `json:"iso639_2"` Name string `json:"name"` NativeName string `json:"nativeName"` } `json:"languages"` Translations struct { De string `json:"de"` Es string `json:"es"` Fr string `json:"fr"` Ja string `json:"ja"` It string `json:"it"` Br string `json:"br"` Pt string `json:"pt"` Nl string `json:"nl"` Hr string `json:"hr"` Fa string `json:"fa"` } `json:"translations"` Flag string `json:"flag"` RegionalBlocs []struct { Acronym string `json:"acronym"` Name string `json:"name"` OtherAcronyms []string `json:"otherAcronyms"` OtherNames []string `json:"otherNames"` } `json:"regionalBlocs"` Cioc string `json:"cioc"` }
Country represents a Country from the API A slice of Country is returned by the methods which return countries, e.g. All and Name
type CurrencyOptions ¶
CurrencyOptions represents options for the Currency() method
type LanguageOptions ¶
LanguageOptions represents options for the Language() method
type NameOptions ¶
NameOptions represents options for the Name() method
type RegionOptions ¶
RegionOptions represents options for the Region() method
type RegionalBlocOptions ¶
RegionalBlocOptions represents options for the RegionalBloc() method
type RestCountries ¶
type RestCountries struct {
// contains filtered or unexported fields
}
RestCountries represents an app/client using the API
func (*RestCountries) All ¶
func (r *RestCountries) All(options AllOptions) ([]Country, error)
All method returns all countries The optional AllOptions.Fields allows filtering fields by specifying the fields you want, instead of all fields
func (*RestCountries) CallingCode ¶
func (r *RestCountries) CallingCode(options CallingCodeOptions) ([]Country, error)
CallingCode method searches countries by calling code using an exact match The optional CallingCodeOptions.Fields allows filtering fields by specifying the fields you want, instead of all fields
func (*RestCountries) Capital ¶
func (r *RestCountries) Capital(options CapitalOptions) ([]Country, error)
Capital method searches countries by capital city using a partial match The optional CapitalOptions.Fields allows filtering fields by specifying the fields you want, instead of all fields
func (*RestCountries) Codes ¶
func (r *RestCountries) Codes(options CodesOptions) ([]Country, error)
Codes method searches countries by country codes using an exact match The optional CodesOptions.Fields allows filtering fields by specifying the fields you want, instead of all fields
func (*RestCountries) Currency ¶
func (r *RestCountries) Currency(options CurrencyOptions) ([]Country, error)
Currency method searches countries by currency code using an exact match The optional CurrencyOptions.Fields allows filtering fields by specifying the fields you want, instead of all fields
func (*RestCountries) Language ¶
func (r *RestCountries) Language(options LanguageOptions) ([]Country, error)
Language method searches countries by language code using an exact match The optional LanguageOptions.Fields allows filtering fields by specifying the fields you want, instead of all fields
func (*RestCountries) Name ¶
func (r *RestCountries) Name(options NameOptions) ([]Country, error)
Name method searches countries by name The optional NameOptions.FullText boolean when true, will search for an exact match. Otherwise, partial matches are returned The optional NameOptions.Fields allows filtering fields by specifying the fields you want, instead of all fields
func (*RestCountries) Region ¶
func (r *RestCountries) Region(options RegionOptions) ([]Country, error)
Region method searches countries by region using an exact match The optional RegionOptions.Fields allows filtering fields by specifying the fields you want, instead of all fields
func (*RestCountries) RegionalBloc ¶
func (r *RestCountries) RegionalBloc(options RegionalBlocOptions) ([]Country, error)
RegionalBloc method searches countries by regional Bloc using an exact match The optional RegionalBlocOptions.Fields allows filtering fields by specifying the fields you want, instead of all fields
func (*RestCountries) SetApiRoot ¶
func (r *RestCountries) SetApiRoot(url string)
SetApiRoot overrides the API root url - used for unit testing
func (*RestCountries) SetTimeout ¶
func (r *RestCountries) SetTimeout(timeout time.Duration)
SetTimeout overrides the HTTP clent timeout