Search in sources :

Example 26 with ToDo

use of com.instructure.canvasapi2.models.ToDo in project instructure-android by instructure.

the class CourseManager method getCourseWithGradeAirwolf.

// region Airwolf
public static void getCourseWithGradeAirwolf(String airwolfDomain, String parentId, String studentId, long courseId, StatusCallback<Course> callback) {
    if (isTesting() || mTesting) {
    // TODO:
    } else {
        RestBuilder adapter = new RestBuilder(callback);
        RestParams params = new RestParams.Builder().withPerPageQueryParam(false).withShouldIgnoreToken(false).withDomain(airwolfDomain).withAPIVersion("").build();
        CourseAPI.getCourseWithGradeAirwolf(parentId, studentId, courseId, adapter, callback, params);
    }
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Example 27 with ToDo

use of com.instructure.canvasapi2.models.ToDo in project instructure-android by instructure.

the class CourseManager method getCourseWithSyllabusAirwolf.

public static void getCourseWithSyllabusAirwolf(String airwolfDomain, String parentId, String studentId, long courseId, StatusCallback<Course> callback) {
    if (isTesting() || mTesting) {
    // TODO:
    } else {
        RestBuilder adapter = new RestBuilder(callback);
        RestParams params = new RestParams.Builder().withPerPageQueryParam(false).withShouldIgnoreToken(false).withDomain(airwolfDomain).withAPIVersion("").build();
        CourseAPI.getCourseWithSyllabusAirwolf(parentId, studentId, courseId, adapter, callback, params);
    }
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Example 28 with ToDo

use of com.instructure.canvasapi2.models.ToDo in project instructure-android by instructure.

the class CourseManager method editCourseName.

public static void editCourseName(long courseId, String newCourseName, StatusCallback<Course> callback, boolean forceNetwork) {
    if (isTesting() || mTesting) {
    // TODO:
    // CourseManager_Test.editCourseName(courseId, callback);
    } else {
        Map<String, String> queryParams = new HashMap<>();
        queryParams.put("course[name]", newCourseName);
        RestBuilder adapter = new RestBuilder(callback);
        RestParams params = new RestParams.Builder().withPerPageQueryParam(false).withShouldIgnoreToken(false).withForceReadFromNetwork(forceNetwork).build();
        CourseAPI.updateCourse(courseId, queryParams, adapter, callback, params);
    }
}
Also used : HashMap(java.util.HashMap) RestParams(com.instructure.canvasapi2.builders.RestParams) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Example 29 with ToDo

use of com.instructure.canvasapi2.models.ToDo in project instructure-android by instructure.

the class DiscussionManager method getAllDiscussionTopicHeaders.

public static void getAllDiscussionTopicHeaders(@NonNull CanvasContext canvasContext, final boolean forceNetwork, StatusCallback<List<DiscussionTopicHeader>> callback) {
    if (isTesting() || mTesting) {
    // TODO:
    } else {
        final RestBuilder adapter = new RestBuilder(callback);
        final RestParams params = new RestParams.Builder().withForceReadFromNetwork(forceNetwork).withPerPageQueryParam(true).build();
        StatusCallback<List<DiscussionTopicHeader>> depaginatedCallback = new ExhaustiveListCallback<DiscussionTopicHeader>(callback) {

            @Override
            public void getNextPage(@NotNull StatusCallback<List<DiscussionTopicHeader>> callback, @NotNull String nextUrl, boolean isCached) {
                DiscussionAPI.getNextPage(nextUrl, adapter, callback, params);
            }
        };
        adapter.setStatusCallback(depaginatedCallback);
        DiscussionAPI.getFirstPageDiscussionTopicHeaders(canvasContext, adapter, depaginatedCallback, params);
    }
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder) List(java.util.List) StatusCallback(com.instructure.canvasapi2.StatusCallback) DiscussionTopicHeader(com.instructure.canvasapi2.models.DiscussionTopicHeader) ExhaustiveListCallback(com.instructure.canvasapi2.utils.ExhaustiveListCallback) NotNull(org.jetbrains.annotations.NotNull)

Example 30 with ToDo

use of com.instructure.canvasapi2.models.ToDo in project instructure-android by instructure.

the class DiscussionManager method getDiscussions.

public static void getDiscussions(final boolean forceNetwork, CanvasContext canvasContext, StatusCallback<List<DiscussionTopicHeader>> callback) {
    if (isTesting() || mTesting) {
    // TODO:
    } else {
        RestBuilder adapter = new RestBuilder(callback);
        RestParams params = new RestParams.Builder().withForceReadFromNetwork(forceNetwork).withPerPageQueryParam(true).build();
        DiscussionAPI.getDiscussions(canvasContext, adapter, callback, params);
    }
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Aggregations

RestBuilder (com.instructure.canvasapi2.builders.RestBuilder)158 RestParams (com.instructure.canvasapi2.builders.RestParams)141 LinkHeaders (com.instructure.canvasapi2.utils.LinkHeaders)51 Response (okhttp3.Response)47 List (java.util.List)43 ArrayList (java.util.ArrayList)36 Request (okhttp3.Request)26 StatusCallback (com.instructure.canvasapi2.StatusCallback)21 ExhaustiveListCallback (com.instructure.canvasapi2.utils.ExhaustiveListCallback)20 NonNull (android.support.annotation.NonNull)19 Conversation (com.instructure.canvasapi2.models.Conversation)10 QuizSubmissionQuestionResponse (com.instructure.canvasapi2.models.QuizSubmissionQuestionResponse)8 QuizSubmissionResponse (com.instructure.canvasapi2.models.QuizSubmissionResponse)8 ToDo (com.instructure.canvasapi2.models.ToDo)8 GradingPeriodResponse (com.instructure.canvasapi2.models.GradingPeriodResponse)7 Assignment (com.instructure.canvasapi2.models.Assignment)6 DiscussionTopicHeader (com.instructure.canvasapi2.models.DiscussionTopicHeader)6 FileFolder (com.instructure.canvasapi2.models.FileFolder)6 UpdateFileFolder (com.instructure.canvasapi2.models.UpdateFileFolder)6 Course (com.instructure.canvasapi2.models.Course)5