Search in sources :

Example 16 with StatusCallback

use of com.instructure.canvasapi2.StatusCallback in project instructure-android by instructure.

the class AssignmentAPI method getNextPageAssignmentGroupsWithAssignmentsForGradingPeriod.

public static void getNextPageAssignmentGroupsWithAssignmentsForGradingPeriod(boolean forceNetwork, @NonNull String nextUrl, @NonNull RestBuilder adapter, @NonNull StatusCallback<List<AssignmentGroup>> callback) {
    RestParams params = new RestParams.Builder().withShouldIgnoreToken(false).withPerPageQueryParam(true).withForceReadFromNetwork(forceNetwork).build();
    callback.addCall(adapter.build(AssignmentInterface.class, params).getNextPageAssignmentGroupListWithAssignmentsForGradingPeriod(nextUrl)).enqueue(callback);
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Example 17 with StatusCallback

use of com.instructure.canvasapi2.StatusCallback in project instructure-android by instructure.

the class CourseAPI method getNextPageCourseStudents.

public static void getNextPageCourseStudents(boolean forceNetwork, String nextUrl, RestBuilder adapter, StatusCallback<List<User>> callback) {
    RestParams params = new RestParams.Builder().withShouldIgnoreToken(false).withPerPageQueryParam(true).withForceReadFromNetwork(forceNetwork).build();
    callback.addCall(adapter.build(CoursesInterface.class, params).getNextPageStudents(nextUrl)).enqueue(callback);
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Example 18 with StatusCallback

use of com.instructure.canvasapi2.StatusCallback in project instructure-android by instructure.

the class EnrollmentAPI method getNextPageEnrollments.

public static void getNextPageEnrollments(boolean forceNetwork, String nextUrl, RestBuilder adapter, StatusCallback<List<Enrollment>> callback) {
    RestParams params = new RestParams.Builder().withShouldIgnoreToken(false).withPerPageQueryParam(true).withForceReadFromNetwork(forceNetwork).build();
    callback.addCall(adapter.build(EnrollmentInterface.class, params).getNextPage(nextUrl)).enqueue(callback);
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Example 19 with StatusCallback

use of com.instructure.canvasapi2.StatusCallback in project instructure-android by instructure.

the class ErrorReportAPI method buildInterface.

private static ErrorReportInterface buildInterface(StatusCallback<?> callback) {
    RestBuilder adapter = new RestBuilder(callback);
    RestParams params = new RestParams.Builder().withShouldIgnoreToken(true).withPerPageQueryParam(false).withForceReadFromCache(false).withForceReadFromNetwork(true).build();
    return adapter.build(ErrorReportInterface.class, params);
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Example 20 with StatusCallback

use of com.instructure.canvasapi2.StatusCallback in project instructure-android by instructure.

the class QuizManager_Test method getQuizQuestions.

public static void getQuizQuestions(long courseId, long quizId, StatusCallback<List<QuizQuestion>> callback) {
    // TODO:
    Response response = new Response.Builder().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<QuizQuestion> quizQuestions = new ArrayList<>();
    retrofit2.Response<List<QuizQuestion>> response1 = retrofit2.Response.success(quizQuestions, response);
    callback.onResponse(response1, new LinkHeaders(), ApiType.CACHE);
}
Also used : QuizSubmissionResponse(com.instructure.canvasapi2.models.QuizSubmissionResponse) Response(okhttp3.Response) QuizSubmissionQuestionResponse(com.instructure.canvasapi2.models.QuizSubmissionQuestionResponse) LinkHeaders(com.instructure.canvasapi2.utils.LinkHeaders) QuizQuestion(com.instructure.canvasapi2.models.QuizQuestion) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List)

Aggregations

RestBuilder (com.instructure.canvasapi2.builders.RestBuilder)279 RestParams (com.instructure.canvasapi2.builders.RestParams)247 LinkHeaders (com.instructure.canvasapi2.utils.LinkHeaders)80 Response (okhttp3.Response)57 List (java.util.List)56 StatusCallback (com.instructure.canvasapi2.StatusCallback)44 ArrayList (java.util.ArrayList)43 ExhaustiveListCallback (com.instructure.canvasapi2.utils.ExhaustiveListCallback)31 NonNull (android.support.annotation.NonNull)30 Request (okhttp3.Request)27 ApiType (com.instructure.canvasapi2.utils.ApiType)22 QuizSubmissionResponse (com.instructure.canvasapi2.models.QuizSubmissionResponse)14 Response (retrofit2.Response)14 QuizSubmissionQuestionResponse (com.instructure.canvasapi2.models.QuizSubmissionQuestionResponse)12 ParentResponse (com.instructure.canvasapi2.models.ParentResponse)10 Conversation (com.instructure.canvasapi2.models.Conversation)9 FileFolder (com.instructure.canvasapi2.models.FileFolder)8 GradingPeriodResponse (com.instructure.canvasapi2.models.GradingPeriodResponse)8 User (com.instructure.canvasapi2.models.User)7 Assignment (com.instructure.canvasapi2.models.Assignment)6