use of com.instructure.canvasapi2.models.CanvasContext in project instructure-android by instructure.
the class DiscussionManager method getAllPinnedDiscussions.
public static void getAllPinnedDiscussions(@NonNull CanvasContext canvasContext, final boolean forceNetwork, StatusCallback<List<DiscussionTopicHeader>> callback) {
if (isTesting() || mTesting) {
// TODO:
} else {
final RestBuilder adapter = new RestBuilder(callback);
final RestParams params = new RestParams.Builder().withForceReadFromNetwork(forceNetwork).withPerPageQueryParam(false).build();
StatusCallback<List<DiscussionTopicHeader>> depaginatedCallback = new ExhaustiveListCallback<DiscussionTopicHeader>(callback) {
@Override
public void getNextPage(@NotNull StatusCallback<List<DiscussionTopicHeader>> callback, @NotNull String nextUrl, boolean isCached) {
DiscussionAPI.getNextPage(nextUrl, adapter, callback, params);
}
};
adapter.setStatusCallback(depaginatedCallback);
DiscussionAPI.getFirstPagePinnedDiscussions(canvasContext, adapter, depaginatedCallback, params);
}
}
use of com.instructure.canvasapi2.models.CanvasContext in project instructure-android by instructure.
the class DiscussionManager method unpinDiscussionTopicHeader.
public static void unpinDiscussionTopicHeader(@NonNull CanvasContext canvasContext, long topicId, StatusCallback<DiscussionTopicHeader> callback) {
if (isTesting() || mTesting) {
// TODO:
} else {
RestBuilder adapter = new RestBuilder(callback);
RestParams params = new RestParams.Builder().withPerPageQueryParam(false).withShouldIgnoreToken(false).build();
DiscussionAPI.unpinDiscussion(adapter, canvasContext, topicId, callback, params);
}
}
use of com.instructure.canvasapi2.models.CanvasContext in project instructure-android by instructure.
the class DiscussionManager method pinDiscussionTopicHeader.
public static void pinDiscussionTopicHeader(@NonNull CanvasContext canvasContext, long topicId, StatusCallback<DiscussionTopicHeader> callback) {
if (isTesting() || mTesting) {
// TODO:
} else {
RestBuilder adapter = new RestBuilder(callback);
RestParams params = new RestParams.Builder().withPerPageQueryParam(false).withShouldIgnoreToken(false).build();
DiscussionAPI.pinDiscussion(adapter, canvasContext, topicId, callback, params);
}
}
use of com.instructure.canvasapi2.models.CanvasContext in project instructure-android by instructure.
the class DiscussionManager method deleteDiscussionEntry.
public static void deleteDiscussionEntry(@NonNull CanvasContext canvasContext, long topicId, long entryId, StatusCallback<Void> callback) {
if (isTesting() || mTesting) {
// TODO:
} else {
RestBuilder adapter = new RestBuilder(callback);
RestParams params = new RestParams.Builder().withPerPageQueryParam(false).withShouldIgnoreToken(false).build();
DiscussionAPI.deleteDiscussionEntry(adapter, canvasContext, topicId, entryId, callback, params);
}
}
use of com.instructure.canvasapi2.models.CanvasContext in project instructure-android by instructure.
the class DiscussionManager method postToDiscussionTopic.
public static void postToDiscussionTopic(CanvasContext canvasContext, long topicId, String message, StatusCallback<DiscussionEntry> callback) {
if (isTesting() || mTesting) {
// TODO:
} else {
RestBuilder adapter = new RestBuilder(callback);
RestParams params = new RestParams.Builder().build();
DiscussionAPI.postToDiscussionTopic(adapter, canvasContext, topicId, message, callback, params);
}
}
Aggregations