getTournamentAppealQuestions method

Future<Iterable<TournamentAppeal>> getTournamentAppealQuestions(
  1. String tournamentId
)

Requests tournament appeal questions TournamentAppeal from server.

Requires tournament identifier tournamentId. Returns tournament appeal questions object TournamentAppeal list in case of success or empty list if tournament results not found. Throws DioError in case of network connection problems.

Implementation

Future<Iterable<TournamentAppeal>> getTournamentAppealQuestions(
    String tournamentId) async {
  final int id = tournamentId.parseIdOrThrow;
  try {
    final Response<dynamic> response =
        await _dio.get('/tournaments.$extensionJson/$id/appeals');
    return (response.data as List<dynamic>)
        .map((dynamic e) => TournamentAppeal.fromMap(e));
  } on DioError catch (e) {
    if (e.message.isNotFoundError) {
      return <TournamentAppeal>[];
    } else {
      rethrow;
    }
  }
}