1
0
Fork 0
mirror of synced 2024-07-07 07:25:56 +12:00
appwrite/app/sdks/server-go/locale.go

89 lines
2.3 KiB
Go
Raw Normal View History

2020-01-29 03:22:13 +13:00
package appwrite
import (
)
// Locale service
type Locale struct {
2020-01-29 09:24:42 +13:00
client Client
2020-01-29 03:22:13 +13:00
}
2020-01-29 18:08:39 +13:00
func NewLocale(clt Client) Locale {
2020-01-29 12:14:30 +13:00
service := Locale{
client: clt,
}
2020-01-29 10:01:07 +13:00
return service
}
2020-01-31 05:18:59 +13:00
// Get get the current user location based on IP. Returns an object with user
// country code, country name, continent name, continent code, ip address and
// suggested currency. You can use the locale header to get the data in a
2020-01-29 03:22:13 +13:00
// supported language.
//
// ([IP Geolocation by DB-IP](https://db-ip.com))
2020-01-31 05:18:59 +13:00
func (srv *Locale) Get() (map[string]interface{}, error) {
2020-01-29 03:22:13 +13:00
path := "/locale"
params := map[string]interface{}{
}
2020-01-29 11:56:24 +13:00
return srv.client.Call("GET", path, nil, params)
2020-01-29 03:22:13 +13:00
}
// GetContinents list of all continents. You can use the locale header to get
// the data in a supported language.
func (srv *Locale) GetContinents() (map[string]interface{}, error) {
path := "/locale/continents"
params := map[string]interface{}{
}
2020-01-29 11:56:24 +13:00
return srv.client.Call("GET", path, nil, params)
2020-01-29 03:22:13 +13:00
}
// GetCountries list of all countries. You can use the locale header to get
// the data in a supported language.
func (srv *Locale) GetCountries() (map[string]interface{}, error) {
path := "/locale/countries"
params := map[string]interface{}{
}
2020-01-29 11:56:24 +13:00
return srv.client.Call("GET", path, nil, params)
2020-01-29 03:22:13 +13:00
}
// GetCountriesEU list of all countries that are currently members of the EU.
// You can use the locale header to get the data in a supported language.
func (srv *Locale) GetCountriesEU() (map[string]interface{}, error) {
path := "/locale/countries/eu"
params := map[string]interface{}{
}
2020-01-29 11:56:24 +13:00
return srv.client.Call("GET", path, nil, params)
2020-01-29 03:22:13 +13:00
}
// GetCountriesPhones list of all countries phone codes. You can use the
// locale header to get the data in a supported language.
func (srv *Locale) GetCountriesPhones() (map[string]interface{}, error) {
path := "/locale/countries/phones"
params := map[string]interface{}{
}
2020-01-29 11:56:24 +13:00
return srv.client.Call("GET", path, nil, params)
2020-01-29 03:22:13 +13:00
}
// GetCurrencies list of all currencies, including currency symol, name,
// plural, and decimal digits for all major and minor currencies. You can use
// the locale header to get the data in a supported language.
func (srv *Locale) GetCurrencies() (map[string]interface{}, error) {
path := "/locale/currencies"
params := map[string]interface{}{
}
2020-01-29 11:56:24 +13:00
return srv.client.Call("GET", path, nil, params)
2020-01-29 03:22:13 +13:00
}