use of com.instructure.canvasapi2.utils.ExhaustiveListCallback in project instructure-android by instructure.
the class EnrollmentManager method getSelfEnrollments.
public static void getSelfEnrollments(@Nullable final List<String> types, @Nullable final List<String> states, boolean forceNetwork, @NonNull StatusCallback<List<Enrollment>> callback) {
if (isTesting() || mTesting) {
} else {
final RestBuilder adapter = new RestBuilder(callback);
final RestParams params = new RestParams.Builder().withPerPageQueryParam(true).withForceReadFromNetwork(forceNetwork).build();
StatusCallback<List<Enrollment>> depaginatedCallback = new ExhaustiveListCallback<Enrollment>(callback) {
@Override
public void getNextPage(@NonNull StatusCallback<List<Enrollment>> callback, @NonNull String nextUrl, boolean isCached) {
EnrollmentAPI.getSelfEnrollments(types, states, adapter, params, callback);
}
};
adapter.setStatusCallback(depaginatedCallback);
EnrollmentAPI.getSelfEnrollments(types, states, adapter, params, callback);
}
}
use of com.instructure.canvasapi2.utils.ExhaustiveListCallback in project instructure-android by instructure.
the class EnrollmentManager method getAllEnrollmentsForUserInCourse.
public static void getAllEnrollmentsForUserInCourse(final long courseId, final long userId, final boolean forceNetwork, StatusCallback<List<Enrollment>> callback) {
if (isTesting() || mTesting) {
// TODO
} else {
final RestBuilder adapter = new RestBuilder(callback);
final RestParams params = new RestParams.Builder().withPerPageQueryParam(true).withShouldIgnoreToken(false).withForceReadFromNetwork(forceNetwork).build();
StatusCallback<List<Enrollment>> depaginatedCallback = new ExhaustiveListCallback<Enrollment>(callback) {
@Override
public void getNextPage(@NonNull StatusCallback<List<Enrollment>> callback, @NonNull String nextUrl, boolean isCached) {
EnrollmentAPI.getNextPageEnrollments(forceNetwork, nextUrl, adapter, callback);
}
};
adapter.setStatusCallback(depaginatedCallback);
EnrollmentAPI.getFirstPageEnrollmentsForUserInCourse(adapter, params, courseId, userId, depaginatedCallback);
}
}
use of com.instructure.canvasapi2.utils.ExhaustiveListCallback in project instructure-android by instructure.
the class GroupCategoriesManager method getAllGroupsForCategory.
public static void getAllGroupsForCategory(long categoryId, 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) {
GroupCategoriesAPI.getNextPageGroups(nextUrl, adapter, callback, params);
}
};
adapter.setStatusCallback(depaginatedCallback);
GroupCategoriesAPI.getFirstPageGroupsInCategory(categoryId, adapter, depaginatedCallback, params);
}
}
use of com.instructure.canvasapi2.utils.ExhaustiveListCallback in project instructure-android by instructure.
the class GroupManager method getFavoriteGroups.
public static void getFavoriteGroups(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.getFavoriteGroups(adapter, depaginatedCallback, params);
}
}
use of com.instructure.canvasapi2.utils.ExhaustiveListCallback in project instructure-android by instructure.
the class GroupManager method getAllGroups.
public static void getAllGroups(StatusCallback<List<Group>> callback, boolean forceNetwork) {
if (isTesting() || mTesting) {
// TODO
} else {
final RestParams params = new RestParams.Builder().withForceReadFromNetwork(forceNetwork).withPerPageQueryParam(true).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.getFirstPageGroups(adapter, depaginatedCallback, params);
}
}
Aggregations