Model objects and parsers for the XML, Eve Central and ZKillboard endpoints.
For a CREST implementation, see evanova/eve-crest-java
For DOTLAN support, see evanova/eve-dotlan-java
This code is used in Evanova for Android.
- Insert Jitpack Dependency in Gradle
repositories {
maven { url "https://jitpack.io" }
}
- Add project to dependencies
compile 'com.github.evanova:eve-api-java:master-SNAPSHOT'
- If you don't want the latest version of master, Replace
master-SNAPSHOTwith a release version
##Usage
The simplest way of getting Eve data is by using the DefaultEveNetwork class.
//Have a simple HTTP/HTTPS support
final EveNetwork eve = new DefaultEveNetwork();
//Create the request to submit
final ServerStatusRequest request = new ServerStatusRequest();
//Submit the request and receive a response
final ServerStatusResponse status = eve.execute(request);
//Do something
System.out.println(status.getOnlinePlayers() + " pilots online");
If you'd rather obtain a response from an InputStream (for mocking, caching, or you have your own network code), you can use the EveFacade utility class instead:
//Create the request to submit
final ServerStatusRequest request = new ServerStatusRequest();
//The result of the request as a stream
InputStream in = ...
//Obtain a parsed version of the response stream
final ServerStatusResponse status = EveFacade.parse(request, in);
For requests that implement EveAPIRequest.Authenticated, you will need to provide API keys as parameters in the request.
This is usually done like so:
request.putParam("keyID", "APIKEY");
request.putParam("vCode", "VCODE");
As of Citadel, you can also use a CREST token that you have previously obtained through CREST SSO:
request.putParam("accessToken", "CREST TOKEN");
request.putParam("accessType", "character"); //'corporation' or 'character'
Each request to an endpoint is modeled as an EveRequest associated with an EveResponse:
public abstract class EveRequest<T extends EveResponse>
Each EveResponse has a corresponding EveParser which creates response instances given an InputStream:
public interface EveParser<T extends EveResponse> {
T parse(InputStream in) throws IOException;
}
The EveNetwork interface provides an EveResponse from an EveRequest
public interface EveNetwork {
<T extends EveResponse> T execute(final EveRequest<T> request);
}
The DefaultEveNetwork class is a simple implementation using HttpUrlConnection, with support for HTTPS.
evanova.mobile@gmail.com (in-game: Evanova Android)
You!