2020-03-27 02:20:07 +13:00
|
|
|
|
2020-04-09 05:26:18 +12:00
|
|
|
|
2020-01-31 05:18:59 +13:00
|
|
|
import 'package:dio/dio.dart';
|
2020-03-27 02:20:07 +13:00
|
|
|
import 'package:meta/meta.dart';
|
|
|
|
|
2020-04-06 01:23:15 +12:00
|
|
|
import "../client.dart";
|
2020-03-27 02:20:07 +13:00
|
|
|
import '../enums.dart';
|
2020-04-06 01:23:15 +12:00
|
|
|
import "../service.dart";
|
2020-01-31 05:18:59 +13:00
|
|
|
|
|
|
|
class Locale extends Service {
|
2020-04-06 01:23:15 +12:00
|
|
|
Locale(Client client): super(client);
|
2020-01-31 05:18:59 +13:00
|
|
|
|
2020-04-11 22:02:21 +12:00
|
|
|
/// Get User Locale
|
|
|
|
///
|
2020-01-31 05:18:59 +13:00
|
|
|
/// 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
|
|
|
|
/// supported language.
|
|
|
|
///
|
|
|
|
/// ([IP Geolocation by DB-IP](https://db-ip.com))
|
2020-04-11 22:02:21 +12:00
|
|
|
///
|
2020-04-06 01:23:15 +12:00
|
|
|
Future<Response> get() {
|
|
|
|
final String path = '/locale';
|
2020-01-31 05:18:59 +13:00
|
|
|
|
2020-04-06 01:23:15 +12:00
|
|
|
final Map<String, dynamic> params = {
|
|
|
|
};
|
2020-01-31 05:18:59 +13:00
|
|
|
|
2020-04-11 22:02:21 +12:00
|
|
|
final Map<String, String> headers = {
|
|
|
|
'content-type': 'application/json',
|
|
|
|
};
|
|
|
|
|
|
|
|
return client.call(HttpMethod.get, path: path, params: params, headers: headers);
|
2020-01-31 05:18:59 +13:00
|
|
|
}
|
2020-04-11 22:02:21 +12:00
|
|
|
|
2020-04-19 16:03:52 +12:00
|
|
|
/// List Continents
|
2020-04-11 22:02:21 +12:00
|
|
|
///
|
2020-01-31 05:18:59 +13:00
|
|
|
/// List of all continents. You can use the locale header to get the data in a
|
|
|
|
/// supported language.
|
2020-04-11 22:02:21 +12:00
|
|
|
///
|
2020-04-06 01:23:15 +12:00
|
|
|
Future<Response> getContinents() {
|
|
|
|
final String path = '/locale/continents';
|
2020-01-31 05:18:59 +13:00
|
|
|
|
2020-04-06 01:23:15 +12:00
|
|
|
final Map<String, dynamic> params = {
|
|
|
|
};
|
2020-01-31 05:18:59 +13:00
|
|
|
|
2020-04-11 22:02:21 +12:00
|
|
|
final Map<String, String> headers = {
|
|
|
|
'content-type': 'application/json',
|
|
|
|
};
|
|
|
|
|
|
|
|
return client.call(HttpMethod.get, path: path, params: params, headers: headers);
|
2020-01-31 05:18:59 +13:00
|
|
|
}
|
2020-04-11 22:02:21 +12:00
|
|
|
|
|
|
|
/// List Countries
|
|
|
|
///
|
2020-01-31 05:18:59 +13:00
|
|
|
/// List of all countries. You can use the locale header to get the data in a
|
|
|
|
/// supported language.
|
2020-04-11 22:02:21 +12:00
|
|
|
///
|
2020-04-06 01:23:15 +12:00
|
|
|
Future<Response> getCountries() {
|
|
|
|
final String path = '/locale/countries';
|
2020-01-31 05:18:59 +13:00
|
|
|
|
2020-04-06 01:23:15 +12:00
|
|
|
final Map<String, dynamic> params = {
|
|
|
|
};
|
2020-01-31 05:18:59 +13:00
|
|
|
|
2020-04-11 22:02:21 +12:00
|
|
|
final Map<String, String> headers = {
|
|
|
|
'content-type': 'application/json',
|
|
|
|
};
|
|
|
|
|
|
|
|
return client.call(HttpMethod.get, path: path, params: params, headers: headers);
|
2020-01-31 05:18:59 +13:00
|
|
|
}
|
2020-04-11 22:02:21 +12:00
|
|
|
|
|
|
|
/// List EU Countries
|
|
|
|
///
|
2020-01-31 05:18:59 +13:00
|
|
|
/// 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.
|
2020-04-11 22:02:21 +12:00
|
|
|
///
|
2020-04-06 01:23:15 +12:00
|
|
|
Future<Response> getCountriesEU() {
|
|
|
|
final String path = '/locale/countries/eu';
|
2020-01-31 05:18:59 +13:00
|
|
|
|
2020-04-06 01:23:15 +12:00
|
|
|
final Map<String, dynamic> params = {
|
|
|
|
};
|
2020-01-31 05:18:59 +13:00
|
|
|
|
2020-04-11 22:02:21 +12:00
|
|
|
final Map<String, String> headers = {
|
|
|
|
'content-type': 'application/json',
|
|
|
|
};
|
|
|
|
|
|
|
|
return client.call(HttpMethod.get, path: path, params: params, headers: headers);
|
2020-01-31 05:18:59 +13:00
|
|
|
}
|
2020-04-11 22:02:21 +12:00
|
|
|
|
|
|
|
/// List Countries Phone Codes
|
|
|
|
///
|
2020-01-31 05:18:59 +13:00
|
|
|
/// List of all countries phone codes. You can use the locale header to get the
|
|
|
|
/// data in a supported language.
|
2020-04-11 22:02:21 +12:00
|
|
|
///
|
2020-04-06 01:23:15 +12:00
|
|
|
Future<Response> getCountriesPhones() {
|
|
|
|
final String path = '/locale/countries/phones';
|
2020-01-31 05:18:59 +13:00
|
|
|
|
2020-04-06 01:23:15 +12:00
|
|
|
final Map<String, dynamic> params = {
|
|
|
|
};
|
2020-01-31 05:18:59 +13:00
|
|
|
|
2020-04-11 22:02:21 +12:00
|
|
|
final Map<String, String> headers = {
|
|
|
|
'content-type': 'application/json',
|
|
|
|
};
|
|
|
|
|
|
|
|
return client.call(HttpMethod.get, path: path, params: params, headers: headers);
|
2020-01-31 05:18:59 +13:00
|
|
|
}
|
2020-04-11 22:02:21 +12:00
|
|
|
|
|
|
|
/// List Currencies
|
|
|
|
///
|
2020-06-17 22:12:45 +12:00
|
|
|
/// List of all currencies, including currency symbol, 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.
|
2020-04-11 22:02:21 +12:00
|
|
|
///
|
2020-04-06 01:23:15 +12:00
|
|
|
Future<Response> getCurrencies() {
|
|
|
|
final String path = '/locale/currencies';
|
2020-01-31 05:18:59 +13:00
|
|
|
|
2020-04-06 01:23:15 +12:00
|
|
|
final Map<String, dynamic> params = {
|
|
|
|
};
|
2020-01-31 05:18:59 +13:00
|
|
|
|
2020-04-11 22:02:21 +12:00
|
|
|
final Map<String, String> headers = {
|
|
|
|
'content-type': 'application/json',
|
|
|
|
};
|
|
|
|
|
2020-06-17 22:12:45 +12:00
|
|
|
return client.call(HttpMethod.get, path: path, params: params, headers: headers);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// List Languages
|
|
|
|
///
|
|
|
|
/// List of all languages classified by ISO 639-1 including 2-letter code, name
|
|
|
|
/// in English, and name in the respective language.
|
|
|
|
///
|
|
|
|
Future<Response> getLanguages() {
|
|
|
|
final String path = '/locale/languages';
|
|
|
|
|
|
|
|
final Map<String, dynamic> params = {
|
|
|
|
};
|
|
|
|
|
|
|
|
final Map<String, String> headers = {
|
|
|
|
'content-type': 'application/json',
|
|
|
|
};
|
|
|
|
|
2020-04-11 22:02:21 +12:00
|
|
|
return client.call(HttpMethod.get, path: path, params: params, headers: headers);
|
2020-01-31 05:18:59 +13:00
|
|
|
}
|
|
|
|
}
|