|
|
@ -34,6 +34,20 @@ class MarathonApiClient {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Future<int> getMarathonersCount({required String marathonId}) async {
|
|
|
|
|
|
|
|
Response response = await ApiClient().getJsonForResponse(
|
|
|
|
|
|
|
|
ApiConsts.marathonGetMarathonersCount + '?marathonId=$marathonId',
|
|
|
|
|
|
|
|
token: AppState().getMarathonToken == null || AppState().getMarathonToken == "" ? await getMarathonToken() : AppState().getMarathonToken,
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var json = jsonDecode(response.body);
|
|
|
|
|
|
|
|
logger.i("json in getMarathonersCount: $json");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MarathonGenericModel marathonGenericModel = MarathonGenericModel.fromJson(json);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return marathonGenericModel.data as int;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future<String> getProjectId() async {
|
|
|
|
Future<String> getProjectId() async {
|
|
|
|
return await ApiClient().postJsonForObject(
|
|
|
|
return await ApiClient().postJsonForObject(
|
|
|
|
(json) {
|
|
|
|
(json) {
|
|
|
@ -89,6 +103,7 @@ class MarathonApiClient {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Future<QuestionModel> getNextQuestion({required String? questionId, required String marathonId}) async {
|
|
|
|
Future<QuestionModel> getNextQuestion({required String? questionId, required String marathonId}) async {
|
|
|
|
Map<String, String?> jsonObject = <String, String?>{
|
|
|
|
Map<String, String?> jsonObject = <String, String?>{
|
|
|
|
"previousQuestionId": questionId,
|
|
|
|
"previousQuestionId": questionId,
|
|
|
|