use of com.instructure.canvasapi2.utils.ExhaustiveListCallback in project instructure-android by instructure.
the class RecipientManager method searchAllRecipientsNoSyntheticContexts.
/**
* Synthetic contexts == sections and groups, so this will return only actual users, not groups or sections
*
* @param forceNetwork
* @param searchQuery
* @param context
* @param callback
*/
public static void searchAllRecipientsNoSyntheticContexts(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.getFirstPageRecipientsNoSyntheticContexts(forceNetwork, searchQuery, context, adapter, depaginatedCallback);
}
}
use of com.instructure.canvasapi2.utils.ExhaustiveListCallback in project instructure-android by instructure.
the class UserManager method getAllEnrollmentsPeopleList.
public static void getAllEnrollmentsPeopleList(final CanvasContext canvasContext, StatusCallback<List<User>> callback, final boolean forceNetwork) {
if (isTesting() || mTesting) {
// TODO
} else {
final RestParams params = new RestParams.Builder().withCanvasContext(canvasContext).withForceReadFromNetwork(forceNetwork).withPerPageQueryParam(true).withShouldIgnoreToken(false).build();
// We don't want the canvas context on the paginated params
final RestParams paginatedParams = new RestParams.Builder().withForceReadFromNetwork(forceNetwork).withPerPageQueryParam(true).withShouldIgnoreToken(false).build();
final RestBuilder adapter = new RestBuilder(callback);
StatusCallback<List<User>> depaginatedCallback = new ExhaustiveListCallback<User>(callback) {
@Override
public void getNextPage(@NonNull StatusCallback<List<User>> callback, @NonNull String nextUrl, boolean isCached) {
UserAPI.getAllPeopleList(adapter, paginatedParams, canvasContext.getId(), callback);
}
};
adapter.setStatusCallback(depaginatedCallback);
UserAPI.getAllPeopleList(adapter, params, canvasContext.getId(), depaginatedCallback);
}
}
use of com.instructure.canvasapi2.utils.ExhaustiveListCallback in project instructure-android by instructure.
the class AccountNotificationManager method getAllAccountNotifications.
public static void getAllAccountNotifications(StatusCallback<List<AccountNotification>> callback, boolean forceNetwork) {
if (isTesting() || mTesting) {
// TODO
} else {
final RestBuilder adapter = new RestBuilder(callback);
final RestParams params = new RestParams.Builder().withForceReadFromNetwork(forceNetwork).withPerPageQueryParam(true).build();
StatusCallback<List<AccountNotification>> depaginatedCallback = new ExhaustiveListCallback<AccountNotification>(callback) {
@Override
public void getNextPage(StatusCallback<List<AccountNotification>> callback, String nextUrl, boolean isCached) {
AccountNotificationAPI.getAccountNotifications(adapter, params, callback);
}
};
adapter.setStatusCallback(depaginatedCallback);
AccountNotificationAPI.getAccountNotifications(adapter, params, depaginatedCallback);
}
}
use of com.instructure.canvasapi2.utils.ExhaustiveListCallback in project instructure-android by instructure.
the class AssignmentManager method getAllGradeableStudentsForAssignment.
public static void getAllGradeableStudentsForAssignment(long courseId, long assignmentId, final boolean forceNetwork, StatusCallback<List<GradeableStudent>> callback) {
if (isTesting() || mTesting) {
AssignmentManager_Test.getAllGradeableStudentsForAssignment(courseId, assignmentId, callback);
} else {
final RestBuilder adapter = new RestBuilder(callback);
StatusCallback<List<GradeableStudent>> depaginatedCallback = new ExhaustiveListCallback<GradeableStudent>(callback) {
@Override
public void getNextPage(@NotNull StatusCallback<List<GradeableStudent>> callback, @NotNull String nextUrl, boolean isCached) {
AssignmentAPI.getNextPageGradeableStudents(forceNetwork, nextUrl, adapter, callback);
}
};
adapter.setStatusCallback(depaginatedCallback);
AssignmentAPI.getFirstPageGradeableStudentsForAssignment(courseId, assignmentId, adapter, depaginatedCallback);
}
}
use of com.instructure.canvasapi2.utils.ExhaustiveListCallback in project instructure-android by instructure.
the class AssignmentManager method getAssignmentGroupsWithAssignmentsForGradingPeriod.
public static void getAssignmentGroupsWithAssignmentsForGradingPeriod(long courseId, final long gradingPeriodId, boolean scopeToStudent, final boolean forceNetwork, StatusCallback<List<AssignmentGroup>> callback) {
if (isTesting() || mTesting) {
AssignmentManager_Test.getAssignmentGroupsWithAssignmentsForGradingPeriod(courseId, callback, gradingPeriodId);
} else {
final RestBuilder adapter = new RestBuilder(callback);
RestParams params = new RestParams.Builder().withPerPageQueryParam(true).withShouldIgnoreToken(false).withForceReadFromNetwork(forceNetwork).build();
StatusCallback<List<AssignmentGroup>> depaginatedCallback = new ExhaustiveListCallback<AssignmentGroup>(callback) {
@Override
public void getNextPage(StatusCallback<List<AssignmentGroup>> callback, String nextUrl, boolean isCached) {
AssignmentAPI.getNextPageAssignmentGroupsWithAssignmentsForGradingPeriod(forceNetwork, nextUrl, adapter, callback);
}
};
adapter.setStatusCallback(depaginatedCallback);
AssignmentAPI.getFirstPageAssignmentGroupsWithAssignmentsForGradingPeriod(courseId, gradingPeriodId, scopeToStudent, adapter, callback, params);
}
}
Aggregations