public class HttpClient extends Client
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CRLF |
java.net.Proxy |
proxy
Proxy to use, defaults to none.
|
static java.lang.String |
SERVER_URL |
_password, _username, API_VERSION, DEFAULT_TIMEOUT, isVerbose, POLLS_INTERVAL, SOFTWARE_VENDOR_ID
Constructor and Description |
---|
HttpClient(java.lang.String username,
java.lang.String password) |
Modifier and Type | Method and Description |
---|---|
protected org.json.JSONObject |
call(java.lang.String cmd) |
protected org.json.JSONObject |
call(java.lang.String cmd,
byte[] data) |
protected org.json.JSONObject |
call(java.lang.String cmd,
byte[] data,
java.lang.String contentType) |
protected org.json.JSONObject |
call(java.lang.String cmd,
org.json.JSONObject args) |
void |
close()
Closes opened connections (if any), cleans up resources.
|
boolean |
connect()
Opens API-specific connection if not opened yet.
|
Captcha |
getCaptcha(int id)
Fetches an uploaded CAPTCHA details.
|
User |
getUser()
Fetches user details.
|
boolean |
report(int id)
Reports an incorrectly solved CAPTCHA
|
Captcha |
upload(byte[] img) |
Captcha |
upload(byte[] img,
int type,
byte[] banner,
java.lang.String banner_text) |
Captcha |
upload(byte[] img,
java.lang.String challenge,
int type,
byte[] banner,
java.lang.String banner_text) |
Captcha |
upload(byte[] img,
java.lang.String challenge,
int type,
byte[] banner,
java.lang.String banner_text,
java.lang.String grid)
Uploads a CAPTCHA to the service.
|
decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, getBalance, getCaptcha, getCredentials, getText, getText, load, load, load, log, log, report, upload, upload, upload
public static final java.lang.String CRLF
public static final java.lang.String SERVER_URL
public java.net.Proxy proxy
public HttpClient(java.lang.String username, java.lang.String password)
Client.Client(String, String)
@NotNull protected org.json.JSONObject call(java.lang.String cmd, @NotNull byte[] data, @Nullable java.lang.String contentType) throws java.io.IOException, Exception
java.io.IOException
Exception
@NotNull protected org.json.JSONObject call(java.lang.String cmd, @NotNull byte[] data) throws java.io.IOException, Exception
java.io.IOException
Exception
@NotNull protected org.json.JSONObject call(java.lang.String cmd, @NotNull org.json.JSONObject args) throws java.io.IOException, Exception
java.io.IOException
Exception
@NotNull protected org.json.JSONObject call(java.lang.String cmd) throws java.io.IOException, Exception
java.io.IOException
Exception
public void close()
Client
public boolean connect() throws java.io.IOException
Client
@NotNull public User getUser() throws java.io.IOException, Exception
Client
@Nullable public Captcha upload(@NotNull byte[] img, @NotNull java.lang.String challenge, int type, @Nullable byte[] banner, @NotNull java.lang.String banner_text, @NotNull java.lang.String grid) throws java.io.IOException, Exception
Client
@Nullable public Captcha upload(@NotNull byte[] img, @NotNull java.lang.String challenge, int type, byte[] banner, @NotNull java.lang.String banner_text) throws java.io.IOException, Exception
@NotNull public Captcha upload(byte[] img, int type, byte[] banner, java.lang.String banner_text) throws java.io.IOException, Exception
@NotNull public Captcha getCaptcha(int id) throws java.io.IOException, Exception
Client
getCaptcha
in class Client
id
- CAPTCHA IDjava.io.IOException
Exception