Search in sources :

Example 1 with CourseNickname

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

the class CourseNicknameManager method getCourseNickname.

public static void getCourseNickname(long courseId, StatusCallback<CourseNickname> callback, boolean forceNetwork) {
    if (isTesting() || mTesting) {
        CourseNicknameManager_Test.getNickname(courseId, callback);
    } else {
        RestBuilder adapter = new RestBuilder(callback);
        RestParams params = new RestParams.Builder().withPerPageQueryParam(false).withShouldIgnoreToken(false).withForceReadFromNetwork(forceNetwork).build();
        CourseNicknameAPI.getNickname(courseId, 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 CourseNickname

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

the class CourseNicknameManager method deleteNickname.

public static void deleteNickname(long courseId, final StatusCallback<CourseNickname> callback) {
    if (isTesting() || mTesting) {
        CourseNicknameManager_Test.deleteNickname(courseId, callback);
    } else {
        RestBuilder adapter = new RestBuilder(callback);
        RestParams params = new RestParams.Builder().withPerPageQueryParam(true).withShouldIgnoreToken(false).build();
        CourseNicknameAPI.deleteNickname(courseId, adapter, callback, params);
    }
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Example 3 with CourseNickname

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

the class CourseNicknameManager method getAllNicknames.

public static void getAllNicknames(StatusCallback<List<CourseNickname>> callback, boolean forceNetwork) {
    if (isTesting() || mTesting) {
        CourseNicknameManager_Test.getAllNicknames(callback);
    } else {
        RestBuilder adapter = new RestBuilder(callback);
        RestParams params = new RestParams.Builder().withPerPageQueryParam(true).withShouldIgnoreToken(false).withForceReadFromNetwork(forceNetwork).build();
        CourseNicknameAPI.getAllNicknames(adapter, callback, params);
    }
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Example 4 with CourseNickname

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

the class CourseNicknameManager_Test method getNickname.

public static void getNickname(long courseId, StatusCallback<CourseNickname> callback) {
    Response response = new Response.Builder().request(new Request.Builder().url("https://test.com").build()).code(200).message("todo").protocol(Protocol.HTTP_1_0).body(ResponseBody.create(MediaType.parse("application/json"), "todo".getBytes())).addHeader("content-type", "application/json").build();
    CourseNickname courseNickname = new CourseNickname();
    courseNickname.setId(courseId);
    retrofit2.Response<CourseNickname> response1 = retrofit2.Response.success(courseNickname, response);
    callback.onResponse(response1, new LinkHeaders(), ApiType.CACHE);
}
Also used : Response(okhttp3.Response) LinkHeaders(com.instructure.canvasapi2.utils.LinkHeaders) Request(okhttp3.Request) CourseNickname(com.instructure.canvasapi2.models.CourseNickname)

Example 5 with CourseNickname

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

the class CourseNicknameManager_Test method deleteAllNicknames.

public static void deleteAllNicknames(StatusCallback<CourseNickname> callback) {
    Response response = new Response.Builder().request(new Request.Builder().url("https://test.com").build()).code(200).message("todo").protocol(Protocol.HTTP_1_0).body(ResponseBody.create(MediaType.parse("application/json"), "todo".getBytes())).addHeader("content-type", "application/json").build();
    CourseNickname courseNickname = new CourseNickname();
    retrofit2.Response<CourseNickname> response1 = retrofit2.Response.success(courseNickname, response);
    callback.onResponse(response1, new LinkHeaders(), ApiType.CACHE);
}
Also used : Response(okhttp3.Response) LinkHeaders(com.instructure.canvasapi2.utils.LinkHeaders) Request(okhttp3.Request) CourseNickname(com.instructure.canvasapi2.models.CourseNickname)

Aggregations

RestBuilder (com.instructure.canvasapi2.builders.RestBuilder)5 RestParams (com.instructure.canvasapi2.builders.RestParams)5 CourseNickname (com.instructure.canvasapi2.models.CourseNickname)5 LinkHeaders (com.instructure.canvasapi2.utils.LinkHeaders)5 Request (okhttp3.Request)5 Response (okhttp3.Response)5 ArrayList (java.util.ArrayList)1 List (java.util.List)1