Search in sources :

Example 26 with StatusCallback

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

the class SubmissionManager_Test method postSubmissionComment.

public static void postSubmissionComment(long courseId, long assignmentId, long userId, String commentText, boolean isGroupMessage, StatusCallback<Submission> callback) {
    // TODO:
    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();
    Submission submission = new Submission();
    retrofit2.Response<Submission> response1 = retrofit2.Response.success(submission, response);
    callback.onResponse(response1, new LinkHeaders(), ApiType.CACHE);
}
Also used : Response(okhttp3.Response) Submission(com.instructure.canvasapi2.models.Submission) LinkHeaders(com.instructure.canvasapi2.utils.LinkHeaders) Request(okhttp3.Request)

Example 27 with StatusCallback

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

the class UserManager_Test method addStudentToParentAirwolf.

public static void addStudentToParentAirwolf(String airwolfDomain, RestBuilder adapter, RestParams params, String parentId, String studentDomain, StatusCallback<ResponseBody> callback) {
    adapter.setStatusCallback(callback);
    Response response = new Response.Builder().code(200).message("success").protocol(Protocol.HTTP_1_0).body(ResponseBody.create(MediaType.parse("application/json"), "success".getBytes())).addHeader("content-type", "application/json").build();
    retrofit2.Response response1 = retrofit2.Response.success(response);
    callback.onResponse(response1, new LinkHeaders(), ApiType.API);
}
Also used : Response(okhttp3.Response) ParentResponse(com.instructure.canvasapi2.models.ParentResponse) LinkHeaders(com.instructure.canvasapi2.utils.LinkHeaders) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Example 28 with StatusCallback

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

the class UserManager_Test method authenticateParentAirwolf.

public static void authenticateParentAirwolf(String airwolfDomain, RestBuilder adapter, RestParams params, String email, String password, StatusCallback<ParentResponse> callback) {
    adapter.setStatusCallback(callback);
    Response response = new Response.Builder().code(200).message("success").protocol(Protocol.HTTP_1_0).body(ResponseBody.create(MediaType.parse("application/json"), "success".getBytes())).addHeader("content-type", "application/json").build();
    retrofit2.Response response1 = retrofit2.Response.success(response);
    callback.onResponse(response1, new LinkHeaders(), ApiType.API);
}
Also used : Response(okhttp3.Response) ParentResponse(com.instructure.canvasapi2.models.ParentResponse) LinkHeaders(com.instructure.canvasapi2.utils.LinkHeaders) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Example 29 with StatusCallback

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

the class UserManager_Test method removeStudentAirwolf.

public static void removeStudentAirwolf(String airwolfDomain, RestBuilder adapter, RestParams params, String parentId, String studentId, StatusCallback<ResponseBody> callback) {
    adapter.setStatusCallback(callback);
    Response response = new Response.Builder().code(200).message("success").protocol(Protocol.HTTP_1_0).body(ResponseBody.create(MediaType.parse("application/json"), "success".getBytes())).addHeader("content-type", "application/json").build();
    retrofit2.Response response1 = retrofit2.Response.success(response);
    callback.onResponse(response1, new LinkHeaders(), ApiType.API);
}
Also used : Response(okhttp3.Response) ParentResponse(com.instructure.canvasapi2.models.ParentResponse) LinkHeaders(com.instructure.canvasapi2.utils.LinkHeaders) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Example 30 with StatusCallback

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

the class UserManager_Test method addParentAirwolf.

public static void addParentAirwolf(String airwolfDomain, RestBuilder adapter, RestParams params, Parent parent, StatusCallback<ParentResponse> callback) {
    adapter.setStatusCallback(callback);
    Response response = new Response.Builder().code(200).message("success").protocol(Protocol.HTTP_1_0).body(ResponseBody.create(MediaType.parse("application/json"), "success".getBytes())).addHeader("content-type", "application/json").build();
    retrofit2.Response response1 = retrofit2.Response.success(response);
    callback.onResponse(response1, new LinkHeaders(), ApiType.API);
}
Also used : Response(okhttp3.Response) ParentResponse(com.instructure.canvasapi2.models.ParentResponse) LinkHeaders(com.instructure.canvasapi2.utils.LinkHeaders) 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