list method
Lists transactions for the current user.
count is the number of transactions to return per page.
page is the page number.
companyId is an optional company ID filter.
Returns a list of TransactionModel instances.
Implementation
Future<ApiResponseModel<List<TransactionModel>>> list({
int? count,
int? page,
String? companyId,
}) async {
final url = "$_baseUrl/transaction/list";
final payload = {
'apiKey': _apiKey,
if (count != null) 'count': count,
if (page != null) 'page': page,
if (companyId != null) 'companyId': companyId,
};
debugPrint("flutter_mon_sms_pro/transaction/list/payload: $payload");
final r = await _dio.post(url, data: payload);
debugPrint("flutter_mon_sms_pro/transaction/list/data: ${r.data}");
final response = ApiResponseModel.fromJson(
r.data,
(data) => (data as List<dynamic>)
.map((e) => TransactionModel.fromJson(e as Map<String, dynamic>))
.toList(),
);
return response;
}