getLeaderboard static method
Returns all the LeaderboardEntry, with optional filters.
Implementation
static Future<List<LeaderboardEntry>> getLeaderboard({
final String? eventType,
final UriHelper uriHelper = uriHelperEventsProd,
}) async {
final Map<String, String> parameters = <String, String>{};
if (eventType != null) {
parameters['event_type'] = eventType;
}
final Response response = await HttpHelper().doGetRequest(
uriHelper.getUri(
path: '/leaderboard',
queryParameters: parameters,
),
uriHelper: uriHelper,
);
_checkResponse(response);
final List<LeaderboardEntry> result = <LeaderboardEntry>[];
final List<dynamic> json =
HttpHelper().jsonDecode(response.body) as List<dynamic>;
for (var element in json) {
result.add(LeaderboardEntry.fromJson(element));
}
return result;
}