Search in sources :

Example 1 with CanvasColor

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

the class UserManager method getColors.

public static void getColors(@NonNull StatusCallback<CanvasColor> callback, boolean forceNetwork) {
    RestBuilder adapter = new RestBuilder(callback);
    RestParams params = new RestParams.Builder().withPerPageQueryParam(false).withForceReadFromCache(!forceNetwork).withForceReadFromNetwork(forceNetwork).build();
    if (isTesting() || mTesting) {
        UserManager_Test.getColors(adapter, callback, params);
    } else {
        UserAPI.getColors(adapter, callback, params);
    }
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Example 2 with CanvasColor

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

the class UserManager_Test method getColors.

public static void getColors(@NonNull RestBuilder adapter, @NonNull StatusCallback<CanvasColor> callback, @NonNull RestParams params) {
    adapter.setStatusCallback(callback);
    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();
    CanvasColor canvasColor = new CanvasColor();
    retrofit2.Response<CanvasColor> response1 = retrofit2.Response.success(canvasColor, response);
    callback.onResponse(response1, new LinkHeaders(), ApiType.CACHE);
}
Also used : Response(okhttp3.Response) ParentResponse(com.instructure.canvasapi2.models.ParentResponse) CanvasColor(com.instructure.canvasapi2.models.CanvasColor) LinkHeaders(com.instructure.canvasapi2.utils.LinkHeaders) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Aggregations

RestBuilder (com.instructure.canvasapi2.builders.RestBuilder)2 RestParams (com.instructure.canvasapi2.builders.RestParams)1 CanvasColor (com.instructure.canvasapi2.models.CanvasColor)1 ParentResponse (com.instructure.canvasapi2.models.ParentResponse)1 LinkHeaders (com.instructure.canvasapi2.utils.LinkHeaders)1 Response (okhttp3.Response)1