Skip to content

Commit 5f48954

Browse files
committed
1 parent 4dd46b2 commit 5f48954

75 files changed

Lines changed: 526 additions & 721 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.openapi-generator/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7.12.0-SNAPSHOT
1+
7.14.0-SNAPSHOT

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
dofusdude
44
- API version: 1.0.0
5-
- Build date: 2025-01-26T15:20:08.698089650Z[Etc/UTC]
6-
- Generator version: 7.12.0-SNAPSHOT
5+
- Build date: 2025-05-26T19:30:53.853622924Z[Etc/UTC]
6+
- Generator version: 7.14.0-SNAPSHOT
77

88
# Open Ankama Developer Community
99
The all-in-one toolbelt for your next Ankama related project.

api/openapi.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,7 +1131,7 @@ paths:
11311131
required: false
11321132
schema:
11331133
example:
1134-
- wings
1134+
- ceremonial-wings
11351135
items:
11361136
type: string
11371137
type: array
@@ -1332,7 +1332,7 @@ paths:
13321332
name: ankama_id
13331333
required: true
13341334
schema:
1335-
example: 26009
1335+
example: 13971
13361336
type: integer
13371337
style: simple
13381338
- description: game main 'dofus3' or beta channel 'dofus3beta'
@@ -2192,7 +2192,7 @@ paths:
21922192
required: false
21932193
schema:
21942194
example:
2195-
- wood
2195+
- key
21962196
items:
21972197
type: string
21982198
type: array
@@ -3008,7 +3008,7 @@ paths:
30083008
required: false
30093009
schema:
30103010
example:
3011-
- boots
3011+
- ceremonial-wings
30123012
items:
30133013
type: string
30143014
type: array
@@ -3139,7 +3139,7 @@ paths:
31393139
required: false
31403140
schema:
31413141
example:
3142-
- boots
3142+
- kwismas-island
31433143
items:
31443144
type: string
31453145
type: array
@@ -3263,7 +3263,7 @@ paths:
32633263
required: false
32643264
schema:
32653265
example:
3266-
- boots
3266+
- chest
32673267
items:
32683268
type: string
32693269
type: array
@@ -3393,7 +3393,7 @@ paths:
33933393
required: false
33943394
schema:
33953395
example:
3396-
- boots
3396+
- garment
33973397
items:
33983398
type: string
33993399
type: array

