Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change to Okhttp #86

Merged
merged 57 commits into from
Mar 17, 2019
Merged
Show file tree
Hide file tree
Changes from 55 commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
0b9ee38
Merge remote-tracking branch 'refs/remotes/burberius/master'
GoldenGnu Nov 2, 2017
ace7662
Merge remote-tracking branch 'refs/remotes/burberius/master'
GoldenGnu Nov 10, 2017
948b1f9
Merge remote-tracking branch 'refs/remotes/burberius/master'
GoldenGnu Nov 13, 2017
fdea96a
Merge remote-tracking branch 'refs/remotes/burberius/master'
GoldenGnu Nov 18, 2017
9cbdaf4
Merge remote-tracking branch 'refs/remotes/burberius/master'
GoldenGnu Nov 18, 2017
396efe9
Merge remote-tracking branch 'refs/remotes/burberius/master'
GoldenGnu Nov 22, 2017
b488789
Merge remote-tracking branch 'refs/remotes/burberius/master'
GoldenGnu Nov 27, 2017
f86ccd2
Merge remote-tracking branch 'refs/remotes/burberius/master'
GoldenGnu Dec 10, 2017
b6a758c
Merge remote-tracking branch 'refs/remotes/burberius/master'
GoldenGnu Dec 16, 2017
cbe501d
Merge remote-tracking branch 'refs/remotes/burberius/master'
GoldenGnu Dec 16, 2017
873c1ac
Merge remote-tracking branch 'refs/remotes/burberius/master'
GoldenGnu Dec 21, 2017
2b16393
Merge remote-tracking branch 'refs/remotes/burberius/master'
GoldenGnu Dec 24, 2017
9ec3e74
Merge remote-tracking branch 'refs/remotes/burberius/master'
GoldenGnu Jan 11, 2018
6964dc5
Merge remote-tracking branch 'refs/remotes/burberius/master'
GoldenGnu Jan 11, 2018
0306401
Merge remote-tracking branch 'refs/remotes/burberius/master'
GoldenGnu Jan 13, 2018
496c3ce
Merge remote-tracking branch 'refs/remotes/burberius/master'
GoldenGnu Jan 23, 2018
abdec3c
Merge remote-tracking branch 'refs/remotes/burberius/master'
GoldenGnu Jan 27, 2018
9ed8e9c
Merge remote-tracking branch 'refs/remotes/burberius/master'
GoldenGnu Feb 17, 2018
8b08f25
Merge remote-tracking branch 'refs/remotes/burberius/master'
GoldenGnu Feb 17, 2018
80b6f90
Merge remote-tracking branch 'refs/remotes/burberius/master'
GoldenGnu Feb 24, 2018
bca36db
Merge remote-tracking branch 'refs/remotes/burberius/master'
GoldenGnu Mar 2, 2018
fc0fc4d
Merge remote-tracking branch 'refs/remotes/burberius/master'
GoldenGnu May 1, 2018
0a235c5
Merge remote-tracking branch 'upstream/master'
GoldenGnu May 5, 2018
63166e1
Line ending changes
GoldenGnu May 20, 2018
cea803d
More line ending stuff
GoldenGnu May 20, 2018
26cf681
Final line ending change
GoldenGnu May 20, 2018
66de995
Merge remote-tracking branch 'upstream/master'
GoldenGnu May 20, 2018
9e2ca70
Merge remote-tracking branch 'upstream/master'
GoldenGnu Jul 29, 2018
c9aa13f
Merge remote-tracking branch 'upstream/master'
GoldenGnu Aug 26, 2018
726518f
Merge remote-tracking branch 'upstream/master'
GoldenGnu Aug 26, 2018
50fe12d
Merge remote-tracking branch 'upstream/master'
GoldenGnu Aug 26, 2018
f7c4b27
Merge remote-tracking branch 'upstream/master'
GoldenGnu Aug 26, 2018
58da9ba
Merge remote-tracking branch 'upstream/master'
GoldenGnu Sep 7, 2018
37d1a46
Merge remote-tracking branch 'upstream/master'
GoldenGnu Sep 7, 2018
7bc556f
Merge remote-tracking branch 'upstream/master'
GoldenGnu Sep 30, 2018
edb63a1
Started on issue 78
GoldenGnu Mar 4, 2019
23f0098
Merge remote-tracking branch 'upstream/master'
GoldenGnu Mar 4, 2019
55d28dd
Better tests
GoldenGnu Mar 4, 2019
2c93b95
Better tests
GoldenGnu Mar 4, 2019
61ba570
More work on issue 78
GoldenGnu Mar 4, 2019
2cd1063
Issue 78
GoldenGnu Mar 4, 2019
cf736e5
Issue 78 formatting
GoldenGnu Mar 4, 2019
c3c47c0
Less sync blocks
GoldenGnu Mar 4, 2019
aa213a4
First commit switching to okhttp
GoldenGnu Mar 5, 2019
11266e6
More work on okhttp
GoldenGnu Mar 5, 2019
58e29c8
swagger codegen 2.3.1
GoldenGnu Mar 5, 2019
7da0d1f
formatting
GoldenGnu Mar 5, 2019
5840c23
Bug Fix for OAuth
GoldenGnu Mar 5, 2019
fd49b92
Ok http (#83)
GoldenGnu Mar 11, 2019
7f7b890
Added fixed openapi-generator.
burberius Mar 11, 2019
3ca4d97
Added new openapi generator and made script executable.
burberius Mar 12, 2019
60b2a7c
Update ApiClient.java
GoldenGnu Mar 12, 2019
c7ff30e
2019-03-11 esi release
GoldenGnu Mar 12, 2019
8cf18a1
ApiClientBuilder (#85)
GoldenGnu Mar 15, 2019
eb16343
Merge branch 'master' into okhttp
burberius Mar 15, 2019
ca8c3e1
Okhttp fixes (#89)
GoldenGnu Mar 17, 2019
7d7388d
Update README.md (#88)
GoldenGnu Mar 17, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@ esi.json
/nbactions.xml
/nb-configuration.xml
/src/main/java/net/troja/eve/esi/Main.java
/nbproject/
/nbproject/
meta.json
4 changes: 4 additions & 0 deletions .swagger-codegen-ignore → .openapi-generator-ignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,7 @@ LICENSE

# Changed by us
src/main/java/net/troja/eve/esi/auth/OAuth.java
src/main/java/net/troja/eve/esi/api/SwaggerApi.java
src/test/java/net/troja/eve/esi/api/SwaggerApiTest.java
src/main/java/net/troja/eve/esi/api/WebUiApi.java
src/test/java/net/troja/eve/esi/api/WebUIApiTest.java
1 change: 1 addition & 0 deletions .openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.3.4
2 changes: 1 addition & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"invokerPackage":"net.troja.eve.esi",
"apiPackage":"net.troja.eve.esi.api",
"modelPackage":"net.troja.eve.esi.model",
"library":"jersey2",
"library":"okhttp-gson",
"serializableModel":"true",
"hideGenerationTimestamp":"true",
"dateLibrary":"java8"
Expand Down
20 changes: 17 additions & 3 deletions generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@
# Get eve swagger file
#
rm -f esi.json
wget -q -O esi.json https://esi.evetech.net/_latest/swagger.json?datasource=tranquility
wget -O esi.json https://esi.evetech.net/_latest/swagger.json?datasource=tranquility
wget -O meta.json https://esi.evetech.net/swagger.json

#
# Remove old model files in case something was removed
#
mv src/main/java/net/troja/eve/esi/model/CharacterInfo.java src/main/java/net/troja/eve/esi/CharacterInfo.java
rm -r src/main/java/net/troja/eve/esi/model
mv src/main/java/net/troja/eve/esi/api/SsoApi.java src/main/java/net/troja/eve/esi/SsoApi.java
rm -r src/main/java/net/troja/eve/esi/api

#
# Get swagger code generator
Expand All @@ -29,19 +33,29 @@ rm -r src/main/java/net/troja/eve/esi/model
# Transform and beautify swagger file
#
sed -i -f replace.sed esi.json
sed -i -f meta_replace.sed meta.json
./meta_transformation.sh
./transformation.sh
#
# Generate code
# Move tests so they are generated new and then moved to a different directory
#
test -d src/test/java/net/troja/eve/esi/api.new && rm -r src/test/java/net/troja/eve/esi/api.new
mv src/test/java/net/troja/eve/esi/api src/test/java/net/troja/eve/esi/api.old
java -jar swagger-codegen-cli.jar generate \
java -jar openapi-generator-cli.jar generate \
--skip-validate-spec \
-i meta.json \
-g java \
-c config.json
java -jar openapi-generator-cli.jar generate \
--skip-validate-spec \
-i esi.json \
-l java \
-g java \
-c config.json
mv src/test/java/net/troja/eve/esi/api src/test/java/net/troja/eve/esi/api.new
mv src/test/java/net/troja/eve/esi/api.old src/test/java/net/troja/eve/esi/api
mv src/main/java/net/troja/eve/esi/CharacterInfo.java src/main/java/net/troja/eve/esi//model/CharacterInfo.java
mv src/main/java/net/troja/eve/esi/SsoApi.java src/main/java/net/troja/eve/esi/api/SsoApi.java

for I in $(grep "OpenAPI spec version" src/* -r | sed -e 's#:.*##'); do
sed -i -e '/OpenAPI spec version/d' $I
Expand Down
3 changes: 3 additions & 0 deletions meta_replace.sed
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Objects
s/get_status_item/EsiStatusResponse/g
s/get_verify_ok/EsiVerifyResponse/g
12 changes: 12 additions & 0 deletions meta_transformation.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

# evesso securityDefinitions
echo "Added evesso securityDefinitions"
jq "(.securityDefinitions.evesso) = {\"authorizationUrl\": \"https://login.eveonline.com/v2/oauth/authorize\",\"flow\": \"implicit\",\"scopes\": {}, \"type\": \"oauth2\"}" meta.json > meta_1.json

# evesso verify
echo "Added evesso to verify"
jq "(.paths.\"/verify/\".get.security[0].evesso) = {}" meta_1.json > meta.json

# Clean up
rm meta_1.json
Binary file not shown.
150 changes: 59 additions & 91 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<modelVersion>4.0.0</modelVersion>
<groupId>net.troja.eve</groupId>
<artifactId>eve-esi</artifactId>
<version>2.4.2-SNAPSHOT</version>
<packaging>jar</packaging>
<version>3.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>EVE-ESI</name>
<description>Java Client for the new Eve Swagger Interface (ESI)</description>
<url>https://github.com/burberius/eve-esi</url>
Expand Down Expand Up @@ -39,95 +39,63 @@
</developer>
</developers>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<swagger-core-version>1.5.21</swagger-core-version>
<jersey-version>2.25.1</jersey-version>
<jackson-version>2.9.8</jackson-version>
<junit-version>4.12</junit-version>
</properties>

<dependencies>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>${swagger-core-version}</version>
</dependency>

<!-- HTTP client: jersey-client -->
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>${jersey-version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-multipart</artifactId>
<version>${jersey-version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>${jersey-version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.security</groupId>
<artifactId>oauth2-client</artifactId>
<version>${jersey-version}</version>
</dependency>

<!-- JSON processing: jackson -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson-version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson-version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson-version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>${jackson-version}</version>
</dependency>

<!-- Base64 encoding that works in both JVM and Android -->
<dependency>
<groupId>com.brsanthu</groupId>
<artifactId>migbase64</artifactId>
<version>2.2</version>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.5</version>
</dependency>

<!-- test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
</dependencies>
<dependencies>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>${swagger-core-version}</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp</groupId>
<artifactId>okhttp</artifactId>
<version>${okhttp-version}</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp</groupId>
<artifactId>logging-interceptor</artifactId>
<version>${okhttp-version}</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${gson-version}</version>
</dependency>
<dependency>
<groupId>io.gsonfire</groupId>
<artifactId>gson-fire</artifactId>
<version>${gson-fire-version}</version>
</dependency>
<dependency>
<groupId>org.apache.oltu.oauth2</groupId>
<artifactId>org.apache.oltu.oauth2.client</artifactId>
<version>1.0.1</version>
</dependency>
<!-- test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<java.version>1.8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<gson-fire-version>1.8.0</gson-fire-version>
<swagger-core-version>1.5.18</swagger-core-version>
<okhttp-version>2.7.5</okhttp-version>
<gson-version>2.8.1</gson-version>
<maven-plugin-version>1.0.0</maven-plugin-version>
<junit-version>4.12</junit-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<build>
<plugins>
Expand Down
75 changes: 75 additions & 0 deletions src/main/java/net/troja/eve/esi/ApiCallback.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
* EVE Swagger Interface
* An OpenAPI for EVE Online
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

package net.troja.eve.esi;

import java.io.IOException;

import java.util.Map;
import java.util.List;

/**
* Callback for asynchronous API call.
*
* @param <T>
* The return type
*/
public interface ApiCallback<T> {
/**
* This is called when the API call fails.
*
* @param e
* The exception causing the failure
* @param statusCode
* Status code of the response if available, otherwise it would
* be 0
* @param responseHeaders
* Headers of the response if available, otherwise it would be
* null
*/
void onFailure(ApiException e, int statusCode, Map<String, List<String>> responseHeaders);

/**
* This is called when the API call succeeded.
*
* @param result
* The result deserialized from response
* @param statusCode
* Status code of the response
* @param responseHeaders
* Headers of the response
*/
void onSuccess(T result, int statusCode, Map<String, List<String>> responseHeaders);

/**
* This is called when the API upload processing.
*
* @param bytesWritten
* bytes Written
* @param contentLength
* content length of request body
* @param done
* write end
*/
void onUploadProgress(long bytesWritten, long contentLength, boolean done);

/**
* This is called when the API downlond processing.
*
* @param bytesRead
* bytes Read
* @param contentLength
* content lenngth of the response
* @param done
* Read end
*/
void onDownloadProgress(long bytesRead, long contentLength, boolean done);
}
Loading