use of com.instructure.canvasapi2.utils.ExhaustiveListCallback in project instructure-android by instructure.
the class GroupManager method getAllGroupsForCourse.
public static void getAllGroupsForCourse(long courseId, StatusCallback<List<Group>> callback, boolean forceNetwork) {
if (isTesting() || mTesting) {
// TODO
} else {
final RestParams params = new RestParams.Builder().withForceReadFromNetwork(forceNetwork).withPerPageQueryParam(true).withShouldIgnoreToken(false).build();
final RestBuilder adapter = new RestBuilder(callback);
StatusCallback<List<Group>> depaginatedCallback = new ExhaustiveListCallback<Group>(callback) {
@Override
public void getNextPage(@NonNull StatusCallback<List<Group>> callback, @NonNull String nextUrl, boolean isCached) {
GroupAPI.getNextPageGroups(nextUrl, adapter, callback, params);
}
};
adapter.setStatusCallback(depaginatedCallback);
GroupAPI.getGroupsForCourse(adapter, depaginatedCallback, params, courseId);
}
}
use of com.instructure.canvasapi2.utils.ExhaustiveListCallback in project instructure-android by instructure.
the class QuizManager method getAllQuizzes.
public static void getAllQuizzes(long courseId, final boolean forceNetwork, StatusCallback<List<Quiz>> callback) {
if (isTesting() || mTesting) {
QuizManager_Test.getQuizesQuestions(callback);
} else {
final RestBuilder adapter = new RestBuilder(callback);
StatusCallback<List<Quiz>> depaginatedCallback = new ExhaustiveListCallback<Quiz>(callback) {
@Override
public void getNextPage(@NonNull StatusCallback<List<Quiz>> callback, @NonNull String nextUrl, boolean isCached) {
QuizAPI.getNextPageQuizzes(forceNetwork, nextUrl, adapter, callback);
}
};
adapter.setStatusCallback(depaginatedCallback);
QuizAPI.getFirstPageQuizzes(courseId, forceNetwork, adapter, depaginatedCallback);
}
}
use of com.instructure.canvasapi2.utils.ExhaustiveListCallback in project instructure-android by instructure.
the class RecipientManager method searchAllRecipients.
public static void searchAllRecipients(final boolean forceNetwork, String searchQuery, String context, StatusCallback<List<Recipient>> callback) {
if (isTesting() || mTesting) {
// TODO...
} else {
final RestBuilder adapter = new RestBuilder(callback);
StatusCallback<List<Recipient>> depaginatedCallback = new ExhaustiveListCallback<Recipient>(callback) {
@Override
public void getNextPage(@NonNull StatusCallback<List<Recipient>> callback, @NonNull String nextUrl, boolean isCached) {
RecipientAPI.getNextPageRecipients(forceNetwork, nextUrl, adapter, callback);
}
};
adapter.setStatusCallback(depaginatedCallback);
RecipientAPI.getFirstPageRecipients(forceNetwork, searchQuery, context, adapter, depaginatedCallback);
}
}
use of com.instructure.canvasapi2.utils.ExhaustiveListCallback in project instructure-android by instructure.
the class SectionManager method getAllSectionsForCourse.
public static void getAllSectionsForCourse(long courseId, StatusCallback<List<Section>> callback, boolean forceNetwork) {
if (isTesting() || mTesting) {
// TODO
} else {
final RestParams params = new RestParams.Builder().withForceReadFromNetwork(forceNetwork).withPerPageQueryParam(true).withShouldIgnoreToken(false).build();
final RestBuilder adapter = new RestBuilder(callback);
StatusCallback<List<Section>> depaginatedCallback = new ExhaustiveListCallback<Section>(callback) {
@Override
public void getNextPage(@NonNull StatusCallback<List<Section>> callback, @NonNull String nextUrl, boolean isCached) {
SectionAPI.getNextPageSections(nextUrl, adapter, callback, params);
}
};
adapter.setStatusCallback(depaginatedCallback);
SectionAPI.getFirstSectionsForCourse(courseId, adapter, depaginatedCallback, params);
}
}
use of com.instructure.canvasapi2.utils.ExhaustiveListCallback 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);
}
}
Aggregations