use of com.instructure.canvasapi2.models.Submission in project instructure-android by instructure.
the class SubmissionManager method getAllStudentSubmissionsForCourse.
public static void getAllStudentSubmissionsForCourse(final long studentId, final long courseId, @NonNull StatusCallback<List<Submission>> callback, boolean forceNetwork) {
if (isTesting() | mTesting) {
SubmissionManager_Test.getStudentSubmissionsForCourse(studentId, courseId, callback);
} else {
final RestBuilder adapter = new RestBuilder(callback);
final RestParams params = new RestParams.Builder().withForceReadFromNetwork(forceNetwork).withPerPageQueryParam(true).withShouldIgnoreToken(false).build();
StatusCallback<List<Submission>> depaginatedCallback = new ExhaustiveListCallback<Submission>(callback) {
@Override
public void getNextPage(@NonNull StatusCallback<List<Submission>> callback, @NonNull String nextUrl, boolean isCached) {
SubmissionAPI.getStudentSubmissionsForCourse(courseId, studentId, adapter, callback, params);
}
};
adapter.setStatusCallback(depaginatedCallback);
SubmissionAPI.getStudentSubmissionsForCourse(courseId, studentId, adapter, callback, params);
}
}
use of com.instructure.canvasapi2.models.Submission in project instructure-android by instructure.
the class SubmissionManager method postSubmissionExcusedStatus.
public static void postSubmissionExcusedStatus(long courseId, long assignmentId, long userId, boolean isExcused, boolean forceNetwork, @NonNull StatusCallback<Submission> callback) {
if (isTesting() | mTesting) {
// SubmissionManager_Test.postSubmissionGrade(courseId, assignmentId, userId, score, callback);
} else {
RestBuilder adapter = new RestBuilder(callback);
RestParams params = new RestParams.Builder().withForceReadFromNetwork(forceNetwork).withPerPageQueryParam(false).withShouldIgnoreToken(false).build();
SubmissionAPI.postSubmissionExcusedStatus(courseId, assignmentId, userId, isExcused, adapter, callback, params);
}
}
use of com.instructure.canvasapi2.models.Submission in project instructure-android by instructure.
the class SubmissionManager method postMediaSubmission.
public static void postMediaSubmission(CanvasContext canvasContext, long assignmentId, String submissionType, String mediaId, String mediaType, StatusCallback<Submission> callback) {
if (isTesting() || mTesting) {
// TODO
} else {
RestBuilder adapter = new RestBuilder(callback);
RestParams params = new RestParams.Builder().withCanvasContext(canvasContext).build();
SubmissionAPI.postMediaSubmission(canvasContext.getId(), assignmentId, submissionType, mediaId, mediaType, adapter, params, callback);
}
}
use of com.instructure.canvasapi2.models.Submission in project instructure-android by instructure.
the class SubmissionManager method postSubmissionComment.
public static void postSubmissionComment(long courseId, long assignmentId, long userId, String commentText, boolean isGroupMessage, List<Long> attachments, @NonNull StatusCallback<Submission> callback) {
if (isTesting() || mTesting) {
SubmissionManager_Test.postSubmissionComment(courseId, assignmentId, userId, commentText, isGroupMessage, callback);
} else {
RestBuilder adapter = new RestBuilder(callback);
RestParams params = new RestParams.Builder().build();
SubmissionAPI.postSubmissionComment(courseId, assignmentId, userId, commentText, isGroupMessage, attachments, adapter, callback, params);
}
}
use of com.instructure.canvasapi2.models.Submission in project instructure-android by instructure.
the class SubmissionManager method getSingleSubmission.
public static void getSingleSubmission(long courseId, long assignmentId, long studentId, @NonNull StatusCallback<Submission> callback, boolean forceNetwork) {
if (isTesting() | mTesting) {
// TODO
} else {
RestBuilder adapter = new RestBuilder(callback);
RestParams params = new RestParams.Builder().withForceReadFromNetwork(forceNetwork).withPerPageQueryParam(false).build();
SubmissionAPI.getSingleSubmission(courseId, assignmentId, studentId, adapter, callback, params);
}
}
Aggregations