Skip to content

Commit 2c53b7c

Browse files
committed
Regenerate API
1 parent b8a8de3 commit 2c53b7c

34 files changed

Lines changed: 678 additions & 539 deletions

sessionize-java-client/src/generated/java/software/xdev/sessionize/api/AllApi.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public AllApi(ApiClient apiClient) {
4747
* @return AllResult
4848
* @throws ApiException if fails to make API call
4949
*/
50-
public AllResult getAll(String endpointId) throws ApiException {
50+
public AllResult getAll(@jakarta.annotation.Nonnull String endpointId) throws ApiException {
5151
return this.getAll(endpointId, Collections.emptyMap());
5252
}
5353

@@ -60,7 +60,7 @@ public AllResult getAll(String endpointId) throws ApiException {
6060
* @return AllResult
6161
* @throws ApiException if fails to make API call
6262
*/
63-
public AllResult getAll(String endpointId, Map<String, String> additionalHeaders) throws ApiException {
63+
public AllResult getAll(@jakarta.annotation.Nonnull String endpointId, Map<String, String> additionalHeaders) throws ApiException {
6464
Object localVarPostBody = null;
6565

6666
// verify the required parameter 'endpointId' is set

sessionize-java-client/src/generated/java/software/xdev/sessionize/api/SessionsApi.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public SessionsApi(ApiClient apiClient) {
4747
* @return List&lt;SessionGroup&gt;
4848
* @throws ApiException if fails to make API call
4949
*/
50-
public List<SessionGroup> getAllSessions(String endpointId) throws ApiException {
50+
public List<SessionGroup> getAllSessions(@jakarta.annotation.Nonnull String endpointId) throws ApiException {
5151
return this.getAllSessions(endpointId, Collections.emptyMap());
5252
}
5353

@@ -60,7 +60,7 @@ public List<SessionGroup> getAllSessions(String endpointId) throws ApiException
6060
* @return List&lt;SessionGroup&gt;
6161
* @throws ApiException if fails to make API call
6262
*/
63-
public List<SessionGroup> getAllSessions(String endpointId, Map<String, String> additionalHeaders) throws ApiException {
63+
public List<SessionGroup> getAllSessions(@jakarta.annotation.Nonnull String endpointId, Map<String, String> additionalHeaders) throws ApiException {
6464
Object localVarPostBody = null;
6565

6666
// verify the required parameter 'endpointId' is set

sessionize-java-client/src/generated/java/software/xdev/sessionize/api/SpeakersApi.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public SpeakersApi(ApiClient apiClient) {
4848
* @return List&lt;Speaker&gt;
4949
* @throws ApiException if fails to make API call
5050
*/
51-
public List<Speaker> getAllSpeakers(String endpointId) throws ApiException {
51+
public List<Speaker> getAllSpeakers(@jakarta.annotation.Nonnull String endpointId) throws ApiException {
5252
return this.getAllSpeakers(endpointId, Collections.emptyMap());
5353
}
5454

@@ -61,7 +61,7 @@ public List<Speaker> getAllSpeakers(String endpointId) throws ApiException {
6161
* @return List&lt;Speaker&gt;
6262
* @throws ApiException if fails to make API call
6363
*/
64-
public List<Speaker> getAllSpeakers(String endpointId, Map<String, String> additionalHeaders) throws ApiException {
64+
public List<Speaker> getAllSpeakers(@jakarta.annotation.Nonnull String endpointId, Map<String, String> additionalHeaders) throws ApiException {
6565
Object localVarPostBody = null;
6666

6767
// verify the required parameter 'endpointId' is set
@@ -124,7 +124,7 @@ public List<Speaker> getAllSpeakers(String endpointId, Map<String, String> addit
124124
* @return List&lt;SpeakerWithEmail&gt;
125125
* @throws ApiException if fails to make API call
126126
*/
127-
public List<SpeakerWithEmail> getAllSpeakersEmails(String endpointId, String s) throws ApiException {
127+
public List<SpeakerWithEmail> getAllSpeakersEmails(@jakarta.annotation.Nonnull String endpointId, @jakarta.annotation.Nonnull String s) throws ApiException {
128128
return this.getAllSpeakersEmails(endpointId, s, Collections.emptyMap());
129129
}
130130

@@ -138,7 +138,7 @@ public List<SpeakerWithEmail> getAllSpeakersEmails(String endpointId, String s)
138138
* @return List&lt;SpeakerWithEmail&gt;
139139
* @throws ApiException if fails to make API call
140140
*/
141-
public List<SpeakerWithEmail> getAllSpeakersEmails(String endpointId, String s, Map<String, String> additionalHeaders) throws ApiException {
141+
public List<SpeakerWithEmail> getAllSpeakersEmails(@jakarta.annotation.Nonnull String endpointId, @jakarta.annotation.Nonnull String s, Map<String, String> additionalHeaders) throws ApiException {
142142
Object localVarPostBody = null;
143143

144144
// verify the required parameter 'endpointId' is set

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

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
import java.util.Date;
5757
import java.util.function.Supplier;
5858
import java.util.TimeZone;
59-
import java.util.concurrent.ConcurrentHashMap;
6059
import java.util.regex.Matcher;
6160
import java.util.regex.Pattern;
6261

@@ -80,9 +79,9 @@
8079
import software.xdev.sessionize.client.auth.Authentication;
8180

8281
public class ApiClient extends JavaTimeFormatter {
83-
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
84-
private Map<String, String> defaultCookieMap = new HashMap<String, String>();
85-
private String basePath = "https://sessionize.com";
82+
protected Map<String, String> defaultHeaderMap = new HashMap<String, String>();
83+
protected Map<String, String> defaultCookieMap = new HashMap<String, String>();
84+
protected String basePath = "https://sessionize.com";
8685
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>(Arrays.asList(
8786
new ServerConfiguration(
8887
"https://sessionize.com",
@@ -92,22 +91,22 @@ public class ApiClient extends JavaTimeFormatter {
9291
));
9392
protected Integer serverIndex = 0;
9493
protected Map<String, String> serverVariables = null;
95-
private boolean debugging = false;
96-
private int connectionTimeout = 0;
94+
protected boolean debugging = false;
95+
protected int connectionTimeout = 0;
9796

98-
private CloseableHttpClient httpClient;
99-
private ObjectMapper objectMapper;
97+
protected CloseableHttpClient httpClient;
98+
protected ObjectMapper objectMapper;
10099
protected String tempFolderPath = null;
101100

102-
private Map<String, Authentication> authentications;
101+
protected Map<String, Authentication> authentications;
103102

104-
private Map<Long, Integer> lastStatusCodeByThread = new ConcurrentHashMap<>();
105-
private Map<Long, Map<String, List<String>>> lastResponseHeadersByThread = new ConcurrentHashMap<>();
103+
protected ThreadLocal<Integer> lastStatusCode = new ThreadLocal<>();
104+
protected ThreadLocal<Map<String, List<String>>> lastResponseHeaders = new ThreadLocal<>();
106105

107-
private DateFormat dateFormat;
106+
protected DateFormat dateFormat;
108107

109108
// Methods that can have a request body
110-
private static List<String> bodyMethods = Arrays.asList("POST", "PUT", "DELETE", "PATCH");
109+
protected static List<String> bodyMethods = Arrays.asList("POST", "PUT", "DELETE", "PATCH");
111110

112111
public ApiClient(CloseableHttpClient httpClient) {
113112
objectMapper = new ObjectMapper();
@@ -119,6 +118,7 @@ public ApiClient(CloseableHttpClient httpClient) {
119118
objectMapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING);
120119
objectMapper.registerModule(new JavaTimeModule());
121120
objectMapper.registerModule(new JsonNullableModule());
121+
objectMapper.registerModule(new RFC3339JavaTimeModule());
122122
objectMapper.setDateFormat(ApiClient.buildDefaultDateFormat());
123123

124124
dateFormat = ApiClient.buildDefaultDateFormat();
@@ -248,7 +248,7 @@ public ApiClient setServerVariables(Map<String, String> serverVariables) {
248248
*/
249249
@Deprecated
250250
public int getStatusCode() {
251-
return lastStatusCodeByThread.get(Thread.currentThread().getId());
251+
return lastStatusCode.get();
252252
}
253253

254254
/**
@@ -257,7 +257,7 @@ public int getStatusCode() {
257257
*/
258258
@Deprecated
259259
public Map<String, List<String>> getResponseHeaders() {
260-
return lastResponseHeadersByThread.get(Thread.currentThread().getId());
260+
return lastResponseHeaders.get();
261261
}
262262

263263
/**
@@ -320,7 +320,7 @@ public ApiClient setTempFolderPath(String tempFolderPath) {
320320
* @param value The header's value
321321
* @return API client
322322
*/
323-
public ApiClient addDefaultHeader(String key, String value) {
323+
public final ApiClient addDefaultHeader(String key, String value) {
324324
defaultHeaderMap.put(key, value);
325325
return this;
326326
}
@@ -610,7 +610,7 @@ protected Map<String, List<String>> transformResponseHeaders(Header[] headers) {
610610
/**
611611
* Parse content type object from header value
612612
*/
613-
private ContentType getContentType(String headerValue) throws ApiException {
613+
protected ContentType getContentType(String headerValue) throws ApiException {
614614
try {
615615
return ContentType.parse(headerValue);
616616
} catch (UnsupportedCharsetException e) {
@@ -621,7 +621,7 @@ private ContentType getContentType(String headerValue) throws ApiException {
621621
/**
622622
* Get content type of a response or null if one was not provided
623623
*/
624-
private String getResponseMimeType(HttpResponse response) throws ApiException {
624+
protected String getResponseMimeType(HttpResponse response) throws ApiException {
625625
Header contentTypeHeader = response.getFirstHeader("Content-Type");
626626
if (contentTypeHeader != null) {
627627
return getContentType(contentTypeHeader.getValue()).getMimeType();
@@ -730,7 +730,7 @@ public <T> T deserialize(CloseableHttpResponse response, TypeReference<T> valueT
730730
}
731731
}
732732

733-
private File downloadFileFromResponse(CloseableHttpResponse response) throws IOException {
733+
protected File downloadFileFromResponse(CloseableHttpResponse response) throws IOException {
734734
Header contentDispositionHeader = response.getFirstHeader("Content-Disposition");
735735
String contentDisposition = contentDispositionHeader == null ? null : contentDispositionHeader.getValue();
736736
File file = prepareDownloadFile(contentDisposition);
@@ -782,6 +782,7 @@ public String getBaseURL() {
782782
if (serverIndex != null) {
783783
if (serverIndex < 0 || serverIndex >= servers.size()) {
784784
throw new ArrayIndexOutOfBoundsException(String.format(
785+
java.util.Locale.ROOT,
785786
"Invalid index %d when selecting the host settings. Must be less than %d", serverIndex, servers.size()
786787
));
787788
}
@@ -801,7 +802,7 @@ public String getBaseURL() {
801802
* @param urlQueryDeepObject URL query string of the deep object parameters
802803
* @return The full URL
803804
*/
804-
private String buildUrl(String path, List<Pair> queryParams, List<Pair> collectionQueryParams, String urlQueryDeepObject) {
805+
protected String buildUrl(String path, List<Pair> queryParams, List<Pair> collectionQueryParams, String urlQueryDeepObject) {
805806
String baseURL = getBaseURL();
806807

807808
final StringBuilder url = new StringBuilder();
@@ -867,13 +868,13 @@ protected Cookie buildCookie(String key, String value, URI uri) {
867868

868869
protected <T> T processResponse(CloseableHttpResponse response, TypeReference<T> returnType) throws ApiException, IOException, ParseException {
869870
int statusCode = response.getCode();
870-
lastStatusCodeByThread.put(Thread.currentThread().getId(), statusCode);
871+
lastStatusCode.set(statusCode);
871872
if (statusCode == HttpStatus.SC_NO_CONTENT) {
872873
return null;
873874
}
874875

875876
Map<String, List<String>> responseHeaders = transformResponseHeaders(response.getHeaders());
876-
lastResponseHeadersByThread.put(Thread.currentThread().getId(), responseHeaders);
877+
lastResponseHeaders.set(responseHeaders);
877878

878879
if (isSuccessfulStatus(statusCode)) {
879880
return this.deserialize(response, returnType);
@@ -980,7 +981,7 @@ public <T> T invokeAPI(
980981
* @param headerParams Header parameters
981982
* @param cookieParams Cookie parameters
982983
*/
983-
private void updateParamsForAuth(String[] authNames, List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams) {
984+
protected void updateParamsForAuth(String[] authNames, List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams) {
984985
for (String authName : authNames) {
985986
Authentication auth = authentications.get(authName);
986987
if (auth == null) throw new RuntimeException("Authentication undefined: " + authName);

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

Lines changed: 44 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,50 @@
1313

1414
package software.xdev.sessionize.client;
1515

16+
import java.util.Objects;
17+
import java.util.concurrent.atomic.AtomicReference;
18+
import java.util.function.Supplier;
19+
1620
public class Configuration {
17-
public static final String VERSION = "2.0";
18-
19-
private static volatile ApiClient defaultApiClient = new ApiClient();
20-
21-
/**
22-
* Get the default API client, which would be used when creating API
23-
* instances without providing an API client.
24-
*
25-
* @return Default API client
26-
*/
27-
public static ApiClient getDefaultApiClient() {
28-
return defaultApiClient;
29-
}
21+
public static final String VERSION = "2.0";
22+
23+
private static final AtomicReference<ApiClient> defaultApiClient = new AtomicReference<>();
24+
private static volatile Supplier<ApiClient> apiClientFactory = ApiClient::new;
3025

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

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

Lines changed: 39 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -21,43 +21,47 @@
2121
* It's generated for java clients when {@code AbstractJavaCodegen#dateLibrary} specified as {@code java8}.
2222
*/
2323
public class JavaTimeFormatter {
24+
private DateTimeFormatter offsetDateTimeFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME;
2425

25-
private DateTimeFormatter offsetDateTimeFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME;
26+
/**
27+
* Get the date format used to parse/format {@code OffsetDateTime} parameters.
28+
*
29+
* @return DateTimeFormatter
30+
*/
31+
public DateTimeFormatter getOffsetDateTimeFormatter() {
32+
return offsetDateTimeFormatter;
33+
}
2634

27-
/**
28-
* Get the date format used to parse/format {@code OffsetDateTime} parameters.
29-
* @return DateTimeFormatter
30-
*/
31-
public DateTimeFormatter getOffsetDateTimeFormatter() {
32-
return offsetDateTimeFormatter;
33-
}
35+
/**
36+
* Set the date format used to parse/format {@code OffsetDateTime} parameters.
37+
*
38+
* @param offsetDateTimeFormatter {@code DateTimeFormatter}
39+
*/
40+
public void setOffsetDateTimeFormatter(DateTimeFormatter offsetDateTimeFormatter) {
41+
this.offsetDateTimeFormatter = offsetDateTimeFormatter;
42+
}
3443

35-
/**
36-
* Set the date format used to parse/format {@code OffsetDateTime} parameters.
37-
* @param offsetDateTimeFormatter {@code DateTimeFormatter}
38-
*/
39-
public void setOffsetDateTimeFormatter(DateTimeFormatter offsetDateTimeFormatter) {
40-
this.offsetDateTimeFormatter = offsetDateTimeFormatter;
44+
/**
45+
* Parse the given string into {@code OffsetDateTime} object.
46+
*
47+
* @param str String
48+
* @return {@code OffsetDateTime}
49+
*/
50+
public OffsetDateTime parseOffsetDateTime(String str) {
51+
try {
52+
return OffsetDateTime.parse(str, offsetDateTimeFormatter);
53+
} catch (DateTimeParseException e) {
54+
throw new RuntimeException(e);
4155
}
56+
}
4257

43-
/**
44-
* Parse the given string into {@code OffsetDateTime} object.
45-
* @param str String
46-
* @return {@code OffsetDateTime}
47-
*/
48-
public OffsetDateTime parseOffsetDateTime(String str) {
49-
try {
50-
return OffsetDateTime.parse(str, offsetDateTimeFormatter);
51-
} catch (DateTimeParseException e) {
52-
throw new RuntimeException(e);
53-
}
54-
}
55-
/**
56-
* Format the given {@code OffsetDateTime} object into string.
57-
* @param offsetDateTime {@code OffsetDateTime}
58-
* @return {@code OffsetDateTime} in string format
59-
*/
60-
public String formatOffsetDateTime(OffsetDateTime offsetDateTime) {
61-
return offsetDateTimeFormatter.format(offsetDateTime);
62-
}
63-
}
58+
/**
59+
* Format the given {@code OffsetDateTime} object into string.
60+
*
61+
* @param offsetDateTime {@code OffsetDateTime}
62+
* @return {@code OffsetDateTime} in string format
63+
*/
64+
public String formatOffsetDateTime(OffsetDateTime offsetDateTime) {
65+
return offsetDateTimeFormatter.format(offsetDateTime);
66+
}
67+
}

0 commit comments

Comments
 (0)