| 5 | import eu.the5zig.util.io.http.HttpResponseCallback; |
| 6 | |
| 7 | public abstract class APIManager { |
| 8 | |
| 9 | private final String BASE_URL; |
| 10 | |
| 11 | public APIManager(String baseURL) { |
| 12 | this.BASE_URL = baseURL; |
| 13 | } |
| 14 | |
| 15 | /** |
| 16 | * Makes an async HTTP Request to {@link #BASE_URL}. |
| 17 | * |
| 18 | * @param endpoint The endpoint of the API. |
| 19 | * @param callback The Callback. |
| 20 | */ |
| 21 | protected void get(String endpoint, final HttpResponseCallback callback) throws Exception { |
| 22 | if (NetworkManager.CLIENT_NIO_EVENTLOOP == null) { |
| 23 | callback.call(null, 300, new RuntimeException("No NIO EventLoop")); |
| 24 | } else { |
| 25 | HttpClient.get(BASE_URL + endpoint, NetworkManager.CLIENT_NIO_EVENTLOOP, callback); |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | } |
nothing calls this directly
no outgoing calls
no test coverage detected