コード例 #1
0
        public static void CommitConformityAnswer(
            ExerciseFormat exerciseFormat,
            Guid exerciseId,
            Guid setId,
            int wordId,
            string taskAnswer,
            bool userChoice)
        {
            var resource = $"exercises/commit/conformity";
            var request  = new RestRequest(resource, Method.POST);
            var body     = new
            {
                ExerciseFormat = exerciseFormat,
                ExerciseId     = exerciseId,
                SetId          = setId,
                WordId         = wordId,
                TaskAnswer     = taskAnswer,
                UserChoice     = userChoice
            };

            request.AddJsonBody(body);
            request.AddHeader("Authorization", "Bearer " + token);

            client.Execute(request);
        }
コード例 #2
0
        public static ConformityExerciseDto StartConformityExercise(ExerciseFormat exerciseFormat, Guid setId)
        {
            var resource = $"exercises/create/conformity";
            var request  = new RestRequest(resource, Method.POST);
            var body     = new
            {
                ExerciseFormat = exerciseFormat,
                SetId          = setId
            };

            request.AddJsonBody(body);
            request.AddHeader("Authorization", "Bearer " + token);

            var response = client.Execute(request);
            var content  = JsonConvert.DeserializeObject <ConformityExerciseDto>(response.Content);

            return(content);
        }
コード例 #3
0
        public static ExerciseResultDto FinishExercise(Guid exerciseId, ExerciseFormat exerciseFormat)
        {
            var resource = $"exercises/finish";
            var request  = new RestRequest(resource, Method.POST);
            var body     = new
            {
                ExerciseId     = exerciseId,
                ExerciseFormat = exerciseFormat
            };

            request.AddJsonBody(body);
            request.AddHeader("Authorization", "Bearer " + token);

            var response = client.Execute(request);
            var content  = JsonConvert.DeserializeObject <ExerciseResultDto>(response.Content);

            return(content);
        }
コード例 #4
0
        public static void CommitChoiceAnswer(
            ExerciseFormat exerciseFormat,
            Guid exerciseId,
            Guid setId,
            int wordId,
            string chosenAnswer)
        {
            var resource = $"exercises/commit/choice";
            var request  = new RestRequest(resource, Method.POST);
            var body     = new
            {
                ExerciseFormat = exerciseFormat,
                ExerciseId     = exerciseId,
                SetId          = setId,
                WordId         = wordId,
                ChosenAnswer   = chosenAnswer
            };

            request.AddJsonBody(body);
            request.AddHeader("Authorization", "Bearer " + token);

            client.Execute(request);
        }