blob: 3dd09f37deac5befbeea540b133165b0f0639434 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
package io;
import com.google.gson.JsonElement;
import java.io.IOException;
import org.json.JSONObject;
/**
* Performs an API request.
*
* @author Peter Wu
*/
public interface Requester {
/**
* Performs an API request for a resource, for example
* "statuses/mentions_timeline" (note, no leading slash nor ".json" suffix).
* Prefix the resource with "1/" when you really need to target the old 1.0
* API.
*
* @param resource The REST resource.
* @return A JSON object resulting from the request.
* @throws java.io.IOException on error fetching the resource.
*/
public Response getJSON(String resource) throws IOException;
/**
* Tests whether this instance can dispatch requests.
*
* @return true if the access tokens are valid, false otherwise.
* @throws java.io.IOException if the status cannot reliably be determined
* (e.g. network error, parsing error).
*/
public boolean isValid() throws IOException;
}
|