Search in sources :

Example 81 with StatusCallback

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

the class FileFolderManager method deleteFile.

public static void deleteFile(long fileId, StatusCallback<FileFolder> callback) {
    if (isTesting() || mTesting) {
    // TODO
    } else {
        RestBuilder adapter = new RestBuilder(callback);
        RestParams params = new RestParams.Builder().build();
        FileFolderAPI.deleteFile(adapter, fileId, callback, params);
    }
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Example 82 with StatusCallback

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

the class FileFolderManager method getFirstPageFilesRoot.

public static void getFirstPageFilesRoot(CanvasContext canvasContext, boolean forceNetwork, final StatusCallback<List<FileFolder>> callback) {
    if (isTesting() || mTesting) {
    // TODO
    } else {
        final RestBuilder adapter = new RestBuilder(callback);
        RestParams params = new RestParams.Builder().withCanvasContext(canvasContext).withForceReadFromNetwork(forceNetwork).withPerPageQueryParam(true).build();
        final RestParams fileParams = new RestParams.Builder().withForceReadFromNetwork(forceNetwork).build();
        FileFolderAPI.getRootFolderForContext(adapter, canvasContext, new StatusCallback<FileFolder>() {

            @Override
            public void onResponse(@NonNull Response<FileFolder> response, @NonNull LinkHeaders linkHeaders, @NonNull ApiType type) {
                FileFolderAPI.getFirstPageFiles(adapter, response.body().getId(), callback, fileParams);
            }
        }, params);
    }
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) LinkHeaders(com.instructure.canvasapi2.utils.LinkHeaders) FileFolder(com.instructure.canvasapi2.models.FileFolder) UpdateFileFolder(com.instructure.canvasapi2.models.UpdateFileFolder) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder) ApiType(com.instructure.canvasapi2.utils.ApiType) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Example 83 with StatusCallback

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

the class FileFolderManager method updateUsageRights.

public static void updateUsageRights(long courseId, Map<String, Object> formParams, final StatusCallback<UsageRights> callback) {
    if (isTesting() || mTesting) {
    // TODO
    } else {
        final RestBuilder adapter = new RestBuilder(callback);
        final RestParams params = new RestParams.Builder().build();
        FileFolderAPI.updateUsageRights(courseId, formParams, adapter, callback, params);
    }
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Example 84 with StatusCallback

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

the class FileFolderManager method getFileFolderFromURLSynchronous.

public static FileFolder getFileFolderFromURLSynchronous(String url) {
    if (isTesting() || mTesting) {
    // TODO:
    } else {
        RestBuilder adapter = new RestBuilder(new StatusCallback() {
        });
        RestParams params = new RestParams.Builder().withPerPageQueryParam(false).build();
        return FileFolderAPI.getFileFolderFromURLSynchronous(adapter, url, params);
    }
    return null;
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder) StatusCallback(com.instructure.canvasapi2.StatusCallback)

Example 85 with StatusCallback

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

the class FileFolderManager method getAllFoldersRoot.

public static void getAllFoldersRoot(CanvasContext canvasContext, final boolean forceNetwork, final StatusCallback<List<FileFolder>> callback) {
    if (isTesting() || mTesting) {
    // TODO
    } else {
        final RestBuilder adapter = new RestBuilder(callback);
        final RestParams params = new RestParams.Builder().withCanvasContext(canvasContext).withForceReadFromNetwork(forceNetwork).withPerPageQueryParam(true).build();
        FileFolderAPI.getRootFolderForContext(adapter, canvasContext, new StatusCallback<FileFolder>() {

            @Override
            public void onResponse(@NonNull Response<FileFolder> response, @NonNull LinkHeaders linkHeaders, @NonNull ApiType type) {
                getAllFolders(response.body().getId(), forceNetwork, callback);
            }
        }, params);
    }
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) LinkHeaders(com.instructure.canvasapi2.utils.LinkHeaders) FileFolder(com.instructure.canvasapi2.models.FileFolder) UpdateFileFolder(com.instructure.canvasapi2.models.UpdateFileFolder) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder) ApiType(com.instructure.canvasapi2.utils.ApiType) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

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