Search in sources :

Example 16 with Conversation

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

the class InboxManager_Test method getConversation.

public static void getConversation(RestBuilder adapter, StatusCallback<Conversation> callback, RestParams params, long conversationId) {
    // 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();
    Conversation conversation = new Conversation();
    retrofit2.Response<Conversation> retrofitResponse = retrofit2.Response.success(conversation, response);
    callback.onResponse(retrofitResponse, 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 17 with Conversation

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

the class InboxManager_Test method deleteMessages.

public static void deleteMessages(long conversationId, List<Long> messageIds, 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 18 with Conversation

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

the class InboxManager_Test method getConversationsFiltered.

public static void getConversationsFiltered(@NonNull InboxApi.Scope scope, @NonNull String canvasContextFilter, @NonNull RestBuilder adapter, @NonNull StatusCallback<List<Conversation>> callback, @NonNull 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<Conversation> conversations = new ArrayList<>();
    retrofit2.Response<List<Conversation>> response1 = retrofit2.Response.success(conversations, 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) Conversation(com.instructure.canvasapi2.models.Conversation) ArrayList(java.util.ArrayList) List(java.util.List)

Example 19 with Conversation

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

the class InboxManager_Test method updateConversation.

public static void updateConversation(long conversationId, Conversation.WorkflowState workflowState, Boolean starred, 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 20 with Conversation

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

the class InboxManager method archiveConversation.

public static void archiveConversation(long conversationId, boolean archive, StatusCallback<Conversation> callback) {
    if (isTesting() || mTesting) {
        InboxManager_Test.updateConversation(conversationId, archive ? Conversation.WorkflowState.ARCHIVED : Conversation.WorkflowState.READ, null, callback);
    } else {
        RestBuilder adapter = new RestBuilder(callback);
        RestParams params = new RestParams.Builder().withShouldIgnoreToken(false).withPerPageQueryParam(false).build();
        InboxApi.updateConversation(adapter, callback, params, conversationId, archive ? Conversation.WorkflowState.ARCHIVED : Conversation.WorkflowState.READ, null);
    }
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Aggregations

Conversation (com.instructure.canvasapi2.models.Conversation)28 RestBuilder (com.instructure.canvasapi2.builders.RestBuilder)20 Test (org.junit.Test)14 RestParams (com.instructure.canvasapi2.builders.RestParams)12 LinkHeaders (com.instructure.canvasapi2.utils.LinkHeaders)9 Response (okhttp3.Response)8 ArrayList (java.util.ArrayList)7 IOException (java.io.IOException)3 List (java.util.List)3 Nullable (android.support.annotation.Nullable)2 Date (java.util.Date)2 Bundle (android.os.Bundle)1 Rfc822Tokenizer (android.text.util.Rfc822Tokenizer)1 Menu (android.view.Menu)1 View (android.view.View)1 AdapterView (android.widget.AdapterView)1 ImageView (android.widget.ImageView)1 ScrollView (android.widget.ScrollView)1 TextView (android.widget.TextView)1 BindView (butterknife.BindView)1