1
0
Fork 0
mirror of synced 2024-07-07 15:36:19 +12:00
appwrite/app/sdks/client-flutter/lib/services/locale.dart
2020-06-17 13:12:45 +03:00

143 lines
4.1 KiB
Dart

import 'package:dio/dio.dart';
import 'package:meta/meta.dart';
import "../client.dart";
import '../enums.dart';
import "../service.dart";
class Locale extends Service {
Locale(Client client): super(client);
/// Get User Locale
///
/// 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))
///
Future<Response> get() {
final String path = '/locale';
final Map<String, dynamic> params = {
};
final Map<String, String> headers = {
'content-type': 'application/json',
};
return client.call(HttpMethod.get, path: path, params: params, headers: headers);
}
/// List Continents
///
/// List of all continents. You can use the locale header to get the data in a
/// supported language.
///
Future<Response> getContinents() {
final String path = '/locale/continents';
final Map<String, dynamic> params = {
};
final Map<String, String> headers = {
'content-type': 'application/json',
};
return client.call(HttpMethod.get, path: path, params: params, headers: headers);
}
/// List Countries
///
/// List of all countries. You can use the locale header to get the data in a
/// supported language.
///
Future<Response> getCountries() {
final String path = '/locale/countries';
final Map<String, dynamic> params = {
};
final Map<String, String> headers = {
'content-type': 'application/json',
};
return client.call(HttpMethod.get, path: path, params: params, headers: headers);
}
/// List EU Countries
///
/// 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.
///
Future<Response> getCountriesEU() {
final String path = '/locale/countries/eu';
final Map<String, dynamic> params = {
};
final Map<String, String> headers = {
'content-type': 'application/json',
};
return client.call(HttpMethod.get, path: path, params: params, headers: headers);
}
/// List Countries Phone Codes
///
/// List of all countries phone codes. You can use the locale header to get the
/// data in a supported language.
///
Future<Response> getCountriesPhones() {
final String path = '/locale/countries/phones';
final Map<String, dynamic> params = {
};
final Map<String, String> headers = {
'content-type': 'application/json',
};
return client.call(HttpMethod.get, path: path, params: params, headers: headers);
}
/// List Currencies
///
/// 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.
///
Future<Response> getCurrencies() {
final String path = '/locale/currencies';
final Map<String, dynamic> params = {
};
final Map<String, String> headers = {
'content-type': 'application/json',
};
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',
};
return client.call(HttpMethod.get, path: path, params: params, headers: headers);
}
}