Search in sources :

Example 26 with FileFolder

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

the class FileFolderManager method getAllFiles.

public static void getAllFiles(long folderId, boolean forceNetwork, StatusCallback<List<FileFolder>> callback) {
    if (isTesting() || mTesting) {
    // TODO
    } else {
        final RestBuilder adapter = new RestBuilder(callback);
        final RestParams params = new RestParams.Builder().withForceReadFromNetwork(forceNetwork).withPerPageQueryParam(true).build();
        final StatusCallback<List<FileFolder>> depaginatedCallback = new ExhaustiveListCallback<FileFolder>(callback) {

            @Override
            public void getNextPage(@NonNull StatusCallback<List<FileFolder>> callback, @NonNull String nextUrl, boolean isCached) {
                FileFolderAPI.getNextPageFilesFolder(adapter, nextUrl, callback, params);
            }
        };
        FileFolderAPI.getFirstPageFiles(adapter, folderId, depaginatedCallback, params);
    }
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) FileFolder(com.instructure.canvasapi2.models.FileFolder) UpdateFileFolder(com.instructure.canvasapi2.models.UpdateFileFolder) NonNull(android.support.annotation.NonNull) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder) ArrayList(java.util.ArrayList) List(java.util.List) StatusCallback(com.instructure.canvasapi2.StatusCallback) ExhaustiveListCallback(com.instructure.canvasapi2.utils.ExhaustiveListCallback)

Example 27 with FileFolder

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

the class FileFolderManager method updateFolder.

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

Example 28 with FileFolder

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

the class FileFolderManager method getNextPageFilesFolder.

public static void getNextPageFilesFolder(String url, boolean forceNetwork, StatusCallback<List<FileFolder>> callback) {
    if (isTesting() || mTesting) {
    // TODO
    } else {
        RestBuilder adapter = new RestBuilder(callback);
        RestParams params = new RestParams.Builder().withForceReadFromNetwork(forceNetwork).withPerPageQueryParam(false).build();
        FileFolderAPI.getNextPageFilesFolder(adapter, url, callback, params);
    }
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Example 29 with FileFolder

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

the class FileFolderManager method getAllFolders.

public static void getAllFolders(long folderId, boolean forceNetwork, StatusCallback<List<FileFolder>> callback) {
    if (isTesting() || mTesting) {
    // TODO
    } else {
        final RestBuilder adapter = new RestBuilder(callback);
        final RestParams params = new RestParams.Builder().withForceReadFromNetwork(forceNetwork).withPerPageQueryParam(true).build();
        final StatusCallback<List<FileFolder>> depaginatedCallback = new ExhaustiveListCallback<FileFolder>(callback) {

            @Override
            public void getNextPage(@NonNull StatusCallback<List<FileFolder>> callback, @NonNull String nextUrl, boolean isCached) {
                FileFolderAPI.getNextPageFilesFolder(adapter, nextUrl, callback, params);
            }
        };
        FileFolderAPI.getFirstPageFolders(adapter, folderId, depaginatedCallback, params);
    }
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) FileFolder(com.instructure.canvasapi2.models.FileFolder) UpdateFileFolder(com.instructure.canvasapi2.models.UpdateFileFolder) NonNull(android.support.annotation.NonNull) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder) ArrayList(java.util.ArrayList) List(java.util.List) StatusCallback(com.instructure.canvasapi2.StatusCallback) ExhaustiveListCallback(com.instructure.canvasapi2.utils.ExhaustiveListCallback)

Example 30 with FileFolder

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

the class FileFolderManager method createFolder.

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

Aggregations

RestBuilder (com.instructure.canvasapi2.builders.RestBuilder)21 RestParams (com.instructure.canvasapi2.builders.RestParams)21 FileFolder (com.instructure.canvasapi2.models.FileFolder)21 Test (org.junit.Test)12 UpdateFileFolder (com.instructure.canvasapi2.models.UpdateFileFolder)7 ApiType (com.instructure.canvasapi2.utils.ApiType)6 LinkHeaders (com.instructure.canvasapi2.utils.LinkHeaders)6 StatusCallback (com.instructure.canvasapi2.StatusCallback)3 NonNull (android.support.annotation.NonNull)2 ExhaustiveListCallback (com.instructure.canvasapi2.utils.ExhaustiveListCallback)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 WorkerThread (android.support.annotation.WorkerThread)1 CanvasContext (com.instructure.canvasapi2.models.CanvasContext)1 RemoteFile (com.instructure.canvasapi2.models.RemoteFile)1 Date (java.util.Date)1 Headers (okhttp3.Headers)1 RequestBody (okhttp3.RequestBody)1 ResponseBody (okhttp3.ResponseBody)1 Response (retrofit2.Response)1