build.sbt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ lazy val root = (project in file(".")).
33
organization := "com.dofusdude",
44
name := "dofusdude-java",
55
version := "1.0.0",
6-
scalaVersion := "2.11.4",
6+
scalaVersion := "2.11.12",
77
scalacOptions ++= Seq("-feature"),
8-
javacOptions in compile ++= Seq("-Xlint:deprecation"),
9-
publishArtifact in (Compile, packageDoc) := false,
8+
compile / javacOptions ++= Seq("-Xlint:deprecation"),
9+
Compile / packageDoc / publishArtifact := false,
1010
resolvers += Resolver.mavenLocal,
1111
libraryDependencies ++= Seq(
1212
"io.swagger" % "swagger-annotations" % "1.6.5",

docs/EquipmentApi.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ public class Example {
266266

267267
EquipmentApi apiInstance = new EquipmentApi(defaultClient);
268268
String language = "en"; // String | a valid language code
269-
Integer ankamaId = 26009; // Integer | identifier
269+
Integer ankamaId = 13971; // Integer | identifier
270270
String game = "dofus3"; // String | game main 'dofus3' or beta channel 'dofus3beta'
271271
try {
272272
Weapon result = apiInstance.getItemsEquipmentSingle(language, ankamaId, game);

src/main/java/com/dofusdude/client/ApiClient.java

Lines changed: 44 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
*/
6262
public class ApiClient {
6363

64-
private String basePath = "https://api.dofusdu.de";
64+
protected String basePath = "https://api.dofusdu.de";
6565
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>(Arrays.asList(
6666
new ServerConfiguration(
6767
"https://api.dofusdu.de",
@@ -71,26 +71,26 @@ public class ApiClient {
7171
));
7272
protected Integer serverIndex = 0;
7373
protected Map<String, String> serverVariables = null;
74-
private boolean debugging = false;
75-
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
76-
private Map<String, String> defaultCookieMap = new HashMap<String, String>();
77-
private String tempFolderPath = null;
74+
protected boolean debugging = false;
75+
protected Map<String, String> defaultHeaderMap = new HashMap<String, String>();
76+
protected Map<String, String> defaultCookieMap = new HashMap<String, String>();
77+
protected String tempFolderPath = null;
7878

79-
private Map<String, Authentication> authentications;
79+
protected Map<String, Authentication> authentications;
8080

81-
private DateFormat dateFormat;
82-
private DateFormat datetimeFormat;
83-
private boolean lenientDatetimeFormat;
84-
private int dateLength;
81+
protected DateFormat dateFormat;
82+
protected DateFormat datetimeFormat;
83+
protected boolean lenientDatetimeFormat;
84+
protected int dateLength;
8585

86-
private InputStream sslCaCert;
87-
private boolean verifyingSsl;
88-
private KeyManager[] keyManagers;
86+
protected InputStream sslCaCert;
87+
protected boolean verifyingSsl;
88+
protected KeyManager[] keyManagers;
8989

90-
private OkHttpClient httpClient;
91-
private JSON json;
90+
protected OkHttpClient httpClient;
91+
protected JSON json;
9292

93-
private HttpLoggingInterceptor loggingInterceptor;
93+
protected HttpLoggingInterceptor loggingInterceptor;
9494

9595
/**
9696
* Basic constructor for ApiClient
@@ -119,11 +119,11 @@ public ApiClient(OkHttpClient client) {
119119
authentications = Collections.unmodifiableMap(authentications);
120120
}
121121

122-
private void initHttpClient() {
122+
protected void initHttpClient() {
123123
initHttpClient(Collections.<Interceptor>emptyList());
124124
}
125125

126-
private void initHttpClient(List<Interceptor> interceptors) {
126+
protected void initHttpClient(List<Interceptor> interceptors) {
127127
OkHttpClient.Builder builder = new OkHttpClient.Builder();
128128
builder.addNetworkInterceptor(getProgressInterceptor());
129129
for (Interceptor interceptor: interceptors) {
@@ -133,7 +133,7 @@ private void initHttpClient(List<Interceptor> interceptors) {
133133
httpClient = builder.build();
134134
}
135135

136-
private void init() {
136+
protected void init() {
137137
verifyingSsl = true;
138138

139139
json = new JSON();
@@ -800,7 +800,7 @@ public String collectionPathParameterToString(String collectionFormat, Collectio
800800
* @return The sanitized filename
801801
*/
802802
public String sanitizeFilename(String filename) {
803-
return filename.replaceAll(".*[/\\\\]", "");
803+
return filename.replaceFirst("^.*[/\\\\]", "");
804804
}
805805

806806
/**
@@ -910,17 +910,8 @@ public <T> T deserialize(Response response, Type returnType) throws ApiException
910910
return (T) downloadFileFromResponse(response);
911911
}
912912

913-
String respBody;
914-
try {
915-
if (response.body() != null)
916-
respBody = response.body().string();
917-
else
918-
respBody = null;
919-
} catch (IOException e) {
920-
throw new ApiException(e);
921-
}
922-
923-
if (respBody == null || "".equals(respBody)) {
913+
ResponseBody respBody = response.body();
914+
if (respBody == null) {
924915
return null;
925916
}
926917

@@ -929,17 +920,25 @@ public <T> T deserialize(Response response, Type returnType) throws ApiException
929920
// ensuring a default content type
930921
contentType = "application/json";
931922
}
932-
if (isJsonMime(contentType)) {
933-
return JSON.deserialize(respBody, returnType);
934-
} else if (returnType.equals(String.class)) {
935-
// Expecting string, return the raw response body.
936-
return (T) respBody;
937-
} else {
938-
throw new ApiException(
923+
try {
924+
if (isJsonMime(contentType)) {
925+
return JSON.deserialize(respBody.byteStream(), returnType);
926+
} else if (returnType.equals(String.class)) {
927+
String respBodyString = respBody.string();
928+
if (respBodyString.isEmpty()) {
929+
return null;
930+
}
931+
// Expecting string, return the raw response body.
932+
return (T) respBodyString;
933+
} else {
934+
throw new ApiException(
939935
"Content type \"" + contentType + "\" is not supported for type: " + returnType,
940936
response.code(),
941937
response.headers().toMultimap(),
942-
respBody);
938+
response.body().string());
939+
}
940+
} catch (IOException e) {
941+
throw new ApiException(e);
943942
}
944943
}
945944

@@ -1435,7 +1434,7 @@ public String guessContentTypeFromFile(File file) {
14351434
* @param key The key of the Header element
14361435
* @param file The file to add to the Header
14371436
*/
1438-
private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) {
1437+
protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) {
14391438
Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\"");
14401439
MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file));
14411440
mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType));
@@ -1448,7 +1447,7 @@ private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String k
14481447
* @param key The key of the Header element
14491448
* @param obj The complex object to add to the Header
14501449
*/
1451-
private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) {
1450+
protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) {
14521451
RequestBody requestBody;
14531452
if (obj instanceof String) {
14541453
requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain"));
@@ -1470,7 +1469,7 @@ private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String k
14701469
* Get network interceptor to add it to the httpClient to track download progress for
14711470
* async requests.
14721471
*/
1473-
private Interceptor getProgressInterceptor() {
1472+
protected Interceptor getProgressInterceptor() {
14741473
return new Interceptor() {
14751474
@Override
14761475
public Response intercept(Interceptor.Chain chain) throws IOException {
@@ -1491,7 +1490,7 @@ public Response intercept(Interceptor.Chain chain) throws IOException {
14911490
* Apply SSL related settings to httpClient according to the current values of
14921491
* verifyingSsl and sslCaCert.
14931492
*/
1494-
private void applySslSettings() {
1493+
protected void applySslSettings() {
14951494
try {
14961495
TrustManager[] trustManagers;
14971496
HostnameVerifier hostnameVerifier;
@@ -1553,7 +1552,7 @@ public boolean verify(String hostname, SSLSession session) {
15531552
}
15541553
}
15551554

1556-
private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException {
1555+
protected KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException {
15571556
try {
15581557
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
15591558
keyStore.load(null, password);
@@ -1570,7 +1569,7 @@ private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityExcepti
15701569
* @return The string representation of the HTTP request body
15711570
* @throws com.dofusdude.client.ApiException If fail to serialize the request body object into a string
15721571
*/
1573-
private String requestBodyToString(RequestBody requestBody) throws ApiException {
1572+
protected String requestBodyToString(RequestBody requestBody) throws ApiException {
15741573
if (requestBody != null) {
15751574
try {
15761575
final Buffer buffer = new Buffer();

src/main/java/com/dofusdude/client/ApiException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
* <p>ApiException class.</p>
2222
*/
2323
@SuppressWarnings("serial")
24-
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-26T15:20:08.698089650Z[Etc/UTC]", comments = "Generator version: 7.12.0-SNAPSHOT")
24+
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-26T19:30:53.853622924Z[Etc/UTC]", comments = "Generator version: 7.14.0-SNAPSHOT")
2525
public class ApiException extends Exception {
2626
private static final long serialVersionUID = 1L;
2727

src/main/java/com/dofusdude/client/Configuration.java

Lines changed: 45 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,29 +13,51 @@
1313

1414
package com.dofusdude.client;
1515

16-
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-26T15:20:08.698089650Z[Etc/UTC]", comments = "Generator version: 7.12.0-SNAPSHOT")
16+
import java.util.Objects;
17+
import java.util.concurrent.atomic.AtomicReference;
18+
import java.util.function.Supplier;
19+
20+
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-26T19:30:53.853622924Z[Etc/UTC]", comments = "Generator version: 7.14.0-SNAPSHOT")
1721
public class Configuration {
18-
public static final String VERSION = "1.0.0";
19-
20-
private static ApiClient defaultApiClient = new ApiClient();
21-
22-
/**
23-
* Get the default API client, which would be used when creating API
24-
* instances without providing an API client.
25-
*
26-
* @return Default API client
27-
*/
28-
public static ApiClient getDefaultApiClient() {
29-
return defaultApiClient;
30-
}
22+
public static final String VERSION = "1.0.0";
23+
24+
private static final AtomicReference<ApiClient> defaultApiClient = new AtomicReference<>();
25+
private static volatile Supplier<ApiClient> apiClientFactory = ApiClient::new;
3126

32-
/**
33-
* Set the default API client, which would be used when creating API
34-
* instances without providing an API client.
35-
*
36-
* @param apiClient API client
37-
*/
38-
public static void setDefaultApiClient(ApiClient apiClient) {
39-
defaultApiClient = apiClient;
27+
/**
28+
* Get the default API client, which would be used when creating API instances without providing an API client.
29+
*
30+
* @return Default API client
31+
*/
32+
public static ApiClient getDefaultApiClient() {
33+
ApiClient client = defaultApiClient.get();
34+
if (client == null) {
35+
client = defaultApiClient.updateAndGet(val -> {
36+
if (val != null) { // changed by another thread
37+
return val;
38+
}
39+
return apiClientFactory.get();
40+
});
4041
}
41-
}
42+
return client;
43+
}
44+
45+
/**
46+
* Set the default API client, which would be used when creating API instances without providing an API client.
47+
*
48+
* @param apiClient API client
49+
*/
50+
public static void setDefaultApiClient(ApiClient apiClient) {
51+
defaultApiClient.set(apiClient);
52+
}
53+
54+
/**
55+
* set the callback used to create new ApiClient objects
56+
*/
57+
public static void setApiClientFactory(Supplier<ApiClient> factory) {
58+
apiClientFactory = Objects.requireNonNull(factory);
59+
}
60+
61+
private Configuration() {
62+
}
63+
}

0 commit comments

Comments
 (0)