getMarketFxQuote method
Future<Map>
getMarketFxQuote(
- String token,
- String? buyAmount,
- String buyCurrencyCode,
- String sellCurrencyCode,
- String? sellAmount,
- String? conversionDate,
override
Implementation
@override
Future<Map> getMarketFxQuote(
String token,
String? buyAmount,
String buyCurrencyCode,
String sellCurrencyCode,
String? sellAmount,
String? conversionDate) async {
final String baseUrl = await getBaseUrl;
var filters = [];
var prefixes = [];
if (buyAmount != null) {
filters.add(buyAmount);
prefixes.add("buy_amount=");
}
filters.add(buyCurrencyCode);
prefixes.add("buy_currency=");
filters.add(sellCurrencyCode);
prefixes.add("sell_currency=");
if (sellAmount != null) {
filters.add(sellAmount);
prefixes.add("sell_amount=");
}
if (conversionDate != null) {
filters.add(conversionDate);
prefixes.add("conversion_date=");
}
String params = addFilter(filters, prefixes);
var url = Uri.parse("$baseUrl/api/v1/marketfx/quote$params");
var response = await http.get(
url,
headers: {"Authorization": "Bearer $token"},
);
var data = jsonDecode(response.body);
return data;
}