Search in sources :

Example 31 with NetworkResponse

use of forpdateam.ru.forpda.api.NetworkResponse in project ForPDA by RadiationX.

the class NewsApi method sendPoll.

public DetailsPage sendPoll(String from, int pollId, int[] answersId) throws Exception {
    String url = "https://4pda.ru/pages/poll/?act=vote&poll_id=" + pollId;
    NetworkRequest.Builder rBuilder = new NetworkRequest.Builder().url(url).multipart().xhrHeader().formHeader("from", from);
    for (int i = 0; i < answersId.length; i++) {
        rBuilder.formHeader("answer[]", Integer.toString(answersId[i]));
    }
    NetworkResponse response = Api.getWebClient().request(rBuilder.build());
    return parseArticle(response.getBody());
}
Also used : NetworkRequest(forpdateam.ru.forpda.api.NetworkRequest) NetworkResponse(forpdateam.ru.forpda.api.NetworkResponse)

Example 32 with NetworkResponse

use of forpdateam.ru.forpda.api.NetworkResponse in project ForPDA by RadiationX.

the class Qms method getBlackList.

public ArrayList<QmsContact> getBlackList() throws Exception {
    NetworkRequest.Builder builder = new NetworkRequest.Builder().url("https://4pda.ru/forum/index.php?act=qms&settings=blacklist").formHeader("xhr", "body");
    NetworkResponse response = Api.getWebClient().request(builder.build());
    return parseBlackList(response.getBody());
}
Also used : NetworkRequest(forpdateam.ru.forpda.api.NetworkRequest) NetworkResponse(forpdateam.ru.forpda.api.NetworkResponse)

Example 33 with NetworkResponse

use of forpdateam.ru.forpda.api.NetworkResponse in project ForPDA by RadiationX.

the class Qms method getThemesList.

public QmsThemes getThemesList(int id) throws Exception {
    NetworkRequest.Builder builder = new NetworkRequest.Builder().url("https://4pda.ru/forum/index.php?act=qms&mid=" + id).formHeader("xhr", "body");
    NetworkResponse response = Api.getWebClient().request(builder.build());
    return parseThemes(response.getBody(), id);
}
Also used : NetworkRequest(forpdateam.ru.forpda.api.NetworkRequest) NetworkResponse(forpdateam.ru.forpda.api.NetworkResponse)

Example 34 with NetworkResponse

use of forpdateam.ru.forpda.api.NetworkResponse in project ForPDA by RadiationX.

the class Qms method unBlockUsers.

public ArrayList<QmsContact> unBlockUsers(int[] ids) throws Exception {
    NetworkRequest.Builder builder = new NetworkRequest.Builder().url("https://4pda.ru/forum/index.php?act=qms&settings=blacklist&xhr=blacklist-form&do=1").formHeader("action", "delete-users");
    String strId;
    for (int id : ids) {
        strId = Integer.toString(id);
        builder.formHeader("user-id[".concat(strId).concat("]"), strId);
    }
    NetworkResponse response = Api.getWebClient().request(builder.build());
    checkOperation(response.getBody());
    return parseBlackList(response.getBody());
}
Also used : NetworkRequest(forpdateam.ru.forpda.api.NetworkRequest) NetworkResponse(forpdateam.ru.forpda.api.NetworkResponse)

Example 35 with NetworkResponse

use of forpdateam.ru.forpda.api.NetworkResponse in project ForPDA by RadiationX.

the class Qms method blockUser.

public ArrayList<QmsContact> blockUser(String nick) throws Exception {
    NetworkRequest.Builder builder = new NetworkRequest.Builder().url("https://4pda.ru/forum/index.php?act=qms&settings=blacklist&xhr=blacklist-form&do=1").formHeader("action", "add-user").formHeader("username", nick);
    NetworkResponse response = Api.getWebClient().request(builder.build());
    checkOperation(response.getBody());
    return parseBlackList(response.getBody());
}
Also used : NetworkRequest(forpdateam.ru.forpda.api.NetworkRequest) NetworkResponse(forpdateam.ru.forpda.api.NetworkResponse)

Aggregations

NetworkResponse (forpdateam.ru.forpda.api.NetworkResponse)44 Matcher (java.util.regex.Matcher)27 NetworkRequest (forpdateam.ru.forpda.api.NetworkRequest)25 ArrayList (java.util.ArrayList)8 AttachmentItem (forpdateam.ru.forpda.api.theme.editpost.models.AttachmentItem)6 Bundle (android.os.Bundle)3 RequestFile (forpdateam.ru.forpda.api.RequestFile)3 Context (android.content.Context)2 Uri (android.net.Uri)2 App (forpdateam.ru.forpda.App)2 R (forpdateam.ru.forpda.R)2 QmsMessage (forpdateam.ru.forpda.api.qms.models.QmsMessage)2 Client (forpdateam.ru.forpda.client.Client)2 Observable (io.reactivex.Observable)2 AndroidSchedulers (io.reactivex.android.schedulers.AndroidSchedulers)2 Schedulers (io.reactivex.schedulers.Schedulers)2 Activity (android.app.Activity)1 DownloadManager (android.app.DownloadManager)1 ActivityNotFoundException (android.content.ActivityNotFoundException)1 Intent (android.content.Intent)1