MCPcopy Create free account
hub / github.com/5zig/The-5zig-Mod / APIManager

Class APIManager

The 5zig Mod/src/eu/the5zig/mod/util/APIManager.java:7–29  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5import eu.the5zig.util.io.http.HttpResponseCallback;
6
7public 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}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected