Search in sources :

Example 81 with LinkHeaders

use of com.instructure.canvasapi2.utils.LinkHeaders in project instructure-android by instructure.

the class InboxManager_Test method deleteConversation.

public static void deleteConversation(long conversationId, StatusCallback<Conversation> callback) {
    // TODO:
    Response rawResponse = 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();
    Conversation conversation = new Conversation();
    retrofit2.Response<Conversation> response = retrofit2.Response.success(conversation, rawResponse);
    callback.onResponse(response, new LinkHeaders(), ApiType.CACHE);
}
Also used : Response(okhttp3.Response) LinkHeaders(com.instructure.canvasapi2.utils.LinkHeaders) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder) Conversation(com.instructure.canvasapi2.models.Conversation)

Example 82 with LinkHeaders

use of com.instructure.canvasapi2.utils.LinkHeaders in project instructure-android by instructure.

the class InboxManager_Test method addMessage.

public static void addMessage(RestBuilder adapter, StatusCallback<Conversation> callback, RestParams params, long conversationId, List<String> recipientIds, String message, long[] includedMessageIds, long[] attachmentIds) {
    // TODO:
    Response rawResponse = 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();
    Conversation conversation = new Conversation();
    retrofit2.Response<Conversation> response = retrofit2.Response.success(conversation, rawResponse);
    callback.onResponse(response, new LinkHeaders(), ApiType.CACHE);
}
Also used : Response(okhttp3.Response) LinkHeaders(com.instructure.canvasapi2.utils.LinkHeaders) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder) Conversation(com.instructure.canvasapi2.models.Conversation)

Example 83 with LinkHeaders

use of com.instructure.canvasapi2.utils.LinkHeaders in project instructure-android by instructure.

the class InboxManager_Test method createConversation.

public static void createConversation(RestBuilder adapter, RestParams params, List<String> userIDs, String message, String subject, String contextId, boolean isBulk, StatusCallback<List<Conversation>> callback) {
    Response rawResponse = 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();
    List<Conversation> conversation = new ArrayList<>();
    retrofit2.Response<List<Conversation>> response = retrofit2.Response.success(conversation, rawResponse);
    callback.onResponse(response, new LinkHeaders(), ApiType.CACHE);
}
Also used : Response(okhttp3.Response) LinkHeaders(com.instructure.canvasapi2.utils.LinkHeaders) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder) ArrayList(java.util.ArrayList) Conversation(com.instructure.canvasapi2.models.Conversation) ArrayList(java.util.ArrayList) List(java.util.List)

Example 84 with LinkHeaders

use of com.instructure.canvasapi2.utils.LinkHeaders in project instructure-android by instructure.

the class QuizManager_Test method getAllQuizSubmissions.

public static void getAllQuizSubmissions(StatusCallback<List<QuizSubmission>> 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();
    List<QuizSubmission> quizSubmissions = new ArrayList<>();
    QuizSubmission quizSubmission = new QuizSubmission();
    quizSubmission.setQuizId(456321L);
    quizSubmissions.add(quizSubmission);
    retrofit2.Response<List<QuizSubmission>> response1 = retrofit2.Response.success(quizSubmissions, response);
    callback.onResponse(response1, new LinkHeaders(), ApiType.CACHE);
}
Also used : QuizSubmissionResponse(com.instructure.canvasapi2.models.QuizSubmissionResponse) Response(okhttp3.Response) QuizSubmissionQuestionResponse(com.instructure.canvasapi2.models.QuizSubmissionQuestionResponse) QuizSubmission(com.instructure.canvasapi2.models.QuizSubmission) LinkHeaders(com.instructure.canvasapi2.utils.LinkHeaders) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List)

Example 85 with LinkHeaders

use of com.instructure.canvasapi2.utils.LinkHeaders in project instructure-android by instructure.

the class QuizManager_Test method startQuizPreview.

public static void startQuizPreview(long courseId, long quizId, StatusCallback<QuizSubmissionResponse> callback) {
    // TODO:
    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();
    QuizSubmissionResponse quizSubmissionResponse = new QuizSubmissionResponse();
    QuizSubmission quizSubmission = new QuizSubmission();
    quizSubmission.setId(8);
    List<QuizSubmission> quizSubmissions = new ArrayList<>();
    quizSubmissions.add(quizSubmission);
    quizSubmissionResponse.setQuizSubmissions(quizSubmissions);
    retrofit2.Response<QuizSubmissionResponse> response1 = retrofit2.Response.success(quizSubmissionResponse, response);
    callback.onResponse(response1, new LinkHeaders(), ApiType.CACHE);
}
Also used : QuizSubmissionResponse(com.instructure.canvasapi2.models.QuizSubmissionResponse) Response(okhttp3.Response) QuizSubmissionQuestionResponse(com.instructure.canvasapi2.models.QuizSubmissionQuestionResponse) QuizSubmission(com.instructure.canvasapi2.models.QuizSubmission) LinkHeaders(com.instructure.canvasapi2.utils.LinkHeaders) ArrayList(java.util.ArrayList) QuizSubmissionResponse(com.instructure.canvasapi2.models.QuizSubmissionResponse)

Aggregations

LinkHeaders (com.instructure.canvasapi2.utils.LinkHeaders)87 Response (okhttp3.Response)57 ArrayList (java.util.ArrayList)31 Request (okhttp3.Request)27 List (java.util.List)25 RestBuilder (com.instructure.canvasapi2.builders.RestBuilder)24 ApiType (com.instructure.canvasapi2.utils.ApiType)23 Response (retrofit2.Response)15 QuizSubmissionResponse (com.instructure.canvasapi2.models.QuizSubmissionResponse)13 QuizSubmissionQuestionResponse (com.instructure.canvasapi2.models.QuizSubmissionQuestionResponse)12 ParentResponse (com.instructure.canvasapi2.models.ParentResponse)10 Conversation (com.instructure.canvasapi2.models.Conversation)9 NonNull (android.support.annotation.NonNull)8 GradingPeriodResponse (com.instructure.canvasapi2.models.GradingPeriodResponse)8 StatusCallback (com.instructure.canvasapi2.StatusCallback)7 FileFolder (com.instructure.canvasapi2.models.FileFolder)6 Submission (com.instructure.canvasapi2.models.Submission)6 Assignment (com.instructure.canvasapi2.models.Assignment)5 CourseNickname (com.instructure.canvasapi2.models.CourseNickname)5 ResponseBody (okhttp3.ResponseBody)5