use of com.instructure.canvasapi2.models.AssignmentGroup in project instructure-android by instructure.
the class AssignmentManager method getAssignmentGroupsWithAssignments.
public static void getAssignmentGroupsWithAssignments(long courseId, final boolean forceNetwork, StatusCallback<List<AssignmentGroup>> callback) {
if (isTesting() || mTesting) {
AssignmentManager_Test.getAssignmentGroupsWithAssignments(courseId, callback);
} 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.getNextPageAssignmentGroupsWithAssignments(forceNetwork, nextUrl, adapter, callback);
}
};
adapter.setStatusCallback(depaginatedCallback);
AssignmentAPI.getFirstPageAssignmentGroupsWithAssignments(courseId, adapter, callback, params);
}
}
use of com.instructure.canvasapi2.models.AssignmentGroup in project instructure-android by instructure.
the class AssignmentManager_Test method getAssignmentGroupsWithAssignments.
public static void getAssignmentGroupsWithAssignments(long courseId, StatusCallback<List<AssignmentGroup>> callback) {
// TODO:
Response httpResponse = new Response.Builder().request(new Request.Builder().url("https://test.com").build()).code(200).message("todo").protocol(Protocol.HTTP_1_0).body(ResponseBody.create(MediaType.parse("application/json"), "todo".getBytes())).addHeader("content-type", "application/json").build();
List<AssignmentGroup> assignments = new ArrayList<>();
retrofit2.Response<List<AssignmentGroup>> response = retrofit2.Response.success(assignments, httpResponse);
callback.onResponse(response, new LinkHeaders(), ApiType.CACHE);
}
use of com.instructure.canvasapi2.models.AssignmentGroup in project instructure-android by instructure.
the class AssignmentManager_Test method getAssignmentGroupsWithAssignmentsForGradingPeriod.
public static void getAssignmentGroupsWithAssignmentsForGradingPeriod(long courseId, StatusCallback<List<AssignmentGroup>> callback, long gradingPeriodId) {
// TODO:
Response httpResponse = new Response.Builder().request(new Request.Builder().url("https://test.com").build()).code(200).message("todo").protocol(Protocol.HTTP_1_0).body(ResponseBody.create(MediaType.parse("application/json"), "todo".getBytes())).addHeader("content-type", "application/json").build();
List<AssignmentGroup> assignments = new ArrayList<>();
retrofit2.Response<List<AssignmentGroup>> response = retrofit2.Response.success(assignments, httpResponse);
callback.onResponse(response, new LinkHeaders(), ApiType.CACHE);
}
use of com.instructure.canvasapi2.models.AssignmentGroup in project instructure-android by instructure.
the class AssignmentManager_Test method getAssignmentGroup.
public static void getAssignmentGroup(long courseId, long assignmentGroupId, StatusCallback<AssignmentGroup> callback) {
// TODO:
Response httpResponse = new Response.Builder().request(new Request.Builder().url("https://test.com").build()).code(200).message("todo").protocol(Protocol.HTTP_1_0).body(ResponseBody.create(MediaType.parse("application/json"), "todo".getBytes())).addHeader("content-type", "application/json").build();
AssignmentGroup assignmentGroup = new AssignmentGroup();
retrofit2.Response<AssignmentGroup> response = retrofit2.Response.success(assignmentGroup, httpResponse);
callback.onResponse(response, new LinkHeaders(), ApiType.CACHE);
}
use of com.instructure.canvasapi2.models.AssignmentGroup 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