package org.wikipedia;

import org.mediawiki.api.json.Api;
import org.mediawiki.api.json.ApiResult;
import org.mediawiki.api.json.RequestBuilder;
import org.wikipedia.concurrency.SaneAsyncTask;

import java.util.concurrent.Executor;

abstract public class ApiTask<T> extends SaneAsyncTask<T> {
    private final Api api;

    public ApiTask(Executor executor, Api api) {
        super(executor);
        this.api = api;
    }

    @Override
    public T performTask() throws Throwable {
        ApiResult result = buildRequest(api).get();
        return processResult(result);
    }

    abstract public RequestBuilder buildRequest(Api api);
    abstract public T processResult(ApiResult result) throws Throwable;

}

@@ -507,16 +507,28 @@
 esult = 
+makeRequest(
 buildReq
@@ -540,13 +540,8 @@
 api)
-.get(
 );%0A 
@@ -580,24 +580,123 @@
 lt);%0A    %7D%0A%0A
+    protected ApiResult makeRequest(RequestBuilder builder) %7B%0A        return builder.get();%0A    %7D%0A%0A
     abstract

Make it possible for ApiTask subclasses to override the HTTP method