getBeneficiaries method
Future<Map>
getBeneficiaries(
- String token,
- String? bankAccountNumber,
- String? companyName,
- String? entityType,
- String? fromDate,
- String? name,
- String? nickname,
- String? pageNumber,
- String? pageSize,
- String? toDate,
override
Implementation
@override
Future<Map> getBeneficiaries(
String token,
String? bankAccountNumber,
String? companyName,
String? entityType,
String? fromDate,
String? name,
String? nickname,
String? pageNumber,
String? pageSize,
String? toDate) async {
final baseUrl = await getBaseUrl;
var filters = [];
var prefixes = [];
if (bankAccountNumber != null) {
filters.add(bankAccountNumber);
prefixes.add("bank_account_number=");
}
if (companyName != null) {
filters.add(companyName);
prefixes.add("company_name=");
}
if (entityType != null) {
filters.add(entityType);
prefixes.add("entity_type=");
}
if (fromDate != null) {
filters.add(fromDate);
prefixes.add("from_date=");
}
if (name != null) {
filters.add(name);
prefixes.add("name=");
}
if (nickname != null) {
filters.add(nickname);
prefixes.add("nick_name=");
}
if (pageNumber != null) {
filters.add(pageNumber);
prefixes.add("page_num=");
}
if (pageSize != null) {
filters.add(pageSize);
prefixes.add("page_size=");
}
if (toDate != null) {
filters.add(toDate);
prefixes.add("to_date=");
}
String params = addFilter(filters, prefixes);
var url = Uri.parse("$baseUrl/api/v1/beneficiaries$params");
var response = await http.get(
url,
headers: {"Authorization": "Bearer $token"},
);
var data = jsonDecode(response.body);
return data;
}