getBalancesHistory method
Future<Map>
getBalancesHistory(
- String token,
- String? currencyCode,
- String? fromPostAt,
- String? pageNumber,
- String? pageSize,
- String? requestId,
- String? toPostAt,
override
Implementation
@override
Future<Map> getBalancesHistory(
String token,
String? currencyCode,
String? fromPostAt,
String? pageNumber,
String? pageSize,
String? requestId,
String? toPostAt) async {
final String baseUrl = await getBaseUrl;
var filters = [];
var prefixes = [];
if (currencyCode != null) {
filters.add(currencyCode);
prefixes.add("currency=");
}
if (fromPostAt != null) {
filters.add(fromPostAt);
prefixes.add("from_post_at=");
}
if (pageNumber != null) {
filters.add(pageNumber);
prefixes.add("page_num=");
}
if (pageSize != null) {
filters.add(pageSize);
prefixes.add("page_size=");
}
if (requestId != null) {
filters.add(requestId);
prefixes.add("request_id=");
}
if (toPostAt != null) {
filters.add(toPostAt);
prefixes.add("to_post_at=");
}
String params = addFilter(filters, prefixes);
var url = Uri.parse("$baseUrl/api/v1/balances/history$params");
var response = await http.get(
url,
headers: {
"Authorization": "Bearer $token",
},
);
var data = jsonDecode(response.body);
//print(response.body);
return data;
}