use of com.instructure.canvasapi2.models.QuizSubmission in project instructure-android by instructure.
the class QuizManager method getAllQuizSubmissions.
public static void getAllQuizSubmissions(final CanvasContext canvasContext, final long quizId, final boolean forceNetwork, final StatusCallback<List<QuizSubmission>> callback) {
if (isTesting() || mTesting) {
QuizManager_Test.getAllQuizSubmissions(callback);
} else {
final RestBuilder adapter = new RestBuilder(callback);
final RestParams params = new RestParams.Builder().withPerPageQueryParam(true).withShouldIgnoreToken(false).withForceReadFromNetwork(forceNetwork).build();
final ExhaustiveCallback<QuizSubmissionResponse, QuizSubmission> paginatedCallback = new ExhaustiveCallback<QuizSubmissionResponse, QuizSubmission>(callback) {
@Override
public void getNextPage(@NotNull StatusCallback<QuizSubmissionResponse> callback, @NotNull String nextUrl, boolean isCached) {
QuizAPI.getQuizSubmissions(canvasContext, quizId, adapter, callback, params);
}
@NotNull
@Override
public List<QuizSubmission> extractItems(QuizSubmissionResponse response) {
return response.getQuizSubmissions();
}
};
adapter.setStatusCallback(paginatedCallback);
QuizAPI.getQuizSubmissions(canvasContext, quizId, adapter, paginatedCallback, params);
}
}
use of com.instructure.canvasapi2.models.QuizSubmission in project instructure-android by instructure.
the class QuizManager method postQuizSubmit.
public static void postQuizSubmit(CanvasContext canvasContext, QuizSubmission quizSubmission, boolean forceNetwork, final StatusCallback<QuizSubmissionResponse> callback) {
final RestBuilder adapter = new RestBuilder(callback);
final RestParams params = new RestParams.Builder().withPerPageQueryParam(true).withShouldIgnoreToken(false).withForceReadFromNetwork(forceNetwork).build();
QuizAPI.postQuizSubmit(canvasContext, quizSubmission, adapter, params, callback);
}
use of com.instructure.canvasapi2.models.QuizSubmission in project instructure-android by instructure.
the class QuizManager method postQuizQuestionEssay.
public static void postQuizQuestionEssay(QuizSubmission quizSubmission, String answer, long questionId, boolean forceNetwork, @NonNull StatusCallback<QuizSubmissionQuestionResponse> callback) {
final RestBuilder adapter = new RestBuilder(callback);
final RestParams params = new RestParams.Builder().withPerPageQueryParam(true).withShouldIgnoreToken(false).withForceReadFromNetwork(forceNetwork).build();
QuizAPI.postQuizQuestionEssay(quizSubmission, questionId, answer, adapter, params, callback);
}
use of com.instructure.canvasapi2.models.QuizSubmission in project instructure-android by instructure.
the class QuizManager method submitQuiz.
public static void submitQuiz(CanvasContext canvasContext, QuizSubmission quizSubmission, final boolean forceNetwork, final StatusCallback<QuizSubmissionResponse> callback) {
final RestBuilder adapter = new RestBuilder(callback);
final RestParams params = new RestParams.Builder().withPerPageQueryParam(true).withShouldIgnoreToken(false).withForceReadFromNetwork(forceNetwork).build();
QuizAPI.submitQuiz(canvasContext, quizSubmission, adapter, params, callback);
}
use of com.instructure.canvasapi2.models.QuizSubmission in project instructure-android by instructure.
the class QuizManager method postQuizQuestionMultiChoice.
public static void postQuizQuestionMultiChoice(QuizSubmission quizSubmission, long answer, long questionId, boolean forceNetwork, @NonNull StatusCallback<QuizSubmissionQuestionResponse> callback) {
final RestBuilder adapter = new RestBuilder(callback);
final RestParams params = new RestParams.Builder().withPerPageQueryParam(true).withShouldIgnoreToken(false).withForceReadFromNetwork(forceNetwork).build();
QuizAPI.postQuizQuestionMultiChoice(quizSubmission.getId(), quizSubmission.getAttempt(), questionId, answer, quizSubmission.getValidationToken(), adapter, params, callback);
}
Aggregations