1
0
Fork 0
mirror of synced 2024-08-22 13:41:45 +12:00
appwrite/app/sdks/client-flutter/lib/services/locale.dart

125 lines
3.6 KiB
Dart
Raw Normal View History

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-01-31 05:18:59 +13:00
/// 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.
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',
};
return client.call(HttpMethod.get, path: path, params: params, headers: headers);
2020-01-31 05:18:59 +13:00
}
}