getScores static method
Returns the score, with optional filters.
Implementation
static Future<int> getScores({
final String? userId,
final String? deviceId,
final String? eventType,
final QueryType? queryType,
}) async {
final Map<String, String> parameters = <String, String>{};
if (userId != null) {
parameters['user_id'] = userId;
}
if (deviceId != null) {
parameters['device_id'] = deviceId;
}
if (eventType != null) {
parameters['event_type'] = eventType;
}
final Response response = await HttpHelper().doGetRequest(
UriHelper.getEventsUri(
path: '/scores',
queryParameters: parameters,
queryType: queryType,
),
queryType: queryType,
);
_checkResponse(response);
final Map<String, dynamic> json =
jsonDecode(response.body) as Map<String, dynamic>;
return json['score'] as int;
}