getExit function

Future<Exit> getExit(
  1. int batchNum,
  2. String accountIndex
)

GET request to the /exits/:batchNum/:accountIndex endpoint. Returns a specific exit @param {int} batchNum - Filter by an exit in a specific batch number @param {string} accountIndex - Filter by an exit associated to an account index @returns {object} Response data with the specific exit

Implementation

Future<Exit> getExit(int batchNum, String accountIndex) async {
  final response = await get(
      baseApiUrl, EXITS_URL + '/' + batchNum.toString() + '/' + accountIndex);
  if (response.statusCode == 200) {
    final jsonResponse = await extractJSON(response);
    final Exit exitResponse = Exit.fromJson(json.decode(jsonResponse));
    return exitResponse;
  } else {
    throw ('Error: $response.statusCode');
  }
}