getPlayerTournamentLastSeason method

Future<PlayerTournamentResponse?> getPlayerTournamentLastSeason(
  1. String playerId
)

Requests player tournaments PlayerTournament list for the last season from server.

Requires player identifier playerId. Returns player tournament object PlayerTournamentResponse in case of success or Null if player not found. Throws DioError in case of network connection problems.

Implementation

Future<PlayerTournamentResponse?> getPlayerTournamentLastSeason(
    String playerId) async {
  final int id = playerId.parseIdOrThrow;
  final Response<dynamic> response =
      await _dio.get('/players.$extensionJson/$id/tournaments/last');
  if (response.data is Iterable) {
    return null;
  } else {
    return PlayerTournamentResponse.fromMap(response.data);
  }
}