Skip to content

Commit dc3eef5

Browse files
committed
Generator update to 7.2
1 parent 73c1de0 commit dc3eef5

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

sessionize-java-client/src/generated/java/software/xdev/sessionize/client/ApiClient.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
import java.util.Arrays;
5656
import java.util.ArrayList;
5757
import java.util.Date;
58+
import java.util.function.Supplier;
5859
import java.util.TimeZone;
5960
import java.util.regex.Matcher;
6061
import java.util.regex.Pattern;
@@ -66,6 +67,7 @@
6667
import java.io.IOException;
6768
import java.io.UnsupportedEncodingException;
6869
import java.nio.charset.Charset;
70+
import java.nio.charset.StandardCharsets;
6971
import java.nio.charset.UnsupportedCharsetException;
7072
import java.nio.file.Files;
7173
import java.nio.file.StandardCopyOption;
@@ -639,7 +641,7 @@ public HttpEntity serialize(Object obj, Map<String, Object> formParams, ContentT
639641
String mimeType = contentType.getMimeType();
640642
if (isJsonMime(mimeType)) {
641643
try {
642-
return new StringEntity(objectMapper.writeValueAsString(obj), contentType);
644+
return new StringEntity(objectMapper.writeValueAsString(obj), contentType.withCharset(StandardCharsets.UTF_8));
643645
} catch (JsonProcessingException e) {
644646
throw new ApiException(e);
645647
}

sessionize-java-client/src/generated/java/software/xdev/sessionize/client/auth/HttpBearerAuth.java

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,15 @@
1515

1616
import software.xdev.sessionize.client.Pair;
1717

18-
import java.util.Map;
1918
import java.util.List;
19+
import java.util.Map;
20+
import java.util.Optional;
21+
import java.util.function.Supplier;
2022

2123
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
2224
public class HttpBearerAuth implements Authentication {
2325
private final String scheme;
24-
private String bearerToken;
26+
private Supplier<String> tokenSupplier;
2527

2628
public HttpBearerAuth(String scheme) {
2729
this.scheme = scheme;
@@ -33,7 +35,7 @@ public HttpBearerAuth(String scheme) {
3335
* @return The bearer token
3436
*/
3537
public String getBearerToken() {
36-
return bearerToken;
38+
return tokenSupplier.get();
3739
}
3840

3941
/**
@@ -42,12 +44,22 @@ public String getBearerToken() {
4244
* @param bearerToken The bearer token to send in the Authorization header
4345
*/
4446
public void setBearerToken(String bearerToken) {
45-
this.bearerToken = bearerToken;
47+
this.tokenSupplier = () -> bearerToken;
48+
}
49+
50+
/**
51+
* Sets the supplier of tokens, which together with the scheme, will be sent as the value of the Authorization header.
52+
*
53+
* @param tokenSupplier The supplier of bearer tokens to send in the Authorization header
54+
*/
55+
public void setBearerToken(Supplier<String> tokenSupplier) {
56+
this.tokenSupplier = tokenSupplier;
4657
}
4758

4859
@Override
4960
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams) {
50-
if(bearerToken == null) {
61+
String bearerToken = Optional.ofNullable(tokenSupplier).map(Supplier::get).orElse(null);
62+
if (bearerToken == null) {
5163
return;
5264
}
5365

0 commit comments

Comments
 (0)