Search in sources :

Example 1 with NotificationsRequest

use of in.ac.iitb.gymkhana.iitbapp.api.model.NotificationsRequest in project IITB-App by wncc.

the class MainActivity method fetchNotifications.

private void fetchNotifications() {
    NotificationsRequest notificationsRequest = new NotificationsRequest(0, 20);
    RetrofitInterface retrofitInterface = ServiceGenerator.createService(RetrofitInterface.class);
    retrofitInterface.getNotifications(notificationsRequest).enqueue(new Callback<NotificationsResponse>() {

        @Override
        public void onResponse(Call<NotificationsResponse> call, Response<NotificationsResponse> response) {
            if (response.isSuccessful()) {
                notificationsResponse = response.body();
                if (showNotifications) {
                    showNotifications();
                    showNotifications = false;
                }
            }
        // Server Error
        }

        @Override
        public void onFailure(Call<NotificationsResponse> call, Throwable t) {
        // Network Error
        }
    });
}
Also used : NotificationsResponse(in.ac.iitb.gymkhana.iitbapp.api.model.NotificationsResponse) NotificationsRequest(in.ac.iitb.gymkhana.iitbapp.api.model.NotificationsRequest) RetrofitInterface(in.ac.iitb.gymkhana.iitbapp.api.RetrofitInterface)

Aggregations

RetrofitInterface (in.ac.iitb.gymkhana.iitbapp.api.RetrofitInterface)1 NotificationsRequest (in.ac.iitb.gymkhana.iitbapp.api.model.NotificationsRequest)1 NotificationsResponse (in.ac.iitb.gymkhana.iitbapp.api.model.NotificationsResponse)1