Search in sources :

Example 96 with ToDo

use of com.instructure.canvasapi2.models.ToDo 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 97 with ToDo

use of com.instructure.canvasapi2.models.ToDo 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 98 with ToDo

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

the class AccountNotificationManager method getAccountNotifications.

public static void getAccountNotifications(StatusCallback<List<AccountNotification>> callback, boolean forceNetwork) {
    if (isTesting() || mTesting) {
    // TODO
    } else {
        RestBuilder adapter = new RestBuilder(callback);
        RestParams params = new RestParams.Builder().withForceReadFromNetwork(forceNetwork).withPerPageQueryParam(true).build();
        AccountNotificationAPI.getAccountNotifications(adapter, params, callback);
    }
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Example 99 with ToDo

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

the class AccountNotificationManager method getAllAccountNotifications.

public static void getAllAccountNotifications(StatusCallback<List<AccountNotification>> callback, boolean forceNetwork) {
    if (isTesting() || mTesting) {
    // TODO
    } else {
        final RestBuilder adapter = new RestBuilder(callback);
        final RestParams params = new RestParams.Builder().withForceReadFromNetwork(forceNetwork).withPerPageQueryParam(true).build();
        StatusCallback<List<AccountNotification>> depaginatedCallback = new ExhaustiveListCallback<AccountNotification>(callback) {

            @Override
            public void getNextPage(StatusCallback<List<AccountNotification>> callback, String nextUrl, boolean isCached) {
                AccountNotificationAPI.getAccountNotifications(adapter, params, callback);
            }
        };
        adapter.setStatusCallback(depaginatedCallback);
        AccountNotificationAPI.getAccountNotifications(adapter, params, depaginatedCallback);
    }
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder) List(java.util.List) StatusCallback(com.instructure.canvasapi2.StatusCallback) ExhaustiveListCallback(com.instructure.canvasapi2.utils.ExhaustiveListCallback) AccountNotification(com.instructure.canvasapi2.models.AccountNotification)

Example 100 with ToDo

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

the class AlertManager method markAlertAsDismissed.

public static void markAlertAsDismissed(String airwolfDomain, String parentId, String alertId, StatusCallback<ResponseBody> callback) {
    if (isTesting() || mTesting) {
    // TODO:
    } else {
        RestBuilder adapter = new RestBuilder(callback);
        RestParams params = new RestParams.Builder().withPerPageQueryParam(false).withDomain(airwolfDomain).withAPIVersion("").build();
        AlertAPI.markAlertAsDismissed(parentId, alertId, adapter, callback, params);
    }
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Aggregations

RestBuilder (com.instructure.canvasapi2.builders.RestBuilder)158 RestParams (com.instructure.canvasapi2.builders.RestParams)141 LinkHeaders (com.instructure.canvasapi2.utils.LinkHeaders)51 Response (okhttp3.Response)47 List (java.util.List)43 ArrayList (java.util.ArrayList)36 Request (okhttp3.Request)26 StatusCallback (com.instructure.canvasapi2.StatusCallback)21 ExhaustiveListCallback (com.instructure.canvasapi2.utils.ExhaustiveListCallback)20 NonNull (android.support.annotation.NonNull)19 Conversation (com.instructure.canvasapi2.models.Conversation)10 QuizSubmissionQuestionResponse (com.instructure.canvasapi2.models.QuizSubmissionQuestionResponse)8 QuizSubmissionResponse (com.instructure.canvasapi2.models.QuizSubmissionResponse)8 ToDo (com.instructure.canvasapi2.models.ToDo)8 GradingPeriodResponse (com.instructure.canvasapi2.models.GradingPeriodResponse)7 Assignment (com.instructure.canvasapi2.models.Assignment)6 DiscussionTopicHeader (com.instructure.canvasapi2.models.DiscussionTopicHeader)6 FileFolder (com.instructure.canvasapi2.models.FileFolder)6 UpdateFileFolder (com.instructure.canvasapi2.models.UpdateFileFolder)6 Course (com.instructure.canvasapi2.models.Course)5