Search in sources :

Example 21 with StatusCallback

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

the class QuizManager_Test method getQuizesQuestions.

public static void getQuizesQuestions(StatusCallback<List<Quiz>> 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();
    List<Quiz> quizzes = new ArrayList<>();
    Quiz quiz = new Quiz();
    quiz.setTitle("TEST");
    quiz.setDescription("description");
    quizzes.add(quiz);
    retrofit2.Response<List<Quiz>> response1 = retrofit2.Response.success(quizzes, 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) Quiz(com.instructure.canvasapi2.models.Quiz) LinkHeaders(com.instructure.canvasapi2.utils.LinkHeaders) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List)

Example 22 with StatusCallback

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

the class QuizManager_Test method getQuizSubmissionQuestions.

public static void getQuizSubmissionQuestions(long quizSubmissionId, StatusCallback<QuizSubmissionQuestionResponse> 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();
    QuizSubmissionQuestionResponse quizSubmissionQuestionResponse = new QuizSubmissionQuestionResponse();
    List<QuizSubmissionQuestion> quizQuestions = new ArrayList<>();
    QuizSubmissionQuestion question = new QuizSubmissionQuestion();
    question.setQuestionText("TEST");
    question.setQuestionType("essay_question");
    quizQuestions.add(question);
    quizSubmissionQuestionResponse.setQuizSubmissionQuestions(quizQuestions);
    retrofit2.Response<QuizSubmissionQuestionResponse> response1 = retrofit2.Response.success(quizSubmissionQuestionResponse, 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) LinkHeaders(com.instructure.canvasapi2.utils.LinkHeaders) QuizSubmissionQuestionResponse(com.instructure.canvasapi2.models.QuizSubmissionQuestionResponse) ArrayList(java.util.ArrayList) QuizSubmissionQuestion(com.instructure.canvasapi2.models.QuizSubmissionQuestion)

Example 23 with StatusCallback

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

the class QuizManager_Test method editQuiz.

public static void editQuiz(QuizPostBody quizPostBody, StatusCallback<Quiz> callback) {
    // TODO:
    Response httpResponse = 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();
    retrofit2.Response<Quiz> response = retrofit2.Response.success(new Quiz(), httpResponse);
    callback.onResponse(response, new LinkHeaders(), ApiType.CACHE);
}
Also used : QuizSubmissionResponse(com.instructure.canvasapi2.models.QuizSubmissionResponse) Response(okhttp3.Response) QuizSubmissionQuestionResponse(com.instructure.canvasapi2.models.QuizSubmissionQuestionResponse) Quiz(com.instructure.canvasapi2.models.Quiz) LinkHeaders(com.instructure.canvasapi2.utils.LinkHeaders) Request(okhttp3.Request)

Example 24 with StatusCallback

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

the class RecipientManager_Test method getFirstPageRecipients.

public static void getFirstPageRecipients(String searchQuery, String context, StatusCallback<List<Recipient>> callback, RestBuilder adapter, RestParams params) {
    // 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();
    List<Recipient> items = new ArrayList<>();
    retrofit2.Response<List<Recipient>> response1 = retrofit2.Response.success(items, response);
    callback.onResponse(response1, 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) Recipient(com.instructure.canvasapi2.models.Recipient) List(java.util.List) ArrayList(java.util.ArrayList)

Example 25 with StatusCallback

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

the class SubmissionManager_Test method updateRubricAssessment.

public static void updateRubricAssessment(long courseId, long assignmentId, long studentId, Map<String, RubricCriterionAssessment> assessmentMap, 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)

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