getPrices method
Future<Map>
getPrices(
- String token,
- String? active,
- String? currencyCode,
- String? pageNumber,
- String? pageSize,
- String? productId,
- String? recurringPeriod,
- String? recurringPeriodUnit,
override
Implementation
@override
Future<Map> getPrices(
String token,
String? active,
String? currencyCode,
String? pageNumber,
String? pageSize,
String? productId,
String? recurringPeriod,
String? recurringPeriodUnit) async {
final baseUrl = await getBaseUrl;
var filters = [];
var prefixes = [];
if (active != null) {
filters.add(active);
prefixes.add("active=");
}
if (currencyCode != null) {
filters.add(currencyCode);
prefixes.add("currency=");
}
if (pageNumber != null) {
filters.add(pageNumber);
prefixes.add("page_num=");
}
if (pageSize != null) {
filters.add(pageSize);
prefixes.add("page_size=");
}
if (productId != null) {
filters.add(productId);
prefixes.add("product_id=");
}
if (recurringPeriod != null) {
filters.add(recurringPeriod);
prefixes.add("recurring_period=");
}
if (recurringPeriodUnit != null) {
filters.add(recurringPeriodUnit);
prefixes.add("recurring_period_unit=");
}
String params = addFilter(filters, prefixes);
var url = Uri.parse("$baseUrl/api/v1/prices$params");
var response = await http.get(
url,
headers: {"Authorization": "Bearer $token"},
);
var data = jsonDecode(response.body);
return data;
}