use of com.instructure.canvasapi2.models.Enrollment 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.models.Enrollment in project instructure-android by instructure.
the class UserManager method getSelfEnrollments.
public static void getSelfEnrollments(boolean forceNetwork, StatusCallback<List<Enrollment>> callback) {
if (isTesting() || mTesting) {
// TODO
} else {
RestBuilder adapter = new RestBuilder(callback);
RestParams params = new RestParams.Builder().withShouldIgnoreToken(false).withPerPageQueryParam(false).withForceReadFromNetwork(forceNetwork).build();
UserAPI.getSelfEnrollments(adapter, params, callback);
}
}
use of com.instructure.canvasapi2.models.Enrollment in project instructure-android by instructure.
the class CourseManager method getEnrollmentsForGradingPeriod.
public static void getEnrollmentsForGradingPeriod(long courseId, long gradingPeriodId, StatusCallback<List<Enrollment>> callback, boolean forceNetwork) {
if (isTesting() || mTesting) {
// TODO
} else {
RestBuilder adapter = new RestBuilder(callback);
RestParams params = new RestParams.Builder().withPerPageQueryParam(true).withShouldIgnoreToken(false).withForceReadFromNetwork(forceNetwork).build();
CourseAPI.getEnrollmentsForGradingPeriod(courseId, gradingPeriodId, adapter, params, callback);
}
}
use of com.instructure.canvasapi2.models.Enrollment in project instructure-android by instructure.
the class EnrollmentManager method getAllEnrollmentsForCourse.
public static void getAllEnrollmentsForCourse(final long courseId, final String enrollmentType, 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.getFirstPageEnrollmentsForCourse(adapter, params, courseId, enrollmentType, depaginatedCallback);
}
}
use of com.instructure.canvasapi2.models.Enrollment in project instructure-android by instructure.
the class EnrollmentManager method getEnrollmentsForCourse.
public static void getEnrollmentsForCourse(long courseId, String enrollmentType, boolean forceNetwork, StatusCallback<List<Enrollment>> callback) {
if (isTesting() || mTesting) {
// TODO
} else {
RestBuilder adapter = new RestBuilder(callback);
RestParams params = new RestParams.Builder().withPerPageQueryParam(true).withShouldIgnoreToken(false).withForceReadFromNetwork(forceNetwork).build();
EnrollmentAPI.getEnrollmentsForCourse(adapter, params, courseId, enrollmentType, callback);
}
}
Aggregations