use of com.instructure.canvasapi2.models.Conversation in project instructure-android by instructure.
the class InboxManager method getConversationSynchronous.
public static Conversation getConversationSynchronous(long conversationId, boolean forceNetwork) {
if (isTesting() || mTesting) {
// TODO
return new Conversation();
} else {
RestBuilder adapter = new RestBuilder();
RestParams params = new RestParams.Builder().withPerPageQueryParam(false).withShouldIgnoreToken(false).withForceReadFromNetwork(forceNetwork).build();
try {
Response<Conversation> response = InboxApi.getConversationSynchronous(adapter, params, conversationId);
return response.isSuccessful() ? response.body() : null;
} catch (IOException e) {
return null;
}
}
}
use of com.instructure.canvasapi2.models.Conversation in project instructure-android by instructure.
the class InboxManager method createConversationWithAttachmentSynchronous.
@Nullable
public static List<Conversation> createConversationWithAttachmentSynchronous(String messageText, String subject, List<String> userIds, String contextId, boolean isGroup, List<Long> attachmentsIds) {
if (isTesting() || mTesting) {
// TODO
return null;
} else {
RestBuilder adapter = new RestBuilder();
RestParams params = new RestParams.Builder().withPerPageQueryParam(false).withShouldIgnoreToken(false).build();
try {
return InboxApi.createConversationWithAttachmentSynchronous(adapter, params, userIds, messageText, subject, contextId, isGroup, attachmentsIds);
} catch (IOException e) {
return null;
}
}
}
use of com.instructure.canvasapi2.models.Conversation in project instructure-android by instructure.
the class InboxManager method createConversation.
public static void createConversation(List<String> userIDs, String message, String subject, String contextId, long[] attachmentIds, boolean isBulk, StatusCallback<List<Conversation>> callback) {
if (isTesting() || mTesting) {
// todo
RestBuilder adapter = new RestBuilder(callback);
RestParams params = new RestParams.Builder().withPerPageQueryParam(false).withShouldIgnoreToken(false).build();
InboxManager_Test.createConversation(adapter, params, userIDs, message, subject, contextId, isBulk, callback);
} else {
RestBuilder adapter = new RestBuilder(callback);
RestParams params = new RestParams.Builder().withPerPageQueryParam(false).withShouldIgnoreToken(false).build();
InboxApi.createConversation(adapter, params, userIDs, message, subject, contextId, attachmentIds, isBulk, callback);
}
}
use of com.instructure.canvasapi2.models.Conversation in project instructure-android by instructure.
the class InboxManager method deleteConversation.
public static void deleteConversation(long conversationId, StatusCallback<Conversation> callback) {
if (isTesting() || mTesting) {
InboxManager_Test.deleteConversation(conversationId, callback);
} else {
RestBuilder adapter = new RestBuilder(callback);
RestParams params = new RestParams.Builder().withShouldIgnoreToken(false).withPerPageQueryParam(false).build();
InboxApi.deleteConversation(adapter, callback, params, conversationId);
}
}
use of com.instructure.canvasapi2.models.Conversation in project instructure-android by instructure.
the class InboxManager method getConversations.
public static void getConversations(InboxApi.Scope scope, boolean forceNetwork, StatusCallback<List<Conversation>> callback) {
if (isTesting() || mTesting) {
RestBuilder adapter = new RestBuilder(callback);
RestParams params = new RestParams.Builder().withPerPageQueryParam(true).withShouldIgnoreToken(false).withForceReadFromNetwork(forceNetwork).build();
InboxManager_Test.getConversations(scope, adapter, callback, params);
} else {
RestBuilder adapter = new RestBuilder(callback);
RestParams params = new RestParams.Builder().withPerPageQueryParam(true).withShouldIgnoreToken(false).withForceReadFromNetwork(forceNetwork).build();
InboxApi.getConversations(scope, adapter, callback, params);
}
}
Aggregations