getBatches function

Future<String> getBatches(
  1. String forgerAddr,
  2. int slotNum,
  3. int fromItem
)

GET request to the /batches endpoint. Returns a filtered list of batches @param {String} forgerAddr - Filter by forger address @param {int} slotNum - A specific slot number @param {int} fromItem - Item from where to start the request @returns {Object} Response data with a paginated list of batches

Implementation

Future<String> getBatches(String forgerAddr, int slotNum, int fromItem) async {
  Map<String, String> params = {};
  params.putIfAbsent(
      'forgerAddr', () => forgerAddr.isNotEmpty ? forgerAddr : '');
  params.putIfAbsent('slotNum', () => slotNum > 0 ? slotNum.toString() : '');
  params.putIfAbsent('fromItem', () => fromItem > 0 ? fromItem.toString() : '');

  return extractJSON(
      await get(baseApiUrl, BATCHES_URL, queryParameters: params));
}