Search in sources :

Example 36 with DiscussionTopicHeader

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

the class DiscussionManager method getFirstPagePinnedDiscussions.

public static void getFirstPagePinnedDiscussions(@NonNull CanvasContext canvasContext, final boolean forceNetwork, StatusCallback<List<DiscussionTopicHeader>> callback) {
    if (isTesting() || mTesting) {
    // TODO:
    } else {
        RestBuilder adapter = new RestBuilder(callback);
        RestParams params = new RestParams.Builder().withForceReadFromNetwork(forceNetwork).withPerPageQueryParam(true).build();
        DiscussionAPI.getFirstPagePinnedDiscussions(canvasContext, adapter, callback, params);
    }
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Example 37 with DiscussionTopicHeader

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

the class DiscussionTopicHeaderTest method getTypeTest_Threaded.

@Test
public void getTypeTest_Threaded() throws Exception {
    DiscussionTopicHeader discussionTopicHeader = new DiscussionTopicHeader();
    discussionTopicHeader.setDiscussionType("threaded");
    assertEquals(DiscussionTopicHeader.DiscussionType.THREADED, discussionTopicHeader.getType());
}
Also used : DiscussionTopicHeader(com.instructure.canvasapi2.models.DiscussionTopicHeader) Test(org.junit.Test)

Example 38 with DiscussionTopicHeader

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

the class DiscussionTopicHeaderTest method convertToDiscussionEntryTest_Message.

@Test
public void convertToDiscussionEntryTest_Message() throws Exception {
    String message = "here is a message";
    DiscussionTopicHeader header = new DiscussionTopicHeader();
    header.setMessage(message);
    DiscussionEntry entry = header.convertToDiscussionEntry("graded", "points");
    assertEquals(header.getMessage(), entry.getMessage());
}
Also used : DiscussionTopicHeader(com.instructure.canvasapi2.models.DiscussionTopicHeader) DiscussionEntry(com.instructure.canvasapi2.models.DiscussionEntry) Test(org.junit.Test)

Example 39 with DiscussionTopicHeader

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

the class DiscussionTopicHeaderTest method getTypeTest_SideComment.

@Test
public void getTypeTest_SideComment() throws Exception {
    DiscussionTopicHeader discussionTopicHeader = new DiscussionTopicHeader();
    discussionTopicHeader.setDiscussionType("side_comment");
    assertEquals(DiscussionTopicHeader.DiscussionType.SIDE_COMMENT, discussionTopicHeader.getType());
}
Also used : DiscussionTopicHeader(com.instructure.canvasapi2.models.DiscussionTopicHeader) Test(org.junit.Test)

Example 40 with DiscussionTopicHeader

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

the class AnnouncementManager_Test method getAnnouncements.

public static void getAnnouncements(CanvasContext canvasContext, StatusCallback<List<DiscussionTopicHeader>> 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<DiscussionTopicHeader> items = new ArrayList<>();
    retrofit2.Response<List<DiscussionTopicHeader>> response1 = retrofit2.Response.success(items, response);
    callback.onResponse(response1, new LinkHeaders(), ApiType.CACHE);
}
Also used : Response(okhttp3.Response) LinkHeaders(com.instructure.canvasapi2.utils.LinkHeaders) ArrayList(java.util.ArrayList) DiscussionTopicHeader(com.instructure.canvasapi2.models.DiscussionTopicHeader) List(java.util.List) ArrayList(java.util.ArrayList)

Aggregations

DiscussionTopicHeader (com.instructure.canvasapi2.models.DiscussionTopicHeader)24 RestBuilder (com.instructure.canvasapi2.builders.RestBuilder)20 RestParams (com.instructure.canvasapi2.builders.RestParams)19 Test (org.junit.Test)17 List (java.util.List)6 StatusCallback (com.instructure.canvasapi2.StatusCallback)4 DiscussionEntry (com.instructure.canvasapi2.models.DiscussionEntry)4 ExhaustiveListCallback (com.instructure.canvasapi2.utils.ExhaustiveListCallback)4 ArrayList (java.util.ArrayList)4 NotNull (org.jetbrains.annotations.NotNull)4 DateTime (hirondelle.date4j.DateTime)3 Date (java.util.Date)3 Assignment (com.instructure.canvasapi2.models.Assignment)2 Course (com.instructure.canvasapi2.models.Course)2 LinkHeaders (com.instructure.canvasapi2.utils.LinkHeaders)2 Response (okhttp3.Response)2 ViewGroup (android.view.ViewGroup)1 AccountNotification (com.instructure.canvasapi2.models.AccountNotification)1 Group (com.instructure.canvasapi2.models.Group)1 ScheduleItem (com.instructure.canvasapi2.models.ScheduleItem)1