getTeamTournamentList method
Requests historical team tournament TeamTournament from server.
Requires team identifier teamId
. Returns team tournament object
TeamTournament list in case of success or empty list
if team tournament not found.
Throws DioError
in case of network connection problems.
Implementation
Future<Iterable<TeamTournament>> getTeamTournamentList(String teamId) async {
final int id = teamId.parseIdOrThrow;
try {
final Response<dynamic> response =
await _dio.get('/teams.$extensionJson/$id/tournaments');
return (response.data as Map<String, dynamic>)
.values
.map((dynamic e) => TeamTournament.fromMap(e));
} on DioError catch (e) {
if (e.message.isNotFoundError) {
return <TeamTournament>[];
} else {
rethrow;
}
}
}