package com.proxerme.library.connection.notifications.request;

import android.support.annotation.IntRange;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import com.afollestad.bridge.Response;
import com.proxerme.library.connection.ProxerException;
import com.proxerme.library.connection.ProxerRequest;
import com.proxerme.library.connection.notifications.result.NewsErrorResult;
import com.proxerme.library.connection.notifications.result.NewsResult;
import com.proxerme.library.info.ProxerTag;
import com.proxerme.library.info.ProxerUrlHolder;

/**
 * TODO: Describe class
 *
 * @author Ruben Gees
 */

public class NewsRequest extends ProxerRequest<NewsResult, NewsErrorResult> {

    private static final String NEWS_URL = "/api/v1/notifications/news?p=%s";

    private int page;

    public NewsRequest(@IntRange(from = 1) int page) {
        this.page = page;
    }

    @Override
    protected int getTag() {
        return ProxerTag.NEWS;
    }

    @Override
    protected NewsResult parse(Response response) throws Exception {
        return response.asClass(NewsResult.class);
    }

    @Override
    protected NewsErrorResult createErrorResult(@NonNull ProxerException exception) {
        return new NewsErrorResult(exception);
    }

    @NonNull
    @Override
    protected String getURL() {
        return ProxerUrlHolder.getHost() + NEWS_URL;
    }

    @Nullable
    @Override
    protected String[] getParameters() {
        return new String[]{String.valueOf(page)};
    }
}

@@ -277,147 +277,14 @@
 oxer
-Exception;%0Aimport com.proxerme.library.connection.ProxerRequest;%0Aimport com.proxerme.library.connection.notifications.result.NewsErrorResul
+Reques
 t;%0Ai
@@ -568,25 +568,8 @@
 sult
-, NewsErrorResult
 %3E %7B%0A
@@ -923,16 +923,16 @@
 ption %7B%0A
+
         
@@ -985,162 +985,8 @@
  %7D%0A%0A
-    @Override%0A    protected NewsErrorResult createErrorResult(@NonNull ProxerException exception) %7B%0A        return new NewsErrorResult(exception);%0A    %7D%0A%0A
     

Fix NewsRequest