use of com.instructure.canvasapi2.models.CourseNickname in project instructure-android by instructure.
the class CourseNicknameManager method setCourseNickname.
public static void setCourseNickname(long courseId, String nickname, StatusCallback<CourseNickname> callback) {
if (isTesting() || mTesting) {
CourseNicknameManager_Test.setNickname(courseId, nickname, callback);
} else {
RestBuilder adapter = new RestBuilder(callback);
RestParams params = new RestParams.Builder().withPerPageQueryParam(false).withShouldIgnoreToken(false).withForceReadFromNetwork(true).build();
if (nickname.isEmpty()) {
CourseNicknameAPI.deleteNickname(courseId, adapter, callback, params);
} else {
CourseNicknameAPI.setNickname(courseId, nickname, adapter, callback, params);
}
}
}
use of com.instructure.canvasapi2.models.CourseNickname in project instructure-android by instructure.
the class CourseNicknameManager method deleteAllNicknames.
public static void deleteAllNicknames(final StatusCallback<CourseNickname> callback) {
if (isTesting() || mTesting) {
CourseNicknameManager_Test.deleteAllNicknames(callback);
} else {
RestBuilder adapter = new RestBuilder(callback);
RestParams params = new RestParams.Builder().withPerPageQueryParam(true).withShouldIgnoreToken(false).build();
CourseNicknameAPI.deleteAllNicknames(adapter, callback, params);
}
}
use of com.instructure.canvasapi2.models.CourseNickname in project instructure-android by instructure.
the class CourseNicknameManager_Test method setNickname.
public static void setNickname(long courseId, String nickname, 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);
courseNickname.setNickname(nickname);
retrofit2.Response<CourseNickname> response1 = retrofit2.Response.success(courseNickname, response);
callback.onResponse(response1, new LinkHeaders(), ApiType.CACHE);
}
use of com.instructure.canvasapi2.models.CourseNickname in project instructure-android by instructure.
the class CourseNicknameManager_Test method deleteNickname.
public static void deleteNickname(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);
}
use of com.instructure.canvasapi2.models.CourseNickname in project instructure-android by instructure.
the class CourseNicknameManager_Test method getAllNicknames.
public static void getAllNicknames(StatusCallback<List<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();
List<CourseNickname> courses = new ArrayList<>();
retrofit2.Response<List<CourseNickname>> response1 = retrofit2.Response.success(courses, response);
callback.onResponse(response1, new LinkHeaders(), ApiType.CACHE);
}
Aggregations