From 6eaa43c5478eb8273ebcaed96d9efe1a94ae2f49 Mon Sep 17 00:00:00 2001 From: Ilya Nemtsev Date: Mon, 30 Jun 2025 15:14:59 +0700 Subject: [PATCH 01/17] add bearer capability --- .../main/resources/Java/ApiClient.mustache | 9 + .../src/main/resources/Java/api.mustache | 205 +++++++++++++++++- 2 files changed, 208 insertions(+), 6 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/Java/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/ApiClient.mustache index d5b70d69a6fa..27a1a53046ba 100644 --- a/modules/openapi-generator/src/main/resources/Java/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/Java/ApiClient.mustache @@ -846,6 +846,15 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { } } + /** + * Get authentications (key: authentication name, value: authentication). + * + * @return Map of authentication objects + */ + public Map getAuthentications() { + return authentications; + } + /** * Update query and header parameters based on authentication settings. * diff --git a/modules/openapi-generator/src/main/resources/Java/api.mustache b/modules/openapi-generator/src/main/resources/Java/api.mustache index f0e57bd127e6..7eecfc2238be 100644 --- a/modules/openapi-generator/src/main/resources/Java/api.mustache +++ b/modules/openapi-generator/src/main/resources/Java/api.mustache @@ -8,6 +8,19 @@ import {{invokerPackage}}.ApiClient; import {{invokerPackage}}.Configuration; import {{modelPackage}}.*; import {{invokerPackage}}.Pair; +import {{invokerPackage}}.auth.Authentication; +{{#hasHttpBearerMethods}} +import {{invokerPackage}}.auth.HttpBearerAuth; +{{/hasHttpBearerMethods}} +{{#hasHttpBasicMethods}} +import {{invokerPackage}}.auth.HttpBasicAuth; +{{/hasHttpBasicMethods}} +{{#hasApiKeyMethods}} +import {{invokerPackage}}.auth.ApiKeyAuth; +{{/hasApiKeyMethods}} +{{#hasOAuthMethods}} +import {{invokerPackage}}.auth.OAuth; +{{/hasOAuthMethods}} {{#imports}}import {{import}}; {{/imports}} @@ -22,6 +35,20 @@ import java.util.Map; {{#operations}} public class {{classname}} { private ApiClient apiClient; + {{#hasHttpBearerMethods}} + private String bearerToken; + {{/hasHttpBearerMethods}} + {{#hasHttpBasicMethods}} + private String username; + private String password; + {{/hasHttpBasicMethods}} + {{#hasApiKeyMethods}} + private String apiKey; + private String apiKeyPrefix; + {{/hasApiKeyMethods}} + {{#hasOAuthMethods}} + private String accessToken; + {{/hasOAuthMethods}} public {{classname}}() { this(Configuration.getDefaultApiClient()); @@ -39,6 +66,164 @@ public class {{classname}} { this.apiClient = apiClient; } + {{#hasHttpBearerMethods}} + /** + * Helper method to set access token for Bearer authentication. + * @param bearerToken Bearer token + * @return {{classname}} + */ + public {{classname}} setBearerToken(String bearerToken) { + this.bearerToken = bearerToken; + return this; + } + {{/hasHttpBearerMethods}} + + {{#hasHttpBasicMethods}} + /** + * Helper method to set username for HTTP basic authentication. + * @param username Username + * @return {{classname}} + */ + public {{classname}} setUsername(String username) { + this.username = username; + return this; + } + + /** + * Helper method to set password for HTTP basic authentication. + * @param password Password + * @return {{classname}} + */ + public {{classname}} setPassword(String password) { + this.password = password; + return this; + } + {{/hasHttpBasicMethods}} + + {{#hasApiKeyMethods}} + /** + * Helper method to set API key value for API key authentication. + * @param apiKey API key + * @return {{classname}} + */ + public {{classname}} setApiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * Helper method to set API key prefix for API key authentication. + * @param apiKeyPrefix API key prefix + * @return {{classname}} + */ + public {{classname}} setApiKeyPrefix(String apiKeyPrefix) { + this.apiKeyPrefix = apiKeyPrefix; + return this; + } + {{/hasApiKeyMethods}} + + {{#hasOAuthMethods}} + /** + * Helper method to set access token for OAuth2 authentication. + * @param accessToken Access token + * @return {{classname}} + */ + public {{classname}} setAccessToken(String accessToken) { + this.accessToken = accessToken; + return this; + } + {{/hasOAuthMethods}} + + /** + * Apply authentication settings to the API client for this request only. + * This does not modify the shared ApiClient's authentication state. + */ + private void applyAuthToApiClient() { + {{#hasHttpBearerMethods}} + if (bearerToken != null) { + for (Authentication auth : apiClient.getAuthentications().values()) { + if (auth instanceof HttpBearerAuth) { + ((HttpBearerAuth) auth).setBearerToken(bearerToken); + break; + } + } + } + {{/hasHttpBearerMethods}} + {{#hasHttpBasicMethods}} + if (username != null || password != null) { + for (Authentication auth : apiClient.getAuthentications().values()) { + if (auth instanceof HttpBasicAuth) { + if (username != null) ((HttpBasicAuth) auth).setUsername(username); + if (password != null) ((HttpBasicAuth) auth).setPassword(password); + break; + } + } + } + {{/hasHttpBasicMethods}} + {{#hasApiKeyMethods}} + if (apiKey != null || apiKeyPrefix != null) { + for (Authentication auth : apiClient.getAuthentications().values()) { + if (auth instanceof ApiKeyAuth) { + if (apiKey != null) ((ApiKeyAuth) auth).setApiKey(apiKey); + if (apiKeyPrefix != null) ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); + break; + } + } + } + {{/hasApiKeyMethods}} + {{#hasOAuthMethods}} + if (accessToken != null) { + for (Authentication auth : apiClient.getAuthentications().values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).setAccessToken(accessToken); + break; + } + } + } + {{/hasOAuthMethods}} + } + + /** + * Clear authentication settings from the API client after the request. + * This ensures no authentication state persists in the shared ApiClient. + */ + private void clearAuthFromApiClient() { + {{#hasHttpBearerMethods}} + for (Authentication auth : apiClient.getAuthentications().values()) { + if (auth instanceof HttpBearerAuth) { + ((HttpBearerAuth) auth).setBearerToken((String) null); + break; + } + } + {{/hasHttpBearerMethods}} + {{#hasHttpBasicMethods}} + for (Authentication auth : apiClient.getAuthentications().values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setUsername(null); + ((HttpBasicAuth) auth).setPassword(null); + break; + } + } + {{/hasHttpBasicMethods}} + {{#hasApiKeyMethods}} + for (Authentication auth : apiClient.getAuthentications().values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKey(null); + ((ApiKeyAuth) auth).setApiKeyPrefix(null); + break; + } + } + {{/hasApiKeyMethods}} + {{#hasOAuthMethods}} + for (Authentication auth : apiClient.getAuthentications().values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).setAccessToken(null); + break; + } + } + {{/hasOAuthMethods}} + } + {{#operation}} /** * {{summary}} @@ -108,12 +293,20 @@ public class {{classname}} { String[] localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{^-last}}, {{/-last}}{{/authMethods}} }; - {{#returnType}} - GenericType<{{{returnType}}}> localVarReturnType = new GenericType<{{{returnType}}}>() {}; - return apiClient.invokeAPI(localVarPath, "{{httpMethod}}", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - {{/returnType}}{{^returnType}} - apiClient.invokeAPI(localVarPath, "{{httpMethod}}", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); - {{/returnType}} + // Apply authentication for this request only + applyAuthToApiClient(); + + try { + {{#returnType}} + GenericType<{{{returnType}}}> localVarReturnType = new GenericType<{{{returnType}}}>() {}; + return apiClient.invokeAPI(localVarPath, "{{httpMethod}}", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + {{/returnType}}{{^returnType}} + apiClient.invokeAPI(localVarPath, "{{httpMethod}}", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + {{/returnType}} + } finally { + // Clear authentication to prevent it from persisting in the shared ApiClient + clearAuthFromApiClient(); + } } {{/operation}} } From 47c0a19fbe64f0e38d96ac1c6d327857b2943838 Mon Sep 17 00:00:00 2001 From: Ilya Nemtsev Date: Mon, 30 Jun 2025 15:37:47 +0700 Subject: [PATCH 02/17] avoid using shared state --- .../main/resources/Java/ApiClient.mustache | 9 +- .../src/main/resources/Java/api.mustache | 129 +++++------------- 2 files changed, 37 insertions(+), 101 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/Java/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/ApiClient.mustache index 27a1a53046ba..8fce2f0dd194 100644 --- a/modules/openapi-generator/src/main/resources/Java/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/Java/ApiClient.mustache @@ -846,14 +846,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { } } - /** - * Get authentications (key: authentication name, value: authentication). - * - * @return Map of authentication objects - */ - public Map getAuthentications() { - return authentications; - } + /** * Update query and header parameters based on authentication settings. diff --git a/modules/openapi-generator/src/main/resources/Java/api.mustache b/modules/openapi-generator/src/main/resources/Java/api.mustache index 7eecfc2238be..6f7e3a245852 100644 --- a/modules/openapi-generator/src/main/resources/Java/api.mustache +++ b/modules/openapi-generator/src/main/resources/Java/api.mustache @@ -8,19 +8,6 @@ import {{invokerPackage}}.ApiClient; import {{invokerPackage}}.Configuration; import {{modelPackage}}.*; import {{invokerPackage}}.Pair; -import {{invokerPackage}}.auth.Authentication; -{{#hasHttpBearerMethods}} -import {{invokerPackage}}.auth.HttpBearerAuth; -{{/hasHttpBearerMethods}} -{{#hasHttpBasicMethods}} -import {{invokerPackage}}.auth.HttpBasicAuth; -{{/hasHttpBasicMethods}} -{{#hasApiKeyMethods}} -import {{invokerPackage}}.auth.ApiKeyAuth; -{{/hasApiKeyMethods}} -{{#hasOAuthMethods}} -import {{invokerPackage}}.auth.OAuth; -{{/hasOAuthMethods}} {{#imports}}import {{import}}; {{/imports}} @@ -30,6 +17,9 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +{{#hasHttpBasicMethods}} +import java.util.Base64; +{{/hasHttpBasicMethods}} {{>generatedAnnotation}} {{#operations}} @@ -135,93 +125,49 @@ public class {{classname}} { {{/hasOAuthMethods}} /** - * Apply authentication settings to the API client for this request only. - * This does not modify the shared ApiClient's authentication state. + * Apply authentication settings directly to request headers. + * This avoids modifying the shared ApiClient's authentication state. */ - private void applyAuthToApiClient() { + private void applyAuthToHeaders(Map headerParams) { {{#hasHttpBearerMethods}} if (bearerToken != null) { - for (Authentication auth : apiClient.getAuthentications().values()) { - if (auth instanceof HttpBearerAuth) { - ((HttpBearerAuth) auth).setBearerToken(bearerToken); - break; - } - } + headerParams.put("Authorization", "Bearer " + bearerToken); } {{/hasHttpBearerMethods}} {{#hasHttpBasicMethods}} - if (username != null || password != null) { - for (Authentication auth : apiClient.getAuthentications().values()) { - if (auth instanceof HttpBasicAuth) { - if (username != null) ((HttpBasicAuth) auth).setUsername(username); - if (password != null) ((HttpBasicAuth) auth).setPassword(password); - break; - } - } + if (username != null && password != null) { + String credentials = java.util.Base64.getEncoder().encodeToString((username + ":" + password).getBytes()); + headerParams.put("Authorization", "Basic " + credentials); } {{/hasHttpBasicMethods}} {{#hasApiKeyMethods}} - if (apiKey != null || apiKeyPrefix != null) { - for (Authentication auth : apiClient.getAuthentications().values()) { - if (auth instanceof ApiKeyAuth) { - if (apiKey != null) ((ApiKeyAuth) auth).setApiKey(apiKey); - if (apiKeyPrefix != null) ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); - break; - } - } + if (apiKey != null) { + {{#authMethods}}{{#isApiKey}}{{#isKeyInHeader}} + String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; + headerParams.put("{{keyParamName}}", keyValue); + {{/isKeyInHeader}}{{/isApiKey}}{{/authMethods}} } {{/hasApiKeyMethods}} {{#hasOAuthMethods}} if (accessToken != null) { - for (Authentication auth : apiClient.getAuthentications().values()) { - if (auth instanceof OAuth) { - ((OAuth) auth).setAccessToken(accessToken); - break; - } - } + headerParams.put("Authorization", "Bearer " + accessToken); } {{/hasOAuthMethods}} } /** - * Clear authentication settings from the API client after the request. - * This ensures no authentication state persists in the shared ApiClient. + * Apply authentication settings directly to query parameters. + * This avoids modifying the shared ApiClient's authentication state. */ - private void clearAuthFromApiClient() { - {{#hasHttpBearerMethods}} - for (Authentication auth : apiClient.getAuthentications().values()) { - if (auth instanceof HttpBearerAuth) { - ((HttpBearerAuth) auth).setBearerToken((String) null); - break; - } - } - {{/hasHttpBearerMethods}} - {{#hasHttpBasicMethods}} - for (Authentication auth : apiClient.getAuthentications().values()) { - if (auth instanceof HttpBasicAuth) { - ((HttpBasicAuth) auth).setUsername(null); - ((HttpBasicAuth) auth).setPassword(null); - break; - } - } - {{/hasHttpBasicMethods}} + private void applyAuthToQueryParams(List queryParams) { {{#hasApiKeyMethods}} - for (Authentication auth : apiClient.getAuthentications().values()) { - if (auth instanceof ApiKeyAuth) { - ((ApiKeyAuth) auth).setApiKey(null); - ((ApiKeyAuth) auth).setApiKeyPrefix(null); - break; - } + if (apiKey != null) { + {{#authMethods}}{{#isApiKey}}{{#isKeyInQuery}} + String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; + queryParams.add(new Pair("{{keyParamName}}", keyValue)); + {{/isKeyInQuery}}{{/isApiKey}}{{/authMethods}} } {{/hasApiKeyMethods}} - {{#hasOAuthMethods}} - for (Authentication auth : apiClient.getAuthentications().values()) { - if (auth instanceof OAuth) { - ((OAuth) auth).setAccessToken(null); - break; - } - } - {{/hasOAuthMethods}} } {{#operation}} @@ -281,6 +227,10 @@ public class {{classname}} { localVarFormParams.put("{{baseName}}", {{paramName}}); {{/formParams}} + // Apply authentication directly to request parameters (no shared state modification) + applyAuthToHeaders(localVarHeaderParams); + applyAuthToQueryParams(localVarQueryParams); + final String[] localVarAccepts = { {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} }; @@ -291,22 +241,15 @@ public class {{classname}} { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{^-last}}, {{/-last}}{{/authMethods}} }; - - // Apply authentication for this request only - applyAuthToApiClient(); + // No authentication names needed - auth is applied directly above + String[] localVarAuthNames = new String[] {}; - try { - {{#returnType}} - GenericType<{{{returnType}}}> localVarReturnType = new GenericType<{{{returnType}}}>() {}; - return apiClient.invokeAPI(localVarPath, "{{httpMethod}}", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - {{/returnType}}{{^returnType}} - apiClient.invokeAPI(localVarPath, "{{httpMethod}}", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); - {{/returnType}} - } finally { - // Clear authentication to prevent it from persisting in the shared ApiClient - clearAuthFromApiClient(); - } + {{#returnType}} + GenericType<{{{returnType}}}> localVarReturnType = new GenericType<{{{returnType}}}>() {}; + return apiClient.invokeAPI(localVarPath, "{{httpMethod}}", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + {{/returnType}}{{^returnType}} + apiClient.invokeAPI(localVarPath, "{{httpMethod}}", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + {{/returnType}} } {{/operation}} } From 1e7267b73d27e498dcb72dc7ec5cc26f3d078356 Mon Sep 17 00:00:00 2001 From: Ilya Nemtsev Date: Mon, 30 Jun 2025 15:38:35 +0700 Subject: [PATCH 03/17] revert needless change --- .../src/main/resources/Java/ApiClient.mustache | 2 -- 1 file changed, 2 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/Java/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/ApiClient.mustache index 8fce2f0dd194..d5b70d69a6fa 100644 --- a/modules/openapi-generator/src/main/resources/Java/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/Java/ApiClient.mustache @@ -846,8 +846,6 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { } } - - /** * Update query and header parameters based on authentication settings. * From 9cab493cc75fb55f5eb793bbc4e07ff6a9ef65bf Mon Sep 17 00:00:00 2001 From: Ilya Nemtsev Date: Tue, 1 Jul 2025 14:28:54 +0700 Subject: [PATCH 04/17] Revert authentication changes from unused root Java/api.mustache template --- .../src/main/resources/Java/api.mustache | 140 +----------------- 1 file changed, 2 insertions(+), 138 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/Java/api.mustache b/modules/openapi-generator/src/main/resources/Java/api.mustache index 6f7e3a245852..f0e57bd127e6 100644 --- a/modules/openapi-generator/src/main/resources/Java/api.mustache +++ b/modules/openapi-generator/src/main/resources/Java/api.mustache @@ -17,28 +17,11 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -{{#hasHttpBasicMethods}} -import java.util.Base64; -{{/hasHttpBasicMethods}} {{>generatedAnnotation}} {{#operations}} public class {{classname}} { private ApiClient apiClient; - {{#hasHttpBearerMethods}} - private String bearerToken; - {{/hasHttpBearerMethods}} - {{#hasHttpBasicMethods}} - private String username; - private String password; - {{/hasHttpBasicMethods}} - {{#hasApiKeyMethods}} - private String apiKey; - private String apiKeyPrefix; - {{/hasApiKeyMethods}} - {{#hasOAuthMethods}} - private String accessToken; - {{/hasOAuthMethods}} public {{classname}}() { this(Configuration.getDefaultApiClient()); @@ -56,120 +39,6 @@ public class {{classname}} { this.apiClient = apiClient; } - {{#hasHttpBearerMethods}} - /** - * Helper method to set access token for Bearer authentication. - * @param bearerToken Bearer token - * @return {{classname}} - */ - public {{classname}} setBearerToken(String bearerToken) { - this.bearerToken = bearerToken; - return this; - } - {{/hasHttpBearerMethods}} - - {{#hasHttpBasicMethods}} - /** - * Helper method to set username for HTTP basic authentication. - * @param username Username - * @return {{classname}} - */ - public {{classname}} setUsername(String username) { - this.username = username; - return this; - } - - /** - * Helper method to set password for HTTP basic authentication. - * @param password Password - * @return {{classname}} - */ - public {{classname}} setPassword(String password) { - this.password = password; - return this; - } - {{/hasHttpBasicMethods}} - - {{#hasApiKeyMethods}} - /** - * Helper method to set API key value for API key authentication. - * @param apiKey API key - * @return {{classname}} - */ - public {{classname}} setApiKey(String apiKey) { - this.apiKey = apiKey; - return this; - } - - /** - * Helper method to set API key prefix for API key authentication. - * @param apiKeyPrefix API key prefix - * @return {{classname}} - */ - public {{classname}} setApiKeyPrefix(String apiKeyPrefix) { - this.apiKeyPrefix = apiKeyPrefix; - return this; - } - {{/hasApiKeyMethods}} - - {{#hasOAuthMethods}} - /** - * Helper method to set access token for OAuth2 authentication. - * @param accessToken Access token - * @return {{classname}} - */ - public {{classname}} setAccessToken(String accessToken) { - this.accessToken = accessToken; - return this; - } - {{/hasOAuthMethods}} - - /** - * Apply authentication settings directly to request headers. - * This avoids modifying the shared ApiClient's authentication state. - */ - private void applyAuthToHeaders(Map headerParams) { - {{#hasHttpBearerMethods}} - if (bearerToken != null) { - headerParams.put("Authorization", "Bearer " + bearerToken); - } - {{/hasHttpBearerMethods}} - {{#hasHttpBasicMethods}} - if (username != null && password != null) { - String credentials = java.util.Base64.getEncoder().encodeToString((username + ":" + password).getBytes()); - headerParams.put("Authorization", "Basic " + credentials); - } - {{/hasHttpBasicMethods}} - {{#hasApiKeyMethods}} - if (apiKey != null) { - {{#authMethods}}{{#isApiKey}}{{#isKeyInHeader}} - String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; - headerParams.put("{{keyParamName}}", keyValue); - {{/isKeyInHeader}}{{/isApiKey}}{{/authMethods}} - } - {{/hasApiKeyMethods}} - {{#hasOAuthMethods}} - if (accessToken != null) { - headerParams.put("Authorization", "Bearer " + accessToken); - } - {{/hasOAuthMethods}} - } - - /** - * Apply authentication settings directly to query parameters. - * This avoids modifying the shared ApiClient's authentication state. - */ - private void applyAuthToQueryParams(List queryParams) { - {{#hasApiKeyMethods}} - if (apiKey != null) { - {{#authMethods}}{{#isApiKey}}{{#isKeyInQuery}} - String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; - queryParams.add(new Pair("{{keyParamName}}", keyValue)); - {{/isKeyInQuery}}{{/isApiKey}}{{/authMethods}} - } - {{/hasApiKeyMethods}} - } - {{#operation}} /** * {{summary}} @@ -227,10 +96,6 @@ public class {{classname}} { localVarFormParams.put("{{baseName}}", {{paramName}}); {{/formParams}} - // Apply authentication directly to request parameters (no shared state modification) - applyAuthToHeaders(localVarHeaderParams); - applyAuthToQueryParams(localVarQueryParams); - final String[] localVarAccepts = { {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} }; @@ -241,9 +106,8 @@ public class {{classname}} { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - // No authentication names needed - auth is applied directly above - String[] localVarAuthNames = new String[] {}; - + String[] localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{^-last}}, {{/-last}}{{/authMethods}} }; + {{#returnType}} GenericType<{{{returnType}}}> localVarReturnType = new GenericType<{{{returnType}}}>() {}; return apiClient.invokeAPI(localVarPath, "{{httpMethod}}", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); From b4ad6db52eeb79b22f7fe9265a52aeb8fb5c75b4 Mon Sep 17 00:00:00 2001 From: Ilya Nemtsev Date: Tue, 1 Jul 2025 14:50:21 +0700 Subject: [PATCH 05/17] applied change to correct lib type --- .../Java/libraries/native/api.mustache | 162 +++++++++++++++++- 1 file changed, 159 insertions(+), 3 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/native/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/native/api.mustache index 75779701c40a..8f389bc115b6 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/native/api.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/native/api.mustache @@ -64,6 +64,28 @@ public class {{classname}} { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; + {{#hasHttpBearerMethods}} + // Per-API Bearer authentication + private String bearerToken; + {{/hasHttpBearerMethods}} + + {{#hasHttpBasicMethods}} + // Per-API Basic authentication + private String username; + private String password; + {{/hasHttpBasicMethods}} + + {{#hasApiKeyMethods}} + // Per-API API key authentication + private String apiKey; + private String apiKeyPrefix; + {{/hasApiKeyMethods}} + + {{#hasOAuthMethods}} + // Per-API OAuth authentication + private String accessToken; + {{/hasOAuthMethods}} + public {{classname}}() { this(Configuration.getDefaultApiClient()); } @@ -77,6 +99,127 @@ public class {{classname}} { memberVarResponseInterceptor = apiClient.getResponseInterceptor(); memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } + + {{#hasHttpBearerMethods}} + /** + * Helper method to set access token for Bearer authentication. + * @param bearerToken Bearer token + * @return {{classname}} + */ + public {{classname}} setBearerToken(String bearerToken) { + this.bearerToken = bearerToken; + return this; + } + {{/hasHttpBearerMethods}} + + {{#hasHttpBasicMethods}} + /** + * Helper method to set username for HTTP basic authentication. + * @param username Username + * @return {{classname}} + */ + public {{classname}} setUsername(String username) { + this.username = username; + return this; + } + + /** + * Helper method to set password for HTTP basic authentication. + * @param password Password + * @return {{classname}} + */ + public {{classname}} setPassword(String password) { + this.password = password; + return this; + } + {{/hasHttpBasicMethods}} + + {{#hasApiKeyMethods}} + /** + * Helper method to set API key value for API key authentication. + * @param apiKey API key + * @return {{classname}} + */ + public {{classname}} setApiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * Helper method to set API key prefix for API key authentication. + * @param apiKeyPrefix API key prefix + * @return {{classname}} + */ + public {{classname}} setApiKeyPrefix(String apiKeyPrefix) { + this.apiKeyPrefix = apiKeyPrefix; + return this; + } + {{/hasApiKeyMethods}} + + {{#hasOAuthMethods}} + /** + * Helper method to set access token for OAuth2 authentication. + * @param accessToken Access token + * @return {{classname}} + */ + public {{classname}} setAccessToken(String accessToken) { + this.accessToken = accessToken; + return this; + } + {{/hasOAuthMethods}} + + /** + * Apply authentication settings directly to request headers. + * This avoids modifying the shared ApiClient's authentication state. + */ + private void applyAuthToHeaders(HttpRequest.Builder localVarRequestBuilder) { + {{#hasHttpBearerMethods}} + if (bearerToken != null) { + localVarRequestBuilder.header("Authorization", "Bearer " + bearerToken); + } + {{/hasHttpBearerMethods}} + {{#hasHttpBasicMethods}} + if (username != null && password != null) { + String credentials = java.util.Base64.getEncoder().encodeToString((username + ":" + password).getBytes()); + localVarRequestBuilder.header("Authorization", "Basic " + credentials); + } + {{/hasHttpBasicMethods}} + {{#hasApiKeyMethods}} + if (apiKey != null) { + {{#authMethods}}{{#isApiKey}}{{#isKeyInHeader}} + String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; + localVarRequestBuilder.header("{{keyParamName}}", keyValue); + {{/isKeyInHeader}}{{/isApiKey}}{{/authMethods}} + } + {{/hasApiKeyMethods}} + {{#hasOAuthMethods}} + if (accessToken != null) { + localVarRequestBuilder.header("Authorization", "Bearer " + accessToken); + } + {{/hasOAuthMethods}} + } + + /** + * Apply authentication settings directly to query parameters. + * This avoids modifying the shared ApiClient's authentication state. + */ + private String applyAuthToQueryParams(String queryString) { + {{#hasApiKeyMethods}} + if (apiKey != null) { + {{#authMethods}}{{#isApiKey}}{{#isKeyInQuery}} + String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; + String authParam = "{{keyParamName}}=" + keyValue; + if (queryString != null && !queryString.isEmpty()) { + return queryString + "&" + authParam; + } else { + return authParam; + } + {{/isKeyInQuery}}{{/isApiKey}}{{/authMethods}} + } + {{/hasApiKeyMethods}} + return queryString; + } + {{#asyncNative}} private ApiException getApiException(String operationId, HttpResponse response) { @@ -439,13 +582,24 @@ public class {{classname}} { if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } } {{/hasQueryParams}} {{^hasQueryParams}} - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } {{/hasQueryParams}} {{#headerParams}} @@ -569,6 +723,8 @@ public class {{classname}} { if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } From 6eece3d247126742178c8c1354311589d7cfac10 Mon Sep 17 00:00:00 2001 From: Ilya Nemtsev Date: Thu, 3 Jul 2025 15:38:50 +0700 Subject: [PATCH 06/17] updated test files --- .../org/openapitools/client/api/AuthApi.java | 82 ++++- .../org/openapitools/client/api/BodyApi.java | 154 ++++++++- .../org/openapitools/client/api/FormApi.java | 91 +++++- .../openapitools/client/api/HeaderApi.java | 73 ++++- .../org/openapitools/client/api/PathApi.java | 73 ++++- .../org/openapitools/client/api/QueryApi.java | 184 +++++++++-- .../client/api/AnotherFakeApi.java | 126 ++++++- .../openapitools/client/api/DefaultApi.java | 126 ++++++- .../org/openapitools/client/api/FakeApi.java | 309 ++++++++++++++++-- .../client/api/FakeClassnameTags123Api.java | 126 ++++++- .../org/openapitools/client/api/PetApi.java | 204 +++++++++++- .../org/openapitools/client/api/StoreApi.java | 153 ++++++++- .../org/openapitools/client/api/UserApi.java | 192 ++++++++++- .../org/openapitools/client/api/PetApi.java | 147 ++++++++- .../org/openapitools/client/api/StoreApi.java | 105 +++++- .../org/openapitools/client/api/UserApi.java | 144 +++++++- .../client/api/AnotherFakeApi.java | 126 ++++++- .../openapitools/client/api/DefaultApi.java | 126 ++++++- .../org/openapitools/client/api/FakeApi.java | 309 ++++++++++++++++-- .../client/api/FakeClassnameTags123Api.java | 126 ++++++- .../org/openapitools/client/api/PetApi.java | 204 +++++++++++- .../org/openapitools/client/api/StoreApi.java | 153 ++++++++- .../org/openapitools/client/api/UserApi.java | 192 ++++++++++- 23 files changed, 3363 insertions(+), 162 deletions(-) diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/AuthApi.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/AuthApi.java index 2c5830a3c230..19222da13a67 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/AuthApi.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/AuthApi.java @@ -54,6 +54,15 @@ public class AuthApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; + // Per-API Bearer authentication + private String bearerToken; + + // Per-API Basic authentication + private String username; + private String password; + + + public AuthApi() { this(Configuration.getDefaultApiClient()); } @@ -68,6 +77,61 @@ public AuthApi(ApiClient apiClient) { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } + /** + * Helper method to set access token for Bearer authentication. + * @param bearerToken Bearer token + * @return AuthApi + */ + public AuthApi setBearerToken(String bearerToken) { + this.bearerToken = bearerToken; + return this; + } + + /** + * Helper method to set username for HTTP basic authentication. + * @param username Username + * @return AuthApi + */ + public AuthApi setUsername(String username) { + this.username = username; + return this; + } + + /** + * Helper method to set password for HTTP basic authentication. + * @param password Password + * @return AuthApi + */ + public AuthApi setPassword(String password) { + this.password = password; + return this; + } + + + + /** + * Apply authentication settings directly to request headers. + * This avoids modifying the shared ApiClient's authentication state. + */ + private void applyAuthToHeaders(HttpRequest.Builder localVarRequestBuilder) { + if (bearerToken != null) { + localVarRequestBuilder.header("Authorization", "Bearer " + bearerToken); + } + if (username != null && password != null) { + String credentials = java.util.Base64.getEncoder().encodeToString((username + ":" + password).getBytes()); + localVarRequestBuilder.header("Authorization", "Basic " + credentials); + } + } + + /** + * Apply authentication settings directly to query parameters. + * This avoids modifying the shared ApiClient's authentication state. + */ + private String applyAuthToQueryParams(String queryString) { + return queryString; + } + + protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { String body = response.body() == null ? null : new String(response.body().readAllBytes()); String message = formatExceptionMessage(operationId, response.statusCode(), body); @@ -141,7 +205,12 @@ private HttpRequest.Builder testAuthHttpBasicRequestBuilder() throws ApiExceptio String localVarPath = "/auth/http/basic"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "text/plain"); @@ -149,6 +218,8 @@ private HttpRequest.Builder testAuthHttpBasicRequestBuilder() throws ApiExceptio if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -215,7 +286,12 @@ private HttpRequest.Builder testAuthHttpBearerRequestBuilder() throws ApiExcepti String localVarPath = "/auth/http/bearer"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "text/plain"); @@ -223,6 +299,8 @@ private HttpRequest.Builder testAuthHttpBearerRequestBuilder() throws ApiExcepti if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/BodyApi.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/BodyApi.java index 23d8e651cae8..79e724a205b7 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/BodyApi.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/BodyApi.java @@ -64,6 +64,15 @@ public class BodyApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; + // Per-API Bearer authentication + private String bearerToken; + + // Per-API Basic authentication + private String username; + private String password; + + + public BodyApi() { this(Configuration.getDefaultApiClient()); } @@ -78,6 +87,61 @@ public BodyApi(ApiClient apiClient) { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } + /** + * Helper method to set access token for Bearer authentication. + * @param bearerToken Bearer token + * @return BodyApi + */ + public BodyApi setBearerToken(String bearerToken) { + this.bearerToken = bearerToken; + return this; + } + + /** + * Helper method to set username for HTTP basic authentication. + * @param username Username + * @return BodyApi + */ + public BodyApi setUsername(String username) { + this.username = username; + return this; + } + + /** + * Helper method to set password for HTTP basic authentication. + * @param password Password + * @return BodyApi + */ + public BodyApi setPassword(String password) { + this.password = password; + return this; + } + + + + /** + * Apply authentication settings directly to request headers. + * This avoids modifying the shared ApiClient's authentication state. + */ + private void applyAuthToHeaders(HttpRequest.Builder localVarRequestBuilder) { + if (bearerToken != null) { + localVarRequestBuilder.header("Authorization", "Bearer " + bearerToken); + } + if (username != null && password != null) { + String credentials = java.util.Base64.getEncoder().encodeToString((username + ":" + password).getBytes()); + localVarRequestBuilder.header("Authorization", "Basic " + credentials); + } + } + + /** + * Apply authentication settings directly to query parameters. + * This avoids modifying the shared ApiClient's authentication state. + */ + private String applyAuthToQueryParams(String queryString) { + return queryString; + } + + protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { String body = response.body() == null ? null : new String(response.body().readAllBytes()); String message = formatExceptionMessage(operationId, response.statusCode(), body); @@ -154,7 +218,12 @@ private HttpRequest.Builder testBinaryGifRequestBuilder() throws ApiException { String localVarPath = "/binary/gif"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "image/gif"); @@ -162,6 +231,8 @@ private HttpRequest.Builder testBinaryGifRequestBuilder() throws ApiException { if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -230,7 +301,12 @@ private HttpRequest.Builder testBodyApplicationOctetstreamBinaryRequestBuilder(@ String localVarPath = "/body/application/octetstream/binary"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/octet-stream"); localVarRequestBuilder.header("Accept", "text/plain"); @@ -244,6 +320,8 @@ private HttpRequest.Builder testBodyApplicationOctetstreamBinaryRequestBuilder(@ if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -316,7 +394,12 @@ private HttpRequest.Builder testBodyMultipartFormdataArrayOfBinaryRequestBuilder String localVarPath = "/body/application/octetstream/array_of_binary"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "text/plain"); @@ -359,6 +442,8 @@ private HttpRequest.Builder testBodyMultipartFormdataArrayOfBinaryRequestBuilder if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -427,7 +512,12 @@ private HttpRequest.Builder testBodyMultipartFormdataSingleBinaryRequestBuilder( String localVarPath = "/body/application/octetstream/single_binary"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "text/plain"); @@ -468,6 +558,8 @@ private HttpRequest.Builder testBodyMultipartFormdataSingleBinaryRequestBuilder( if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -539,7 +631,12 @@ private HttpRequest.Builder testEchoBodyAllOfPetRequestBuilder(@javax.annotation String localVarPath = "/echo/body/allOf/Pet"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -553,6 +650,8 @@ private HttpRequest.Builder testEchoBodyAllOfPetRequestBuilder(@javax.annotation if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -621,7 +720,12 @@ private HttpRequest.Builder testEchoBodyFreeFormObjectResponseStringRequestBuild String localVarPath = "/echo/body/FreeFormObject/response_string"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "text/plain"); @@ -635,6 +739,8 @@ private HttpRequest.Builder testEchoBodyFreeFormObjectResponseStringRequestBuild if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -706,7 +812,12 @@ private HttpRequest.Builder testEchoBodyPetRequestBuilder(@javax.annotation.Null String localVarPath = "/echo/body/Pet"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -720,6 +831,8 @@ private HttpRequest.Builder testEchoBodyPetRequestBuilder(@javax.annotation.Null if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -788,7 +901,12 @@ private HttpRequest.Builder testEchoBodyPetResponseStringRequestBuilder(@javax.a String localVarPath = "/echo/body/Pet/response_string"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "text/plain"); @@ -802,6 +920,8 @@ private HttpRequest.Builder testEchoBodyPetResponseStringRequestBuilder(@javax.a if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -873,7 +993,12 @@ private HttpRequest.Builder testEchoBodyStringEnumRequestBuilder(@javax.annotati String localVarPath = "/echo/body/string_enum"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -887,6 +1012,8 @@ private HttpRequest.Builder testEchoBodyStringEnumRequestBuilder(@javax.annotati if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -955,7 +1082,12 @@ private HttpRequest.Builder testEchoBodyTagResponseStringRequestBuilder(@javax.a String localVarPath = "/echo/body/Tag/response_string"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "text/plain"); @@ -969,6 +1101,8 @@ private HttpRequest.Builder testEchoBodyTagResponseStringRequestBuilder(@javax.a if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/FormApi.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/FormApi.java index d5c55e28f841..ed2766116cda 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/FormApi.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/FormApi.java @@ -61,6 +61,15 @@ public class FormApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; + // Per-API Bearer authentication + private String bearerToken; + + // Per-API Basic authentication + private String username; + private String password; + + + public FormApi() { this(Configuration.getDefaultApiClient()); } @@ -75,6 +84,61 @@ public FormApi(ApiClient apiClient) { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } + /** + * Helper method to set access token for Bearer authentication. + * @param bearerToken Bearer token + * @return FormApi + */ + public FormApi setBearerToken(String bearerToken) { + this.bearerToken = bearerToken; + return this; + } + + /** + * Helper method to set username for HTTP basic authentication. + * @param username Username + * @return FormApi + */ + public FormApi setUsername(String username) { + this.username = username; + return this; + } + + /** + * Helper method to set password for HTTP basic authentication. + * @param password Password + * @return FormApi + */ + public FormApi setPassword(String password) { + this.password = password; + return this; + } + + + + /** + * Apply authentication settings directly to request headers. + * This avoids modifying the shared ApiClient's authentication state. + */ + private void applyAuthToHeaders(HttpRequest.Builder localVarRequestBuilder) { + if (bearerToken != null) { + localVarRequestBuilder.header("Authorization", "Bearer " + bearerToken); + } + if (username != null && password != null) { + String credentials = java.util.Base64.getEncoder().encodeToString((username + ":" + password).getBytes()); + localVarRequestBuilder.header("Authorization", "Basic " + credentials); + } + } + + /** + * Apply authentication settings directly to query parameters. + * This avoids modifying the shared ApiClient's authentication state. + */ + private String applyAuthToQueryParams(String queryString) { + return queryString; + } + + protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { String body = response.body() == null ? null : new String(response.body().readAllBytes()); String message = formatExceptionMessage(operationId, response.statusCode(), body); @@ -154,7 +218,12 @@ private HttpRequest.Builder testFormIntegerBooleanStringRequestBuilder(@javax.an String localVarPath = "/form/integer/boolean/string"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "text/plain"); @@ -182,6 +251,8 @@ private HttpRequest.Builder testFormIntegerBooleanStringRequestBuilder(@javax.an if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -254,7 +325,12 @@ private HttpRequest.Builder testFormObjectMultipartRequestBuilder(@javax.annotat String localVarPath = "/form/object/multipart"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "text/plain"); @@ -296,6 +372,8 @@ private HttpRequest.Builder testFormObjectMultipartRequestBuilder(@javax.annotat if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -374,7 +452,12 @@ private HttpRequest.Builder testFormOneofRequestBuilder(@javax.annotation.Nullab String localVarPath = "/form/oneof"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "text/plain"); @@ -411,6 +494,8 @@ private HttpRequest.Builder testFormOneofRequestBuilder(@javax.annotation.Nullab if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/HeaderApi.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/HeaderApi.java index b44830548e85..3a31ca1defca 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/HeaderApi.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/HeaderApi.java @@ -61,6 +61,15 @@ public class HeaderApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; + // Per-API Bearer authentication + private String bearerToken; + + // Per-API Basic authentication + private String username; + private String password; + + + public HeaderApi() { this(Configuration.getDefaultApiClient()); } @@ -75,6 +84,61 @@ public HeaderApi(ApiClient apiClient) { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } + /** + * Helper method to set access token for Bearer authentication. + * @param bearerToken Bearer token + * @return HeaderApi + */ + public HeaderApi setBearerToken(String bearerToken) { + this.bearerToken = bearerToken; + return this; + } + + /** + * Helper method to set username for HTTP basic authentication. + * @param username Username + * @return HeaderApi + */ + public HeaderApi setUsername(String username) { + this.username = username; + return this; + } + + /** + * Helper method to set password for HTTP basic authentication. + * @param password Password + * @return HeaderApi + */ + public HeaderApi setPassword(String password) { + this.password = password; + return this; + } + + + + /** + * Apply authentication settings directly to request headers. + * This avoids modifying the shared ApiClient's authentication state. + */ + private void applyAuthToHeaders(HttpRequest.Builder localVarRequestBuilder) { + if (bearerToken != null) { + localVarRequestBuilder.header("Authorization", "Bearer " + bearerToken); + } + if (username != null && password != null) { + String credentials = java.util.Base64.getEncoder().encodeToString((username + ":" + password).getBytes()); + localVarRequestBuilder.header("Authorization", "Basic " + credentials); + } + } + + /** + * Apply authentication settings directly to query parameters. + * This avoids modifying the shared ApiClient's authentication state. + */ + private String applyAuthToQueryParams(String queryString) { + return queryString; + } + + protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { String body = response.body() == null ? null : new String(response.body().readAllBytes()); String message = formatExceptionMessage(operationId, response.statusCode(), body); @@ -158,7 +222,12 @@ private HttpRequest.Builder testHeaderIntegerBooleanStringEnumsRequestBuilder(@j String localVarPath = "/header/integer/boolean/string/enums"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } if (integerHeader != null) { localVarRequestBuilder.header("integer_header", integerHeader.toString()); @@ -181,6 +250,8 @@ private HttpRequest.Builder testHeaderIntegerBooleanStringEnumsRequestBuilder(@j if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/PathApi.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/PathApi.java index 9757e2287011..3e2972814d4b 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/PathApi.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/PathApi.java @@ -61,6 +61,15 @@ public class PathApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; + // Per-API Bearer authentication + private String bearerToken; + + // Per-API Basic authentication + private String username; + private String password; + + + public PathApi() { this(Configuration.getDefaultApiClient()); } @@ -75,6 +84,61 @@ public PathApi(ApiClient apiClient) { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } + /** + * Helper method to set access token for Bearer authentication. + * @param bearerToken Bearer token + * @return PathApi + */ + public PathApi setBearerToken(String bearerToken) { + this.bearerToken = bearerToken; + return this; + } + + /** + * Helper method to set username for HTTP basic authentication. + * @param username Username + * @return PathApi + */ + public PathApi setUsername(String username) { + this.username = username; + return this; + } + + /** + * Helper method to set password for HTTP basic authentication. + * @param password Password + * @return PathApi + */ + public PathApi setPassword(String password) { + this.password = password; + return this; + } + + + + /** + * Apply authentication settings directly to request headers. + * This avoids modifying the shared ApiClient's authentication state. + */ + private void applyAuthToHeaders(HttpRequest.Builder localVarRequestBuilder) { + if (bearerToken != null) { + localVarRequestBuilder.header("Authorization", "Bearer " + bearerToken); + } + if (username != null && password != null) { + String credentials = java.util.Base64.getEncoder().encodeToString((username + ":" + password).getBytes()); + localVarRequestBuilder.header("Authorization", "Basic " + credentials); + } + } + + /** + * Apply authentication settings directly to query parameters. + * This avoids modifying the shared ApiClient's authentication state. + */ + private String applyAuthToQueryParams(String queryString) { + return queryString; + } + + protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { String body = response.body() == null ? null : new String(response.body().readAllBytes()); String message = formatExceptionMessage(operationId, response.statusCode(), body); @@ -176,7 +240,12 @@ private HttpRequest.Builder testsPathStringPathStringIntegerPathIntegerEnumNonre .replace("{enum_nonref_string_path}", ApiClient.urlEncode(enumNonrefStringPath.toString())) .replace("{enum_ref_string_path}", ApiClient.urlEncode(enumRefStringPath.toString())); - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "text/plain"); @@ -184,6 +253,8 @@ private HttpRequest.Builder testsPathStringPathStringIntegerPathIntegerEnumNonre if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/QueryApi.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/QueryApi.java index 05c4257eac70..4ff34f58e7af 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/QueryApi.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/QueryApi.java @@ -67,6 +67,15 @@ public class QueryApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; + // Per-API Bearer authentication + private String bearerToken; + + // Per-API Basic authentication + private String username; + private String password; + + + public QueryApi() { this(Configuration.getDefaultApiClient()); } @@ -81,6 +90,61 @@ public QueryApi(ApiClient apiClient) { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } + /** + * Helper method to set access token for Bearer authentication. + * @param bearerToken Bearer token + * @return QueryApi + */ + public QueryApi setBearerToken(String bearerToken) { + this.bearerToken = bearerToken; + return this; + } + + /** + * Helper method to set username for HTTP basic authentication. + * @param username Username + * @return QueryApi + */ + public QueryApi setUsername(String username) { + this.username = username; + return this; + } + + /** + * Helper method to set password for HTTP basic authentication. + * @param password Password + * @return QueryApi + */ + public QueryApi setPassword(String password) { + this.password = password; + return this; + } + + + + /** + * Apply authentication settings directly to request headers. + * This avoids modifying the shared ApiClient's authentication state. + */ + private void applyAuthToHeaders(HttpRequest.Builder localVarRequestBuilder) { + if (bearerToken != null) { + localVarRequestBuilder.header("Authorization", "Bearer " + bearerToken); + } + if (username != null && password != null) { + String credentials = java.util.Base64.getEncoder().encodeToString((username + ":" + password).getBytes()); + localVarRequestBuilder.header("Authorization", "Basic " + credentials); + } + } + + /** + * Apply authentication settings directly to query parameters. + * This avoids modifying the shared ApiClient's authentication state. + */ + private String applyAuthToQueryParams(String queryString) { + return queryString; + } + + protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { String body = response.body() == null ? null : new String(response.body().readAllBytes()); String message = formatExceptionMessage(operationId, response.statusCode(), body); @@ -172,9 +236,15 @@ private HttpRequest.Builder testEnumRefStringRequestBuilder(@javax.annotation.Nu if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } } localVarRequestBuilder.header("Accept", "text/plain"); @@ -183,6 +253,8 @@ private HttpRequest.Builder testEnumRefStringRequestBuilder(@javax.annotation.Nu if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -271,9 +343,15 @@ private HttpRequest.Builder testQueryDatetimeDateStringRequestBuilder(@javax.ann if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } } localVarRequestBuilder.header("Accept", "text/plain"); @@ -282,6 +360,8 @@ private HttpRequest.Builder testQueryDatetimeDateStringRequestBuilder(@javax.ann if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -370,9 +450,15 @@ private HttpRequest.Builder testQueryIntegerBooleanStringRequestBuilder(@javax.a if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } } localVarRequestBuilder.header("Accept", "text/plain"); @@ -381,6 +467,8 @@ private HttpRequest.Builder testQueryIntegerBooleanStringRequestBuilder(@javax.a if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -466,9 +554,15 @@ private HttpRequest.Builder testQueryStyleDeepObjectExplodeTrueObjectRequestBuil if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } } localVarRequestBuilder.header("Accept", "text/plain"); @@ -477,6 +571,8 @@ private HttpRequest.Builder testQueryStyleDeepObjectExplodeTrueObjectRequestBuil if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -562,9 +658,15 @@ private HttpRequest.Builder testQueryStyleDeepObjectExplodeTrueObjectAllOfReques if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } } localVarRequestBuilder.header("Accept", "text/plain"); @@ -573,6 +675,8 @@ private HttpRequest.Builder testQueryStyleDeepObjectExplodeTrueObjectAllOfReques if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -653,9 +757,15 @@ private HttpRequest.Builder testQueryStyleFormExplodeFalseArrayIntegerRequestBui if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } } localVarRequestBuilder.header("Accept", "text/plain"); @@ -664,6 +774,8 @@ private HttpRequest.Builder testQueryStyleFormExplodeFalseArrayIntegerRequestBui if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -744,9 +856,15 @@ private HttpRequest.Builder testQueryStyleFormExplodeFalseArrayStringRequestBuil if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } } localVarRequestBuilder.header("Accept", "text/plain"); @@ -755,6 +873,8 @@ private HttpRequest.Builder testQueryStyleFormExplodeFalseArrayStringRequestBuil if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -835,9 +955,15 @@ private HttpRequest.Builder testQueryStyleFormExplodeTrueArrayStringRequestBuild if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } } localVarRequestBuilder.header("Accept", "text/plain"); @@ -846,6 +972,8 @@ private HttpRequest.Builder testQueryStyleFormExplodeTrueArrayStringRequestBuild if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -931,9 +1059,15 @@ private HttpRequest.Builder testQueryStyleFormExplodeTrueObjectRequestBuilder(@j if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } } localVarRequestBuilder.header("Accept", "text/plain"); @@ -942,6 +1076,8 @@ private HttpRequest.Builder testQueryStyleFormExplodeTrueObjectRequestBuilder(@j if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1022,9 +1158,15 @@ private HttpRequest.Builder testQueryStyleFormExplodeTrueObjectAllOfRequestBuild if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } } localVarRequestBuilder.header("Accept", "text/plain"); @@ -1033,6 +1175,8 @@ private HttpRequest.Builder testQueryStyleFormExplodeTrueObjectAllOfRequestBuild if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/AnotherFakeApi.java index 1919d1809c23..cd35e28e92c2 100644 --- a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/AnotherFakeApi.java +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -57,6 +57,20 @@ public class AnotherFakeApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; + // Per-API Bearer authentication + private String bearerToken; + + // Per-API Basic authentication + private String username; + private String password; + + // Per-API API key authentication + private String apiKey; + private String apiKeyPrefix; + + // Per-API OAuth authentication + private String accessToken; + public AnotherFakeApi() { this(Configuration.getDefaultApiClient()); } @@ -71,6 +85,109 @@ public AnotherFakeApi(ApiClient apiClient) { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } + /** + * Helper method to set access token for Bearer authentication. + * @param bearerToken Bearer token + * @return AnotherFakeApi + */ + public AnotherFakeApi setBearerToken(String bearerToken) { + this.bearerToken = bearerToken; + return this; + } + + /** + * Helper method to set username for HTTP basic authentication. + * @param username Username + * @return AnotherFakeApi + */ + public AnotherFakeApi setUsername(String username) { + this.username = username; + return this; + } + + /** + * Helper method to set password for HTTP basic authentication. + * @param password Password + * @return AnotherFakeApi + */ + public AnotherFakeApi setPassword(String password) { + this.password = password; + return this; + } + + /** + * Helper method to set API key value for API key authentication. + * @param apiKey API key + * @return AnotherFakeApi + */ + public AnotherFakeApi setApiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * Helper method to set API key prefix for API key authentication. + * @param apiKeyPrefix API key prefix + * @return AnotherFakeApi + */ + public AnotherFakeApi setApiKeyPrefix(String apiKeyPrefix) { + this.apiKeyPrefix = apiKeyPrefix; + return this; + } + + /** + * Helper method to set access token for OAuth2 authentication. + * @param accessToken Access token + * @return AnotherFakeApi + */ + public AnotherFakeApi setAccessToken(String accessToken) { + this.accessToken = accessToken; + return this; + } + + /** + * Apply authentication settings directly to request headers. + * This avoids modifying the shared ApiClient's authentication state. + */ + private void applyAuthToHeaders(HttpRequest.Builder localVarRequestBuilder) { + if (bearerToken != null) { + localVarRequestBuilder.header("Authorization", "Bearer " + bearerToken); + } + if (username != null && password != null) { + String credentials = java.util.Base64.getEncoder().encodeToString((username + ":" + password).getBytes()); + localVarRequestBuilder.header("Authorization", "Basic " + credentials); + } + if (apiKey != null) { + + String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; + localVarRequestBuilder.header("api_key", keyValue); + + } + if (accessToken != null) { + localVarRequestBuilder.header("Authorization", "Bearer " + accessToken); + } + } + + /** + * Apply authentication settings directly to query parameters. + * This avoids modifying the shared ApiClient's authentication state. + */ + private String applyAuthToQueryParams(String queryString) { + if (apiKey != null) { + + String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; + String authParam = "api_key_query=" + keyValue; + if (queryString != null && !queryString.isEmpty()) { + return queryString + "&" + authParam; + } else { + return authParam; + } + + } + return queryString; + } + + private ApiException getApiException(String operationId, HttpResponse response) { String message = formatExceptionMessage(operationId, response.statusCode(), response.body()); return new ApiException(response.statusCode(), message, response.headers(), response.body()); @@ -162,7 +279,12 @@ private HttpRequest.Builder call123testSpecialTagsRequestBuilder(@javax.annotati String localVarPath = "/another-fake/dummy"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -176,6 +298,8 @@ private HttpRequest.Builder call123testSpecialTagsRequestBuilder(@javax.annotati if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/DefaultApi.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/DefaultApi.java index 761019e6d171..eb63104031c3 100644 --- a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/DefaultApi.java +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/DefaultApi.java @@ -57,6 +57,20 @@ public class DefaultApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; + // Per-API Bearer authentication + private String bearerToken; + + // Per-API Basic authentication + private String username; + private String password; + + // Per-API API key authentication + private String apiKey; + private String apiKeyPrefix; + + // Per-API OAuth authentication + private String accessToken; + public DefaultApi() { this(Configuration.getDefaultApiClient()); } @@ -71,6 +85,109 @@ public DefaultApi(ApiClient apiClient) { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } + /** + * Helper method to set access token for Bearer authentication. + * @param bearerToken Bearer token + * @return DefaultApi + */ + public DefaultApi setBearerToken(String bearerToken) { + this.bearerToken = bearerToken; + return this; + } + + /** + * Helper method to set username for HTTP basic authentication. + * @param username Username + * @return DefaultApi + */ + public DefaultApi setUsername(String username) { + this.username = username; + return this; + } + + /** + * Helper method to set password for HTTP basic authentication. + * @param password Password + * @return DefaultApi + */ + public DefaultApi setPassword(String password) { + this.password = password; + return this; + } + + /** + * Helper method to set API key value for API key authentication. + * @param apiKey API key + * @return DefaultApi + */ + public DefaultApi setApiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * Helper method to set API key prefix for API key authentication. + * @param apiKeyPrefix API key prefix + * @return DefaultApi + */ + public DefaultApi setApiKeyPrefix(String apiKeyPrefix) { + this.apiKeyPrefix = apiKeyPrefix; + return this; + } + + /** + * Helper method to set access token for OAuth2 authentication. + * @param accessToken Access token + * @return DefaultApi + */ + public DefaultApi setAccessToken(String accessToken) { + this.accessToken = accessToken; + return this; + } + + /** + * Apply authentication settings directly to request headers. + * This avoids modifying the shared ApiClient's authentication state. + */ + private void applyAuthToHeaders(HttpRequest.Builder localVarRequestBuilder) { + if (bearerToken != null) { + localVarRequestBuilder.header("Authorization", "Bearer " + bearerToken); + } + if (username != null && password != null) { + String credentials = java.util.Base64.getEncoder().encodeToString((username + ":" + password).getBytes()); + localVarRequestBuilder.header("Authorization", "Basic " + credentials); + } + if (apiKey != null) { + + String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; + localVarRequestBuilder.header("api_key", keyValue); + + } + if (accessToken != null) { + localVarRequestBuilder.header("Authorization", "Bearer " + accessToken); + } + } + + /** + * Apply authentication settings directly to query parameters. + * This avoids modifying the shared ApiClient's authentication state. + */ + private String applyAuthToQueryParams(String queryString) { + if (apiKey != null) { + + String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; + String authParam = "api_key_query=" + keyValue; + if (queryString != null && !queryString.isEmpty()) { + return queryString + "&" + authParam; + } else { + return authParam; + } + + } + return queryString; + } + + private ApiException getApiException(String operationId, HttpResponse response) { String message = formatExceptionMessage(operationId, response.statusCode(), response.body()); return new ApiException(response.statusCode(), message, response.headers(), response.body()); @@ -156,7 +273,12 @@ private HttpRequest.Builder fooGetRequestBuilder() throws ApiException { String localVarPath = "/foo"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "application/json"); @@ -164,6 +286,8 @@ private HttpRequest.Builder fooGetRequestBuilder() throws ApiException { if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeApi.java index d91496aa76de..39d8ed5aeea0 100644 --- a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeApi.java @@ -74,6 +74,20 @@ public class FakeApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; + // Per-API Bearer authentication + private String bearerToken; + + // Per-API Basic authentication + private String username; + private String password; + + // Per-API API key authentication + private String apiKey; + private String apiKeyPrefix; + + // Per-API OAuth authentication + private String accessToken; + public FakeApi() { this(Configuration.getDefaultApiClient()); } @@ -88,6 +102,109 @@ public FakeApi(ApiClient apiClient) { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } + /** + * Helper method to set access token for Bearer authentication. + * @param bearerToken Bearer token + * @return FakeApi + */ + public FakeApi setBearerToken(String bearerToken) { + this.bearerToken = bearerToken; + return this; + } + + /** + * Helper method to set username for HTTP basic authentication. + * @param username Username + * @return FakeApi + */ + public FakeApi setUsername(String username) { + this.username = username; + return this; + } + + /** + * Helper method to set password for HTTP basic authentication. + * @param password Password + * @return FakeApi + */ + public FakeApi setPassword(String password) { + this.password = password; + return this; + } + + /** + * Helper method to set API key value for API key authentication. + * @param apiKey API key + * @return FakeApi + */ + public FakeApi setApiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * Helper method to set API key prefix for API key authentication. + * @param apiKeyPrefix API key prefix + * @return FakeApi + */ + public FakeApi setApiKeyPrefix(String apiKeyPrefix) { + this.apiKeyPrefix = apiKeyPrefix; + return this; + } + + /** + * Helper method to set access token for OAuth2 authentication. + * @param accessToken Access token + * @return FakeApi + */ + public FakeApi setAccessToken(String accessToken) { + this.accessToken = accessToken; + return this; + } + + /** + * Apply authentication settings directly to request headers. + * This avoids modifying the shared ApiClient's authentication state. + */ + private void applyAuthToHeaders(HttpRequest.Builder localVarRequestBuilder) { + if (bearerToken != null) { + localVarRequestBuilder.header("Authorization", "Bearer " + bearerToken); + } + if (username != null && password != null) { + String credentials = java.util.Base64.getEncoder().encodeToString((username + ":" + password).getBytes()); + localVarRequestBuilder.header("Authorization", "Basic " + credentials); + } + if (apiKey != null) { + + String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; + localVarRequestBuilder.header("api_key", keyValue); + + } + if (accessToken != null) { + localVarRequestBuilder.header("Authorization", "Bearer " + accessToken); + } + } + + /** + * Apply authentication settings directly to query parameters. + * This avoids modifying the shared ApiClient's authentication state. + */ + private String applyAuthToQueryParams(String queryString) { + if (apiKey != null) { + + String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; + String authParam = "api_key_query=" + keyValue; + if (queryString != null && !queryString.isEmpty()) { + return queryString + "&" + authParam; + } else { + return authParam; + } + + } + return queryString; + } + + private ApiException getApiException(String operationId, HttpResponse response) { String message = formatExceptionMessage(operationId, response.statusCode(), response.body()); return new ApiException(response.statusCode(), message, response.headers(), response.body()); @@ -173,7 +290,12 @@ private HttpRequest.Builder fakeBigDecimalMapRequestBuilder() throws ApiExceptio String localVarPath = "/fake/BigDecimalMap"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "*/*"); @@ -181,6 +303,8 @@ private HttpRequest.Builder fakeBigDecimalMapRequestBuilder() throws ApiExceptio if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -260,7 +384,12 @@ private HttpRequest.Builder fakeHealthGetRequestBuilder() throws ApiException { String localVarPath = "/fake/health"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "application/json"); @@ -268,6 +397,8 @@ private HttpRequest.Builder fakeHealthGetRequestBuilder() throws ApiException { if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -349,7 +480,12 @@ private HttpRequest.Builder fakeOuterBooleanSerializeRequestBuilder(@javax.annot String localVarPath = "/fake/outer/boolean"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "*/*"); @@ -363,6 +499,8 @@ private HttpRequest.Builder fakeOuterBooleanSerializeRequestBuilder(@javax.annot if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -444,7 +582,12 @@ private HttpRequest.Builder fakeOuterCompositeSerializeRequestBuilder(@javax.ann String localVarPath = "/fake/outer/composite"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "*/*"); @@ -458,6 +601,8 @@ private HttpRequest.Builder fakeOuterCompositeSerializeRequestBuilder(@javax.ann if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -539,7 +684,12 @@ private HttpRequest.Builder fakeOuterNumberSerializeRequestBuilder(@javax.annota String localVarPath = "/fake/outer/number"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "*/*"); @@ -553,6 +703,8 @@ private HttpRequest.Builder fakeOuterNumberSerializeRequestBuilder(@javax.annota if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -634,7 +786,12 @@ private HttpRequest.Builder fakeOuterStringSerializeRequestBuilder(@javax.annota String localVarPath = "/fake/outer/string"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "*/*"); @@ -643,6 +800,8 @@ private HttpRequest.Builder fakeOuterStringSerializeRequestBuilder(@javax.annota if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -722,7 +881,12 @@ private HttpRequest.Builder getApplicationJsonUtf8RequestBuilder() throws ApiExc String localVarPath = "/fake/application_json_utf8"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "application/json;charset=utf-8"); @@ -730,6 +894,8 @@ private HttpRequest.Builder getApplicationJsonUtf8RequestBuilder() throws ApiExc if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -809,7 +975,12 @@ private HttpRequest.Builder getArrayOfEnumsRequestBuilder() throws ApiException String localVarPath = "/fake/array-of-enums"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "application/json"); @@ -817,6 +988,8 @@ private HttpRequest.Builder getArrayOfEnumsRequestBuilder() throws ApiException if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -887,7 +1060,12 @@ private HttpRequest.Builder testAdditionalPropertiesReferenceRequestBuilder(@jav String localVarPath = "/fake/additionalProperties-reference"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -901,6 +1079,8 @@ private HttpRequest.Builder testAdditionalPropertiesReferenceRequestBuilder(@jav if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -971,7 +1151,12 @@ private HttpRequest.Builder testBodyWithFileSchemaRequestBuilder(@javax.annotati String localVarPath = "/fake/body-with-file-schema"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -985,6 +1170,8 @@ private HttpRequest.Builder testBodyWithFileSchemaRequestBuilder(@javax.annotati if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1073,9 +1260,15 @@ private HttpRequest.Builder testBodyWithQueryParamsRequestBuilder(@javax.annotat if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } } localVarRequestBuilder.header("Content-Type", "application/json"); @@ -1090,6 +1283,8 @@ private HttpRequest.Builder testBodyWithQueryParamsRequestBuilder(@javax.annotat if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1175,7 +1370,12 @@ private HttpRequest.Builder testClientModelRequestBuilder(@javax.annotation.Nonn String localVarPath = "/fake"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -1189,6 +1389,8 @@ private HttpRequest.Builder testClientModelRequestBuilder(@javax.annotation.Nonn if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1297,7 +1499,12 @@ private HttpRequest.Builder testEndpointParametersRequestBuilder(@javax.annotati String localVarPath = "/fake"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "application/json"); @@ -1358,6 +1565,8 @@ private HttpRequest.Builder testEndpointParametersRequestBuilder(@javax.annotati if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1456,9 +1665,15 @@ private HttpRequest.Builder testEnumParametersRequestBuilder(@javax.annotation.N if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } } if (enumHeaderStringArray != null) { @@ -1492,6 +1707,8 @@ private HttpRequest.Builder testEnumParametersRequestBuilder(@javax.annotation.N if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1638,9 +1855,15 @@ private HttpRequest.Builder testGroupParametersRequestBuilder(@javax.annotation. if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } } if (requiredBooleanGroup != null) { @@ -1655,6 +1878,8 @@ private HttpRequest.Builder testGroupParametersRequestBuilder(@javax.annotation. if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1814,7 +2039,12 @@ private HttpRequest.Builder testInlineAdditionalPropertiesRequestBuilder(@javax. String localVarPath = "/fake/inline-additionalProperties"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -1828,6 +2058,8 @@ private HttpRequest.Builder testInlineAdditionalPropertiesRequestBuilder(@javax. if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1898,7 +2130,12 @@ private HttpRequest.Builder testInlineFreeformAdditionalPropertiesRequestBuilder String localVarPath = "/fake/inline-freeform-additionalProperties"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -1912,6 +2149,8 @@ private HttpRequest.Builder testInlineFreeformAdditionalPropertiesRequestBuilder if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1988,7 +2227,12 @@ private HttpRequest.Builder testJsonFormDataRequestBuilder(@javax.annotation.Non String localVarPath = "/fake/jsonFormData"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "application/json"); @@ -2013,6 +2257,8 @@ private HttpRequest.Builder testJsonFormDataRequestBuilder(@javax.annotation.Non if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -2127,9 +2373,15 @@ private HttpRequest.Builder testQueryParameterCollectionFormatRequestBuilder(@ja if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } } localVarRequestBuilder.header("Accept", "application/json"); @@ -2138,6 +2390,8 @@ private HttpRequest.Builder testQueryParameterCollectionFormatRequestBuilder(@ja if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -2208,7 +2462,12 @@ private HttpRequest.Builder testStringMapReferenceRequestBuilder(@javax.annotati String localVarPath = "/fake/stringMap-reference"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -2222,6 +2481,8 @@ private HttpRequest.Builder testStringMapReferenceRequestBuilder(@javax.annotati if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java index 50ba0a06562b..f5a0823271f9 100644 --- a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -63,6 +63,20 @@ public class FakeClassnameTags123Api { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; + // Per-API Bearer authentication + private String bearerToken; + + // Per-API Basic authentication + private String username; + private String password; + + // Per-API API key authentication + private String apiKey; + private String apiKeyPrefix; + + // Per-API OAuth authentication + private String accessToken; + public FakeClassnameTags123Api() { this(Configuration.getDefaultApiClient()); } @@ -77,6 +91,109 @@ public FakeClassnameTags123Api(ApiClient apiClient) { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } + /** + * Helper method to set access token for Bearer authentication. + * @param bearerToken Bearer token + * @return FakeClassnameTags123Api + */ + public FakeClassnameTags123Api setBearerToken(String bearerToken) { + this.bearerToken = bearerToken; + return this; + } + + /** + * Helper method to set username for HTTP basic authentication. + * @param username Username + * @return FakeClassnameTags123Api + */ + public FakeClassnameTags123Api setUsername(String username) { + this.username = username; + return this; + } + + /** + * Helper method to set password for HTTP basic authentication. + * @param password Password + * @return FakeClassnameTags123Api + */ + public FakeClassnameTags123Api setPassword(String password) { + this.password = password; + return this; + } + + /** + * Helper method to set API key value for API key authentication. + * @param apiKey API key + * @return FakeClassnameTags123Api + */ + public FakeClassnameTags123Api setApiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * Helper method to set API key prefix for API key authentication. + * @param apiKeyPrefix API key prefix + * @return FakeClassnameTags123Api + */ + public FakeClassnameTags123Api setApiKeyPrefix(String apiKeyPrefix) { + this.apiKeyPrefix = apiKeyPrefix; + return this; + } + + /** + * Helper method to set access token for OAuth2 authentication. + * @param accessToken Access token + * @return FakeClassnameTags123Api + */ + public FakeClassnameTags123Api setAccessToken(String accessToken) { + this.accessToken = accessToken; + return this; + } + + /** + * Apply authentication settings directly to request headers. + * This avoids modifying the shared ApiClient's authentication state. + */ + private void applyAuthToHeaders(HttpRequest.Builder localVarRequestBuilder) { + if (bearerToken != null) { + localVarRequestBuilder.header("Authorization", "Bearer " + bearerToken); + } + if (username != null && password != null) { + String credentials = java.util.Base64.getEncoder().encodeToString((username + ":" + password).getBytes()); + localVarRequestBuilder.header("Authorization", "Basic " + credentials); + } + if (apiKey != null) { + + String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; + localVarRequestBuilder.header("api_key", keyValue); + + } + if (accessToken != null) { + localVarRequestBuilder.header("Authorization", "Bearer " + accessToken); + } + } + + /** + * Apply authentication settings directly to query parameters. + * This avoids modifying the shared ApiClient's authentication state. + */ + private String applyAuthToQueryParams(String queryString) { + if (apiKey != null) { + + String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; + String authParam = "api_key_query=" + keyValue; + if (queryString != null && !queryString.isEmpty()) { + return queryString + "&" + authParam; + } else { + return authParam; + } + + } + return queryString; + } + + private ApiException getApiException(String operationId, HttpResponse response) { String message = formatExceptionMessage(operationId, response.statusCode(), response.body()); return new ApiException(response.statusCode(), message, response.headers(), response.body()); @@ -168,7 +285,12 @@ private HttpRequest.Builder testClassnameRequestBuilder(@javax.annotation.Nonnul String localVarPath = "/fake_classname_test"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -182,6 +304,8 @@ private HttpRequest.Builder testClassnameRequestBuilder(@javax.annotation.Nonnul if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/PetApi.java index 0dea62269b82..6f73255f3062 100644 --- a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/PetApi.java @@ -65,6 +65,20 @@ public class PetApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; + // Per-API Bearer authentication + private String bearerToken; + + // Per-API Basic authentication + private String username; + private String password; + + // Per-API API key authentication + private String apiKey; + private String apiKeyPrefix; + + // Per-API OAuth authentication + private String accessToken; + public PetApi() { this(Configuration.getDefaultApiClient()); } @@ -79,6 +93,109 @@ public PetApi(ApiClient apiClient) { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } + /** + * Helper method to set access token for Bearer authentication. + * @param bearerToken Bearer token + * @return PetApi + */ + public PetApi setBearerToken(String bearerToken) { + this.bearerToken = bearerToken; + return this; + } + + /** + * Helper method to set username for HTTP basic authentication. + * @param username Username + * @return PetApi + */ + public PetApi setUsername(String username) { + this.username = username; + return this; + } + + /** + * Helper method to set password for HTTP basic authentication. + * @param password Password + * @return PetApi + */ + public PetApi setPassword(String password) { + this.password = password; + return this; + } + + /** + * Helper method to set API key value for API key authentication. + * @param apiKey API key + * @return PetApi + */ + public PetApi setApiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * Helper method to set API key prefix for API key authentication. + * @param apiKeyPrefix API key prefix + * @return PetApi + */ + public PetApi setApiKeyPrefix(String apiKeyPrefix) { + this.apiKeyPrefix = apiKeyPrefix; + return this; + } + + /** + * Helper method to set access token for OAuth2 authentication. + * @param accessToken Access token + * @return PetApi + */ + public PetApi setAccessToken(String accessToken) { + this.accessToken = accessToken; + return this; + } + + /** + * Apply authentication settings directly to request headers. + * This avoids modifying the shared ApiClient's authentication state. + */ + private void applyAuthToHeaders(HttpRequest.Builder localVarRequestBuilder) { + if (bearerToken != null) { + localVarRequestBuilder.header("Authorization", "Bearer " + bearerToken); + } + if (username != null && password != null) { + String credentials = java.util.Base64.getEncoder().encodeToString((username + ":" + password).getBytes()); + localVarRequestBuilder.header("Authorization", "Basic " + credentials); + } + if (apiKey != null) { + + String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; + localVarRequestBuilder.header("api_key", keyValue); + + } + if (accessToken != null) { + localVarRequestBuilder.header("Authorization", "Bearer " + accessToken); + } + } + + /** + * Apply authentication settings directly to query parameters. + * This avoids modifying the shared ApiClient's authentication state. + */ + private String applyAuthToQueryParams(String queryString) { + if (apiKey != null) { + + String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; + String authParam = "api_key_query=" + keyValue; + if (queryString != null && !queryString.isEmpty()) { + return queryString + "&" + authParam; + } else { + return authParam; + } + + } + return queryString; + } + + private ApiException getApiException(String operationId, HttpResponse response) { String message = formatExceptionMessage(operationId, response.statusCode(), response.body()); return new ApiException(response.statusCode(), message, response.headers(), response.body()); @@ -155,7 +272,12 @@ private HttpRequest.Builder addPetRequestBuilder(@javax.annotation.Nonnull Pet p String localVarPath = "/pet"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -169,6 +291,8 @@ private HttpRequest.Builder addPetRequestBuilder(@javax.annotation.Nonnull Pet p if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -242,7 +366,12 @@ private HttpRequest.Builder deletePetRequestBuilder(@javax.annotation.Nonnull Lo String localVarPath = "/pet/{petId}" .replace("{petId}", ApiClient.urlEncode(petId.toString())); - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } if (apiKey != null) { localVarRequestBuilder.header("api_key", apiKey.toString()); @@ -253,6 +382,8 @@ private HttpRequest.Builder deletePetRequestBuilder(@javax.annotation.Nonnull Lo if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -350,9 +481,15 @@ private HttpRequest.Builder findPetsByStatusRequestBuilder(@javax.annotation.Non if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } } localVarRequestBuilder.header("Accept", "application/xml, application/json"); @@ -361,6 +498,8 @@ private HttpRequest.Builder findPetsByStatusRequestBuilder(@javax.annotation.Non if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -462,9 +601,15 @@ private HttpRequest.Builder findPetsByTagsRequestBuilder(@javax.annotation.Nonnu if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } } localVarRequestBuilder.header("Accept", "application/xml, application/json"); @@ -473,6 +618,8 @@ private HttpRequest.Builder findPetsByTagsRequestBuilder(@javax.annotation.Nonnu if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -559,7 +706,12 @@ private HttpRequest.Builder getPetByIdRequestBuilder(@javax.annotation.Nonnull L String localVarPath = "/pet/{petId}" .replace("{petId}", ApiClient.urlEncode(petId.toString())); - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "application/xml, application/json"); @@ -567,6 +719,8 @@ private HttpRequest.Builder getPetByIdRequestBuilder(@javax.annotation.Nonnull L if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -637,7 +791,12 @@ private HttpRequest.Builder updatePetRequestBuilder(@javax.annotation.Nonnull Pe String localVarPath = "/pet"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -651,6 +810,8 @@ private HttpRequest.Builder updatePetRequestBuilder(@javax.annotation.Nonnull Pe if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -726,7 +887,12 @@ private HttpRequest.Builder updatePetWithFormRequestBuilder(@javax.annotation.No String localVarPath = "/pet/{petId}" .replace("{petId}", ApiClient.urlEncode(petId.toString())); - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "application/json"); @@ -751,6 +917,8 @@ private HttpRequest.Builder updatePetWithFormRequestBuilder(@javax.annotation.No if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -841,7 +1009,12 @@ private HttpRequest.Builder uploadFileRequestBuilder(@javax.annotation.Nonnull L String localVarPath = "/pet/{petId}/uploadImage" .replace("{petId}", ApiClient.urlEncode(petId.toString())); - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "application/json"); @@ -885,6 +1058,8 @@ private HttpRequest.Builder uploadFileRequestBuilder(@javax.annotation.Nonnull L if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -979,7 +1154,12 @@ private HttpRequest.Builder uploadFileWithRequiredFileRequestBuilder(@javax.anno String localVarPath = "/fake/{petId}/uploadImageWithRequiredFile" .replace("{petId}", ApiClient.urlEncode(petId.toString())); - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "application/json"); @@ -1023,6 +1203,8 @@ private HttpRequest.Builder uploadFileWithRequiredFileRequestBuilder(@javax.anno if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/StoreApi.java index 9250421fa1a8..6c6fed6166e6 100644 --- a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/StoreApi.java @@ -63,6 +63,20 @@ public class StoreApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; + // Per-API Bearer authentication + private String bearerToken; + + // Per-API Basic authentication + private String username; + private String password; + + // Per-API API key authentication + private String apiKey; + private String apiKeyPrefix; + + // Per-API OAuth authentication + private String accessToken; + public StoreApi() { this(Configuration.getDefaultApiClient()); } @@ -77,6 +91,109 @@ public StoreApi(ApiClient apiClient) { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } + /** + * Helper method to set access token for Bearer authentication. + * @param bearerToken Bearer token + * @return StoreApi + */ + public StoreApi setBearerToken(String bearerToken) { + this.bearerToken = bearerToken; + return this; + } + + /** + * Helper method to set username for HTTP basic authentication. + * @param username Username + * @return StoreApi + */ + public StoreApi setUsername(String username) { + this.username = username; + return this; + } + + /** + * Helper method to set password for HTTP basic authentication. + * @param password Password + * @return StoreApi + */ + public StoreApi setPassword(String password) { + this.password = password; + return this; + } + + /** + * Helper method to set API key value for API key authentication. + * @param apiKey API key + * @return StoreApi + */ + public StoreApi setApiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * Helper method to set API key prefix for API key authentication. + * @param apiKeyPrefix API key prefix + * @return StoreApi + */ + public StoreApi setApiKeyPrefix(String apiKeyPrefix) { + this.apiKeyPrefix = apiKeyPrefix; + return this; + } + + /** + * Helper method to set access token for OAuth2 authentication. + * @param accessToken Access token + * @return StoreApi + */ + public StoreApi setAccessToken(String accessToken) { + this.accessToken = accessToken; + return this; + } + + /** + * Apply authentication settings directly to request headers. + * This avoids modifying the shared ApiClient's authentication state. + */ + private void applyAuthToHeaders(HttpRequest.Builder localVarRequestBuilder) { + if (bearerToken != null) { + localVarRequestBuilder.header("Authorization", "Bearer " + bearerToken); + } + if (username != null && password != null) { + String credentials = java.util.Base64.getEncoder().encodeToString((username + ":" + password).getBytes()); + localVarRequestBuilder.header("Authorization", "Basic " + credentials); + } + if (apiKey != null) { + + String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; + localVarRequestBuilder.header("api_key", keyValue); + + } + if (accessToken != null) { + localVarRequestBuilder.header("Authorization", "Bearer " + accessToken); + } + } + + /** + * Apply authentication settings directly to query parameters. + * This avoids modifying the shared ApiClient's authentication state. + */ + private String applyAuthToQueryParams(String queryString) { + if (apiKey != null) { + + String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; + String authParam = "api_key_query=" + keyValue; + if (queryString != null && !queryString.isEmpty()) { + return queryString + "&" + authParam; + } else { + return authParam; + } + + } + return queryString; + } + + private ApiException getApiException(String operationId, HttpResponse response) { String message = formatExceptionMessage(operationId, response.statusCode(), response.body()); return new ApiException(response.statusCode(), message, response.headers(), response.body()); @@ -154,7 +271,12 @@ private HttpRequest.Builder deleteOrderRequestBuilder(@javax.annotation.Nonnull String localVarPath = "/store/order/{order_id}" .replace("{order_id}", ApiClient.urlEncode(orderId.toString())); - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "application/json"); @@ -162,6 +284,8 @@ private HttpRequest.Builder deleteOrderRequestBuilder(@javax.annotation.Nonnull if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -241,7 +365,12 @@ private HttpRequest.Builder getInventoryRequestBuilder() throws ApiException { String localVarPath = "/store/inventory"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "application/json"); @@ -249,6 +378,8 @@ private HttpRequest.Builder getInventoryRequestBuilder() throws ApiException { if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -335,7 +466,12 @@ private HttpRequest.Builder getOrderByIdRequestBuilder(@javax.annotation.Nonnull String localVarPath = "/store/order/{order_id}" .replace("{order_id}", ApiClient.urlEncode(orderId.toString())); - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "application/xml, application/json"); @@ -343,6 +479,8 @@ private HttpRequest.Builder getOrderByIdRequestBuilder(@javax.annotation.Nonnull if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -428,7 +566,12 @@ private HttpRequest.Builder placeOrderRequestBuilder(@javax.annotation.Nonnull O String localVarPath = "/store/order"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/xml, application/json"); @@ -442,6 +585,8 @@ private HttpRequest.Builder placeOrderRequestBuilder(@javax.annotation.Nonnull O if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/UserApi.java index f30354c274ec..ad0f935e1259 100644 --- a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/UserApi.java @@ -64,6 +64,20 @@ public class UserApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; + // Per-API Bearer authentication + private String bearerToken; + + // Per-API Basic authentication + private String username; + private String password; + + // Per-API API key authentication + private String apiKey; + private String apiKeyPrefix; + + // Per-API OAuth authentication + private String accessToken; + public UserApi() { this(Configuration.getDefaultApiClient()); } @@ -78,6 +92,109 @@ public UserApi(ApiClient apiClient) { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } + /** + * Helper method to set access token for Bearer authentication. + * @param bearerToken Bearer token + * @return UserApi + */ + public UserApi setBearerToken(String bearerToken) { + this.bearerToken = bearerToken; + return this; + } + + /** + * Helper method to set username for HTTP basic authentication. + * @param username Username + * @return UserApi + */ + public UserApi setUsername(String username) { + this.username = username; + return this; + } + + /** + * Helper method to set password for HTTP basic authentication. + * @param password Password + * @return UserApi + */ + public UserApi setPassword(String password) { + this.password = password; + return this; + } + + /** + * Helper method to set API key value for API key authentication. + * @param apiKey API key + * @return UserApi + */ + public UserApi setApiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * Helper method to set API key prefix for API key authentication. + * @param apiKeyPrefix API key prefix + * @return UserApi + */ + public UserApi setApiKeyPrefix(String apiKeyPrefix) { + this.apiKeyPrefix = apiKeyPrefix; + return this; + } + + /** + * Helper method to set access token for OAuth2 authentication. + * @param accessToken Access token + * @return UserApi + */ + public UserApi setAccessToken(String accessToken) { + this.accessToken = accessToken; + return this; + } + + /** + * Apply authentication settings directly to request headers. + * This avoids modifying the shared ApiClient's authentication state. + */ + private void applyAuthToHeaders(HttpRequest.Builder localVarRequestBuilder) { + if (bearerToken != null) { + localVarRequestBuilder.header("Authorization", "Bearer " + bearerToken); + } + if (username != null && password != null) { + String credentials = java.util.Base64.getEncoder().encodeToString((username + ":" + password).getBytes()); + localVarRequestBuilder.header("Authorization", "Basic " + credentials); + } + if (apiKey != null) { + + String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; + localVarRequestBuilder.header("api_key", keyValue); + + } + if (accessToken != null) { + localVarRequestBuilder.header("Authorization", "Bearer " + accessToken); + } + } + + /** + * Apply authentication settings directly to query parameters. + * This avoids modifying the shared ApiClient's authentication state. + */ + private String applyAuthToQueryParams(String queryString) { + if (apiKey != null) { + + String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; + String authParam = "api_key_query=" + keyValue; + if (queryString != null && !queryString.isEmpty()) { + return queryString + "&" + authParam; + } else { + return authParam; + } + + } + return queryString; + } + + private ApiException getApiException(String operationId, HttpResponse response) { String message = formatExceptionMessage(operationId, response.statusCode(), response.body()); return new ApiException(response.statusCode(), message, response.headers(), response.body()); @@ -154,7 +271,12 @@ private HttpRequest.Builder createUserRequestBuilder(@javax.annotation.Nonnull U String localVarPath = "/user"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -168,6 +290,8 @@ private HttpRequest.Builder createUserRequestBuilder(@javax.annotation.Nonnull U if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -238,7 +362,12 @@ private HttpRequest.Builder createUsersWithArrayInputRequestBuilder(@javax.annot String localVarPath = "/user/createWithArray"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -252,6 +381,8 @@ private HttpRequest.Builder createUsersWithArrayInputRequestBuilder(@javax.annot if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -322,7 +453,12 @@ private HttpRequest.Builder createUsersWithListInputRequestBuilder(@javax.annota String localVarPath = "/user/createWithList"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -336,6 +472,8 @@ private HttpRequest.Builder createUsersWithListInputRequestBuilder(@javax.annota if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -407,7 +545,12 @@ private HttpRequest.Builder deleteUserRequestBuilder(@javax.annotation.Nonnull S String localVarPath = "/user/{username}" .replace("{username}", ApiClient.urlEncode(username.toString())); - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "application/json"); @@ -415,6 +558,8 @@ private HttpRequest.Builder deleteUserRequestBuilder(@javax.annotation.Nonnull S if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -501,7 +646,12 @@ private HttpRequest.Builder getUserByNameRequestBuilder(@javax.annotation.Nonnul String localVarPath = "/user/{username}" .replace("{username}", ApiClient.urlEncode(username.toString())); - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "application/xml, application/json"); @@ -509,6 +659,8 @@ private HttpRequest.Builder getUserByNameRequestBuilder(@javax.annotation.Nonnul if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -614,9 +766,15 @@ private HttpRequest.Builder loginUserRequestBuilder(@javax.annotation.Nonnull St if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } } localVarRequestBuilder.header("Accept", "application/xml, application/json"); @@ -625,6 +783,8 @@ private HttpRequest.Builder loginUserRequestBuilder(@javax.annotation.Nonnull St if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -689,7 +849,12 @@ private HttpRequest.Builder logoutUserRequestBuilder() throws ApiException { String localVarPath = "/user/logout"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "application/json"); @@ -697,6 +862,8 @@ private HttpRequest.Builder logoutUserRequestBuilder() throws ApiException { if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -774,7 +941,12 @@ private HttpRequest.Builder updateUserRequestBuilder(@javax.annotation.Nonnull S String localVarPath = "/user/{username}" .replace("{username}", ApiClient.urlEncode(username.toString())); - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -788,6 +960,8 @@ private HttpRequest.Builder updateUserRequestBuilder(@javax.annotation.Nonnull S if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/PetApi.java index c1706f368014..af8aa02b6d2f 100644 --- a/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/PetApi.java @@ -63,6 +63,15 @@ public class PetApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; + + + // Per-API API key authentication + private String apiKey; + private String apiKeyPrefix; + + // Per-API OAuth authentication + private String accessToken; + public PetApi() { this(Configuration.getDefaultApiClient()); } @@ -77,6 +86,66 @@ public PetApi(ApiClient apiClient) { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } + + + /** + * Helper method to set API key value for API key authentication. + * @param apiKey API key + * @return PetApi + */ + public PetApi setApiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * Helper method to set API key prefix for API key authentication. + * @param apiKeyPrefix API key prefix + * @return PetApi + */ + public PetApi setApiKeyPrefix(String apiKeyPrefix) { + this.apiKeyPrefix = apiKeyPrefix; + return this; + } + + /** + * Helper method to set access token for OAuth2 authentication. + * @param accessToken Access token + * @return PetApi + */ + public PetApi setAccessToken(String accessToken) { + this.accessToken = accessToken; + return this; + } + + /** + * Apply authentication settings directly to request headers. + * This avoids modifying the shared ApiClient's authentication state. + */ + private void applyAuthToHeaders(HttpRequest.Builder localVarRequestBuilder) { + if (apiKey != null) { + + String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; + localVarRequestBuilder.header("api_key", keyValue); + + } + if (accessToken != null) { + localVarRequestBuilder.header("Authorization", "Bearer " + accessToken); + } + } + + /** + * Apply authentication settings directly to query parameters. + * This avoids modifying the shared ApiClient's authentication state. + */ + private String applyAuthToQueryParams(String queryString) { + if (apiKey != null) { + + } + return queryString; + } + + protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { String body = response.body() == null ? null : new String(response.body().readAllBytes()); String message = formatExceptionMessage(operationId, response.statusCode(), body); @@ -159,7 +228,12 @@ private HttpRequest.Builder addPetRequestBuilder(@jakarta.annotation.Nonnull Pet String localVarPath = "/pet"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/xml, application/json"); @@ -173,6 +247,8 @@ private HttpRequest.Builder addPetRequestBuilder(@jakarta.annotation.Nonnull Pet if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -243,7 +319,12 @@ private HttpRequest.Builder deletePetRequestBuilder(@jakarta.annotation.Nonnull String localVarPath = "/pet/{petId}" .replace("{petId}", ApiClient.urlEncode(petId.toString())); - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } if (apiKey != null) { localVarRequestBuilder.header("api_key", apiKey.toString()); @@ -254,6 +335,8 @@ private HttpRequest.Builder deletePetRequestBuilder(@jakarta.annotation.Nonnull if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -341,9 +424,15 @@ private HttpRequest.Builder findPetsByStatusRequestBuilder(@jakarta.annotation.N if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } } localVarRequestBuilder.header("Accept", "application/xml, application/json"); @@ -352,6 +441,8 @@ private HttpRequest.Builder findPetsByStatusRequestBuilder(@jakarta.annotation.N if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -443,9 +534,15 @@ private HttpRequest.Builder findPetsByTagsRequestBuilder(@jakarta.annotation.Non if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } } localVarRequestBuilder.header("Accept", "application/xml, application/json"); @@ -454,6 +551,8 @@ private HttpRequest.Builder findPetsByTagsRequestBuilder(@jakarta.annotation.Non if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -530,7 +629,12 @@ private HttpRequest.Builder getPetByIdRequestBuilder(@jakarta.annotation.Nonnull String localVarPath = "/pet/{petId}" .replace("{petId}", ApiClient.urlEncode(petId.toString())); - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "application/xml, application/json"); @@ -538,6 +642,8 @@ private HttpRequest.Builder getPetByIdRequestBuilder(@jakarta.annotation.Nonnull if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -617,7 +723,12 @@ private HttpRequest.Builder updatePetRequestBuilder(@jakarta.annotation.Nonnull String localVarPath = "/pet"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/xml, application/json"); @@ -631,6 +742,8 @@ private HttpRequest.Builder updatePetRequestBuilder(@jakarta.annotation.Nonnull if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -703,7 +816,12 @@ private HttpRequest.Builder updatePetWithFormRequestBuilder(@jakarta.annotation. String localVarPath = "/pet/{petId}" .replace("{petId}", ApiClient.urlEncode(petId.toString())); - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "application/json"); @@ -728,6 +846,8 @@ private HttpRequest.Builder updatePetWithFormRequestBuilder(@jakarta.annotation. if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -808,7 +928,12 @@ private HttpRequest.Builder uploadFileRequestBuilder(@jakarta.annotation.Nonnull String localVarPath = "/pet/{petId}/uploadImage" .replace("{petId}", ApiClient.urlEncode(petId.toString())); - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "application/json"); @@ -852,6 +977,8 @@ private HttpRequest.Builder uploadFileRequestBuilder(@jakarta.annotation.Nonnull if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/StoreApi.java index bcf89d35d458..dc1396960406 100644 --- a/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/StoreApi.java @@ -61,6 +61,15 @@ public class StoreApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; + + + // Per-API API key authentication + private String apiKey; + private String apiKeyPrefix; + + // Per-API OAuth authentication + private String accessToken; + public StoreApi() { this(Configuration.getDefaultApiClient()); } @@ -75,6 +84,66 @@ public StoreApi(ApiClient apiClient) { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } + + + /** + * Helper method to set API key value for API key authentication. + * @param apiKey API key + * @return StoreApi + */ + public StoreApi setApiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * Helper method to set API key prefix for API key authentication. + * @param apiKeyPrefix API key prefix + * @return StoreApi + */ + public StoreApi setApiKeyPrefix(String apiKeyPrefix) { + this.apiKeyPrefix = apiKeyPrefix; + return this; + } + + /** + * Helper method to set access token for OAuth2 authentication. + * @param accessToken Access token + * @return StoreApi + */ + public StoreApi setAccessToken(String accessToken) { + this.accessToken = accessToken; + return this; + } + + /** + * Apply authentication settings directly to request headers. + * This avoids modifying the shared ApiClient's authentication state. + */ + private void applyAuthToHeaders(HttpRequest.Builder localVarRequestBuilder) { + if (apiKey != null) { + + String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; + localVarRequestBuilder.header("api_key", keyValue); + + } + if (accessToken != null) { + localVarRequestBuilder.header("Authorization", "Bearer " + accessToken); + } + } + + /** + * Apply authentication settings directly to query parameters. + * This avoids modifying the shared ApiClient's authentication state. + */ + private String applyAuthToQueryParams(String queryString) { + if (apiKey != null) { + + } + return queryString; + } + + protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { String body = response.body() == null ? null : new String(response.body().readAllBytes()); String message = formatExceptionMessage(operationId, response.statusCode(), body); @@ -150,7 +219,12 @@ private HttpRequest.Builder deleteOrderRequestBuilder(@jakarta.annotation.Nonnul String localVarPath = "/store/order/{orderId}" .replace("{orderId}", ApiClient.urlEncode(orderId.toString())); - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "application/json"); @@ -158,6 +232,8 @@ private HttpRequest.Builder deleteOrderRequestBuilder(@jakarta.annotation.Nonnul if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -227,7 +303,12 @@ private HttpRequest.Builder getInventoryRequestBuilder() throws ApiException { String localVarPath = "/store/inventory"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "application/json"); @@ -235,6 +316,8 @@ private HttpRequest.Builder getInventoryRequestBuilder() throws ApiException { if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -311,7 +394,12 @@ private HttpRequest.Builder getOrderByIdRequestBuilder(@jakarta.annotation.Nonnu String localVarPath = "/store/order/{orderId}" .replace("{orderId}", ApiClient.urlEncode(orderId.toString())); - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "application/xml, application/json"); @@ -319,6 +407,8 @@ private HttpRequest.Builder getOrderByIdRequestBuilder(@jakarta.annotation.Nonnu if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -394,7 +484,12 @@ private HttpRequest.Builder placeOrderRequestBuilder(@jakarta.annotation.Nonnull String localVarPath = "/store/order"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/xml, application/json"); @@ -408,6 +503,8 @@ private HttpRequest.Builder placeOrderRequestBuilder(@jakarta.annotation.Nonnull if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/UserApi.java index b147efbfb003..47bafd5cd8ff 100644 --- a/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/UserApi.java @@ -62,6 +62,15 @@ public class UserApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; + + + // Per-API API key authentication + private String apiKey; + private String apiKeyPrefix; + + // Per-API OAuth authentication + private String accessToken; + public UserApi() { this(Configuration.getDefaultApiClient()); } @@ -76,6 +85,66 @@ public UserApi(ApiClient apiClient) { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } + + + /** + * Helper method to set API key value for API key authentication. + * @param apiKey API key + * @return UserApi + */ + public UserApi setApiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * Helper method to set API key prefix for API key authentication. + * @param apiKeyPrefix API key prefix + * @return UserApi + */ + public UserApi setApiKeyPrefix(String apiKeyPrefix) { + this.apiKeyPrefix = apiKeyPrefix; + return this; + } + + /** + * Helper method to set access token for OAuth2 authentication. + * @param accessToken Access token + * @return UserApi + */ + public UserApi setAccessToken(String accessToken) { + this.accessToken = accessToken; + return this; + } + + /** + * Apply authentication settings directly to request headers. + * This avoids modifying the shared ApiClient's authentication state. + */ + private void applyAuthToHeaders(HttpRequest.Builder localVarRequestBuilder) { + if (apiKey != null) { + + String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; + localVarRequestBuilder.header("api_key", keyValue); + + } + if (accessToken != null) { + localVarRequestBuilder.header("Authorization", "Bearer " + accessToken); + } + } + + /** + * Apply authentication settings directly to query parameters. + * This avoids modifying the shared ApiClient's authentication state. + */ + private String applyAuthToQueryParams(String queryString) { + if (apiKey != null) { + + } + return queryString; + } + + protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { String body = response.body() == null ? null : new String(response.body().readAllBytes()); String message = formatExceptionMessage(operationId, response.statusCode(), body); @@ -150,7 +219,12 @@ private HttpRequest.Builder createUserRequestBuilder(@jakarta.annotation.Nonnull String localVarPath = "/user"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -164,6 +238,8 @@ private HttpRequest.Builder createUserRequestBuilder(@jakarta.annotation.Nonnull if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -231,7 +307,12 @@ private HttpRequest.Builder createUsersWithArrayInputRequestBuilder(@jakarta.ann String localVarPath = "/user/createWithArray"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -245,6 +326,8 @@ private HttpRequest.Builder createUsersWithArrayInputRequestBuilder(@jakarta.ann if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -312,7 +395,12 @@ private HttpRequest.Builder createUsersWithListInputRequestBuilder(@jakarta.anno String localVarPath = "/user/createWithList"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -326,6 +414,8 @@ private HttpRequest.Builder createUsersWithListInputRequestBuilder(@jakarta.anno if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -394,7 +484,12 @@ private HttpRequest.Builder deleteUserRequestBuilder(@jakarta.annotation.Nonnull String localVarPath = "/user/{username}" .replace("{username}", ApiClient.urlEncode(username.toString())); - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "application/json"); @@ -402,6 +497,8 @@ private HttpRequest.Builder deleteUserRequestBuilder(@jakarta.annotation.Nonnull if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -478,7 +575,12 @@ private HttpRequest.Builder getUserByNameRequestBuilder(@jakarta.annotation.Nonn String localVarPath = "/user/{username}" .replace("{username}", ApiClient.urlEncode(username.toString())); - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "application/xml, application/json"); @@ -486,6 +588,8 @@ private HttpRequest.Builder getUserByNameRequestBuilder(@jakarta.annotation.Nonn if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -581,9 +685,15 @@ private HttpRequest.Builder loginUserRequestBuilder(@jakarta.annotation.Nonnull if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } } localVarRequestBuilder.header("Accept", "application/xml, application/json"); @@ -592,6 +702,8 @@ private HttpRequest.Builder loginUserRequestBuilder(@jakarta.annotation.Nonnull if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -653,7 +765,12 @@ private HttpRequest.Builder logoutUserRequestBuilder() throws ApiException { String localVarPath = "/user/logout"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "application/json"); @@ -661,6 +778,8 @@ private HttpRequest.Builder logoutUserRequestBuilder() throws ApiException { if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -735,7 +854,12 @@ private HttpRequest.Builder updateUserRequestBuilder(@jakarta.annotation.Nonnull String localVarPath = "/user/{username}" .replace("{username}", ApiClient.urlEncode(username.toString())); - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -749,6 +873,8 @@ private HttpRequest.Builder updateUserRequestBuilder(@jakarta.annotation.Nonnull if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/AnotherFakeApi.java index ff0797c5a0c6..5752329bbc70 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/AnotherFakeApi.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -55,6 +55,20 @@ public class AnotherFakeApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; + // Per-API Bearer authentication + private String bearerToken; + + // Per-API Basic authentication + private String username; + private String password; + + // Per-API API key authentication + private String apiKey; + private String apiKeyPrefix; + + // Per-API OAuth authentication + private String accessToken; + public AnotherFakeApi() { this(Configuration.getDefaultApiClient()); } @@ -69,6 +83,109 @@ public AnotherFakeApi(ApiClient apiClient) { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } + /** + * Helper method to set access token for Bearer authentication. + * @param bearerToken Bearer token + * @return AnotherFakeApi + */ + public AnotherFakeApi setBearerToken(String bearerToken) { + this.bearerToken = bearerToken; + return this; + } + + /** + * Helper method to set username for HTTP basic authentication. + * @param username Username + * @return AnotherFakeApi + */ + public AnotherFakeApi setUsername(String username) { + this.username = username; + return this; + } + + /** + * Helper method to set password for HTTP basic authentication. + * @param password Password + * @return AnotherFakeApi + */ + public AnotherFakeApi setPassword(String password) { + this.password = password; + return this; + } + + /** + * Helper method to set API key value for API key authentication. + * @param apiKey API key + * @return AnotherFakeApi + */ + public AnotherFakeApi setApiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * Helper method to set API key prefix for API key authentication. + * @param apiKeyPrefix API key prefix + * @return AnotherFakeApi + */ + public AnotherFakeApi setApiKeyPrefix(String apiKeyPrefix) { + this.apiKeyPrefix = apiKeyPrefix; + return this; + } + + /** + * Helper method to set access token for OAuth2 authentication. + * @param accessToken Access token + * @return AnotherFakeApi + */ + public AnotherFakeApi setAccessToken(String accessToken) { + this.accessToken = accessToken; + return this; + } + + /** + * Apply authentication settings directly to request headers. + * This avoids modifying the shared ApiClient's authentication state. + */ + private void applyAuthToHeaders(HttpRequest.Builder localVarRequestBuilder) { + if (bearerToken != null) { + localVarRequestBuilder.header("Authorization", "Bearer " + bearerToken); + } + if (username != null && password != null) { + String credentials = java.util.Base64.getEncoder().encodeToString((username + ":" + password).getBytes()); + localVarRequestBuilder.header("Authorization", "Basic " + credentials); + } + if (apiKey != null) { + + String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; + localVarRequestBuilder.header("api_key", keyValue); + + } + if (accessToken != null) { + localVarRequestBuilder.header("Authorization", "Bearer " + accessToken); + } + } + + /** + * Apply authentication settings directly to query parameters. + * This avoids modifying the shared ApiClient's authentication state. + */ + private String applyAuthToQueryParams(String queryString) { + if (apiKey != null) { + + String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; + String authParam = "api_key_query=" + keyValue; + if (queryString != null && !queryString.isEmpty()) { + return queryString + "&" + authParam; + } else { + return authParam; + } + + } + return queryString; + } + + protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { String body = response.body() == null ? null : new String(response.body().readAllBytes()); String message = formatExceptionMessage(operationId, response.statusCode(), body); @@ -151,7 +268,12 @@ private HttpRequest.Builder call123testSpecialTagsRequestBuilder(@javax.annotati String localVarPath = "/another-fake/dummy"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -165,6 +287,8 @@ private HttpRequest.Builder call123testSpecialTagsRequestBuilder(@javax.annotati if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/DefaultApi.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/DefaultApi.java index 37eb48690777..d2babcdbba12 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/DefaultApi.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/DefaultApi.java @@ -55,6 +55,20 @@ public class DefaultApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; + // Per-API Bearer authentication + private String bearerToken; + + // Per-API Basic authentication + private String username; + private String password; + + // Per-API API key authentication + private String apiKey; + private String apiKeyPrefix; + + // Per-API OAuth authentication + private String accessToken; + public DefaultApi() { this(Configuration.getDefaultApiClient()); } @@ -69,6 +83,109 @@ public DefaultApi(ApiClient apiClient) { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } + /** + * Helper method to set access token for Bearer authentication. + * @param bearerToken Bearer token + * @return DefaultApi + */ + public DefaultApi setBearerToken(String bearerToken) { + this.bearerToken = bearerToken; + return this; + } + + /** + * Helper method to set username for HTTP basic authentication. + * @param username Username + * @return DefaultApi + */ + public DefaultApi setUsername(String username) { + this.username = username; + return this; + } + + /** + * Helper method to set password for HTTP basic authentication. + * @param password Password + * @return DefaultApi + */ + public DefaultApi setPassword(String password) { + this.password = password; + return this; + } + + /** + * Helper method to set API key value for API key authentication. + * @param apiKey API key + * @return DefaultApi + */ + public DefaultApi setApiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * Helper method to set API key prefix for API key authentication. + * @param apiKeyPrefix API key prefix + * @return DefaultApi + */ + public DefaultApi setApiKeyPrefix(String apiKeyPrefix) { + this.apiKeyPrefix = apiKeyPrefix; + return this; + } + + /** + * Helper method to set access token for OAuth2 authentication. + * @param accessToken Access token + * @return DefaultApi + */ + public DefaultApi setAccessToken(String accessToken) { + this.accessToken = accessToken; + return this; + } + + /** + * Apply authentication settings directly to request headers. + * This avoids modifying the shared ApiClient's authentication state. + */ + private void applyAuthToHeaders(HttpRequest.Builder localVarRequestBuilder) { + if (bearerToken != null) { + localVarRequestBuilder.header("Authorization", "Bearer " + bearerToken); + } + if (username != null && password != null) { + String credentials = java.util.Base64.getEncoder().encodeToString((username + ":" + password).getBytes()); + localVarRequestBuilder.header("Authorization", "Basic " + credentials); + } + if (apiKey != null) { + + String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; + localVarRequestBuilder.header("api_key", keyValue); + + } + if (accessToken != null) { + localVarRequestBuilder.header("Authorization", "Bearer " + accessToken); + } + } + + /** + * Apply authentication settings directly to query parameters. + * This avoids modifying the shared ApiClient's authentication state. + */ + private String applyAuthToQueryParams(String queryString) { + if (apiKey != null) { + + String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; + String authParam = "api_key_query=" + keyValue; + if (queryString != null && !queryString.isEmpty()) { + return queryString + "&" + authParam; + } else { + return authParam; + } + + } + return queryString; + } + + protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { String body = response.body() == null ? null : new String(response.body().readAllBytes()); String message = formatExceptionMessage(operationId, response.statusCode(), body); @@ -145,7 +262,12 @@ private HttpRequest.Builder fooGetRequestBuilder() throws ApiException { String localVarPath = "/foo"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "application/json"); @@ -153,6 +275,8 @@ private HttpRequest.Builder fooGetRequestBuilder() throws ApiException { if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeApi.java index b5361e2fbd2d..f1b86337b460 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeApi.java @@ -72,6 +72,20 @@ public class FakeApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; + // Per-API Bearer authentication + private String bearerToken; + + // Per-API Basic authentication + private String username; + private String password; + + // Per-API API key authentication + private String apiKey; + private String apiKeyPrefix; + + // Per-API OAuth authentication + private String accessToken; + public FakeApi() { this(Configuration.getDefaultApiClient()); } @@ -86,6 +100,109 @@ public FakeApi(ApiClient apiClient) { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } + /** + * Helper method to set access token for Bearer authentication. + * @param bearerToken Bearer token + * @return FakeApi + */ + public FakeApi setBearerToken(String bearerToken) { + this.bearerToken = bearerToken; + return this; + } + + /** + * Helper method to set username for HTTP basic authentication. + * @param username Username + * @return FakeApi + */ + public FakeApi setUsername(String username) { + this.username = username; + return this; + } + + /** + * Helper method to set password for HTTP basic authentication. + * @param password Password + * @return FakeApi + */ + public FakeApi setPassword(String password) { + this.password = password; + return this; + } + + /** + * Helper method to set API key value for API key authentication. + * @param apiKey API key + * @return FakeApi + */ + public FakeApi setApiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * Helper method to set API key prefix for API key authentication. + * @param apiKeyPrefix API key prefix + * @return FakeApi + */ + public FakeApi setApiKeyPrefix(String apiKeyPrefix) { + this.apiKeyPrefix = apiKeyPrefix; + return this; + } + + /** + * Helper method to set access token for OAuth2 authentication. + * @param accessToken Access token + * @return FakeApi + */ + public FakeApi setAccessToken(String accessToken) { + this.accessToken = accessToken; + return this; + } + + /** + * Apply authentication settings directly to request headers. + * This avoids modifying the shared ApiClient's authentication state. + */ + private void applyAuthToHeaders(HttpRequest.Builder localVarRequestBuilder) { + if (bearerToken != null) { + localVarRequestBuilder.header("Authorization", "Bearer " + bearerToken); + } + if (username != null && password != null) { + String credentials = java.util.Base64.getEncoder().encodeToString((username + ":" + password).getBytes()); + localVarRequestBuilder.header("Authorization", "Basic " + credentials); + } + if (apiKey != null) { + + String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; + localVarRequestBuilder.header("api_key", keyValue); + + } + if (accessToken != null) { + localVarRequestBuilder.header("Authorization", "Bearer " + accessToken); + } + } + + /** + * Apply authentication settings directly to query parameters. + * This avoids modifying the shared ApiClient's authentication state. + */ + private String applyAuthToQueryParams(String queryString) { + if (apiKey != null) { + + String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; + String authParam = "api_key_query=" + keyValue; + if (queryString != null && !queryString.isEmpty()) { + return queryString + "&" + authParam; + } else { + return authParam; + } + + } + return queryString; + } + + protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { String body = response.body() == null ? null : new String(response.body().readAllBytes()); String message = formatExceptionMessage(operationId, response.statusCode(), body); @@ -162,7 +279,12 @@ private HttpRequest.Builder fakeBigDecimalMapRequestBuilder() throws ApiExceptio String localVarPath = "/fake/BigDecimalMap"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "*/*"); @@ -170,6 +292,8 @@ private HttpRequest.Builder fakeBigDecimalMapRequestBuilder() throws ApiExceptio if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -239,7 +363,12 @@ private HttpRequest.Builder fakeHealthGetRequestBuilder() throws ApiException { String localVarPath = "/fake/health"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "application/json"); @@ -247,6 +376,8 @@ private HttpRequest.Builder fakeHealthGetRequestBuilder() throws ApiException { if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -318,7 +449,12 @@ private HttpRequest.Builder fakeOuterBooleanSerializeRequestBuilder(@javax.annot String localVarPath = "/fake/outer/boolean"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "*/*"); @@ -332,6 +468,8 @@ private HttpRequest.Builder fakeOuterBooleanSerializeRequestBuilder(@javax.annot if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -403,7 +541,12 @@ private HttpRequest.Builder fakeOuterCompositeSerializeRequestBuilder(@javax.ann String localVarPath = "/fake/outer/composite"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "*/*"); @@ -417,6 +560,8 @@ private HttpRequest.Builder fakeOuterCompositeSerializeRequestBuilder(@javax.ann if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -488,7 +633,12 @@ private HttpRequest.Builder fakeOuterNumberSerializeRequestBuilder(@javax.annota String localVarPath = "/fake/outer/number"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "*/*"); @@ -502,6 +652,8 @@ private HttpRequest.Builder fakeOuterNumberSerializeRequestBuilder(@javax.annota if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -573,7 +725,12 @@ private HttpRequest.Builder fakeOuterStringSerializeRequestBuilder(@javax.annota String localVarPath = "/fake/outer/string"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "*/*"); @@ -582,6 +739,8 @@ private HttpRequest.Builder fakeOuterStringSerializeRequestBuilder(@javax.annota if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -651,7 +810,12 @@ private HttpRequest.Builder getApplicationJsonUtf8RequestBuilder() throws ApiExc String localVarPath = "/fake/application_json_utf8"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "application/json;charset=utf-8"); @@ -659,6 +823,8 @@ private HttpRequest.Builder getApplicationJsonUtf8RequestBuilder() throws ApiExc if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -728,7 +894,12 @@ private HttpRequest.Builder getArrayOfEnumsRequestBuilder() throws ApiException String localVarPath = "/fake/array-of-enums"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "application/json"); @@ -736,6 +907,8 @@ private HttpRequest.Builder getArrayOfEnumsRequestBuilder() throws ApiException if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -803,7 +976,12 @@ private HttpRequest.Builder testAdditionalPropertiesReferenceRequestBuilder(@jav String localVarPath = "/fake/additionalProperties-reference"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -817,6 +995,8 @@ private HttpRequest.Builder testAdditionalPropertiesReferenceRequestBuilder(@jav if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -884,7 +1064,12 @@ private HttpRequest.Builder testBodyWithFileSchemaRequestBuilder(@javax.annotati String localVarPath = "/fake/body-with-file-schema"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -898,6 +1083,8 @@ private HttpRequest.Builder testBodyWithFileSchemaRequestBuilder(@javax.annotati if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -983,9 +1170,15 @@ private HttpRequest.Builder testBodyWithQueryParamsRequestBuilder(@javax.annotat if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } } localVarRequestBuilder.header("Content-Type", "application/json"); @@ -1000,6 +1193,8 @@ private HttpRequest.Builder testBodyWithQueryParamsRequestBuilder(@javax.annotat if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1075,7 +1270,12 @@ private HttpRequest.Builder testClientModelRequestBuilder(@javax.annotation.Nonn String localVarPath = "/fake"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -1089,6 +1289,8 @@ private HttpRequest.Builder testClientModelRequestBuilder(@javax.annotation.Nonn if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1194,7 +1396,12 @@ private HttpRequest.Builder testEndpointParametersRequestBuilder(@javax.annotati String localVarPath = "/fake"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "application/json"); @@ -1255,6 +1462,8 @@ private HttpRequest.Builder testEndpointParametersRequestBuilder(@javax.annotati if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1350,9 +1559,15 @@ private HttpRequest.Builder testEnumParametersRequestBuilder(@javax.annotation.N if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } } if (enumHeaderStringArray != null) { @@ -1386,6 +1601,8 @@ private HttpRequest.Builder testEnumParametersRequestBuilder(@javax.annotation.N if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1528,9 +1745,15 @@ private HttpRequest.Builder testGroupParametersRequestBuilder(@javax.annotation. if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } } if (requiredBooleanGroup != null) { @@ -1545,6 +1768,8 @@ private HttpRequest.Builder testGroupParametersRequestBuilder(@javax.annotation. if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1701,7 +1926,12 @@ private HttpRequest.Builder testInlineAdditionalPropertiesRequestBuilder(@javax. String localVarPath = "/fake/inline-additionalProperties"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -1715,6 +1945,8 @@ private HttpRequest.Builder testInlineAdditionalPropertiesRequestBuilder(@javax. if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1782,7 +2014,12 @@ private HttpRequest.Builder testInlineFreeformAdditionalPropertiesRequestBuilder String localVarPath = "/fake/inline-freeform-additionalProperties"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -1796,6 +2033,8 @@ private HttpRequest.Builder testInlineFreeformAdditionalPropertiesRequestBuilder if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1869,7 +2108,12 @@ private HttpRequest.Builder testJsonFormDataRequestBuilder(@javax.annotation.Non String localVarPath = "/fake/jsonFormData"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "application/json"); @@ -1894,6 +2138,8 @@ private HttpRequest.Builder testJsonFormDataRequestBuilder(@javax.annotation.Non if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -2005,9 +2251,15 @@ private HttpRequest.Builder testQueryParameterCollectionFormatRequestBuilder(@ja if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } } localVarRequestBuilder.header("Accept", "application/json"); @@ -2016,6 +2268,8 @@ private HttpRequest.Builder testQueryParameterCollectionFormatRequestBuilder(@ja if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -2083,7 +2337,12 @@ private HttpRequest.Builder testStringMapReferenceRequestBuilder(@javax.annotati String localVarPath = "/fake/stringMap-reference"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -2097,6 +2356,8 @@ private HttpRequest.Builder testStringMapReferenceRequestBuilder(@javax.annotati if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java index 4f1e2d966f2f..7cfe721c7913 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -61,6 +61,20 @@ public class FakeClassnameTags123Api { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; + // Per-API Bearer authentication + private String bearerToken; + + // Per-API Basic authentication + private String username; + private String password; + + // Per-API API key authentication + private String apiKey; + private String apiKeyPrefix; + + // Per-API OAuth authentication + private String accessToken; + public FakeClassnameTags123Api() { this(Configuration.getDefaultApiClient()); } @@ -75,6 +89,109 @@ public FakeClassnameTags123Api(ApiClient apiClient) { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } + /** + * Helper method to set access token for Bearer authentication. + * @param bearerToken Bearer token + * @return FakeClassnameTags123Api + */ + public FakeClassnameTags123Api setBearerToken(String bearerToken) { + this.bearerToken = bearerToken; + return this; + } + + /** + * Helper method to set username for HTTP basic authentication. + * @param username Username + * @return FakeClassnameTags123Api + */ + public FakeClassnameTags123Api setUsername(String username) { + this.username = username; + return this; + } + + /** + * Helper method to set password for HTTP basic authentication. + * @param password Password + * @return FakeClassnameTags123Api + */ + public FakeClassnameTags123Api setPassword(String password) { + this.password = password; + return this; + } + + /** + * Helper method to set API key value for API key authentication. + * @param apiKey API key + * @return FakeClassnameTags123Api + */ + public FakeClassnameTags123Api setApiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * Helper method to set API key prefix for API key authentication. + * @param apiKeyPrefix API key prefix + * @return FakeClassnameTags123Api + */ + public FakeClassnameTags123Api setApiKeyPrefix(String apiKeyPrefix) { + this.apiKeyPrefix = apiKeyPrefix; + return this; + } + + /** + * Helper method to set access token for OAuth2 authentication. + * @param accessToken Access token + * @return FakeClassnameTags123Api + */ + public FakeClassnameTags123Api setAccessToken(String accessToken) { + this.accessToken = accessToken; + return this; + } + + /** + * Apply authentication settings directly to request headers. + * This avoids modifying the shared ApiClient's authentication state. + */ + private void applyAuthToHeaders(HttpRequest.Builder localVarRequestBuilder) { + if (bearerToken != null) { + localVarRequestBuilder.header("Authorization", "Bearer " + bearerToken); + } + if (username != null && password != null) { + String credentials = java.util.Base64.getEncoder().encodeToString((username + ":" + password).getBytes()); + localVarRequestBuilder.header("Authorization", "Basic " + credentials); + } + if (apiKey != null) { + + String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; + localVarRequestBuilder.header("api_key", keyValue); + + } + if (accessToken != null) { + localVarRequestBuilder.header("Authorization", "Bearer " + accessToken); + } + } + + /** + * Apply authentication settings directly to query parameters. + * This avoids modifying the shared ApiClient's authentication state. + */ + private String applyAuthToQueryParams(String queryString) { + if (apiKey != null) { + + String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; + String authParam = "api_key_query=" + keyValue; + if (queryString != null && !queryString.isEmpty()) { + return queryString + "&" + authParam; + } else { + return authParam; + } + + } + return queryString; + } + + protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { String body = response.body() == null ? null : new String(response.body().readAllBytes()); String message = formatExceptionMessage(operationId, response.statusCode(), body); @@ -157,7 +274,12 @@ private HttpRequest.Builder testClassnameRequestBuilder(@javax.annotation.Nonnul String localVarPath = "/fake_classname_test"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -171,6 +293,8 @@ private HttpRequest.Builder testClassnameRequestBuilder(@javax.annotation.Nonnul if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/PetApi.java index e621ee755339..ebe228b6255a 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/PetApi.java @@ -63,6 +63,20 @@ public class PetApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; + // Per-API Bearer authentication + private String bearerToken; + + // Per-API Basic authentication + private String username; + private String password; + + // Per-API API key authentication + private String apiKey; + private String apiKeyPrefix; + + // Per-API OAuth authentication + private String accessToken; + public PetApi() { this(Configuration.getDefaultApiClient()); } @@ -77,6 +91,109 @@ public PetApi(ApiClient apiClient) { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } + /** + * Helper method to set access token for Bearer authentication. + * @param bearerToken Bearer token + * @return PetApi + */ + public PetApi setBearerToken(String bearerToken) { + this.bearerToken = bearerToken; + return this; + } + + /** + * Helper method to set username for HTTP basic authentication. + * @param username Username + * @return PetApi + */ + public PetApi setUsername(String username) { + this.username = username; + return this; + } + + /** + * Helper method to set password for HTTP basic authentication. + * @param password Password + * @return PetApi + */ + public PetApi setPassword(String password) { + this.password = password; + return this; + } + + /** + * Helper method to set API key value for API key authentication. + * @param apiKey API key + * @return PetApi + */ + public PetApi setApiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * Helper method to set API key prefix for API key authentication. + * @param apiKeyPrefix API key prefix + * @return PetApi + */ + public PetApi setApiKeyPrefix(String apiKeyPrefix) { + this.apiKeyPrefix = apiKeyPrefix; + return this; + } + + /** + * Helper method to set access token for OAuth2 authentication. + * @param accessToken Access token + * @return PetApi + */ + public PetApi setAccessToken(String accessToken) { + this.accessToken = accessToken; + return this; + } + + /** + * Apply authentication settings directly to request headers. + * This avoids modifying the shared ApiClient's authentication state. + */ + private void applyAuthToHeaders(HttpRequest.Builder localVarRequestBuilder) { + if (bearerToken != null) { + localVarRequestBuilder.header("Authorization", "Bearer " + bearerToken); + } + if (username != null && password != null) { + String credentials = java.util.Base64.getEncoder().encodeToString((username + ":" + password).getBytes()); + localVarRequestBuilder.header("Authorization", "Basic " + credentials); + } + if (apiKey != null) { + + String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; + localVarRequestBuilder.header("api_key", keyValue); + + } + if (accessToken != null) { + localVarRequestBuilder.header("Authorization", "Bearer " + accessToken); + } + } + + /** + * Apply authentication settings directly to query parameters. + * This avoids modifying the shared ApiClient's authentication state. + */ + private String applyAuthToQueryParams(String queryString) { + if (apiKey != null) { + + String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; + String authParam = "api_key_query=" + keyValue; + if (queryString != null && !queryString.isEmpty()) { + return queryString + "&" + authParam; + } else { + return authParam; + } + + } + return queryString; + } + + protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { String body = response.body() == null ? null : new String(response.body().readAllBytes()); String message = formatExceptionMessage(operationId, response.statusCode(), body); @@ -151,7 +268,12 @@ private HttpRequest.Builder addPetRequestBuilder(@javax.annotation.Nonnull Pet p String localVarPath = "/pet"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -165,6 +287,8 @@ private HttpRequest.Builder addPetRequestBuilder(@javax.annotation.Nonnull Pet p if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -235,7 +359,12 @@ private HttpRequest.Builder deletePetRequestBuilder(@javax.annotation.Nonnull Lo String localVarPath = "/pet/{petId}" .replace("{petId}", ApiClient.urlEncode(petId.toString())); - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } if (apiKey != null) { localVarRequestBuilder.header("api_key", apiKey.toString()); @@ -246,6 +375,8 @@ private HttpRequest.Builder deletePetRequestBuilder(@javax.annotation.Nonnull Lo if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -333,9 +464,15 @@ private HttpRequest.Builder findPetsByStatusRequestBuilder(@javax.annotation.Non if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } } localVarRequestBuilder.header("Accept", "application/xml, application/json"); @@ -344,6 +481,8 @@ private HttpRequest.Builder findPetsByStatusRequestBuilder(@javax.annotation.Non if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -435,9 +574,15 @@ private HttpRequest.Builder findPetsByTagsRequestBuilder(@javax.annotation.Nonnu if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } } localVarRequestBuilder.header("Accept", "application/xml, application/json"); @@ -446,6 +591,8 @@ private HttpRequest.Builder findPetsByTagsRequestBuilder(@javax.annotation.Nonnu if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -522,7 +669,12 @@ private HttpRequest.Builder getPetByIdRequestBuilder(@javax.annotation.Nonnull L String localVarPath = "/pet/{petId}" .replace("{petId}", ApiClient.urlEncode(petId.toString())); - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "application/xml, application/json"); @@ -530,6 +682,8 @@ private HttpRequest.Builder getPetByIdRequestBuilder(@javax.annotation.Nonnull L if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -597,7 +751,12 @@ private HttpRequest.Builder updatePetRequestBuilder(@javax.annotation.Nonnull Pe String localVarPath = "/pet"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -611,6 +770,8 @@ private HttpRequest.Builder updatePetRequestBuilder(@javax.annotation.Nonnull Pe if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -683,7 +844,12 @@ private HttpRequest.Builder updatePetWithFormRequestBuilder(@javax.annotation.No String localVarPath = "/pet/{petId}" .replace("{petId}", ApiClient.urlEncode(petId.toString())); - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "application/json"); @@ -708,6 +874,8 @@ private HttpRequest.Builder updatePetWithFormRequestBuilder(@javax.annotation.No if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -788,7 +956,12 @@ private HttpRequest.Builder uploadFileRequestBuilder(@javax.annotation.Nonnull L String localVarPath = "/pet/{petId}/uploadImage" .replace("{petId}", ApiClient.urlEncode(petId.toString())); - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "application/json"); @@ -832,6 +1005,8 @@ private HttpRequest.Builder uploadFileRequestBuilder(@javax.annotation.Nonnull L if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -916,7 +1091,12 @@ private HttpRequest.Builder uploadFileWithRequiredFileRequestBuilder(@javax.anno String localVarPath = "/fake/{petId}/uploadImageWithRequiredFile" .replace("{petId}", ApiClient.urlEncode(petId.toString())); - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "application/json"); @@ -960,6 +1140,8 @@ private HttpRequest.Builder uploadFileWithRequiredFileRequestBuilder(@javax.anno if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/StoreApi.java index 278213ecb8ed..1045c2c26c54 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/StoreApi.java @@ -61,6 +61,20 @@ public class StoreApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; + // Per-API Bearer authentication + private String bearerToken; + + // Per-API Basic authentication + private String username; + private String password; + + // Per-API API key authentication + private String apiKey; + private String apiKeyPrefix; + + // Per-API OAuth authentication + private String accessToken; + public StoreApi() { this(Configuration.getDefaultApiClient()); } @@ -75,6 +89,109 @@ public StoreApi(ApiClient apiClient) { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } + /** + * Helper method to set access token for Bearer authentication. + * @param bearerToken Bearer token + * @return StoreApi + */ + public StoreApi setBearerToken(String bearerToken) { + this.bearerToken = bearerToken; + return this; + } + + /** + * Helper method to set username for HTTP basic authentication. + * @param username Username + * @return StoreApi + */ + public StoreApi setUsername(String username) { + this.username = username; + return this; + } + + /** + * Helper method to set password for HTTP basic authentication. + * @param password Password + * @return StoreApi + */ + public StoreApi setPassword(String password) { + this.password = password; + return this; + } + + /** + * Helper method to set API key value for API key authentication. + * @param apiKey API key + * @return StoreApi + */ + public StoreApi setApiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * Helper method to set API key prefix for API key authentication. + * @param apiKeyPrefix API key prefix + * @return StoreApi + */ + public StoreApi setApiKeyPrefix(String apiKeyPrefix) { + this.apiKeyPrefix = apiKeyPrefix; + return this; + } + + /** + * Helper method to set access token for OAuth2 authentication. + * @param accessToken Access token + * @return StoreApi + */ + public StoreApi setAccessToken(String accessToken) { + this.accessToken = accessToken; + return this; + } + + /** + * Apply authentication settings directly to request headers. + * This avoids modifying the shared ApiClient's authentication state. + */ + private void applyAuthToHeaders(HttpRequest.Builder localVarRequestBuilder) { + if (bearerToken != null) { + localVarRequestBuilder.header("Authorization", "Bearer " + bearerToken); + } + if (username != null && password != null) { + String credentials = java.util.Base64.getEncoder().encodeToString((username + ":" + password).getBytes()); + localVarRequestBuilder.header("Authorization", "Basic " + credentials); + } + if (apiKey != null) { + + String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; + localVarRequestBuilder.header("api_key", keyValue); + + } + if (accessToken != null) { + localVarRequestBuilder.header("Authorization", "Bearer " + accessToken); + } + } + + /** + * Apply authentication settings directly to query parameters. + * This avoids modifying the shared ApiClient's authentication state. + */ + private String applyAuthToQueryParams(String queryString) { + if (apiKey != null) { + + String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; + String authParam = "api_key_query=" + keyValue; + if (queryString != null && !queryString.isEmpty()) { + return queryString + "&" + authParam; + } else { + return authParam; + } + + } + return queryString; + } + + protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { String body = response.body() == null ? null : new String(response.body().readAllBytes()); String message = formatExceptionMessage(operationId, response.statusCode(), body); @@ -150,7 +267,12 @@ private HttpRequest.Builder deleteOrderRequestBuilder(@javax.annotation.Nonnull String localVarPath = "/store/order/{order_id}" .replace("{order_id}", ApiClient.urlEncode(orderId.toString())); - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "application/json"); @@ -158,6 +280,8 @@ private HttpRequest.Builder deleteOrderRequestBuilder(@javax.annotation.Nonnull if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -227,7 +351,12 @@ private HttpRequest.Builder getInventoryRequestBuilder() throws ApiException { String localVarPath = "/store/inventory"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "application/json"); @@ -235,6 +364,8 @@ private HttpRequest.Builder getInventoryRequestBuilder() throws ApiException { if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -311,7 +442,12 @@ private HttpRequest.Builder getOrderByIdRequestBuilder(@javax.annotation.Nonnull String localVarPath = "/store/order/{order_id}" .replace("{order_id}", ApiClient.urlEncode(orderId.toString())); - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "application/xml, application/json"); @@ -319,6 +455,8 @@ private HttpRequest.Builder getOrderByIdRequestBuilder(@javax.annotation.Nonnull if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -394,7 +532,12 @@ private HttpRequest.Builder placeOrderRequestBuilder(@javax.annotation.Nonnull O String localVarPath = "/store/order"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/xml, application/json"); @@ -408,6 +551,8 @@ private HttpRequest.Builder placeOrderRequestBuilder(@javax.annotation.Nonnull O if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/UserApi.java index 589405a76a62..93dc69f27b73 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/UserApi.java @@ -62,6 +62,20 @@ public class UserApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; + // Per-API Bearer authentication + private String bearerToken; + + // Per-API Basic authentication + private String username; + private String password; + + // Per-API API key authentication + private String apiKey; + private String apiKeyPrefix; + + // Per-API OAuth authentication + private String accessToken; + public UserApi() { this(Configuration.getDefaultApiClient()); } @@ -76,6 +90,109 @@ public UserApi(ApiClient apiClient) { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } + /** + * Helper method to set access token for Bearer authentication. + * @param bearerToken Bearer token + * @return UserApi + */ + public UserApi setBearerToken(String bearerToken) { + this.bearerToken = bearerToken; + return this; + } + + /** + * Helper method to set username for HTTP basic authentication. + * @param username Username + * @return UserApi + */ + public UserApi setUsername(String username) { + this.username = username; + return this; + } + + /** + * Helper method to set password for HTTP basic authentication. + * @param password Password + * @return UserApi + */ + public UserApi setPassword(String password) { + this.password = password; + return this; + } + + /** + * Helper method to set API key value for API key authentication. + * @param apiKey API key + * @return UserApi + */ + public UserApi setApiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * Helper method to set API key prefix for API key authentication. + * @param apiKeyPrefix API key prefix + * @return UserApi + */ + public UserApi setApiKeyPrefix(String apiKeyPrefix) { + this.apiKeyPrefix = apiKeyPrefix; + return this; + } + + /** + * Helper method to set access token for OAuth2 authentication. + * @param accessToken Access token + * @return UserApi + */ + public UserApi setAccessToken(String accessToken) { + this.accessToken = accessToken; + return this; + } + + /** + * Apply authentication settings directly to request headers. + * This avoids modifying the shared ApiClient's authentication state. + */ + private void applyAuthToHeaders(HttpRequest.Builder localVarRequestBuilder) { + if (bearerToken != null) { + localVarRequestBuilder.header("Authorization", "Bearer " + bearerToken); + } + if (username != null && password != null) { + String credentials = java.util.Base64.getEncoder().encodeToString((username + ":" + password).getBytes()); + localVarRequestBuilder.header("Authorization", "Basic " + credentials); + } + if (apiKey != null) { + + String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; + localVarRequestBuilder.header("api_key", keyValue); + + } + if (accessToken != null) { + localVarRequestBuilder.header("Authorization", "Bearer " + accessToken); + } + } + + /** + * Apply authentication settings directly to query parameters. + * This avoids modifying the shared ApiClient's authentication state. + */ + private String applyAuthToQueryParams(String queryString) { + if (apiKey != null) { + + String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; + String authParam = "api_key_query=" + keyValue; + if (queryString != null && !queryString.isEmpty()) { + return queryString + "&" + authParam; + } else { + return authParam; + } + + } + return queryString; + } + + protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { String body = response.body() == null ? null : new String(response.body().readAllBytes()); String message = formatExceptionMessage(operationId, response.statusCode(), body); @@ -150,7 +267,12 @@ private HttpRequest.Builder createUserRequestBuilder(@javax.annotation.Nonnull U String localVarPath = "/user"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -164,6 +286,8 @@ private HttpRequest.Builder createUserRequestBuilder(@javax.annotation.Nonnull U if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -231,7 +355,12 @@ private HttpRequest.Builder createUsersWithArrayInputRequestBuilder(@javax.annot String localVarPath = "/user/createWithArray"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -245,6 +374,8 @@ private HttpRequest.Builder createUsersWithArrayInputRequestBuilder(@javax.annot if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -312,7 +443,12 @@ private HttpRequest.Builder createUsersWithListInputRequestBuilder(@javax.annota String localVarPath = "/user/createWithList"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -326,6 +462,8 @@ private HttpRequest.Builder createUsersWithListInputRequestBuilder(@javax.annota if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -394,7 +532,12 @@ private HttpRequest.Builder deleteUserRequestBuilder(@javax.annotation.Nonnull S String localVarPath = "/user/{username}" .replace("{username}", ApiClient.urlEncode(username.toString())); - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "application/json"); @@ -402,6 +545,8 @@ private HttpRequest.Builder deleteUserRequestBuilder(@javax.annotation.Nonnull S if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -478,7 +623,12 @@ private HttpRequest.Builder getUserByNameRequestBuilder(@javax.annotation.Nonnul String localVarPath = "/user/{username}" .replace("{username}", ApiClient.urlEncode(username.toString())); - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "application/xml, application/json"); @@ -486,6 +636,8 @@ private HttpRequest.Builder getUserByNameRequestBuilder(@javax.annotation.Nonnul if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -581,9 +733,15 @@ private HttpRequest.Builder loginUserRequestBuilder(@javax.annotation.Nonnull St if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } } localVarRequestBuilder.header("Accept", "application/xml, application/json"); @@ -592,6 +750,8 @@ private HttpRequest.Builder loginUserRequestBuilder(@javax.annotation.Nonnull St if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -653,7 +813,12 @@ private HttpRequest.Builder logoutUserRequestBuilder() throws ApiException { String localVarPath = "/user/logout"; - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "application/json"); @@ -661,6 +826,8 @@ private HttpRequest.Builder logoutUserRequestBuilder() throws ApiException { if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -735,7 +902,12 @@ private HttpRequest.Builder updateUserRequestBuilder(@javax.annotation.Nonnull S String localVarPath = "/user/{username}" .replace("{username}", ApiClient.urlEncode(username.toString())); - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + String authQuery = applyAuthToQueryParams(null); + if (authQuery != null && !authQuery.isEmpty()) { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -749,6 +921,8 @@ private HttpRequest.Builder updateUserRequestBuilder(@javax.annotation.Nonnull S if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } + // Apply per-API authentication directly to the request + applyAuthToHeaders(localVarRequestBuilder); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } From 27925d4ba8a57d6bb5368c1af91eec364a0191f8 Mon Sep 17 00:00:00 2001 From: Ilya Nemtsev Date: Mon, 7 Jul 2025 16:38:07 +0700 Subject: [PATCH 07/17] made security method more generic for flexibility --- .../Java/libraries/native/api.mustache | 159 +++--------------- 1 file changed, 22 insertions(+), 137 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/native/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/native/api.mustache index 8f389bc115b6..db9c5ab7b520 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/native/api.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/native/api.mustache @@ -64,27 +64,8 @@ public class {{classname}} { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; - {{#hasHttpBearerMethods}} - // Per-API Bearer authentication - private String bearerToken; - {{/hasHttpBearerMethods}} - - {{#hasHttpBasicMethods}} - // Per-API Basic authentication - private String username; - private String password; - {{/hasHttpBasicMethods}} - - {{#hasApiKeyMethods}} - // Per-API API key authentication - private String apiKey; - private String apiKeyPrefix; - {{/hasApiKeyMethods}} - - {{#hasOAuthMethods}} - // Per-API OAuth authentication - private String accessToken; - {{/hasOAuthMethods}} + // Custom headers to be sent with every request from this API client + private final Map extraHeaders = new java.util.HashMap<>(); public {{classname}}() { this(Configuration.getDefaultApiClient()); @@ -100,126 +81,27 @@ public class {{classname}} { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } - {{#hasHttpBearerMethods}} /** - * Helper method to set access token for Bearer authentication. - * @param bearerToken Bearer token - * @return {{classname}} + * Add a custom header to be sent with every request from this API client. + * @param name Header name + * @param value Header value + * @return this */ - public {{classname}} setBearerToken(String bearerToken) { - this.bearerToken = bearerToken; + public {{classname}} addHeader(String name, String value) { + this.extraHeaders.put(name, value); return this; } - {{/hasHttpBearerMethods}} - {{#hasHttpBasicMethods}} /** - * Helper method to set username for HTTP basic authentication. - * @param username Username - * @return {{classname}} + * Remove a custom header. + * @param name Header name + * @return this */ - public {{classname}} setUsername(String username) { - this.username = username; + public {{classname}} removeHeader(String name) { + this.extraHeaders.remove(name); return this; } - /** - * Helper method to set password for HTTP basic authentication. - * @param password Password - * @return {{classname}} - */ - public {{classname}} setPassword(String password) { - this.password = password; - return this; - } - {{/hasHttpBasicMethods}} - - {{#hasApiKeyMethods}} - /** - * Helper method to set API key value for API key authentication. - * @param apiKey API key - * @return {{classname}} - */ - public {{classname}} setApiKey(String apiKey) { - this.apiKey = apiKey; - return this; - } - - /** - * Helper method to set API key prefix for API key authentication. - * @param apiKeyPrefix API key prefix - * @return {{classname}} - */ - public {{classname}} setApiKeyPrefix(String apiKeyPrefix) { - this.apiKeyPrefix = apiKeyPrefix; - return this; - } - {{/hasApiKeyMethods}} - - {{#hasOAuthMethods}} - /** - * Helper method to set access token for OAuth2 authentication. - * @param accessToken Access token - * @return {{classname}} - */ - public {{classname}} setAccessToken(String accessToken) { - this.accessToken = accessToken; - return this; - } - {{/hasOAuthMethods}} - - /** - * Apply authentication settings directly to request headers. - * This avoids modifying the shared ApiClient's authentication state. - */ - private void applyAuthToHeaders(HttpRequest.Builder localVarRequestBuilder) { - {{#hasHttpBearerMethods}} - if (bearerToken != null) { - localVarRequestBuilder.header("Authorization", "Bearer " + bearerToken); - } - {{/hasHttpBearerMethods}} - {{#hasHttpBasicMethods}} - if (username != null && password != null) { - String credentials = java.util.Base64.getEncoder().encodeToString((username + ":" + password).getBytes()); - localVarRequestBuilder.header("Authorization", "Basic " + credentials); - } - {{/hasHttpBasicMethods}} - {{#hasApiKeyMethods}} - if (apiKey != null) { - {{#authMethods}}{{#isApiKey}}{{#isKeyInHeader}} - String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; - localVarRequestBuilder.header("{{keyParamName}}", keyValue); - {{/isKeyInHeader}}{{/isApiKey}}{{/authMethods}} - } - {{/hasApiKeyMethods}} - {{#hasOAuthMethods}} - if (accessToken != null) { - localVarRequestBuilder.header("Authorization", "Bearer " + accessToken); - } - {{/hasOAuthMethods}} - } - - /** - * Apply authentication settings directly to query parameters. - * This avoids modifying the shared ApiClient's authentication state. - */ - private String applyAuthToQueryParams(String queryString) { - {{#hasApiKeyMethods}} - if (apiKey != null) { - {{#authMethods}}{{#isApiKey}}{{#isKeyInQuery}} - String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; - String authParam = "{{keyParamName}}=" + keyValue; - if (queryString != null && !queryString.isEmpty()) { - return queryString + "&" + authParam; - } else { - return authParam; - } - {{/isKeyInQuery}}{{/isApiKey}}{{/authMethods}} - } - {{/hasApiKeyMethods}} - return queryString; - } - {{#asyncNative}} private ApiException getApiException(String operationId, HttpResponse response) { @@ -512,7 +394,8 @@ public class {{classname}} { {{#required}} // verify the required parameter '{{paramName}}' is set if ({{paramName}} == null) { - throw new ApiException(400, "Missing the required parameter '{{paramName}}' when calling {{operationId}}"); + throw new ApiException(400, "Missing the required parameter '{{paramName}}' when calling {{operationId}}" + ); } {{/required}} {{/allParams}} @@ -582,10 +465,10 @@ public class {{classname}} { if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + String finalQuery = null; // No longer need to apply auth to query params localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -594,7 +477,7 @@ public class {{classname}} { } {{/hasQueryParams}} {{^hasQueryParams}} - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -723,8 +606,10 @@ public class {{classname}} { if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } From 4332345b799a20ef015b7d5bf309024d1f45fa50 Mon Sep 17 00:00:00 2001 From: Ilya Nemtsev Date: Mon, 7 Jul 2025 16:46:15 +0700 Subject: [PATCH 08/17] regenerated samples --- .../org/openapitools/client/api/AuthApi.java | 81 ++-- .../org/openapitools/client/api/BodyApi.java | 148 ++++---- .../org/openapitools/client/api/FormApi.java | 92 ++--- .../openapitools/client/api/HeaderApi.java | 73 +--- .../org/openapitools/client/api/PathApi.java | 85 ++--- .../org/openapitools/client/api/QueryApi.java | 165 ++++---- .../client/api/AnotherFakeApi.java | 129 +------ .../openapitools/client/api/DefaultApi.java | 126 +------ .../org/openapitools/client/api/FakeApi.java | 352 ++++++++---------- .../client/api/FakeClassnameTags123Api.java | 129 +------ .../org/openapitools/client/api/PetApi.java | 224 ++++------- .../org/openapitools/client/api/StoreApi.java | 159 ++------ .../org/openapitools/client/api/UserApi.java | 211 ++++------- .../org/openapitools/client/api/PetApi.java | 162 ++++---- .../org/openapitools/client/api/StoreApi.java | 111 ++---- .../org/openapitools/client/api/UserApi.java | 163 ++++---- .../client/api/AnotherFakeApi.java | 129 +------ .../openapitools/client/api/DefaultApi.java | 126 +------ .../org/openapitools/client/api/FakeApi.java | 352 ++++++++---------- .../client/api/FakeClassnameTags123Api.java | 129 +------ .../org/openapitools/client/api/PetApi.java | 224 ++++------- .../org/openapitools/client/api/StoreApi.java | 159 ++------ .../org/openapitools/client/api/UserApi.java | 211 ++++------- 23 files changed, 1237 insertions(+), 2503 deletions(-) diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/AuthApi.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/AuthApi.java index 19222da13a67..985bb1de0c35 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/AuthApi.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/AuthApi.java @@ -54,14 +54,8 @@ public class AuthApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; - // Per-API Bearer authentication - private String bearerToken; - - // Per-API Basic authentication - private String username; - private String password; - - + // Custom headers to be sent with every request from this API client + private final Map extraHeaders = new java.util.HashMap<>(); public AuthApi() { this(Configuration.getDefaultApiClient()); @@ -78,59 +72,26 @@ public AuthApi(ApiClient apiClient) { } /** - * Helper method to set access token for Bearer authentication. - * @param bearerToken Bearer token - * @return AuthApi + * Add a custom header to be sent with every request from this API client. + * @param name Header name + * @param value Header value + * @return this */ - public AuthApi setBearerToken(String bearerToken) { - this.bearerToken = bearerToken; + public AuthApi addHeader(String name, String value) { + this.extraHeaders.put(name, value); return this; } /** - * Helper method to set username for HTTP basic authentication. - * @param username Username - * @return AuthApi + * Remove a custom header. + * @param name Header name + * @return this */ - public AuthApi setUsername(String username) { - this.username = username; + public AuthApi removeHeader(String name) { + this.extraHeaders.remove(name); return this; } - /** - * Helper method to set password for HTTP basic authentication. - * @param password Password - * @return AuthApi - */ - public AuthApi setPassword(String password) { - this.password = password; - return this; - } - - - - /** - * Apply authentication settings directly to request headers. - * This avoids modifying the shared ApiClient's authentication state. - */ - private void applyAuthToHeaders(HttpRequest.Builder localVarRequestBuilder) { - if (bearerToken != null) { - localVarRequestBuilder.header("Authorization", "Bearer " + bearerToken); - } - if (username != null && password != null) { - String credentials = java.util.Base64.getEncoder().encodeToString((username + ":" + password).getBytes()); - localVarRequestBuilder.header("Authorization", "Basic " + credentials); - } - } - - /** - * Apply authentication settings directly to query parameters. - * This avoids modifying the shared ApiClient's authentication state. - */ - private String applyAuthToQueryParams(String queryString) { - return queryString; - } - protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { String body = response.body() == null ? null : new String(response.body().readAllBytes()); @@ -205,7 +166,7 @@ private HttpRequest.Builder testAuthHttpBasicRequestBuilder() throws ApiExceptio String localVarPath = "/auth/http/basic"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -218,8 +179,10 @@ private HttpRequest.Builder testAuthHttpBasicRequestBuilder() throws ApiExceptio if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -286,7 +249,7 @@ private HttpRequest.Builder testAuthHttpBearerRequestBuilder() throws ApiExcepti String localVarPath = "/auth/http/bearer"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -299,8 +262,10 @@ private HttpRequest.Builder testAuthHttpBearerRequestBuilder() throws ApiExcepti if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/BodyApi.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/BodyApi.java index 79e724a205b7..6ff0fd5ebf48 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/BodyApi.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/BodyApi.java @@ -64,14 +64,8 @@ public class BodyApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; - // Per-API Bearer authentication - private String bearerToken; - - // Per-API Basic authentication - private String username; - private String password; - - + // Custom headers to be sent with every request from this API client + private final Map extraHeaders = new java.util.HashMap<>(); public BodyApi() { this(Configuration.getDefaultApiClient()); @@ -88,60 +82,27 @@ public BodyApi(ApiClient apiClient) { } /** - * Helper method to set access token for Bearer authentication. - * @param bearerToken Bearer token - * @return BodyApi - */ - public BodyApi setBearerToken(String bearerToken) { - this.bearerToken = bearerToken; - return this; - } - - /** - * Helper method to set username for HTTP basic authentication. - * @param username Username - * @return BodyApi + * Add a custom header to be sent with every request from this API client. + * @param name Header name + * @param value Header value + * @return this */ - public BodyApi setUsername(String username) { - this.username = username; + public BodyApi addHeader(String name, String value) { + this.extraHeaders.put(name, value); return this; } /** - * Helper method to set password for HTTP basic authentication. - * @param password Password - * @return BodyApi + * Remove a custom header. + * @param name Header name + * @return this */ - public BodyApi setPassword(String password) { - this.password = password; + public BodyApi removeHeader(String name) { + this.extraHeaders.remove(name); return this; } - - /** - * Apply authentication settings directly to request headers. - * This avoids modifying the shared ApiClient's authentication state. - */ - private void applyAuthToHeaders(HttpRequest.Builder localVarRequestBuilder) { - if (bearerToken != null) { - localVarRequestBuilder.header("Authorization", "Bearer " + bearerToken); - } - if (username != null && password != null) { - String credentials = java.util.Base64.getEncoder().encodeToString((username + ":" + password).getBytes()); - localVarRequestBuilder.header("Authorization", "Basic " + credentials); - } - } - - /** - * Apply authentication settings directly to query parameters. - * This avoids modifying the shared ApiClient's authentication state. - */ - private String applyAuthToQueryParams(String queryString) { - return queryString; - } - - protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { String body = response.body() == null ? null : new String(response.body().readAllBytes()); String message = formatExceptionMessage(operationId, response.statusCode(), body); @@ -218,7 +179,7 @@ private HttpRequest.Builder testBinaryGifRequestBuilder() throws ApiException { String localVarPath = "/binary/gif"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -231,8 +192,10 @@ private HttpRequest.Builder testBinaryGifRequestBuilder() throws ApiException { if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -301,7 +264,7 @@ private HttpRequest.Builder testBodyApplicationOctetstreamBinaryRequestBuilder(@ String localVarPath = "/body/application/octetstream/binary"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -320,8 +283,10 @@ private HttpRequest.Builder testBodyApplicationOctetstreamBinaryRequestBuilder(@ if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -387,14 +352,15 @@ public ApiResponse testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(@j private HttpRequest.Builder testBodyMultipartFormdataArrayOfBinaryRequestBuilder(@javax.annotation.Nonnull List files) throws ApiException { // verify the required parameter 'files' is set if (files == null) { - throw new ApiException(400, "Missing the required parameter 'files' when calling testBodyMultipartFormdataArrayOfBinary"); + throw new ApiException(400, "Missing the required parameter 'files' when calling testBodyMultipartFormdataArrayOfBinary" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/body/application/octetstream/array_of_binary"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -442,8 +408,10 @@ private HttpRequest.Builder testBodyMultipartFormdataArrayOfBinaryRequestBuilder if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -512,7 +480,7 @@ private HttpRequest.Builder testBodyMultipartFormdataSingleBinaryRequestBuilder( String localVarPath = "/body/application/octetstream/single_binary"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -558,8 +526,10 @@ private HttpRequest.Builder testBodyMultipartFormdataSingleBinaryRequestBuilder( if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -631,7 +601,7 @@ private HttpRequest.Builder testEchoBodyAllOfPetRequestBuilder(@javax.annotation String localVarPath = "/echo/body/allOf/Pet"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -650,8 +620,10 @@ private HttpRequest.Builder testEchoBodyAllOfPetRequestBuilder(@javax.annotation if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -720,7 +692,7 @@ private HttpRequest.Builder testEchoBodyFreeFormObjectResponseStringRequestBuild String localVarPath = "/echo/body/FreeFormObject/response_string"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -739,8 +711,10 @@ private HttpRequest.Builder testEchoBodyFreeFormObjectResponseStringRequestBuild if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -812,7 +786,7 @@ private HttpRequest.Builder testEchoBodyPetRequestBuilder(@javax.annotation.Null String localVarPath = "/echo/body/Pet"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -831,8 +805,10 @@ private HttpRequest.Builder testEchoBodyPetRequestBuilder(@javax.annotation.Null if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -901,7 +877,7 @@ private HttpRequest.Builder testEchoBodyPetResponseStringRequestBuilder(@javax.a String localVarPath = "/echo/body/Pet/response_string"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -920,8 +896,10 @@ private HttpRequest.Builder testEchoBodyPetResponseStringRequestBuilder(@javax.a if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -993,7 +971,7 @@ private HttpRequest.Builder testEchoBodyStringEnumRequestBuilder(@javax.annotati String localVarPath = "/echo/body/string_enum"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -1012,8 +990,10 @@ private HttpRequest.Builder testEchoBodyStringEnumRequestBuilder(@javax.annotati if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1082,7 +1062,7 @@ private HttpRequest.Builder testEchoBodyTagResponseStringRequestBuilder(@javax.a String localVarPath = "/echo/body/Tag/response_string"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -1101,8 +1081,10 @@ private HttpRequest.Builder testEchoBodyTagResponseStringRequestBuilder(@javax.a if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/FormApi.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/FormApi.java index ed2766116cda..206d173a91be 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/FormApi.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/FormApi.java @@ -61,14 +61,8 @@ public class FormApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; - // Per-API Bearer authentication - private String bearerToken; - - // Per-API Basic authentication - private String username; - private String password; - - + // Custom headers to be sent with every request from this API client + private final Map extraHeaders = new java.util.HashMap<>(); public FormApi() { this(Configuration.getDefaultApiClient()); @@ -85,60 +79,27 @@ public FormApi(ApiClient apiClient) { } /** - * Helper method to set access token for Bearer authentication. - * @param bearerToken Bearer token - * @return FormApi - */ - public FormApi setBearerToken(String bearerToken) { - this.bearerToken = bearerToken; - return this; - } - - /** - * Helper method to set username for HTTP basic authentication. - * @param username Username - * @return FormApi + * Add a custom header to be sent with every request from this API client. + * @param name Header name + * @param value Header value + * @return this */ - public FormApi setUsername(String username) { - this.username = username; + public FormApi addHeader(String name, String value) { + this.extraHeaders.put(name, value); return this; } /** - * Helper method to set password for HTTP basic authentication. - * @param password Password - * @return FormApi + * Remove a custom header. + * @param name Header name + * @return this */ - public FormApi setPassword(String password) { - this.password = password; + public FormApi removeHeader(String name) { + this.extraHeaders.remove(name); return this; } - - /** - * Apply authentication settings directly to request headers. - * This avoids modifying the shared ApiClient's authentication state. - */ - private void applyAuthToHeaders(HttpRequest.Builder localVarRequestBuilder) { - if (bearerToken != null) { - localVarRequestBuilder.header("Authorization", "Bearer " + bearerToken); - } - if (username != null && password != null) { - String credentials = java.util.Base64.getEncoder().encodeToString((username + ":" + password).getBytes()); - localVarRequestBuilder.header("Authorization", "Basic " + credentials); - } - } - - /** - * Apply authentication settings directly to query parameters. - * This avoids modifying the shared ApiClient's authentication state. - */ - private String applyAuthToQueryParams(String queryString) { - return queryString; - } - - protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { String body = response.body() == null ? null : new String(response.body().readAllBytes()); String message = formatExceptionMessage(operationId, response.statusCode(), body); @@ -218,7 +179,7 @@ private HttpRequest.Builder testFormIntegerBooleanStringRequestBuilder(@javax.an String localVarPath = "/form/integer/boolean/string"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -251,8 +212,10 @@ private HttpRequest.Builder testFormIntegerBooleanStringRequestBuilder(@javax.an if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -318,14 +281,15 @@ public ApiResponse testFormObjectMultipartWithHttpInfo(@javax.annotation private HttpRequest.Builder testFormObjectMultipartRequestBuilder(@javax.annotation.Nonnull TestFormObjectMultipartRequestMarker marker) throws ApiException { // verify the required parameter 'marker' is set if (marker == null) { - throw new ApiException(400, "Missing the required parameter 'marker' when calling testFormObjectMultipart"); + throw new ApiException(400, "Missing the required parameter 'marker' when calling testFormObjectMultipart" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/form/object/multipart"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -372,8 +336,10 @@ private HttpRequest.Builder testFormObjectMultipartRequestBuilder(@javax.annotat if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -452,7 +418,7 @@ private HttpRequest.Builder testFormOneofRequestBuilder(@javax.annotation.Nullab String localVarPath = "/form/oneof"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -494,8 +460,10 @@ private HttpRequest.Builder testFormOneofRequestBuilder(@javax.annotation.Nullab if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/HeaderApi.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/HeaderApi.java index 3a31ca1defca..ff4132803b9c 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/HeaderApi.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/HeaderApi.java @@ -61,14 +61,8 @@ public class HeaderApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; - // Per-API Bearer authentication - private String bearerToken; - - // Per-API Basic authentication - private String username; - private String password; - - + // Custom headers to be sent with every request from this API client + private final Map extraHeaders = new java.util.HashMap<>(); public HeaderApi() { this(Configuration.getDefaultApiClient()); @@ -85,59 +79,26 @@ public HeaderApi(ApiClient apiClient) { } /** - * Helper method to set access token for Bearer authentication. - * @param bearerToken Bearer token - * @return HeaderApi + * Add a custom header to be sent with every request from this API client. + * @param name Header name + * @param value Header value + * @return this */ - public HeaderApi setBearerToken(String bearerToken) { - this.bearerToken = bearerToken; + public HeaderApi addHeader(String name, String value) { + this.extraHeaders.put(name, value); return this; } /** - * Helper method to set username for HTTP basic authentication. - * @param username Username - * @return HeaderApi + * Remove a custom header. + * @param name Header name + * @return this */ - public HeaderApi setUsername(String username) { - this.username = username; + public HeaderApi removeHeader(String name) { + this.extraHeaders.remove(name); return this; } - /** - * Helper method to set password for HTTP basic authentication. - * @param password Password - * @return HeaderApi - */ - public HeaderApi setPassword(String password) { - this.password = password; - return this; - } - - - - /** - * Apply authentication settings directly to request headers. - * This avoids modifying the shared ApiClient's authentication state. - */ - private void applyAuthToHeaders(HttpRequest.Builder localVarRequestBuilder) { - if (bearerToken != null) { - localVarRequestBuilder.header("Authorization", "Bearer " + bearerToken); - } - if (username != null && password != null) { - String credentials = java.util.Base64.getEncoder().encodeToString((username + ":" + password).getBytes()); - localVarRequestBuilder.header("Authorization", "Basic " + credentials); - } - } - - /** - * Apply authentication settings directly to query parameters. - * This avoids modifying the shared ApiClient's authentication state. - */ - private String applyAuthToQueryParams(String queryString) { - return queryString; - } - protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { String body = response.body() == null ? null : new String(response.body().readAllBytes()); @@ -222,7 +183,7 @@ private HttpRequest.Builder testHeaderIntegerBooleanStringEnumsRequestBuilder(@j String localVarPath = "/header/integer/boolean/string/enums"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -250,8 +211,10 @@ private HttpRequest.Builder testHeaderIntegerBooleanStringEnumsRequestBuilder(@j if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/PathApi.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/PathApi.java index 3e2972814d4b..d507415be641 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/PathApi.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/PathApi.java @@ -61,14 +61,8 @@ public class PathApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; - // Per-API Bearer authentication - private String bearerToken; - - // Per-API Basic authentication - private String username; - private String password; - - + // Custom headers to be sent with every request from this API client + private final Map extraHeaders = new java.util.HashMap<>(); public PathApi() { this(Configuration.getDefaultApiClient()); @@ -85,59 +79,26 @@ public PathApi(ApiClient apiClient) { } /** - * Helper method to set access token for Bearer authentication. - * @param bearerToken Bearer token - * @return PathApi + * Add a custom header to be sent with every request from this API client. + * @param name Header name + * @param value Header value + * @return this */ - public PathApi setBearerToken(String bearerToken) { - this.bearerToken = bearerToken; + public PathApi addHeader(String name, String value) { + this.extraHeaders.put(name, value); return this; } /** - * Helper method to set username for HTTP basic authentication. - * @param username Username - * @return PathApi + * Remove a custom header. + * @param name Header name + * @return this */ - public PathApi setUsername(String username) { - this.username = username; + public PathApi removeHeader(String name) { + this.extraHeaders.remove(name); return this; } - /** - * Helper method to set password for HTTP basic authentication. - * @param password Password - * @return PathApi - */ - public PathApi setPassword(String password) { - this.password = password; - return this; - } - - - - /** - * Apply authentication settings directly to request headers. - * This avoids modifying the shared ApiClient's authentication state. - */ - private void applyAuthToHeaders(HttpRequest.Builder localVarRequestBuilder) { - if (bearerToken != null) { - localVarRequestBuilder.header("Authorization", "Bearer " + bearerToken); - } - if (username != null && password != null) { - String credentials = java.util.Base64.getEncoder().encodeToString((username + ":" + password).getBytes()); - localVarRequestBuilder.header("Authorization", "Basic " + credentials); - } - } - - /** - * Apply authentication settings directly to query parameters. - * This avoids modifying the shared ApiClient's authentication state. - */ - private String applyAuthToQueryParams(String queryString) { - return queryString; - } - protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { String body = response.body() == null ? null : new String(response.body().readAllBytes()); @@ -217,19 +178,23 @@ public ApiResponse testsPathStringPathStringIntegerPathIntegerEnumNonref private HttpRequest.Builder testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathRequestBuilder(@javax.annotation.Nonnull String pathString, @javax.annotation.Nonnull Integer pathInteger, @javax.annotation.Nonnull String enumNonrefStringPath, @javax.annotation.Nonnull StringEnumRef enumRefStringPath) throws ApiException { // verify the required parameter 'pathString' is set if (pathString == null) { - throw new ApiException(400, "Missing the required parameter 'pathString' when calling testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath"); + throw new ApiException(400, "Missing the required parameter 'pathString' when calling testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath" + ); } // verify the required parameter 'pathInteger' is set if (pathInteger == null) { - throw new ApiException(400, "Missing the required parameter 'pathInteger' when calling testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath"); + throw new ApiException(400, "Missing the required parameter 'pathInteger' when calling testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath" + ); } // verify the required parameter 'enumNonrefStringPath' is set if (enumNonrefStringPath == null) { - throw new ApiException(400, "Missing the required parameter 'enumNonrefStringPath' when calling testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath"); + throw new ApiException(400, "Missing the required parameter 'enumNonrefStringPath' when calling testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath" + ); } // verify the required parameter 'enumRefStringPath' is set if (enumRefStringPath == null) { - throw new ApiException(400, "Missing the required parameter 'enumRefStringPath' when calling testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath"); + throw new ApiException(400, "Missing the required parameter 'enumRefStringPath' when calling testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -240,7 +205,7 @@ private HttpRequest.Builder testsPathStringPathStringIntegerPathIntegerEnumNonre .replace("{enum_nonref_string_path}", ApiClient.urlEncode(enumNonrefStringPath.toString())) .replace("{enum_ref_string_path}", ApiClient.urlEncode(enumRefStringPath.toString())); - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -253,8 +218,10 @@ private HttpRequest.Builder testsPathStringPathStringIntegerPathIntegerEnumNonre if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/QueryApi.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/QueryApi.java index 4ff34f58e7af..c57b73a42a9e 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/QueryApi.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/QueryApi.java @@ -67,14 +67,8 @@ public class QueryApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; - // Per-API Bearer authentication - private String bearerToken; - - // Per-API Basic authentication - private String username; - private String password; - - + // Custom headers to be sent with every request from this API client + private final Map extraHeaders = new java.util.HashMap<>(); public QueryApi() { this(Configuration.getDefaultApiClient()); @@ -91,60 +85,27 @@ public QueryApi(ApiClient apiClient) { } /** - * Helper method to set access token for Bearer authentication. - * @param bearerToken Bearer token - * @return QueryApi - */ - public QueryApi setBearerToken(String bearerToken) { - this.bearerToken = bearerToken; - return this; - } - - /** - * Helper method to set username for HTTP basic authentication. - * @param username Username - * @return QueryApi + * Add a custom header to be sent with every request from this API client. + * @param name Header name + * @param value Header value + * @return this */ - public QueryApi setUsername(String username) { - this.username = username; + public QueryApi addHeader(String name, String value) { + this.extraHeaders.put(name, value); return this; } /** - * Helper method to set password for HTTP basic authentication. - * @param password Password - * @return QueryApi + * Remove a custom header. + * @param name Header name + * @return this */ - public QueryApi setPassword(String password) { - this.password = password; + public QueryApi removeHeader(String name) { + this.extraHeaders.remove(name); return this; } - - /** - * Apply authentication settings directly to request headers. - * This avoids modifying the shared ApiClient's authentication state. - */ - private void applyAuthToHeaders(HttpRequest.Builder localVarRequestBuilder) { - if (bearerToken != null) { - localVarRequestBuilder.header("Authorization", "Bearer " + bearerToken); - } - if (username != null && password != null) { - String credentials = java.util.Base64.getEncoder().encodeToString((username + ":" + password).getBytes()); - localVarRequestBuilder.header("Authorization", "Basic " + credentials); - } - } - - /** - * Apply authentication settings directly to query parameters. - * This avoids modifying the shared ApiClient's authentication state. - */ - private String applyAuthToQueryParams(String queryString) { - return queryString; - } - - protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { String body = response.body() == null ? null : new String(response.body().readAllBytes()); String message = formatExceptionMessage(operationId, response.statusCode(), body); @@ -236,10 +197,10 @@ private HttpRequest.Builder testEnumRefStringRequestBuilder(@javax.annotation.Nu if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + String finalQuery = null; // No longer need to apply auth to query params localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -253,8 +214,10 @@ private HttpRequest.Builder testEnumRefStringRequestBuilder(@javax.annotation.Nu if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -343,10 +306,10 @@ private HttpRequest.Builder testQueryDatetimeDateStringRequestBuilder(@javax.ann if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + String finalQuery = null; // No longer need to apply auth to query params localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -360,8 +323,10 @@ private HttpRequest.Builder testQueryDatetimeDateStringRequestBuilder(@javax.ann if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -450,10 +415,10 @@ private HttpRequest.Builder testQueryIntegerBooleanStringRequestBuilder(@javax.a if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + String finalQuery = null; // No longer need to apply auth to query params localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -467,8 +432,10 @@ private HttpRequest.Builder testQueryIntegerBooleanStringRequestBuilder(@javax.a if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -554,10 +521,10 @@ private HttpRequest.Builder testQueryStyleDeepObjectExplodeTrueObjectRequestBuil if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + String finalQuery = null; // No longer need to apply auth to query params localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -571,8 +538,10 @@ private HttpRequest.Builder testQueryStyleDeepObjectExplodeTrueObjectRequestBuil if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -658,10 +627,10 @@ private HttpRequest.Builder testQueryStyleDeepObjectExplodeTrueObjectAllOfReques if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + String finalQuery = null; // No longer need to apply auth to query params localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -675,8 +644,10 @@ private HttpRequest.Builder testQueryStyleDeepObjectExplodeTrueObjectAllOfReques if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -757,10 +728,10 @@ private HttpRequest.Builder testQueryStyleFormExplodeFalseArrayIntegerRequestBui if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + String finalQuery = null; // No longer need to apply auth to query params localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -774,8 +745,10 @@ private HttpRequest.Builder testQueryStyleFormExplodeFalseArrayIntegerRequestBui if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -856,10 +829,10 @@ private HttpRequest.Builder testQueryStyleFormExplodeFalseArrayStringRequestBuil if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + String finalQuery = null; // No longer need to apply auth to query params localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -873,8 +846,10 @@ private HttpRequest.Builder testQueryStyleFormExplodeFalseArrayStringRequestBuil if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -955,10 +930,10 @@ private HttpRequest.Builder testQueryStyleFormExplodeTrueArrayStringRequestBuild if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + String finalQuery = null; // No longer need to apply auth to query params localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -972,8 +947,10 @@ private HttpRequest.Builder testQueryStyleFormExplodeTrueArrayStringRequestBuild if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1059,10 +1036,10 @@ private HttpRequest.Builder testQueryStyleFormExplodeTrueObjectRequestBuilder(@j if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + String finalQuery = null; // No longer need to apply auth to query params localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -1076,8 +1053,10 @@ private HttpRequest.Builder testQueryStyleFormExplodeTrueObjectRequestBuilder(@j if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1158,10 +1137,10 @@ private HttpRequest.Builder testQueryStyleFormExplodeTrueObjectAllOfRequestBuild if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + String finalQuery = null; // No longer need to apply auth to query params localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -1175,8 +1154,10 @@ private HttpRequest.Builder testQueryStyleFormExplodeTrueObjectAllOfRequestBuild if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/AnotherFakeApi.java index cd35e28e92c2..6d8cb399b9cc 100644 --- a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/AnotherFakeApi.java +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -57,19 +57,8 @@ public class AnotherFakeApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; - // Per-API Bearer authentication - private String bearerToken; - - // Per-API Basic authentication - private String username; - private String password; - - // Per-API API key authentication - private String apiKey; - private String apiKeyPrefix; - - // Per-API OAuth authentication - private String accessToken; + // Custom headers to be sent with every request from this API client + private final Map extraHeaders = new java.util.HashMap<>(); public AnotherFakeApi() { this(Configuration.getDefaultApiClient()); @@ -86,107 +75,26 @@ public AnotherFakeApi(ApiClient apiClient) { } /** - * Helper method to set access token for Bearer authentication. - * @param bearerToken Bearer token - * @return AnotherFakeApi - */ - public AnotherFakeApi setBearerToken(String bearerToken) { - this.bearerToken = bearerToken; - return this; - } - - /** - * Helper method to set username for HTTP basic authentication. - * @param username Username - * @return AnotherFakeApi - */ - public AnotherFakeApi setUsername(String username) { - this.username = username; - return this; - } - - /** - * Helper method to set password for HTTP basic authentication. - * @param password Password - * @return AnotherFakeApi - */ - public AnotherFakeApi setPassword(String password) { - this.password = password; - return this; - } - - /** - * Helper method to set API key value for API key authentication. - * @param apiKey API key - * @return AnotherFakeApi - */ - public AnotherFakeApi setApiKey(String apiKey) { - this.apiKey = apiKey; - return this; - } - - /** - * Helper method to set API key prefix for API key authentication. - * @param apiKeyPrefix API key prefix - * @return AnotherFakeApi + * Add a custom header to be sent with every request from this API client. + * @param name Header name + * @param value Header value + * @return this */ - public AnotherFakeApi setApiKeyPrefix(String apiKeyPrefix) { - this.apiKeyPrefix = apiKeyPrefix; + public AnotherFakeApi addHeader(String name, String value) { + this.extraHeaders.put(name, value); return this; } /** - * Helper method to set access token for OAuth2 authentication. - * @param accessToken Access token - * @return AnotherFakeApi + * Remove a custom header. + * @param name Header name + * @return this */ - public AnotherFakeApi setAccessToken(String accessToken) { - this.accessToken = accessToken; + public AnotherFakeApi removeHeader(String name) { + this.extraHeaders.remove(name); return this; } - /** - * Apply authentication settings directly to request headers. - * This avoids modifying the shared ApiClient's authentication state. - */ - private void applyAuthToHeaders(HttpRequest.Builder localVarRequestBuilder) { - if (bearerToken != null) { - localVarRequestBuilder.header("Authorization", "Bearer " + bearerToken); - } - if (username != null && password != null) { - String credentials = java.util.Base64.getEncoder().encodeToString((username + ":" + password).getBytes()); - localVarRequestBuilder.header("Authorization", "Basic " + credentials); - } - if (apiKey != null) { - - String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; - localVarRequestBuilder.header("api_key", keyValue); - - } - if (accessToken != null) { - localVarRequestBuilder.header("Authorization", "Bearer " + accessToken); - } - } - - /** - * Apply authentication settings directly to query parameters. - * This avoids modifying the shared ApiClient's authentication state. - */ - private String applyAuthToQueryParams(String queryString) { - if (apiKey != null) { - - String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; - String authParam = "api_key_query=" + keyValue; - if (queryString != null && !queryString.isEmpty()) { - return queryString + "&" + authParam; - } else { - return authParam; - } - - } - return queryString; - } - private ApiException getApiException(String operationId, HttpResponse response) { String message = formatExceptionMessage(operationId, response.statusCode(), response.body()); @@ -272,14 +180,15 @@ public CompletableFuture> call123testSpecialTagsWithHttpInfo private HttpRequest.Builder call123testSpecialTagsRequestBuilder(@javax.annotation.Nonnull Client client) throws ApiException { // verify the required parameter 'client' is set if (client == null) { - throw new ApiException(400, "Missing the required parameter 'client' when calling call123testSpecialTags"); + throw new ApiException(400, "Missing the required parameter 'client' when calling call123testSpecialTags" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/another-fake/dummy"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -298,8 +207,10 @@ private HttpRequest.Builder call123testSpecialTagsRequestBuilder(@javax.annotati if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/DefaultApi.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/DefaultApi.java index eb63104031c3..f96f737fe2b2 100644 --- a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/DefaultApi.java +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/DefaultApi.java @@ -57,19 +57,8 @@ public class DefaultApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; - // Per-API Bearer authentication - private String bearerToken; - - // Per-API Basic authentication - private String username; - private String password; - - // Per-API API key authentication - private String apiKey; - private String apiKeyPrefix; - - // Per-API OAuth authentication - private String accessToken; + // Custom headers to be sent with every request from this API client + private final Map extraHeaders = new java.util.HashMap<>(); public DefaultApi() { this(Configuration.getDefaultApiClient()); @@ -86,107 +75,26 @@ public DefaultApi(ApiClient apiClient) { } /** - * Helper method to set access token for Bearer authentication. - * @param bearerToken Bearer token - * @return DefaultApi + * Add a custom header to be sent with every request from this API client. + * @param name Header name + * @param value Header value + * @return this */ - public DefaultApi setBearerToken(String bearerToken) { - this.bearerToken = bearerToken; + public DefaultApi addHeader(String name, String value) { + this.extraHeaders.put(name, value); return this; } /** - * Helper method to set username for HTTP basic authentication. - * @param username Username - * @return DefaultApi + * Remove a custom header. + * @param name Header name + * @return this */ - public DefaultApi setUsername(String username) { - this.username = username; + public DefaultApi removeHeader(String name) { + this.extraHeaders.remove(name); return this; } - /** - * Helper method to set password for HTTP basic authentication. - * @param password Password - * @return DefaultApi - */ - public DefaultApi setPassword(String password) { - this.password = password; - return this; - } - - /** - * Helper method to set API key value for API key authentication. - * @param apiKey API key - * @return DefaultApi - */ - public DefaultApi setApiKey(String apiKey) { - this.apiKey = apiKey; - return this; - } - - /** - * Helper method to set API key prefix for API key authentication. - * @param apiKeyPrefix API key prefix - * @return DefaultApi - */ - public DefaultApi setApiKeyPrefix(String apiKeyPrefix) { - this.apiKeyPrefix = apiKeyPrefix; - return this; - } - - /** - * Helper method to set access token for OAuth2 authentication. - * @param accessToken Access token - * @return DefaultApi - */ - public DefaultApi setAccessToken(String accessToken) { - this.accessToken = accessToken; - return this; - } - - /** - * Apply authentication settings directly to request headers. - * This avoids modifying the shared ApiClient's authentication state. - */ - private void applyAuthToHeaders(HttpRequest.Builder localVarRequestBuilder) { - if (bearerToken != null) { - localVarRequestBuilder.header("Authorization", "Bearer " + bearerToken); - } - if (username != null && password != null) { - String credentials = java.util.Base64.getEncoder().encodeToString((username + ":" + password).getBytes()); - localVarRequestBuilder.header("Authorization", "Basic " + credentials); - } - if (apiKey != null) { - - String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; - localVarRequestBuilder.header("api_key", keyValue); - - } - if (accessToken != null) { - localVarRequestBuilder.header("Authorization", "Bearer " + accessToken); - } - } - - /** - * Apply authentication settings directly to query parameters. - * This avoids modifying the shared ApiClient's authentication state. - */ - private String applyAuthToQueryParams(String queryString) { - if (apiKey != null) { - - String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; - String authParam = "api_key_query=" + keyValue; - if (queryString != null && !queryString.isEmpty()) { - return queryString + "&" + authParam; - } else { - return authParam; - } - - } - return queryString; - } - private ApiException getApiException(String operationId, HttpResponse response) { String message = formatExceptionMessage(operationId, response.statusCode(), response.body()); @@ -273,7 +181,7 @@ private HttpRequest.Builder fooGetRequestBuilder() throws ApiException { String localVarPath = "/foo"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -286,8 +194,10 @@ private HttpRequest.Builder fooGetRequestBuilder() throws ApiException { if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeApi.java index 39d8ed5aeea0..9e02107bba57 100644 --- a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeApi.java @@ -74,19 +74,8 @@ public class FakeApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; - // Per-API Bearer authentication - private String bearerToken; - - // Per-API Basic authentication - private String username; - private String password; - - // Per-API API key authentication - private String apiKey; - private String apiKeyPrefix; - - // Per-API OAuth authentication - private String accessToken; + // Custom headers to be sent with every request from this API client + private final Map extraHeaders = new java.util.HashMap<>(); public FakeApi() { this(Configuration.getDefaultApiClient()); @@ -103,107 +92,26 @@ public FakeApi(ApiClient apiClient) { } /** - * Helper method to set access token for Bearer authentication. - * @param bearerToken Bearer token - * @return FakeApi - */ - public FakeApi setBearerToken(String bearerToken) { - this.bearerToken = bearerToken; - return this; - } - - /** - * Helper method to set username for HTTP basic authentication. - * @param username Username - * @return FakeApi - */ - public FakeApi setUsername(String username) { - this.username = username; - return this; - } - - /** - * Helper method to set password for HTTP basic authentication. - * @param password Password - * @return FakeApi - */ - public FakeApi setPassword(String password) { - this.password = password; - return this; - } - - /** - * Helper method to set API key value for API key authentication. - * @param apiKey API key - * @return FakeApi - */ - public FakeApi setApiKey(String apiKey) { - this.apiKey = apiKey; - return this; - } - - /** - * Helper method to set API key prefix for API key authentication. - * @param apiKeyPrefix API key prefix - * @return FakeApi + * Add a custom header to be sent with every request from this API client. + * @param name Header name + * @param value Header value + * @return this */ - public FakeApi setApiKeyPrefix(String apiKeyPrefix) { - this.apiKeyPrefix = apiKeyPrefix; + public FakeApi addHeader(String name, String value) { + this.extraHeaders.put(name, value); return this; } /** - * Helper method to set access token for OAuth2 authentication. - * @param accessToken Access token - * @return FakeApi + * Remove a custom header. + * @param name Header name + * @return this */ - public FakeApi setAccessToken(String accessToken) { - this.accessToken = accessToken; + public FakeApi removeHeader(String name) { + this.extraHeaders.remove(name); return this; } - /** - * Apply authentication settings directly to request headers. - * This avoids modifying the shared ApiClient's authentication state. - */ - private void applyAuthToHeaders(HttpRequest.Builder localVarRequestBuilder) { - if (bearerToken != null) { - localVarRequestBuilder.header("Authorization", "Bearer " + bearerToken); - } - if (username != null && password != null) { - String credentials = java.util.Base64.getEncoder().encodeToString((username + ":" + password).getBytes()); - localVarRequestBuilder.header("Authorization", "Basic " + credentials); - } - if (apiKey != null) { - - String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; - localVarRequestBuilder.header("api_key", keyValue); - - } - if (accessToken != null) { - localVarRequestBuilder.header("Authorization", "Bearer " + accessToken); - } - } - - /** - * Apply authentication settings directly to query parameters. - * This avoids modifying the shared ApiClient's authentication state. - */ - private String applyAuthToQueryParams(String queryString) { - if (apiKey != null) { - - String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; - String authParam = "api_key_query=" + keyValue; - if (queryString != null && !queryString.isEmpty()) { - return queryString + "&" + authParam; - } else { - return authParam; - } - - } - return queryString; - } - private ApiException getApiException(String operationId, HttpResponse response) { String message = formatExceptionMessage(operationId, response.statusCode(), response.body()); @@ -290,7 +198,7 @@ private HttpRequest.Builder fakeBigDecimalMapRequestBuilder() throws ApiExceptio String localVarPath = "/fake/BigDecimalMap"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -303,8 +211,10 @@ private HttpRequest.Builder fakeBigDecimalMapRequestBuilder() throws ApiExceptio if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -384,7 +294,7 @@ private HttpRequest.Builder fakeHealthGetRequestBuilder() throws ApiException { String localVarPath = "/fake/health"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -397,8 +307,10 @@ private HttpRequest.Builder fakeHealthGetRequestBuilder() throws ApiException { if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -480,7 +392,7 @@ private HttpRequest.Builder fakeOuterBooleanSerializeRequestBuilder(@javax.annot String localVarPath = "/fake/outer/boolean"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -499,8 +411,10 @@ private HttpRequest.Builder fakeOuterBooleanSerializeRequestBuilder(@javax.annot if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -582,7 +496,7 @@ private HttpRequest.Builder fakeOuterCompositeSerializeRequestBuilder(@javax.ann String localVarPath = "/fake/outer/composite"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -601,8 +515,10 @@ private HttpRequest.Builder fakeOuterCompositeSerializeRequestBuilder(@javax.ann if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -684,7 +600,7 @@ private HttpRequest.Builder fakeOuterNumberSerializeRequestBuilder(@javax.annota String localVarPath = "/fake/outer/number"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -703,8 +619,10 @@ private HttpRequest.Builder fakeOuterNumberSerializeRequestBuilder(@javax.annota if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -786,7 +704,7 @@ private HttpRequest.Builder fakeOuterStringSerializeRequestBuilder(@javax.annota String localVarPath = "/fake/outer/string"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -800,8 +718,10 @@ private HttpRequest.Builder fakeOuterStringSerializeRequestBuilder(@javax.annota if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -881,7 +801,7 @@ private HttpRequest.Builder getApplicationJsonUtf8RequestBuilder() throws ApiExc String localVarPath = "/fake/application_json_utf8"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -894,8 +814,10 @@ private HttpRequest.Builder getApplicationJsonUtf8RequestBuilder() throws ApiExc if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -975,7 +897,7 @@ private HttpRequest.Builder getArrayOfEnumsRequestBuilder() throws ApiException String localVarPath = "/fake/array-of-enums"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -988,8 +910,10 @@ private HttpRequest.Builder getArrayOfEnumsRequestBuilder() throws ApiException if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1053,14 +977,15 @@ public CompletableFuture> testAdditionalPropertiesReferenceWit private HttpRequest.Builder testAdditionalPropertiesReferenceRequestBuilder(@javax.annotation.Nonnull Map requestBody) throws ApiException { // verify the required parameter 'requestBody' is set if (requestBody == null) { - throw new ApiException(400, "Missing the required parameter 'requestBody' when calling testAdditionalPropertiesReference"); + throw new ApiException(400, "Missing the required parameter 'requestBody' when calling testAdditionalPropertiesReference" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/fake/additionalProperties-reference"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -1079,8 +1004,10 @@ private HttpRequest.Builder testAdditionalPropertiesReferenceRequestBuilder(@jav if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1144,14 +1071,15 @@ public CompletableFuture> testBodyWithFileSchemaWithHttpInfo(@ private HttpRequest.Builder testBodyWithFileSchemaRequestBuilder(@javax.annotation.Nonnull FileSchemaTestClass fileSchemaTestClass) throws ApiException { // verify the required parameter 'fileSchemaTestClass' is set if (fileSchemaTestClass == null) { - throw new ApiException(400, "Missing the required parameter 'fileSchemaTestClass' when calling testBodyWithFileSchema"); + throw new ApiException(400, "Missing the required parameter 'fileSchemaTestClass' when calling testBodyWithFileSchema" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/fake/body-with-file-schema"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -1170,8 +1098,10 @@ private HttpRequest.Builder testBodyWithFileSchemaRequestBuilder(@javax.annotati if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1237,11 +1167,13 @@ public CompletableFuture> testBodyWithQueryParamsWithHttpInfo( private HttpRequest.Builder testBodyWithQueryParamsRequestBuilder(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull User user) throws ApiException { // verify the required parameter 'query' is set if (query == null) { - throw new ApiException(400, "Missing the required parameter 'query' when calling testBodyWithQueryParams"); + throw new ApiException(400, "Missing the required parameter 'query' when calling testBodyWithQueryParams" + ); } // verify the required parameter 'user' is set if (user == null) { - throw new ApiException(400, "Missing the required parameter 'user' when calling testBodyWithQueryParams"); + throw new ApiException(400, "Missing the required parameter 'user' when calling testBodyWithQueryParams" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -1260,10 +1192,10 @@ private HttpRequest.Builder testBodyWithQueryParamsRequestBuilder(@javax.annotat if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + String finalQuery = null; // No longer need to apply auth to query params localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -1283,8 +1215,10 @@ private HttpRequest.Builder testBodyWithQueryParamsRequestBuilder(@javax.annotat if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1363,14 +1297,15 @@ public CompletableFuture> testClientModelWithHttpInfo(@javax private HttpRequest.Builder testClientModelRequestBuilder(@javax.annotation.Nonnull Client client) throws ApiException { // verify the required parameter 'client' is set if (client == null) { - throw new ApiException(400, "Missing the required parameter 'client' when calling testClientModel"); + throw new ApiException(400, "Missing the required parameter 'client' when calling testClientModel" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/fake"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -1389,8 +1324,10 @@ private HttpRequest.Builder testClientModelRequestBuilder(@javax.annotation.Nonn if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1480,26 +1417,30 @@ public CompletableFuture> testEndpointParametersWithHttpInfo(@ private HttpRequest.Builder testEndpointParametersRequestBuilder(@javax.annotation.Nonnull BigDecimal number, @javax.annotation.Nonnull Double _double, @javax.annotation.Nonnull String patternWithoutDelimiter, @javax.annotation.Nonnull byte[] _byte, @javax.annotation.Nullable Integer integer, @javax.annotation.Nullable Integer int32, @javax.annotation.Nullable Long int64, @javax.annotation.Nullable Float _float, @javax.annotation.Nullable String string, @javax.annotation.Nullable File binary, @javax.annotation.Nullable LocalDate date, @javax.annotation.Nullable OffsetDateTime dateTime, @javax.annotation.Nullable String password, @javax.annotation.Nullable String paramCallback) throws ApiException { // verify the required parameter 'number' is set if (number == null) { - throw new ApiException(400, "Missing the required parameter 'number' when calling testEndpointParameters"); + throw new ApiException(400, "Missing the required parameter 'number' when calling testEndpointParameters" + ); } // verify the required parameter '_double' is set if (_double == null) { - throw new ApiException(400, "Missing the required parameter '_double' when calling testEndpointParameters"); + throw new ApiException(400, "Missing the required parameter '_double' when calling testEndpointParameters" + ); } // verify the required parameter 'patternWithoutDelimiter' is set if (patternWithoutDelimiter == null) { - throw new ApiException(400, "Missing the required parameter 'patternWithoutDelimiter' when calling testEndpointParameters"); + throw new ApiException(400, "Missing the required parameter 'patternWithoutDelimiter' when calling testEndpointParameters" + ); } // verify the required parameter '_byte' is set if (_byte == null) { - throw new ApiException(400, "Missing the required parameter '_byte' when calling testEndpointParameters"); + throw new ApiException(400, "Missing the required parameter '_byte' when calling testEndpointParameters" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/fake"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -1565,8 +1506,10 @@ private HttpRequest.Builder testEndpointParametersRequestBuilder(@javax.annotati if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1665,10 +1608,10 @@ private HttpRequest.Builder testEnumParametersRequestBuilder(@javax.annotation.N if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + String finalQuery = null; // No longer need to apply auth to query params localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -1707,8 +1650,10 @@ private HttpRequest.Builder testEnumParametersRequestBuilder(@javax.annotation.N if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1822,15 +1767,18 @@ public CompletableFuture> testGroupParametersWithHttpInfo(@jav private HttpRequest.Builder testGroupParametersRequestBuilder(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group, @javax.annotation.Nullable Integer stringGroup, @javax.annotation.Nullable Boolean booleanGroup, @javax.annotation.Nullable Long int64Group) throws ApiException { // verify the required parameter 'requiredStringGroup' is set if (requiredStringGroup == null) { - throw new ApiException(400, "Missing the required parameter 'requiredStringGroup' when calling testGroupParameters"); + throw new ApiException(400, "Missing the required parameter 'requiredStringGroup' when calling testGroupParameters" + ); } // verify the required parameter 'requiredBooleanGroup' is set if (requiredBooleanGroup == null) { - throw new ApiException(400, "Missing the required parameter 'requiredBooleanGroup' when calling testGroupParameters"); + throw new ApiException(400, "Missing the required parameter 'requiredBooleanGroup' when calling testGroupParameters" + ); } // verify the required parameter 'requiredInt64Group' is set if (requiredInt64Group == null) { - throw new ApiException(400, "Missing the required parameter 'requiredInt64Group' when calling testGroupParameters"); + throw new ApiException(400, "Missing the required parameter 'requiredInt64Group' when calling testGroupParameters" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -1855,10 +1803,10 @@ private HttpRequest.Builder testGroupParametersRequestBuilder(@javax.annotation. if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + String finalQuery = null; // No longer need to apply auth to query params localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -1878,8 +1826,10 @@ private HttpRequest.Builder testGroupParametersRequestBuilder(@javax.annotation. if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -2032,14 +1982,15 @@ public CompletableFuture> testInlineAdditionalPropertiesWithHt private HttpRequest.Builder testInlineAdditionalPropertiesRequestBuilder(@javax.annotation.Nonnull Map requestBody) throws ApiException { // verify the required parameter 'requestBody' is set if (requestBody == null) { - throw new ApiException(400, "Missing the required parameter 'requestBody' when calling testInlineAdditionalProperties"); + throw new ApiException(400, "Missing the required parameter 'requestBody' when calling testInlineAdditionalProperties" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/fake/inline-additionalProperties"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -2058,8 +2009,10 @@ private HttpRequest.Builder testInlineAdditionalPropertiesRequestBuilder(@javax. if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -2123,14 +2076,15 @@ public CompletableFuture> testInlineFreeformAdditionalProperti private HttpRequest.Builder testInlineFreeformAdditionalPropertiesRequestBuilder(@javax.annotation.Nonnull TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest) throws ApiException { // verify the required parameter 'testInlineFreeformAdditionalPropertiesRequest' is set if (testInlineFreeformAdditionalPropertiesRequest == null) { - throw new ApiException(400, "Missing the required parameter 'testInlineFreeformAdditionalPropertiesRequest' when calling testInlineFreeformAdditionalProperties"); + throw new ApiException(400, "Missing the required parameter 'testInlineFreeformAdditionalPropertiesRequest' when calling testInlineFreeformAdditionalProperties" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/fake/inline-freeform-additionalProperties"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -2149,8 +2103,10 @@ private HttpRequest.Builder testInlineFreeformAdditionalPropertiesRequestBuilder if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -2216,18 +2172,20 @@ public CompletableFuture> testJsonFormDataWithHttpInfo(@javax. private HttpRequest.Builder testJsonFormDataRequestBuilder(@javax.annotation.Nonnull String param, @javax.annotation.Nonnull String param2) throws ApiException { // verify the required parameter 'param' is set if (param == null) { - throw new ApiException(400, "Missing the required parameter 'param' when calling testJsonFormData"); + throw new ApiException(400, "Missing the required parameter 'param' when calling testJsonFormData" + ); } // verify the required parameter 'param2' is set if (param2 == null) { - throw new ApiException(400, "Missing the required parameter 'param2' when calling testJsonFormData"); + throw new ApiException(400, "Missing the required parameter 'param2' when calling testJsonFormData" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/fake/jsonFormData"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -2257,8 +2215,10 @@ private HttpRequest.Builder testJsonFormDataRequestBuilder(@javax.annotation.Non if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -2330,23 +2290,28 @@ public CompletableFuture> testQueryParameterCollectionFormatWi private HttpRequest.Builder testQueryParameterCollectionFormatRequestBuilder(@javax.annotation.Nonnull List pipe, @javax.annotation.Nonnull List ioutil, @javax.annotation.Nonnull List http, @javax.annotation.Nonnull List url, @javax.annotation.Nonnull List context) throws ApiException { // verify the required parameter 'pipe' is set if (pipe == null) { - throw new ApiException(400, "Missing the required parameter 'pipe' when calling testQueryParameterCollectionFormat"); + throw new ApiException(400, "Missing the required parameter 'pipe' when calling testQueryParameterCollectionFormat" + ); } // verify the required parameter 'ioutil' is set if (ioutil == null) { - throw new ApiException(400, "Missing the required parameter 'ioutil' when calling testQueryParameterCollectionFormat"); + throw new ApiException(400, "Missing the required parameter 'ioutil' when calling testQueryParameterCollectionFormat" + ); } // verify the required parameter 'http' is set if (http == null) { - throw new ApiException(400, "Missing the required parameter 'http' when calling testQueryParameterCollectionFormat"); + throw new ApiException(400, "Missing the required parameter 'http' when calling testQueryParameterCollectionFormat" + ); } // verify the required parameter 'url' is set if (url == null) { - throw new ApiException(400, "Missing the required parameter 'url' when calling testQueryParameterCollectionFormat"); + throw new ApiException(400, "Missing the required parameter 'url' when calling testQueryParameterCollectionFormat" + ); } // verify the required parameter 'context' is set if (context == null) { - throw new ApiException(400, "Missing the required parameter 'context' when calling testQueryParameterCollectionFormat"); + throw new ApiException(400, "Missing the required parameter 'context' when calling testQueryParameterCollectionFormat" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -2373,10 +2338,10 @@ private HttpRequest.Builder testQueryParameterCollectionFormatRequestBuilder(@ja if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + String finalQuery = null; // No longer need to apply auth to query params localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -2390,8 +2355,10 @@ private HttpRequest.Builder testQueryParameterCollectionFormatRequestBuilder(@ja if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -2455,14 +2422,15 @@ public CompletableFuture> testStringMapReferenceWithHttpInfo(@ private HttpRequest.Builder testStringMapReferenceRequestBuilder(@javax.annotation.Nonnull Map requestBody) throws ApiException { // verify the required parameter 'requestBody' is set if (requestBody == null) { - throw new ApiException(400, "Missing the required parameter 'requestBody' when calling testStringMapReference"); + throw new ApiException(400, "Missing the required parameter 'requestBody' when calling testStringMapReference" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/fake/stringMap-reference"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -2481,8 +2449,10 @@ private HttpRequest.Builder testStringMapReferenceRequestBuilder(@javax.annotati if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java index f5a0823271f9..278c2beb6aeb 100644 --- a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -63,19 +63,8 @@ public class FakeClassnameTags123Api { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; - // Per-API Bearer authentication - private String bearerToken; - - // Per-API Basic authentication - private String username; - private String password; - - // Per-API API key authentication - private String apiKey; - private String apiKeyPrefix; - - // Per-API OAuth authentication - private String accessToken; + // Custom headers to be sent with every request from this API client + private final Map extraHeaders = new java.util.HashMap<>(); public FakeClassnameTags123Api() { this(Configuration.getDefaultApiClient()); @@ -92,107 +81,26 @@ public FakeClassnameTags123Api(ApiClient apiClient) { } /** - * Helper method to set access token for Bearer authentication. - * @param bearerToken Bearer token - * @return FakeClassnameTags123Api - */ - public FakeClassnameTags123Api setBearerToken(String bearerToken) { - this.bearerToken = bearerToken; - return this; - } - - /** - * Helper method to set username for HTTP basic authentication. - * @param username Username - * @return FakeClassnameTags123Api - */ - public FakeClassnameTags123Api setUsername(String username) { - this.username = username; - return this; - } - - /** - * Helper method to set password for HTTP basic authentication. - * @param password Password - * @return FakeClassnameTags123Api - */ - public FakeClassnameTags123Api setPassword(String password) { - this.password = password; - return this; - } - - /** - * Helper method to set API key value for API key authentication. - * @param apiKey API key - * @return FakeClassnameTags123Api - */ - public FakeClassnameTags123Api setApiKey(String apiKey) { - this.apiKey = apiKey; - return this; - } - - /** - * Helper method to set API key prefix for API key authentication. - * @param apiKeyPrefix API key prefix - * @return FakeClassnameTags123Api + * Add a custom header to be sent with every request from this API client. + * @param name Header name + * @param value Header value + * @return this */ - public FakeClassnameTags123Api setApiKeyPrefix(String apiKeyPrefix) { - this.apiKeyPrefix = apiKeyPrefix; + public FakeClassnameTags123Api addHeader(String name, String value) { + this.extraHeaders.put(name, value); return this; } /** - * Helper method to set access token for OAuth2 authentication. - * @param accessToken Access token - * @return FakeClassnameTags123Api + * Remove a custom header. + * @param name Header name + * @return this */ - public FakeClassnameTags123Api setAccessToken(String accessToken) { - this.accessToken = accessToken; + public FakeClassnameTags123Api removeHeader(String name) { + this.extraHeaders.remove(name); return this; } - /** - * Apply authentication settings directly to request headers. - * This avoids modifying the shared ApiClient's authentication state. - */ - private void applyAuthToHeaders(HttpRequest.Builder localVarRequestBuilder) { - if (bearerToken != null) { - localVarRequestBuilder.header("Authorization", "Bearer " + bearerToken); - } - if (username != null && password != null) { - String credentials = java.util.Base64.getEncoder().encodeToString((username + ":" + password).getBytes()); - localVarRequestBuilder.header("Authorization", "Basic " + credentials); - } - if (apiKey != null) { - - String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; - localVarRequestBuilder.header("api_key", keyValue); - - } - if (accessToken != null) { - localVarRequestBuilder.header("Authorization", "Bearer " + accessToken); - } - } - - /** - * Apply authentication settings directly to query parameters. - * This avoids modifying the shared ApiClient's authentication state. - */ - private String applyAuthToQueryParams(String queryString) { - if (apiKey != null) { - - String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; - String authParam = "api_key_query=" + keyValue; - if (queryString != null && !queryString.isEmpty()) { - return queryString + "&" + authParam; - } else { - return authParam; - } - - } - return queryString; - } - private ApiException getApiException(String operationId, HttpResponse response) { String message = formatExceptionMessage(operationId, response.statusCode(), response.body()); @@ -278,14 +186,15 @@ public CompletableFuture> testClassnameWithHttpInfo(@javax.a private HttpRequest.Builder testClassnameRequestBuilder(@javax.annotation.Nonnull Client client) throws ApiException { // verify the required parameter 'client' is set if (client == null) { - throw new ApiException(400, "Missing the required parameter 'client' when calling testClassname"); + throw new ApiException(400, "Missing the required parameter 'client' when calling testClassname" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/fake_classname_test"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -304,8 +213,10 @@ private HttpRequest.Builder testClassnameRequestBuilder(@javax.annotation.Nonnul if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/PetApi.java index 6f73255f3062..d7542d922d0e 100644 --- a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/PetApi.java @@ -65,19 +65,8 @@ public class PetApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; - // Per-API Bearer authentication - private String bearerToken; - - // Per-API Basic authentication - private String username; - private String password; - - // Per-API API key authentication - private String apiKey; - private String apiKeyPrefix; - - // Per-API OAuth authentication - private String accessToken; + // Custom headers to be sent with every request from this API client + private final Map extraHeaders = new java.util.HashMap<>(); public PetApi() { this(Configuration.getDefaultApiClient()); @@ -94,107 +83,26 @@ public PetApi(ApiClient apiClient) { } /** - * Helper method to set access token for Bearer authentication. - * @param bearerToken Bearer token - * @return PetApi - */ - public PetApi setBearerToken(String bearerToken) { - this.bearerToken = bearerToken; - return this; - } - - /** - * Helper method to set username for HTTP basic authentication. - * @param username Username - * @return PetApi - */ - public PetApi setUsername(String username) { - this.username = username; - return this; - } - - /** - * Helper method to set password for HTTP basic authentication. - * @param password Password - * @return PetApi - */ - public PetApi setPassword(String password) { - this.password = password; - return this; - } - - /** - * Helper method to set API key value for API key authentication. - * @param apiKey API key - * @return PetApi + * Add a custom header to be sent with every request from this API client. + * @param name Header name + * @param value Header value + * @return this */ - public PetApi setApiKey(String apiKey) { - this.apiKey = apiKey; + public PetApi addHeader(String name, String value) { + this.extraHeaders.put(name, value); return this; } /** - * Helper method to set API key prefix for API key authentication. - * @param apiKeyPrefix API key prefix - * @return PetApi + * Remove a custom header. + * @param name Header name + * @return this */ - public PetApi setApiKeyPrefix(String apiKeyPrefix) { - this.apiKeyPrefix = apiKeyPrefix; + public PetApi removeHeader(String name) { + this.extraHeaders.remove(name); return this; } - /** - * Helper method to set access token for OAuth2 authentication. - * @param accessToken Access token - * @return PetApi - */ - public PetApi setAccessToken(String accessToken) { - this.accessToken = accessToken; - return this; - } - - /** - * Apply authentication settings directly to request headers. - * This avoids modifying the shared ApiClient's authentication state. - */ - private void applyAuthToHeaders(HttpRequest.Builder localVarRequestBuilder) { - if (bearerToken != null) { - localVarRequestBuilder.header("Authorization", "Bearer " + bearerToken); - } - if (username != null && password != null) { - String credentials = java.util.Base64.getEncoder().encodeToString((username + ":" + password).getBytes()); - localVarRequestBuilder.header("Authorization", "Basic " + credentials); - } - if (apiKey != null) { - - String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; - localVarRequestBuilder.header("api_key", keyValue); - - } - if (accessToken != null) { - localVarRequestBuilder.header("Authorization", "Bearer " + accessToken); - } - } - - /** - * Apply authentication settings directly to query parameters. - * This avoids modifying the shared ApiClient's authentication state. - */ - private String applyAuthToQueryParams(String queryString) { - if (apiKey != null) { - - String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; - String authParam = "api_key_query=" + keyValue; - if (queryString != null && !queryString.isEmpty()) { - return queryString + "&" + authParam; - } else { - return authParam; - } - - } - return queryString; - } - private ApiException getApiException(String operationId, HttpResponse response) { String message = formatExceptionMessage(operationId, response.statusCode(), response.body()); @@ -265,14 +173,15 @@ public CompletableFuture> addPetWithHttpInfo(@javax.annotation private HttpRequest.Builder addPetRequestBuilder(@javax.annotation.Nonnull Pet pet) throws ApiException { // verify the required parameter 'pet' is set if (pet == null) { - throw new ApiException(400, "Missing the required parameter 'pet' when calling addPet"); + throw new ApiException(400, "Missing the required parameter 'pet' when calling addPet" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/pet"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -291,8 +200,10 @@ private HttpRequest.Builder addPetRequestBuilder(@javax.annotation.Nonnull Pet p if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -358,7 +269,8 @@ public CompletableFuture> deletePetWithHttpInfo(@javax.annotat private HttpRequest.Builder deletePetRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling deletePet"); + throw new ApiException(400, "Missing the required parameter 'petId' when calling deletePet" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -366,7 +278,7 @@ private HttpRequest.Builder deletePetRequestBuilder(@javax.annotation.Nonnull Lo String localVarPath = "/pet/{petId}" .replace("{petId}", ApiClient.urlEncode(petId.toString())); - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -382,8 +294,10 @@ private HttpRequest.Builder deletePetRequestBuilder(@javax.annotation.Nonnull Lo if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -462,7 +376,8 @@ public CompletableFuture>> findPetsByStatusWithHttpInfo(@j private HttpRequest.Builder findPetsByStatusRequestBuilder(@javax.annotation.Nonnull List status) throws ApiException { // verify the required parameter 'status' is set if (status == null) { - throw new ApiException(400, "Missing the required parameter 'status' when calling findPetsByStatus"); + throw new ApiException(400, "Missing the required parameter 'status' when calling findPetsByStatus" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -481,10 +396,10 @@ private HttpRequest.Builder findPetsByStatusRequestBuilder(@javax.annotation.Non if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + String finalQuery = null; // No longer need to apply auth to query params localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -498,8 +413,10 @@ private HttpRequest.Builder findPetsByStatusRequestBuilder(@javax.annotation.Non if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -582,7 +499,8 @@ public CompletableFuture>> findPetsByTagsWithHttpInfo(@jav private HttpRequest.Builder findPetsByTagsRequestBuilder(@javax.annotation.Nonnull List tags) throws ApiException { // verify the required parameter 'tags' is set if (tags == null) { - throw new ApiException(400, "Missing the required parameter 'tags' when calling findPetsByTags"); + throw new ApiException(400, "Missing the required parameter 'tags' when calling findPetsByTags" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -601,10 +519,10 @@ private HttpRequest.Builder findPetsByTagsRequestBuilder(@javax.annotation.Nonnu if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + String finalQuery = null; // No longer need to apply auth to query params localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -618,8 +536,10 @@ private HttpRequest.Builder findPetsByTagsRequestBuilder(@javax.annotation.Nonnu if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -698,7 +618,8 @@ public CompletableFuture> getPetByIdWithHttpInfo(@javax.annotat private HttpRequest.Builder getPetByIdRequestBuilder(@javax.annotation.Nonnull Long petId) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetById"); + throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetById" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -706,7 +627,7 @@ private HttpRequest.Builder getPetByIdRequestBuilder(@javax.annotation.Nonnull L String localVarPath = "/pet/{petId}" .replace("{petId}", ApiClient.urlEncode(petId.toString())); - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -719,8 +640,10 @@ private HttpRequest.Builder getPetByIdRequestBuilder(@javax.annotation.Nonnull L if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -784,14 +707,15 @@ public CompletableFuture> updatePetWithHttpInfo(@javax.annotat private HttpRequest.Builder updatePetRequestBuilder(@javax.annotation.Nonnull Pet pet) throws ApiException { // verify the required parameter 'pet' is set if (pet == null) { - throw new ApiException(400, "Missing the required parameter 'pet' when calling updatePet"); + throw new ApiException(400, "Missing the required parameter 'pet' when calling updatePet" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/pet"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -810,8 +734,10 @@ private HttpRequest.Builder updatePetRequestBuilder(@javax.annotation.Nonnull Pe if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -879,7 +805,8 @@ public CompletableFuture> updatePetWithFormWithHttpInfo(@javax private HttpRequest.Builder updatePetWithFormRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling updatePetWithForm"); + throw new ApiException(400, "Missing the required parameter 'petId' when calling updatePetWithForm" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -887,7 +814,7 @@ private HttpRequest.Builder updatePetWithFormRequestBuilder(@javax.annotation.No String localVarPath = "/pet/{petId}" .replace("{petId}", ApiClient.urlEncode(petId.toString())); - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -917,8 +844,10 @@ private HttpRequest.Builder updatePetWithFormRequestBuilder(@javax.annotation.No if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1001,7 +930,8 @@ public CompletableFuture> uploadFileWithHttpInfo(@ private HttpRequest.Builder uploadFileRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFile"); + throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFile" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -1009,7 +939,7 @@ private HttpRequest.Builder uploadFileRequestBuilder(@javax.annotation.Nonnull L String localVarPath = "/pet/{petId}/uploadImage" .replace("{petId}", ApiClient.urlEncode(petId.toString())); - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -1058,8 +988,10 @@ private HttpRequest.Builder uploadFileRequestBuilder(@javax.annotation.Nonnull L if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1142,11 +1074,13 @@ public CompletableFuture> uploadFileWithRequiredFi private HttpRequest.Builder uploadFileWithRequiredFileRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFileWithRequiredFile"); + throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFileWithRequiredFile" + ); } // verify the required parameter 'requiredFile' is set if (requiredFile == null) { - throw new ApiException(400, "Missing the required parameter 'requiredFile' when calling uploadFileWithRequiredFile"); + throw new ApiException(400, "Missing the required parameter 'requiredFile' when calling uploadFileWithRequiredFile" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -1154,7 +1088,7 @@ private HttpRequest.Builder uploadFileWithRequiredFileRequestBuilder(@javax.anno String localVarPath = "/fake/{petId}/uploadImageWithRequiredFile" .replace("{petId}", ApiClient.urlEncode(petId.toString())); - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -1203,8 +1137,10 @@ private HttpRequest.Builder uploadFileWithRequiredFileRequestBuilder(@javax.anno if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/StoreApi.java index 6c6fed6166e6..3be0c00099a2 100644 --- a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/StoreApi.java @@ -63,19 +63,8 @@ public class StoreApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; - // Per-API Bearer authentication - private String bearerToken; - - // Per-API Basic authentication - private String username; - private String password; - - // Per-API API key authentication - private String apiKey; - private String apiKeyPrefix; - - // Per-API OAuth authentication - private String accessToken; + // Custom headers to be sent with every request from this API client + private final Map extraHeaders = new java.util.HashMap<>(); public StoreApi() { this(Configuration.getDefaultApiClient()); @@ -92,107 +81,26 @@ public StoreApi(ApiClient apiClient) { } /** - * Helper method to set access token for Bearer authentication. - * @param bearerToken Bearer token - * @return StoreApi - */ - public StoreApi setBearerToken(String bearerToken) { - this.bearerToken = bearerToken; - return this; - } - - /** - * Helper method to set username for HTTP basic authentication. - * @param username Username - * @return StoreApi - */ - public StoreApi setUsername(String username) { - this.username = username; - return this; - } - - /** - * Helper method to set password for HTTP basic authentication. - * @param password Password - * @return StoreApi - */ - public StoreApi setPassword(String password) { - this.password = password; - return this; - } - - /** - * Helper method to set API key value for API key authentication. - * @param apiKey API key - * @return StoreApi - */ - public StoreApi setApiKey(String apiKey) { - this.apiKey = apiKey; - return this; - } - - /** - * Helper method to set API key prefix for API key authentication. - * @param apiKeyPrefix API key prefix - * @return StoreApi + * Add a custom header to be sent with every request from this API client. + * @param name Header name + * @param value Header value + * @return this */ - public StoreApi setApiKeyPrefix(String apiKeyPrefix) { - this.apiKeyPrefix = apiKeyPrefix; + public StoreApi addHeader(String name, String value) { + this.extraHeaders.put(name, value); return this; } /** - * Helper method to set access token for OAuth2 authentication. - * @param accessToken Access token - * @return StoreApi + * Remove a custom header. + * @param name Header name + * @return this */ - public StoreApi setAccessToken(String accessToken) { - this.accessToken = accessToken; + public StoreApi removeHeader(String name) { + this.extraHeaders.remove(name); return this; } - /** - * Apply authentication settings directly to request headers. - * This avoids modifying the shared ApiClient's authentication state. - */ - private void applyAuthToHeaders(HttpRequest.Builder localVarRequestBuilder) { - if (bearerToken != null) { - localVarRequestBuilder.header("Authorization", "Bearer " + bearerToken); - } - if (username != null && password != null) { - String credentials = java.util.Base64.getEncoder().encodeToString((username + ":" + password).getBytes()); - localVarRequestBuilder.header("Authorization", "Basic " + credentials); - } - if (apiKey != null) { - - String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; - localVarRequestBuilder.header("api_key", keyValue); - - } - if (accessToken != null) { - localVarRequestBuilder.header("Authorization", "Bearer " + accessToken); - } - } - - /** - * Apply authentication settings directly to query parameters. - * This avoids modifying the shared ApiClient's authentication state. - */ - private String applyAuthToQueryParams(String queryString) { - if (apiKey != null) { - - String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; - String authParam = "api_key_query=" + keyValue; - if (queryString != null && !queryString.isEmpty()) { - return queryString + "&" + authParam; - } else { - return authParam; - } - - } - return queryString; - } - private ApiException getApiException(String operationId, HttpResponse response) { String message = formatExceptionMessage(operationId, response.statusCode(), response.body()); @@ -263,7 +171,8 @@ public CompletableFuture> deleteOrderWithHttpInfo(@javax.annot private HttpRequest.Builder deleteOrderRequestBuilder(@javax.annotation.Nonnull String orderId) throws ApiException { // verify the required parameter 'orderId' is set if (orderId == null) { - throw new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder"); + throw new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -271,7 +180,7 @@ private HttpRequest.Builder deleteOrderRequestBuilder(@javax.annotation.Nonnull String localVarPath = "/store/order/{order_id}" .replace("{order_id}", ApiClient.urlEncode(orderId.toString())); - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -284,8 +193,10 @@ private HttpRequest.Builder deleteOrderRequestBuilder(@javax.annotation.Nonnull if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -365,7 +276,7 @@ private HttpRequest.Builder getInventoryRequestBuilder() throws ApiException { String localVarPath = "/store/inventory"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -378,8 +289,10 @@ private HttpRequest.Builder getInventoryRequestBuilder() throws ApiException { if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -458,7 +371,8 @@ public CompletableFuture> getOrderByIdWithHttpInfo(@javax.ann private HttpRequest.Builder getOrderByIdRequestBuilder(@javax.annotation.Nonnull Long orderId) throws ApiException { // verify the required parameter 'orderId' is set if (orderId == null) { - throw new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById"); + throw new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -466,7 +380,7 @@ private HttpRequest.Builder getOrderByIdRequestBuilder(@javax.annotation.Nonnull String localVarPath = "/store/order/{order_id}" .replace("{order_id}", ApiClient.urlEncode(orderId.toString())); - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -479,8 +393,10 @@ private HttpRequest.Builder getOrderByIdRequestBuilder(@javax.annotation.Nonnull if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -559,14 +475,15 @@ public CompletableFuture> placeOrderWithHttpInfo(@javax.annot private HttpRequest.Builder placeOrderRequestBuilder(@javax.annotation.Nonnull Order order) throws ApiException { // verify the required parameter 'order' is set if (order == null) { - throw new ApiException(400, "Missing the required parameter 'order' when calling placeOrder"); + throw new ApiException(400, "Missing the required parameter 'order' when calling placeOrder" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/store/order"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -585,8 +502,10 @@ private HttpRequest.Builder placeOrderRequestBuilder(@javax.annotation.Nonnull O if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/UserApi.java index ad0f935e1259..45b404334f95 100644 --- a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/UserApi.java @@ -64,19 +64,8 @@ public class UserApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; - // Per-API Bearer authentication - private String bearerToken; - - // Per-API Basic authentication - private String username; - private String password; - - // Per-API API key authentication - private String apiKey; - private String apiKeyPrefix; - - // Per-API OAuth authentication - private String accessToken; + // Custom headers to be sent with every request from this API client + private final Map extraHeaders = new java.util.HashMap<>(); public UserApi() { this(Configuration.getDefaultApiClient()); @@ -93,107 +82,26 @@ public UserApi(ApiClient apiClient) { } /** - * Helper method to set access token for Bearer authentication. - * @param bearerToken Bearer token - * @return UserApi - */ - public UserApi setBearerToken(String bearerToken) { - this.bearerToken = bearerToken; - return this; - } - - /** - * Helper method to set username for HTTP basic authentication. - * @param username Username - * @return UserApi - */ - public UserApi setUsername(String username) { - this.username = username; - return this; - } - - /** - * Helper method to set password for HTTP basic authentication. - * @param password Password - * @return UserApi - */ - public UserApi setPassword(String password) { - this.password = password; - return this; - } - - /** - * Helper method to set API key value for API key authentication. - * @param apiKey API key - * @return UserApi + * Add a custom header to be sent with every request from this API client. + * @param name Header name + * @param value Header value + * @return this */ - public UserApi setApiKey(String apiKey) { - this.apiKey = apiKey; + public UserApi addHeader(String name, String value) { + this.extraHeaders.put(name, value); return this; } /** - * Helper method to set API key prefix for API key authentication. - * @param apiKeyPrefix API key prefix - * @return UserApi + * Remove a custom header. + * @param name Header name + * @return this */ - public UserApi setApiKeyPrefix(String apiKeyPrefix) { - this.apiKeyPrefix = apiKeyPrefix; + public UserApi removeHeader(String name) { + this.extraHeaders.remove(name); return this; } - /** - * Helper method to set access token for OAuth2 authentication. - * @param accessToken Access token - * @return UserApi - */ - public UserApi setAccessToken(String accessToken) { - this.accessToken = accessToken; - return this; - } - - /** - * Apply authentication settings directly to request headers. - * This avoids modifying the shared ApiClient's authentication state. - */ - private void applyAuthToHeaders(HttpRequest.Builder localVarRequestBuilder) { - if (bearerToken != null) { - localVarRequestBuilder.header("Authorization", "Bearer " + bearerToken); - } - if (username != null && password != null) { - String credentials = java.util.Base64.getEncoder().encodeToString((username + ":" + password).getBytes()); - localVarRequestBuilder.header("Authorization", "Basic " + credentials); - } - if (apiKey != null) { - - String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; - localVarRequestBuilder.header("api_key", keyValue); - - } - if (accessToken != null) { - localVarRequestBuilder.header("Authorization", "Bearer " + accessToken); - } - } - - /** - * Apply authentication settings directly to query parameters. - * This avoids modifying the shared ApiClient's authentication state. - */ - private String applyAuthToQueryParams(String queryString) { - if (apiKey != null) { - - String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; - String authParam = "api_key_query=" + keyValue; - if (queryString != null && !queryString.isEmpty()) { - return queryString + "&" + authParam; - } else { - return authParam; - } - - } - return queryString; - } - private ApiException getApiException(String operationId, HttpResponse response) { String message = formatExceptionMessage(operationId, response.statusCode(), response.body()); @@ -264,14 +172,15 @@ public CompletableFuture> createUserWithHttpInfo(@javax.annota private HttpRequest.Builder createUserRequestBuilder(@javax.annotation.Nonnull User user) throws ApiException { // verify the required parameter 'user' is set if (user == null) { - throw new ApiException(400, "Missing the required parameter 'user' when calling createUser"); + throw new ApiException(400, "Missing the required parameter 'user' when calling createUser" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/user"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -290,8 +199,10 @@ private HttpRequest.Builder createUserRequestBuilder(@javax.annotation.Nonnull U if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -355,14 +266,15 @@ public CompletableFuture> createUsersWithArrayInputWithHttpInf private HttpRequest.Builder createUsersWithArrayInputRequestBuilder(@javax.annotation.Nonnull List user) throws ApiException { // verify the required parameter 'user' is set if (user == null) { - throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithArrayInput"); + throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithArrayInput" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/user/createWithArray"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -381,8 +293,10 @@ private HttpRequest.Builder createUsersWithArrayInputRequestBuilder(@javax.annot if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -446,14 +360,15 @@ public CompletableFuture> createUsersWithListInputWithHttpInfo private HttpRequest.Builder createUsersWithListInputRequestBuilder(@javax.annotation.Nonnull List user) throws ApiException { // verify the required parameter 'user' is set if (user == null) { - throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithListInput"); + throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithListInput" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/user/createWithList"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -472,8 +387,10 @@ private HttpRequest.Builder createUsersWithListInputRequestBuilder(@javax.annota if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -537,7 +454,8 @@ public CompletableFuture> deleteUserWithHttpInfo(@javax.annota private HttpRequest.Builder deleteUserRequestBuilder(@javax.annotation.Nonnull String username) throws ApiException { // verify the required parameter 'username' is set if (username == null) { - throw new ApiException(400, "Missing the required parameter 'username' when calling deleteUser"); + throw new ApiException(400, "Missing the required parameter 'username' when calling deleteUser" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -545,7 +463,7 @@ private HttpRequest.Builder deleteUserRequestBuilder(@javax.annotation.Nonnull S String localVarPath = "/user/{username}" .replace("{username}", ApiClient.urlEncode(username.toString())); - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -558,8 +476,10 @@ private HttpRequest.Builder deleteUserRequestBuilder(@javax.annotation.Nonnull S if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -638,7 +558,8 @@ public CompletableFuture> getUserByNameWithHttpInfo(@javax.ann private HttpRequest.Builder getUserByNameRequestBuilder(@javax.annotation.Nonnull String username) throws ApiException { // verify the required parameter 'username' is set if (username == null) { - throw new ApiException(400, "Missing the required parameter 'username' when calling getUserByName"); + throw new ApiException(400, "Missing the required parameter 'username' when calling getUserByName" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -646,7 +567,7 @@ private HttpRequest.Builder getUserByNameRequestBuilder(@javax.annotation.Nonnul String localVarPath = "/user/{username}" .replace("{username}", ApiClient.urlEncode(username.toString())); - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -659,8 +580,10 @@ private HttpRequest.Builder getUserByNameRequestBuilder(@javax.annotation.Nonnul if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -741,11 +664,13 @@ public CompletableFuture> loginUserWithHttpInfo(@javax.annot private HttpRequest.Builder loginUserRequestBuilder(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException { // verify the required parameter 'username' is set if (username == null) { - throw new ApiException(400, "Missing the required parameter 'username' when calling loginUser"); + throw new ApiException(400, "Missing the required parameter 'username' when calling loginUser" + ); } // verify the required parameter 'password' is set if (password == null) { - throw new ApiException(400, "Missing the required parameter 'password' when calling loginUser"); + throw new ApiException(400, "Missing the required parameter 'password' when calling loginUser" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -766,10 +691,10 @@ private HttpRequest.Builder loginUserRequestBuilder(@javax.annotation.Nonnull St if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + String finalQuery = null; // No longer need to apply auth to query params localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -783,8 +708,10 @@ private HttpRequest.Builder loginUserRequestBuilder(@javax.annotation.Nonnull St if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -849,7 +776,7 @@ private HttpRequest.Builder logoutUserRequestBuilder() throws ApiException { String localVarPath = "/user/logout"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -862,8 +789,10 @@ private HttpRequest.Builder logoutUserRequestBuilder() throws ApiException { if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -929,11 +858,13 @@ public CompletableFuture> updateUserWithHttpInfo(@javax.annota private HttpRequest.Builder updateUserRequestBuilder(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user) throws ApiException { // verify the required parameter 'username' is set if (username == null) { - throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser"); + throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser" + ); } // verify the required parameter 'user' is set if (user == null) { - throw new ApiException(400, "Missing the required parameter 'user' when calling updateUser"); + throw new ApiException(400, "Missing the required parameter 'user' when calling updateUser" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -941,7 +872,7 @@ private HttpRequest.Builder updateUserRequestBuilder(@javax.annotation.Nonnull S String localVarPath = "/user/{username}" .replace("{username}", ApiClient.urlEncode(username.toString())); - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -960,8 +891,10 @@ private HttpRequest.Builder updateUserRequestBuilder(@javax.annotation.Nonnull S if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/PetApi.java index af8aa02b6d2f..b62b9f59aa30 100644 --- a/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/PetApi.java @@ -63,14 +63,8 @@ public class PetApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; - - - // Per-API API key authentication - private String apiKey; - private String apiKeyPrefix; - - // Per-API OAuth authentication - private String accessToken; + // Custom headers to be sent with every request from this API client + private final Map extraHeaders = new java.util.HashMap<>(); public PetApi() { this(Configuration.getDefaultApiClient()); @@ -86,65 +80,27 @@ public PetApi(ApiClient apiClient) { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } - - - /** - * Helper method to set API key value for API key authentication. - * @param apiKey API key - * @return PetApi - */ - public PetApi setApiKey(String apiKey) { - this.apiKey = apiKey; - return this; - } - /** - * Helper method to set API key prefix for API key authentication. - * @param apiKeyPrefix API key prefix - * @return PetApi + * Add a custom header to be sent with every request from this API client. + * @param name Header name + * @param value Header value + * @return this */ - public PetApi setApiKeyPrefix(String apiKeyPrefix) { - this.apiKeyPrefix = apiKeyPrefix; + public PetApi addHeader(String name, String value) { + this.extraHeaders.put(name, value); return this; } /** - * Helper method to set access token for OAuth2 authentication. - * @param accessToken Access token - * @return PetApi + * Remove a custom header. + * @param name Header name + * @return this */ - public PetApi setAccessToken(String accessToken) { - this.accessToken = accessToken; + public PetApi removeHeader(String name) { + this.extraHeaders.remove(name); return this; } - /** - * Apply authentication settings directly to request headers. - * This avoids modifying the shared ApiClient's authentication state. - */ - private void applyAuthToHeaders(HttpRequest.Builder localVarRequestBuilder) { - if (apiKey != null) { - - String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; - localVarRequestBuilder.header("api_key", keyValue); - - } - if (accessToken != null) { - localVarRequestBuilder.header("Authorization", "Bearer " + accessToken); - } - } - - /** - * Apply authentication settings directly to query parameters. - * This avoids modifying the shared ApiClient's authentication state. - */ - private String applyAuthToQueryParams(String queryString) { - if (apiKey != null) { - - } - return queryString; - } - protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { String body = response.body() == null ? null : new String(response.body().readAllBytes()); @@ -221,14 +177,15 @@ public ApiResponse addPetWithHttpInfo(@jakarta.annotation.Nonnull Pet pet) private HttpRequest.Builder addPetRequestBuilder(@jakarta.annotation.Nonnull Pet pet) throws ApiException { // verify the required parameter 'pet' is set if (pet == null) { - throw new ApiException(400, "Missing the required parameter 'pet' when calling addPet"); + throw new ApiException(400, "Missing the required parameter 'pet' when calling addPet" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/pet"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -247,8 +204,10 @@ private HttpRequest.Builder addPetRequestBuilder(@jakarta.annotation.Nonnull Pet if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -311,7 +270,8 @@ public ApiResponse deletePetWithHttpInfo(@jakarta.annotation.Nonnull Long private HttpRequest.Builder deletePetRequestBuilder(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String apiKey) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling deletePet"); + throw new ApiException(400, "Missing the required parameter 'petId' when calling deletePet" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -319,7 +279,7 @@ private HttpRequest.Builder deletePetRequestBuilder(@jakarta.annotation.Nonnull String localVarPath = "/pet/{petId}" .replace("{petId}", ApiClient.urlEncode(petId.toString())); - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -335,8 +295,10 @@ private HttpRequest.Builder deletePetRequestBuilder(@jakarta.annotation.Nonnull if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -405,7 +367,8 @@ public ApiResponse> findPetsByStatusWithHttpInfo(@jakarta.annotation.N private HttpRequest.Builder findPetsByStatusRequestBuilder(@jakarta.annotation.Nonnull List status) throws ApiException { // verify the required parameter 'status' is set if (status == null) { - throw new ApiException(400, "Missing the required parameter 'status' when calling findPetsByStatus"); + throw new ApiException(400, "Missing the required parameter 'status' when calling findPetsByStatus" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -424,10 +387,10 @@ private HttpRequest.Builder findPetsByStatusRequestBuilder(@jakarta.annotation.N if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + String finalQuery = null; // No longer need to apply auth to query params localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -441,8 +404,10 @@ private HttpRequest.Builder findPetsByStatusRequestBuilder(@jakarta.annotation.N if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -515,7 +480,8 @@ public ApiResponse> findPetsByTagsWithHttpInfo(@jakarta.annotation.Non private HttpRequest.Builder findPetsByTagsRequestBuilder(@jakarta.annotation.Nonnull List tags) throws ApiException { // verify the required parameter 'tags' is set if (tags == null) { - throw new ApiException(400, "Missing the required parameter 'tags' when calling findPetsByTags"); + throw new ApiException(400, "Missing the required parameter 'tags' when calling findPetsByTags" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -534,10 +500,10 @@ private HttpRequest.Builder findPetsByTagsRequestBuilder(@jakarta.annotation.Non if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + String finalQuery = null; // No longer need to apply auth to query params localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -551,8 +517,10 @@ private HttpRequest.Builder findPetsByTagsRequestBuilder(@jakarta.annotation.Non if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -621,7 +589,8 @@ public ApiResponse getPetByIdWithHttpInfo(@jakarta.annotation.Nonnull Long private HttpRequest.Builder getPetByIdRequestBuilder(@jakarta.annotation.Nonnull Long petId) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetById"); + throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetById" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -629,7 +598,7 @@ private HttpRequest.Builder getPetByIdRequestBuilder(@jakarta.annotation.Nonnull String localVarPath = "/pet/{petId}" .replace("{petId}", ApiClient.urlEncode(petId.toString())); - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -642,8 +611,10 @@ private HttpRequest.Builder getPetByIdRequestBuilder(@jakarta.annotation.Nonnull if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -716,14 +687,15 @@ public ApiResponse updatePetWithHttpInfo(@jakarta.annotation.Nonnull Pet pe private HttpRequest.Builder updatePetRequestBuilder(@jakarta.annotation.Nonnull Pet pet) throws ApiException { // verify the required parameter 'pet' is set if (pet == null) { - throw new ApiException(400, "Missing the required parameter 'pet' when calling updatePet"); + throw new ApiException(400, "Missing the required parameter 'pet' when calling updatePet" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/pet"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -742,8 +714,10 @@ private HttpRequest.Builder updatePetRequestBuilder(@jakarta.annotation.Nonnull if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -808,7 +782,8 @@ public ApiResponse updatePetWithFormWithHttpInfo(@jakarta.annotation.Nonnu private HttpRequest.Builder updatePetWithFormRequestBuilder(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String name, @jakarta.annotation.Nullable String status) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling updatePetWithForm"); + throw new ApiException(400, "Missing the required parameter 'petId' when calling updatePetWithForm" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -816,7 +791,7 @@ private HttpRequest.Builder updatePetWithFormRequestBuilder(@jakarta.annotation. String localVarPath = "/pet/{petId}" .replace("{petId}", ApiClient.urlEncode(petId.toString())); - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -846,8 +821,10 @@ private HttpRequest.Builder updatePetWithFormRequestBuilder(@jakarta.annotation. if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -920,7 +897,8 @@ public ApiResponse uploadFileWithHttpInfo(@jakarta.annotation. private HttpRequest.Builder uploadFileRequestBuilder(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String additionalMetadata, @jakarta.annotation.Nullable File _file) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFile"); + throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFile" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -928,7 +906,7 @@ private HttpRequest.Builder uploadFileRequestBuilder(@jakarta.annotation.Nonnull String localVarPath = "/pet/{petId}/uploadImage" .replace("{petId}", ApiClient.urlEncode(petId.toString())); - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -977,8 +955,10 @@ private HttpRequest.Builder uploadFileRequestBuilder(@jakarta.annotation.Nonnull if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/StoreApi.java index dc1396960406..0b9cf2632a16 100644 --- a/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/StoreApi.java @@ -61,14 +61,8 @@ public class StoreApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; - - - // Per-API API key authentication - private String apiKey; - private String apiKeyPrefix; - - // Per-API OAuth authentication - private String accessToken; + // Custom headers to be sent with every request from this API client + private final Map extraHeaders = new java.util.HashMap<>(); public StoreApi() { this(Configuration.getDefaultApiClient()); @@ -84,65 +78,27 @@ public StoreApi(ApiClient apiClient) { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } - - /** - * Helper method to set API key value for API key authentication. - * @param apiKey API key - * @return StoreApi + * Add a custom header to be sent with every request from this API client. + * @param name Header name + * @param value Header value + * @return this */ - public StoreApi setApiKey(String apiKey) { - this.apiKey = apiKey; + public StoreApi addHeader(String name, String value) { + this.extraHeaders.put(name, value); return this; } /** - * Helper method to set API key prefix for API key authentication. - * @param apiKeyPrefix API key prefix - * @return StoreApi + * Remove a custom header. + * @param name Header name + * @return this */ - public StoreApi setApiKeyPrefix(String apiKeyPrefix) { - this.apiKeyPrefix = apiKeyPrefix; + public StoreApi removeHeader(String name) { + this.extraHeaders.remove(name); return this; } - /** - * Helper method to set access token for OAuth2 authentication. - * @param accessToken Access token - * @return StoreApi - */ - public StoreApi setAccessToken(String accessToken) { - this.accessToken = accessToken; - return this; - } - - /** - * Apply authentication settings directly to request headers. - * This avoids modifying the shared ApiClient's authentication state. - */ - private void applyAuthToHeaders(HttpRequest.Builder localVarRequestBuilder) { - if (apiKey != null) { - - String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; - localVarRequestBuilder.header("api_key", keyValue); - - } - if (accessToken != null) { - localVarRequestBuilder.header("Authorization", "Bearer " + accessToken); - } - } - - /** - * Apply authentication settings directly to query parameters. - * This avoids modifying the shared ApiClient's authentication state. - */ - private String applyAuthToQueryParams(String queryString) { - if (apiKey != null) { - - } - return queryString; - } - protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { String body = response.body() == null ? null : new String(response.body().readAllBytes()); @@ -211,7 +167,8 @@ public ApiResponse deleteOrderWithHttpInfo(@jakarta.annotation.Nonnull Str private HttpRequest.Builder deleteOrderRequestBuilder(@jakarta.annotation.Nonnull String orderId) throws ApiException { // verify the required parameter 'orderId' is set if (orderId == null) { - throw new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder"); + throw new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -219,7 +176,7 @@ private HttpRequest.Builder deleteOrderRequestBuilder(@jakarta.annotation.Nonnul String localVarPath = "/store/order/{orderId}" .replace("{orderId}", ApiClient.urlEncode(orderId.toString())); - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -232,8 +189,10 @@ private HttpRequest.Builder deleteOrderRequestBuilder(@jakarta.annotation.Nonnul if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -303,7 +262,7 @@ private HttpRequest.Builder getInventoryRequestBuilder() throws ApiException { String localVarPath = "/store/inventory"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -316,8 +275,10 @@ private HttpRequest.Builder getInventoryRequestBuilder() throws ApiException { if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -386,7 +347,8 @@ public ApiResponse getOrderByIdWithHttpInfo(@jakarta.annotation.Nonnull L private HttpRequest.Builder getOrderByIdRequestBuilder(@jakarta.annotation.Nonnull Long orderId) throws ApiException { // verify the required parameter 'orderId' is set if (orderId == null) { - throw new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById"); + throw new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -394,7 +356,7 @@ private HttpRequest.Builder getOrderByIdRequestBuilder(@jakarta.annotation.Nonnu String localVarPath = "/store/order/{orderId}" .replace("{orderId}", ApiClient.urlEncode(orderId.toString())); - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -407,8 +369,10 @@ private HttpRequest.Builder getOrderByIdRequestBuilder(@jakarta.annotation.Nonnu if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -477,14 +441,15 @@ public ApiResponse placeOrderWithHttpInfo(@jakarta.annotation.Nonnull Ord private HttpRequest.Builder placeOrderRequestBuilder(@jakarta.annotation.Nonnull Order order) throws ApiException { // verify the required parameter 'order' is set if (order == null) { - throw new ApiException(400, "Missing the required parameter 'order' when calling placeOrder"); + throw new ApiException(400, "Missing the required parameter 'order' when calling placeOrder" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/store/order"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -503,8 +468,10 @@ private HttpRequest.Builder placeOrderRequestBuilder(@jakarta.annotation.Nonnull if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/UserApi.java index 47bafd5cd8ff..6c05aa4e40bd 100644 --- a/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/UserApi.java @@ -62,14 +62,8 @@ public class UserApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; - - - // Per-API API key authentication - private String apiKey; - private String apiKeyPrefix; - - // Per-API OAuth authentication - private String accessToken; + // Custom headers to be sent with every request from this API client + private final Map extraHeaders = new java.util.HashMap<>(); public UserApi() { this(Configuration.getDefaultApiClient()); @@ -85,65 +79,27 @@ public UserApi(ApiClient apiClient) { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } - - /** - * Helper method to set API key value for API key authentication. - * @param apiKey API key - * @return UserApi + * Add a custom header to be sent with every request from this API client. + * @param name Header name + * @param value Header value + * @return this */ - public UserApi setApiKey(String apiKey) { - this.apiKey = apiKey; + public UserApi addHeader(String name, String value) { + this.extraHeaders.put(name, value); return this; } /** - * Helper method to set API key prefix for API key authentication. - * @param apiKeyPrefix API key prefix - * @return UserApi + * Remove a custom header. + * @param name Header name + * @return this */ - public UserApi setApiKeyPrefix(String apiKeyPrefix) { - this.apiKeyPrefix = apiKeyPrefix; + public UserApi removeHeader(String name) { + this.extraHeaders.remove(name); return this; } - /** - * Helper method to set access token for OAuth2 authentication. - * @param accessToken Access token - * @return UserApi - */ - public UserApi setAccessToken(String accessToken) { - this.accessToken = accessToken; - return this; - } - - /** - * Apply authentication settings directly to request headers. - * This avoids modifying the shared ApiClient's authentication state. - */ - private void applyAuthToHeaders(HttpRequest.Builder localVarRequestBuilder) { - if (apiKey != null) { - - String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; - localVarRequestBuilder.header("api_key", keyValue); - - } - if (accessToken != null) { - localVarRequestBuilder.header("Authorization", "Bearer " + accessToken); - } - } - - /** - * Apply authentication settings directly to query parameters. - * This avoids modifying the shared ApiClient's authentication state. - */ - private String applyAuthToQueryParams(String queryString) { - if (apiKey != null) { - - } - return queryString; - } - protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { String body = response.body() == null ? null : new String(response.body().readAllBytes()); @@ -212,14 +168,15 @@ public ApiResponse createUserWithHttpInfo(@jakarta.annotation.Nonnull User private HttpRequest.Builder createUserRequestBuilder(@jakarta.annotation.Nonnull User user) throws ApiException { // verify the required parameter 'user' is set if (user == null) { - throw new ApiException(400, "Missing the required parameter 'user' when calling createUser"); + throw new ApiException(400, "Missing the required parameter 'user' when calling createUser" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/user"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -238,8 +195,10 @@ private HttpRequest.Builder createUserRequestBuilder(@jakarta.annotation.Nonnull if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -300,14 +259,15 @@ public ApiResponse createUsersWithArrayInputWithHttpInfo(@jakarta.annotati private HttpRequest.Builder createUsersWithArrayInputRequestBuilder(@jakarta.annotation.Nonnull List user) throws ApiException { // verify the required parameter 'user' is set if (user == null) { - throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithArrayInput"); + throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithArrayInput" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/user/createWithArray"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -326,8 +286,10 @@ private HttpRequest.Builder createUsersWithArrayInputRequestBuilder(@jakarta.ann if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -388,14 +350,15 @@ public ApiResponse createUsersWithListInputWithHttpInfo(@jakarta.annotatio private HttpRequest.Builder createUsersWithListInputRequestBuilder(@jakarta.annotation.Nonnull List user) throws ApiException { // verify the required parameter 'user' is set if (user == null) { - throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithListInput"); + throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithListInput" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/user/createWithList"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -414,8 +377,10 @@ private HttpRequest.Builder createUsersWithListInputRequestBuilder(@jakarta.anno if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -476,7 +441,8 @@ public ApiResponse deleteUserWithHttpInfo(@jakarta.annotation.Nonnull Stri private HttpRequest.Builder deleteUserRequestBuilder(@jakarta.annotation.Nonnull String username) throws ApiException { // verify the required parameter 'username' is set if (username == null) { - throw new ApiException(400, "Missing the required parameter 'username' when calling deleteUser"); + throw new ApiException(400, "Missing the required parameter 'username' when calling deleteUser" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -484,7 +450,7 @@ private HttpRequest.Builder deleteUserRequestBuilder(@jakarta.annotation.Nonnull String localVarPath = "/user/{username}" .replace("{username}", ApiClient.urlEncode(username.toString())); - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -497,8 +463,10 @@ private HttpRequest.Builder deleteUserRequestBuilder(@jakarta.annotation.Nonnull if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -567,7 +535,8 @@ public ApiResponse getUserByNameWithHttpInfo(@jakarta.annotation.Nonnull S private HttpRequest.Builder getUserByNameRequestBuilder(@jakarta.annotation.Nonnull String username) throws ApiException { // verify the required parameter 'username' is set if (username == null) { - throw new ApiException(400, "Missing the required parameter 'username' when calling getUserByName"); + throw new ApiException(400, "Missing the required parameter 'username' when calling getUserByName" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -575,7 +544,7 @@ private HttpRequest.Builder getUserByNameRequestBuilder(@jakarta.annotation.Nonn String localVarPath = "/user/{username}" .replace("{username}", ApiClient.urlEncode(username.toString())); - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -588,8 +557,10 @@ private HttpRequest.Builder getUserByNameRequestBuilder(@jakarta.annotation.Nonn if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -660,11 +631,13 @@ public ApiResponse loginUserWithHttpInfo(@jakarta.annotation.Nonnull Str private HttpRequest.Builder loginUserRequestBuilder(@jakarta.annotation.Nonnull String username, @jakarta.annotation.Nonnull String password) throws ApiException { // verify the required parameter 'username' is set if (username == null) { - throw new ApiException(400, "Missing the required parameter 'username' when calling loginUser"); + throw new ApiException(400, "Missing the required parameter 'username' when calling loginUser" + ); } // verify the required parameter 'password' is set if (password == null) { - throw new ApiException(400, "Missing the required parameter 'password' when calling loginUser"); + throw new ApiException(400, "Missing the required parameter 'password' when calling loginUser" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -685,10 +658,10 @@ private HttpRequest.Builder loginUserRequestBuilder(@jakarta.annotation.Nonnull if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + String finalQuery = null; // No longer need to apply auth to query params localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -702,8 +675,10 @@ private HttpRequest.Builder loginUserRequestBuilder(@jakarta.annotation.Nonnull if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -765,7 +740,7 @@ private HttpRequest.Builder logoutUserRequestBuilder() throws ApiException { String localVarPath = "/user/logout"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -778,8 +753,10 @@ private HttpRequest.Builder logoutUserRequestBuilder() throws ApiException { if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -842,11 +819,13 @@ public ApiResponse updateUserWithHttpInfo(@jakarta.annotation.Nonnull Stri private HttpRequest.Builder updateUserRequestBuilder(@jakarta.annotation.Nonnull String username, @jakarta.annotation.Nonnull User user) throws ApiException { // verify the required parameter 'username' is set if (username == null) { - throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser"); + throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser" + ); } // verify the required parameter 'user' is set if (user == null) { - throw new ApiException(400, "Missing the required parameter 'user' when calling updateUser"); + throw new ApiException(400, "Missing the required parameter 'user' when calling updateUser" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -854,7 +833,7 @@ private HttpRequest.Builder updateUserRequestBuilder(@jakarta.annotation.Nonnull String localVarPath = "/user/{username}" .replace("{username}", ApiClient.urlEncode(username.toString())); - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -873,8 +852,10 @@ private HttpRequest.Builder updateUserRequestBuilder(@jakarta.annotation.Nonnull if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/AnotherFakeApi.java index 5752329bbc70..54b3b3017c76 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/AnotherFakeApi.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -55,19 +55,8 @@ public class AnotherFakeApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; - // Per-API Bearer authentication - private String bearerToken; - - // Per-API Basic authentication - private String username; - private String password; - - // Per-API API key authentication - private String apiKey; - private String apiKeyPrefix; - - // Per-API OAuth authentication - private String accessToken; + // Custom headers to be sent with every request from this API client + private final Map extraHeaders = new java.util.HashMap<>(); public AnotherFakeApi() { this(Configuration.getDefaultApiClient()); @@ -84,107 +73,26 @@ public AnotherFakeApi(ApiClient apiClient) { } /** - * Helper method to set access token for Bearer authentication. - * @param bearerToken Bearer token - * @return AnotherFakeApi - */ - public AnotherFakeApi setBearerToken(String bearerToken) { - this.bearerToken = bearerToken; - return this; - } - - /** - * Helper method to set username for HTTP basic authentication. - * @param username Username - * @return AnotherFakeApi - */ - public AnotherFakeApi setUsername(String username) { - this.username = username; - return this; - } - - /** - * Helper method to set password for HTTP basic authentication. - * @param password Password - * @return AnotherFakeApi - */ - public AnotherFakeApi setPassword(String password) { - this.password = password; - return this; - } - - /** - * Helper method to set API key value for API key authentication. - * @param apiKey API key - * @return AnotherFakeApi - */ - public AnotherFakeApi setApiKey(String apiKey) { - this.apiKey = apiKey; - return this; - } - - /** - * Helper method to set API key prefix for API key authentication. - * @param apiKeyPrefix API key prefix - * @return AnotherFakeApi + * Add a custom header to be sent with every request from this API client. + * @param name Header name + * @param value Header value + * @return this */ - public AnotherFakeApi setApiKeyPrefix(String apiKeyPrefix) { - this.apiKeyPrefix = apiKeyPrefix; + public AnotherFakeApi addHeader(String name, String value) { + this.extraHeaders.put(name, value); return this; } /** - * Helper method to set access token for OAuth2 authentication. - * @param accessToken Access token - * @return AnotherFakeApi + * Remove a custom header. + * @param name Header name + * @return this */ - public AnotherFakeApi setAccessToken(String accessToken) { - this.accessToken = accessToken; + public AnotherFakeApi removeHeader(String name) { + this.extraHeaders.remove(name); return this; } - /** - * Apply authentication settings directly to request headers. - * This avoids modifying the shared ApiClient's authentication state. - */ - private void applyAuthToHeaders(HttpRequest.Builder localVarRequestBuilder) { - if (bearerToken != null) { - localVarRequestBuilder.header("Authorization", "Bearer " + bearerToken); - } - if (username != null && password != null) { - String credentials = java.util.Base64.getEncoder().encodeToString((username + ":" + password).getBytes()); - localVarRequestBuilder.header("Authorization", "Basic " + credentials); - } - if (apiKey != null) { - - String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; - localVarRequestBuilder.header("api_key", keyValue); - - } - if (accessToken != null) { - localVarRequestBuilder.header("Authorization", "Bearer " + accessToken); - } - } - - /** - * Apply authentication settings directly to query parameters. - * This avoids modifying the shared ApiClient's authentication state. - */ - private String applyAuthToQueryParams(String queryString) { - if (apiKey != null) { - - String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; - String authParam = "api_key_query=" + keyValue; - if (queryString != null && !queryString.isEmpty()) { - return queryString + "&" + authParam; - } else { - return authParam; - } - - } - return queryString; - } - protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { String body = response.body() == null ? null : new String(response.body().readAllBytes()); @@ -261,14 +169,15 @@ public ApiResponse call123testSpecialTagsWithHttpInfo(@javax.annotation. private HttpRequest.Builder call123testSpecialTagsRequestBuilder(@javax.annotation.Nonnull Client client) throws ApiException { // verify the required parameter 'client' is set if (client == null) { - throw new ApiException(400, "Missing the required parameter 'client' when calling call123testSpecialTags"); + throw new ApiException(400, "Missing the required parameter 'client' when calling call123testSpecialTags" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/another-fake/dummy"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -287,8 +196,10 @@ private HttpRequest.Builder call123testSpecialTagsRequestBuilder(@javax.annotati if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/DefaultApi.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/DefaultApi.java index d2babcdbba12..6abfc00d126e 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/DefaultApi.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/DefaultApi.java @@ -55,19 +55,8 @@ public class DefaultApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; - // Per-API Bearer authentication - private String bearerToken; - - // Per-API Basic authentication - private String username; - private String password; - - // Per-API API key authentication - private String apiKey; - private String apiKeyPrefix; - - // Per-API OAuth authentication - private String accessToken; + // Custom headers to be sent with every request from this API client + private final Map extraHeaders = new java.util.HashMap<>(); public DefaultApi() { this(Configuration.getDefaultApiClient()); @@ -84,107 +73,26 @@ public DefaultApi(ApiClient apiClient) { } /** - * Helper method to set access token for Bearer authentication. - * @param bearerToken Bearer token - * @return DefaultApi - */ - public DefaultApi setBearerToken(String bearerToken) { - this.bearerToken = bearerToken; - return this; - } - - /** - * Helper method to set username for HTTP basic authentication. - * @param username Username - * @return DefaultApi - */ - public DefaultApi setUsername(String username) { - this.username = username; - return this; - } - - /** - * Helper method to set password for HTTP basic authentication. - * @param password Password - * @return DefaultApi - */ - public DefaultApi setPassword(String password) { - this.password = password; - return this; - } - - /** - * Helper method to set API key value for API key authentication. - * @param apiKey API key - * @return DefaultApi - */ - public DefaultApi setApiKey(String apiKey) { - this.apiKey = apiKey; - return this; - } - - /** - * Helper method to set API key prefix for API key authentication. - * @param apiKeyPrefix API key prefix - * @return DefaultApi + * Add a custom header to be sent with every request from this API client. + * @param name Header name + * @param value Header value + * @return this */ - public DefaultApi setApiKeyPrefix(String apiKeyPrefix) { - this.apiKeyPrefix = apiKeyPrefix; + public DefaultApi addHeader(String name, String value) { + this.extraHeaders.put(name, value); return this; } /** - * Helper method to set access token for OAuth2 authentication. - * @param accessToken Access token - * @return DefaultApi + * Remove a custom header. + * @param name Header name + * @return this */ - public DefaultApi setAccessToken(String accessToken) { - this.accessToken = accessToken; + public DefaultApi removeHeader(String name) { + this.extraHeaders.remove(name); return this; } - /** - * Apply authentication settings directly to request headers. - * This avoids modifying the shared ApiClient's authentication state. - */ - private void applyAuthToHeaders(HttpRequest.Builder localVarRequestBuilder) { - if (bearerToken != null) { - localVarRequestBuilder.header("Authorization", "Bearer " + bearerToken); - } - if (username != null && password != null) { - String credentials = java.util.Base64.getEncoder().encodeToString((username + ":" + password).getBytes()); - localVarRequestBuilder.header("Authorization", "Basic " + credentials); - } - if (apiKey != null) { - - String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; - localVarRequestBuilder.header("api_key", keyValue); - - } - if (accessToken != null) { - localVarRequestBuilder.header("Authorization", "Bearer " + accessToken); - } - } - - /** - * Apply authentication settings directly to query parameters. - * This avoids modifying the shared ApiClient's authentication state. - */ - private String applyAuthToQueryParams(String queryString) { - if (apiKey != null) { - - String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; - String authParam = "api_key_query=" + keyValue; - if (queryString != null && !queryString.isEmpty()) { - return queryString + "&" + authParam; - } else { - return authParam; - } - - } - return queryString; - } - protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { String body = response.body() == null ? null : new String(response.body().readAllBytes()); @@ -262,7 +170,7 @@ private HttpRequest.Builder fooGetRequestBuilder() throws ApiException { String localVarPath = "/foo"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -275,8 +183,10 @@ private HttpRequest.Builder fooGetRequestBuilder() throws ApiException { if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeApi.java index f1b86337b460..3cb8867924b5 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeApi.java @@ -72,19 +72,8 @@ public class FakeApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; - // Per-API Bearer authentication - private String bearerToken; - - // Per-API Basic authentication - private String username; - private String password; - - // Per-API API key authentication - private String apiKey; - private String apiKeyPrefix; - - // Per-API OAuth authentication - private String accessToken; + // Custom headers to be sent with every request from this API client + private final Map extraHeaders = new java.util.HashMap<>(); public FakeApi() { this(Configuration.getDefaultApiClient()); @@ -101,107 +90,26 @@ public FakeApi(ApiClient apiClient) { } /** - * Helper method to set access token for Bearer authentication. - * @param bearerToken Bearer token - * @return FakeApi - */ - public FakeApi setBearerToken(String bearerToken) { - this.bearerToken = bearerToken; - return this; - } - - /** - * Helper method to set username for HTTP basic authentication. - * @param username Username - * @return FakeApi + * Add a custom header to be sent with every request from this API client. + * @param name Header name + * @param value Header value + * @return this */ - public FakeApi setUsername(String username) { - this.username = username; + public FakeApi addHeader(String name, String value) { + this.extraHeaders.put(name, value); return this; } /** - * Helper method to set password for HTTP basic authentication. - * @param password Password - * @return FakeApi + * Remove a custom header. + * @param name Header name + * @return this */ - public FakeApi setPassword(String password) { - this.password = password; + public FakeApi removeHeader(String name) { + this.extraHeaders.remove(name); return this; } - /** - * Helper method to set API key value for API key authentication. - * @param apiKey API key - * @return FakeApi - */ - public FakeApi setApiKey(String apiKey) { - this.apiKey = apiKey; - return this; - } - - /** - * Helper method to set API key prefix for API key authentication. - * @param apiKeyPrefix API key prefix - * @return FakeApi - */ - public FakeApi setApiKeyPrefix(String apiKeyPrefix) { - this.apiKeyPrefix = apiKeyPrefix; - return this; - } - - /** - * Helper method to set access token for OAuth2 authentication. - * @param accessToken Access token - * @return FakeApi - */ - public FakeApi setAccessToken(String accessToken) { - this.accessToken = accessToken; - return this; - } - - /** - * Apply authentication settings directly to request headers. - * This avoids modifying the shared ApiClient's authentication state. - */ - private void applyAuthToHeaders(HttpRequest.Builder localVarRequestBuilder) { - if (bearerToken != null) { - localVarRequestBuilder.header("Authorization", "Bearer " + bearerToken); - } - if (username != null && password != null) { - String credentials = java.util.Base64.getEncoder().encodeToString((username + ":" + password).getBytes()); - localVarRequestBuilder.header("Authorization", "Basic " + credentials); - } - if (apiKey != null) { - - String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; - localVarRequestBuilder.header("api_key", keyValue); - - } - if (accessToken != null) { - localVarRequestBuilder.header("Authorization", "Bearer " + accessToken); - } - } - - /** - * Apply authentication settings directly to query parameters. - * This avoids modifying the shared ApiClient's authentication state. - */ - private String applyAuthToQueryParams(String queryString) { - if (apiKey != null) { - - String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; - String authParam = "api_key_query=" + keyValue; - if (queryString != null && !queryString.isEmpty()) { - return queryString + "&" + authParam; - } else { - return authParam; - } - - } - return queryString; - } - protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { String body = response.body() == null ? null : new String(response.body().readAllBytes()); @@ -279,7 +187,7 @@ private HttpRequest.Builder fakeBigDecimalMapRequestBuilder() throws ApiExceptio String localVarPath = "/fake/BigDecimalMap"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -292,8 +200,10 @@ private HttpRequest.Builder fakeBigDecimalMapRequestBuilder() throws ApiExceptio if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -363,7 +273,7 @@ private HttpRequest.Builder fakeHealthGetRequestBuilder() throws ApiException { String localVarPath = "/fake/health"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -376,8 +286,10 @@ private HttpRequest.Builder fakeHealthGetRequestBuilder() throws ApiException { if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -449,7 +361,7 @@ private HttpRequest.Builder fakeOuterBooleanSerializeRequestBuilder(@javax.annot String localVarPath = "/fake/outer/boolean"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -468,8 +380,10 @@ private HttpRequest.Builder fakeOuterBooleanSerializeRequestBuilder(@javax.annot if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -541,7 +455,7 @@ private HttpRequest.Builder fakeOuterCompositeSerializeRequestBuilder(@javax.ann String localVarPath = "/fake/outer/composite"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -560,8 +474,10 @@ private HttpRequest.Builder fakeOuterCompositeSerializeRequestBuilder(@javax.ann if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -633,7 +549,7 @@ private HttpRequest.Builder fakeOuterNumberSerializeRequestBuilder(@javax.annota String localVarPath = "/fake/outer/number"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -652,8 +568,10 @@ private HttpRequest.Builder fakeOuterNumberSerializeRequestBuilder(@javax.annota if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -725,7 +643,7 @@ private HttpRequest.Builder fakeOuterStringSerializeRequestBuilder(@javax.annota String localVarPath = "/fake/outer/string"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -739,8 +657,10 @@ private HttpRequest.Builder fakeOuterStringSerializeRequestBuilder(@javax.annota if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -810,7 +730,7 @@ private HttpRequest.Builder getApplicationJsonUtf8RequestBuilder() throws ApiExc String localVarPath = "/fake/application_json_utf8"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -823,8 +743,10 @@ private HttpRequest.Builder getApplicationJsonUtf8RequestBuilder() throws ApiExc if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -894,7 +816,7 @@ private HttpRequest.Builder getArrayOfEnumsRequestBuilder() throws ApiException String localVarPath = "/fake/array-of-enums"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -907,8 +829,10 @@ private HttpRequest.Builder getArrayOfEnumsRequestBuilder() throws ApiException if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -969,14 +893,15 @@ public ApiResponse testAdditionalPropertiesReferenceWithHttpInfo(@javax.an private HttpRequest.Builder testAdditionalPropertiesReferenceRequestBuilder(@javax.annotation.Nonnull Map requestBody) throws ApiException { // verify the required parameter 'requestBody' is set if (requestBody == null) { - throw new ApiException(400, "Missing the required parameter 'requestBody' when calling testAdditionalPropertiesReference"); + throw new ApiException(400, "Missing the required parameter 'requestBody' when calling testAdditionalPropertiesReference" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/fake/additionalProperties-reference"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -995,8 +920,10 @@ private HttpRequest.Builder testAdditionalPropertiesReferenceRequestBuilder(@jav if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1057,14 +984,15 @@ public ApiResponse testBodyWithFileSchemaWithHttpInfo(@javax.annotation.No private HttpRequest.Builder testBodyWithFileSchemaRequestBuilder(@javax.annotation.Nonnull FileSchemaTestClass fileSchemaTestClass) throws ApiException { // verify the required parameter 'fileSchemaTestClass' is set if (fileSchemaTestClass == null) { - throw new ApiException(400, "Missing the required parameter 'fileSchemaTestClass' when calling testBodyWithFileSchema"); + throw new ApiException(400, "Missing the required parameter 'fileSchemaTestClass' when calling testBodyWithFileSchema" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/fake/body-with-file-schema"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -1083,8 +1011,10 @@ private HttpRequest.Builder testBodyWithFileSchemaRequestBuilder(@javax.annotati if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1147,11 +1077,13 @@ public ApiResponse testBodyWithQueryParamsWithHttpInfo(@javax.annotation.N private HttpRequest.Builder testBodyWithQueryParamsRequestBuilder(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull User user) throws ApiException { // verify the required parameter 'query' is set if (query == null) { - throw new ApiException(400, "Missing the required parameter 'query' when calling testBodyWithQueryParams"); + throw new ApiException(400, "Missing the required parameter 'query' when calling testBodyWithQueryParams" + ); } // verify the required parameter 'user' is set if (user == null) { - throw new ApiException(400, "Missing the required parameter 'user' when calling testBodyWithQueryParams"); + throw new ApiException(400, "Missing the required parameter 'user' when calling testBodyWithQueryParams" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -1170,10 +1102,10 @@ private HttpRequest.Builder testBodyWithQueryParamsRequestBuilder(@javax.annotat if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + String finalQuery = null; // No longer need to apply auth to query params localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -1193,8 +1125,10 @@ private HttpRequest.Builder testBodyWithQueryParamsRequestBuilder(@javax.annotat if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1263,14 +1197,15 @@ public ApiResponse testClientModelWithHttpInfo(@javax.annotation.Nonnull private HttpRequest.Builder testClientModelRequestBuilder(@javax.annotation.Nonnull Client client) throws ApiException { // verify the required parameter 'client' is set if (client == null) { - throw new ApiException(400, "Missing the required parameter 'client' when calling testClientModel"); + throw new ApiException(400, "Missing the required parameter 'client' when calling testClientModel" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/fake"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -1289,8 +1224,10 @@ private HttpRequest.Builder testClientModelRequestBuilder(@javax.annotation.Nonn if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1377,26 +1314,30 @@ public ApiResponse testEndpointParametersWithHttpInfo(@javax.annotation.No private HttpRequest.Builder testEndpointParametersRequestBuilder(@javax.annotation.Nonnull BigDecimal number, @javax.annotation.Nonnull Double _double, @javax.annotation.Nonnull String patternWithoutDelimiter, @javax.annotation.Nonnull byte[] _byte, @javax.annotation.Nullable Integer integer, @javax.annotation.Nullable Integer int32, @javax.annotation.Nullable Long int64, @javax.annotation.Nullable Float _float, @javax.annotation.Nullable String string, @javax.annotation.Nullable File binary, @javax.annotation.Nullable LocalDate date, @javax.annotation.Nullable OffsetDateTime dateTime, @javax.annotation.Nullable String password, @javax.annotation.Nullable String paramCallback) throws ApiException { // verify the required parameter 'number' is set if (number == null) { - throw new ApiException(400, "Missing the required parameter 'number' when calling testEndpointParameters"); + throw new ApiException(400, "Missing the required parameter 'number' when calling testEndpointParameters" + ); } // verify the required parameter '_double' is set if (_double == null) { - throw new ApiException(400, "Missing the required parameter '_double' when calling testEndpointParameters"); + throw new ApiException(400, "Missing the required parameter '_double' when calling testEndpointParameters" + ); } // verify the required parameter 'patternWithoutDelimiter' is set if (patternWithoutDelimiter == null) { - throw new ApiException(400, "Missing the required parameter 'patternWithoutDelimiter' when calling testEndpointParameters"); + throw new ApiException(400, "Missing the required parameter 'patternWithoutDelimiter' when calling testEndpointParameters" + ); } // verify the required parameter '_byte' is set if (_byte == null) { - throw new ApiException(400, "Missing the required parameter '_byte' when calling testEndpointParameters"); + throw new ApiException(400, "Missing the required parameter '_byte' when calling testEndpointParameters" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/fake"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -1462,8 +1403,10 @@ private HttpRequest.Builder testEndpointParametersRequestBuilder(@javax.annotati if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1559,10 +1502,10 @@ private HttpRequest.Builder testEnumParametersRequestBuilder(@javax.annotation.N if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + String finalQuery = null; // No longer need to apply auth to query params localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -1601,8 +1544,10 @@ private HttpRequest.Builder testEnumParametersRequestBuilder(@javax.annotation.N if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1712,15 +1657,18 @@ public ApiResponse testGroupParametersWithHttpInfo(@javax.annotation.Nonnu private HttpRequest.Builder testGroupParametersRequestBuilder(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group, @javax.annotation.Nullable Integer stringGroup, @javax.annotation.Nullable Boolean booleanGroup, @javax.annotation.Nullable Long int64Group) throws ApiException { // verify the required parameter 'requiredStringGroup' is set if (requiredStringGroup == null) { - throw new ApiException(400, "Missing the required parameter 'requiredStringGroup' when calling testGroupParameters"); + throw new ApiException(400, "Missing the required parameter 'requiredStringGroup' when calling testGroupParameters" + ); } // verify the required parameter 'requiredBooleanGroup' is set if (requiredBooleanGroup == null) { - throw new ApiException(400, "Missing the required parameter 'requiredBooleanGroup' when calling testGroupParameters"); + throw new ApiException(400, "Missing the required parameter 'requiredBooleanGroup' when calling testGroupParameters" + ); } // verify the required parameter 'requiredInt64Group' is set if (requiredInt64Group == null) { - throw new ApiException(400, "Missing the required parameter 'requiredInt64Group' when calling testGroupParameters"); + throw new ApiException(400, "Missing the required parameter 'requiredInt64Group' when calling testGroupParameters" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -1745,10 +1693,10 @@ private HttpRequest.Builder testGroupParametersRequestBuilder(@javax.annotation. if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + String finalQuery = null; // No longer need to apply auth to query params localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -1768,8 +1716,10 @@ private HttpRequest.Builder testGroupParametersRequestBuilder(@javax.annotation. if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1919,14 +1869,15 @@ public ApiResponse testInlineAdditionalPropertiesWithHttpInfo(@javax.annot private HttpRequest.Builder testInlineAdditionalPropertiesRequestBuilder(@javax.annotation.Nonnull Map requestBody) throws ApiException { // verify the required parameter 'requestBody' is set if (requestBody == null) { - throw new ApiException(400, "Missing the required parameter 'requestBody' when calling testInlineAdditionalProperties"); + throw new ApiException(400, "Missing the required parameter 'requestBody' when calling testInlineAdditionalProperties" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/fake/inline-additionalProperties"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -1945,8 +1896,10 @@ private HttpRequest.Builder testInlineAdditionalPropertiesRequestBuilder(@javax. if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -2007,14 +1960,15 @@ public ApiResponse testInlineFreeformAdditionalPropertiesWithHttpInfo(@jav private HttpRequest.Builder testInlineFreeformAdditionalPropertiesRequestBuilder(@javax.annotation.Nonnull TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest) throws ApiException { // verify the required parameter 'testInlineFreeformAdditionalPropertiesRequest' is set if (testInlineFreeformAdditionalPropertiesRequest == null) { - throw new ApiException(400, "Missing the required parameter 'testInlineFreeformAdditionalPropertiesRequest' when calling testInlineFreeformAdditionalProperties"); + throw new ApiException(400, "Missing the required parameter 'testInlineFreeformAdditionalPropertiesRequest' when calling testInlineFreeformAdditionalProperties" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/fake/inline-freeform-additionalProperties"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -2033,8 +1987,10 @@ private HttpRequest.Builder testInlineFreeformAdditionalPropertiesRequestBuilder if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -2097,18 +2053,20 @@ public ApiResponse testJsonFormDataWithHttpInfo(@javax.annotation.Nonnull private HttpRequest.Builder testJsonFormDataRequestBuilder(@javax.annotation.Nonnull String param, @javax.annotation.Nonnull String param2) throws ApiException { // verify the required parameter 'param' is set if (param == null) { - throw new ApiException(400, "Missing the required parameter 'param' when calling testJsonFormData"); + throw new ApiException(400, "Missing the required parameter 'param' when calling testJsonFormData" + ); } // verify the required parameter 'param2' is set if (param2 == null) { - throw new ApiException(400, "Missing the required parameter 'param2' when calling testJsonFormData"); + throw new ApiException(400, "Missing the required parameter 'param2' when calling testJsonFormData" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/fake/jsonFormData"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -2138,8 +2096,10 @@ private HttpRequest.Builder testJsonFormDataRequestBuilder(@javax.annotation.Non if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -2208,23 +2168,28 @@ public ApiResponse testQueryParameterCollectionFormatWithHttpInfo(@javax.a private HttpRequest.Builder testQueryParameterCollectionFormatRequestBuilder(@javax.annotation.Nonnull List pipe, @javax.annotation.Nonnull List ioutil, @javax.annotation.Nonnull List http, @javax.annotation.Nonnull List url, @javax.annotation.Nonnull List context) throws ApiException { // verify the required parameter 'pipe' is set if (pipe == null) { - throw new ApiException(400, "Missing the required parameter 'pipe' when calling testQueryParameterCollectionFormat"); + throw new ApiException(400, "Missing the required parameter 'pipe' when calling testQueryParameterCollectionFormat" + ); } // verify the required parameter 'ioutil' is set if (ioutil == null) { - throw new ApiException(400, "Missing the required parameter 'ioutil' when calling testQueryParameterCollectionFormat"); + throw new ApiException(400, "Missing the required parameter 'ioutil' when calling testQueryParameterCollectionFormat" + ); } // verify the required parameter 'http' is set if (http == null) { - throw new ApiException(400, "Missing the required parameter 'http' when calling testQueryParameterCollectionFormat"); + throw new ApiException(400, "Missing the required parameter 'http' when calling testQueryParameterCollectionFormat" + ); } // verify the required parameter 'url' is set if (url == null) { - throw new ApiException(400, "Missing the required parameter 'url' when calling testQueryParameterCollectionFormat"); + throw new ApiException(400, "Missing the required parameter 'url' when calling testQueryParameterCollectionFormat" + ); } // verify the required parameter 'context' is set if (context == null) { - throw new ApiException(400, "Missing the required parameter 'context' when calling testQueryParameterCollectionFormat"); + throw new ApiException(400, "Missing the required parameter 'context' when calling testQueryParameterCollectionFormat" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -2251,10 +2216,10 @@ private HttpRequest.Builder testQueryParameterCollectionFormatRequestBuilder(@ja if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + String finalQuery = null; // No longer need to apply auth to query params localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -2268,8 +2233,10 @@ private HttpRequest.Builder testQueryParameterCollectionFormatRequestBuilder(@ja if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -2330,14 +2297,15 @@ public ApiResponse testStringMapReferenceWithHttpInfo(@javax.annotation.No private HttpRequest.Builder testStringMapReferenceRequestBuilder(@javax.annotation.Nonnull Map requestBody) throws ApiException { // verify the required parameter 'requestBody' is set if (requestBody == null) { - throw new ApiException(400, "Missing the required parameter 'requestBody' when calling testStringMapReference"); + throw new ApiException(400, "Missing the required parameter 'requestBody' when calling testStringMapReference" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/fake/stringMap-reference"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -2356,8 +2324,10 @@ private HttpRequest.Builder testStringMapReferenceRequestBuilder(@javax.annotati if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java index 7cfe721c7913..0395541d9169 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -61,19 +61,8 @@ public class FakeClassnameTags123Api { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; - // Per-API Bearer authentication - private String bearerToken; - - // Per-API Basic authentication - private String username; - private String password; - - // Per-API API key authentication - private String apiKey; - private String apiKeyPrefix; - - // Per-API OAuth authentication - private String accessToken; + // Custom headers to be sent with every request from this API client + private final Map extraHeaders = new java.util.HashMap<>(); public FakeClassnameTags123Api() { this(Configuration.getDefaultApiClient()); @@ -90,107 +79,26 @@ public FakeClassnameTags123Api(ApiClient apiClient) { } /** - * Helper method to set access token for Bearer authentication. - * @param bearerToken Bearer token - * @return FakeClassnameTags123Api - */ - public FakeClassnameTags123Api setBearerToken(String bearerToken) { - this.bearerToken = bearerToken; - return this; - } - - /** - * Helper method to set username for HTTP basic authentication. - * @param username Username - * @return FakeClassnameTags123Api - */ - public FakeClassnameTags123Api setUsername(String username) { - this.username = username; - return this; - } - - /** - * Helper method to set password for HTTP basic authentication. - * @param password Password - * @return FakeClassnameTags123Api - */ - public FakeClassnameTags123Api setPassword(String password) { - this.password = password; - return this; - } - - /** - * Helper method to set API key value for API key authentication. - * @param apiKey API key - * @return FakeClassnameTags123Api - */ - public FakeClassnameTags123Api setApiKey(String apiKey) { - this.apiKey = apiKey; - return this; - } - - /** - * Helper method to set API key prefix for API key authentication. - * @param apiKeyPrefix API key prefix - * @return FakeClassnameTags123Api + * Add a custom header to be sent with every request from this API client. + * @param name Header name + * @param value Header value + * @return this */ - public FakeClassnameTags123Api setApiKeyPrefix(String apiKeyPrefix) { - this.apiKeyPrefix = apiKeyPrefix; + public FakeClassnameTags123Api addHeader(String name, String value) { + this.extraHeaders.put(name, value); return this; } /** - * Helper method to set access token for OAuth2 authentication. - * @param accessToken Access token - * @return FakeClassnameTags123Api + * Remove a custom header. + * @param name Header name + * @return this */ - public FakeClassnameTags123Api setAccessToken(String accessToken) { - this.accessToken = accessToken; + public FakeClassnameTags123Api removeHeader(String name) { + this.extraHeaders.remove(name); return this; } - /** - * Apply authentication settings directly to request headers. - * This avoids modifying the shared ApiClient's authentication state. - */ - private void applyAuthToHeaders(HttpRequest.Builder localVarRequestBuilder) { - if (bearerToken != null) { - localVarRequestBuilder.header("Authorization", "Bearer " + bearerToken); - } - if (username != null && password != null) { - String credentials = java.util.Base64.getEncoder().encodeToString((username + ":" + password).getBytes()); - localVarRequestBuilder.header("Authorization", "Basic " + credentials); - } - if (apiKey != null) { - - String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; - localVarRequestBuilder.header("api_key", keyValue); - - } - if (accessToken != null) { - localVarRequestBuilder.header("Authorization", "Bearer " + accessToken); - } - } - - /** - * Apply authentication settings directly to query parameters. - * This avoids modifying the shared ApiClient's authentication state. - */ - private String applyAuthToQueryParams(String queryString) { - if (apiKey != null) { - - String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; - String authParam = "api_key_query=" + keyValue; - if (queryString != null && !queryString.isEmpty()) { - return queryString + "&" + authParam; - } else { - return authParam; - } - - } - return queryString; - } - protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { String body = response.body() == null ? null : new String(response.body().readAllBytes()); @@ -267,14 +175,15 @@ public ApiResponse testClassnameWithHttpInfo(@javax.annotation.Nonnull C private HttpRequest.Builder testClassnameRequestBuilder(@javax.annotation.Nonnull Client client) throws ApiException { // verify the required parameter 'client' is set if (client == null) { - throw new ApiException(400, "Missing the required parameter 'client' when calling testClassname"); + throw new ApiException(400, "Missing the required parameter 'client' when calling testClassname" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/fake_classname_test"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -293,8 +202,10 @@ private HttpRequest.Builder testClassnameRequestBuilder(@javax.annotation.Nonnul if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/PetApi.java index ebe228b6255a..f7e6691637f7 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/PetApi.java @@ -63,19 +63,8 @@ public class PetApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; - // Per-API Bearer authentication - private String bearerToken; - - // Per-API Basic authentication - private String username; - private String password; - - // Per-API API key authentication - private String apiKey; - private String apiKeyPrefix; - - // Per-API OAuth authentication - private String accessToken; + // Custom headers to be sent with every request from this API client + private final Map extraHeaders = new java.util.HashMap<>(); public PetApi() { this(Configuration.getDefaultApiClient()); @@ -92,107 +81,26 @@ public PetApi(ApiClient apiClient) { } /** - * Helper method to set access token for Bearer authentication. - * @param bearerToken Bearer token - * @return PetApi + * Add a custom header to be sent with every request from this API client. + * @param name Header name + * @param value Header value + * @return this */ - public PetApi setBearerToken(String bearerToken) { - this.bearerToken = bearerToken; + public PetApi addHeader(String name, String value) { + this.extraHeaders.put(name, value); return this; } /** - * Helper method to set username for HTTP basic authentication. - * @param username Username - * @return PetApi + * Remove a custom header. + * @param name Header name + * @return this */ - public PetApi setUsername(String username) { - this.username = username; + public PetApi removeHeader(String name) { + this.extraHeaders.remove(name); return this; } - /** - * Helper method to set password for HTTP basic authentication. - * @param password Password - * @return PetApi - */ - public PetApi setPassword(String password) { - this.password = password; - return this; - } - - /** - * Helper method to set API key value for API key authentication. - * @param apiKey API key - * @return PetApi - */ - public PetApi setApiKey(String apiKey) { - this.apiKey = apiKey; - return this; - } - - /** - * Helper method to set API key prefix for API key authentication. - * @param apiKeyPrefix API key prefix - * @return PetApi - */ - public PetApi setApiKeyPrefix(String apiKeyPrefix) { - this.apiKeyPrefix = apiKeyPrefix; - return this; - } - - /** - * Helper method to set access token for OAuth2 authentication. - * @param accessToken Access token - * @return PetApi - */ - public PetApi setAccessToken(String accessToken) { - this.accessToken = accessToken; - return this; - } - - /** - * Apply authentication settings directly to request headers. - * This avoids modifying the shared ApiClient's authentication state. - */ - private void applyAuthToHeaders(HttpRequest.Builder localVarRequestBuilder) { - if (bearerToken != null) { - localVarRequestBuilder.header("Authorization", "Bearer " + bearerToken); - } - if (username != null && password != null) { - String credentials = java.util.Base64.getEncoder().encodeToString((username + ":" + password).getBytes()); - localVarRequestBuilder.header("Authorization", "Basic " + credentials); - } - if (apiKey != null) { - - String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; - localVarRequestBuilder.header("api_key", keyValue); - - } - if (accessToken != null) { - localVarRequestBuilder.header("Authorization", "Bearer " + accessToken); - } - } - - /** - * Apply authentication settings directly to query parameters. - * This avoids modifying the shared ApiClient's authentication state. - */ - private String applyAuthToQueryParams(String queryString) { - if (apiKey != null) { - - String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; - String authParam = "api_key_query=" + keyValue; - if (queryString != null && !queryString.isEmpty()) { - return queryString + "&" + authParam; - } else { - return authParam; - } - - } - return queryString; - } - protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { String body = response.body() == null ? null : new String(response.body().readAllBytes()); @@ -261,14 +169,15 @@ public ApiResponse addPetWithHttpInfo(@javax.annotation.Nonnull Pet pet) t private HttpRequest.Builder addPetRequestBuilder(@javax.annotation.Nonnull Pet pet) throws ApiException { // verify the required parameter 'pet' is set if (pet == null) { - throw new ApiException(400, "Missing the required parameter 'pet' when calling addPet"); + throw new ApiException(400, "Missing the required parameter 'pet' when calling addPet" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/pet"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -287,8 +196,10 @@ private HttpRequest.Builder addPetRequestBuilder(@javax.annotation.Nonnull Pet p if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -351,7 +262,8 @@ public ApiResponse deletePetWithHttpInfo(@javax.annotation.Nonnull Long pe private HttpRequest.Builder deletePetRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling deletePet"); + throw new ApiException(400, "Missing the required parameter 'petId' when calling deletePet" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -359,7 +271,7 @@ private HttpRequest.Builder deletePetRequestBuilder(@javax.annotation.Nonnull Lo String localVarPath = "/pet/{petId}" .replace("{petId}", ApiClient.urlEncode(petId.toString())); - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -375,8 +287,10 @@ private HttpRequest.Builder deletePetRequestBuilder(@javax.annotation.Nonnull Lo if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -445,7 +359,8 @@ public ApiResponse> findPetsByStatusWithHttpInfo(@javax.annotation.Non private HttpRequest.Builder findPetsByStatusRequestBuilder(@javax.annotation.Nonnull List status) throws ApiException { // verify the required parameter 'status' is set if (status == null) { - throw new ApiException(400, "Missing the required parameter 'status' when calling findPetsByStatus"); + throw new ApiException(400, "Missing the required parameter 'status' when calling findPetsByStatus" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -464,10 +379,10 @@ private HttpRequest.Builder findPetsByStatusRequestBuilder(@javax.annotation.Non if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + String finalQuery = null; // No longer need to apply auth to query params localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -481,8 +396,10 @@ private HttpRequest.Builder findPetsByStatusRequestBuilder(@javax.annotation.Non if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -555,7 +472,8 @@ public ApiResponse> findPetsByTagsWithHttpInfo(@javax.annotation.Nonnu private HttpRequest.Builder findPetsByTagsRequestBuilder(@javax.annotation.Nonnull List tags) throws ApiException { // verify the required parameter 'tags' is set if (tags == null) { - throw new ApiException(400, "Missing the required parameter 'tags' when calling findPetsByTags"); + throw new ApiException(400, "Missing the required parameter 'tags' when calling findPetsByTags" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -574,10 +492,10 @@ private HttpRequest.Builder findPetsByTagsRequestBuilder(@javax.annotation.Nonnu if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + String finalQuery = null; // No longer need to apply auth to query params localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -591,8 +509,10 @@ private HttpRequest.Builder findPetsByTagsRequestBuilder(@javax.annotation.Nonnu if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -661,7 +581,8 @@ public ApiResponse getPetByIdWithHttpInfo(@javax.annotation.Nonnull Long pe private HttpRequest.Builder getPetByIdRequestBuilder(@javax.annotation.Nonnull Long petId) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetById"); + throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetById" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -669,7 +590,7 @@ private HttpRequest.Builder getPetByIdRequestBuilder(@javax.annotation.Nonnull L String localVarPath = "/pet/{petId}" .replace("{petId}", ApiClient.urlEncode(petId.toString())); - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -682,8 +603,10 @@ private HttpRequest.Builder getPetByIdRequestBuilder(@javax.annotation.Nonnull L if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -744,14 +667,15 @@ public ApiResponse updatePetWithHttpInfo(@javax.annotation.Nonnull Pet pet private HttpRequest.Builder updatePetRequestBuilder(@javax.annotation.Nonnull Pet pet) throws ApiException { // verify the required parameter 'pet' is set if (pet == null) { - throw new ApiException(400, "Missing the required parameter 'pet' when calling updatePet"); + throw new ApiException(400, "Missing the required parameter 'pet' when calling updatePet" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/pet"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -770,8 +694,10 @@ private HttpRequest.Builder updatePetRequestBuilder(@javax.annotation.Nonnull Pe if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -836,7 +762,8 @@ public ApiResponse updatePetWithFormWithHttpInfo(@javax.annotation.Nonnull private HttpRequest.Builder updatePetWithFormRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling updatePetWithForm"); + throw new ApiException(400, "Missing the required parameter 'petId' when calling updatePetWithForm" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -844,7 +771,7 @@ private HttpRequest.Builder updatePetWithFormRequestBuilder(@javax.annotation.No String localVarPath = "/pet/{petId}" .replace("{petId}", ApiClient.urlEncode(petId.toString())); - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -874,8 +801,10 @@ private HttpRequest.Builder updatePetWithFormRequestBuilder(@javax.annotation.No if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -948,7 +877,8 @@ public ApiResponse uploadFileWithHttpInfo(@javax.annotation.No private HttpRequest.Builder uploadFileRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFile"); + throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFile" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -956,7 +886,7 @@ private HttpRequest.Builder uploadFileRequestBuilder(@javax.annotation.Nonnull L String localVarPath = "/pet/{petId}/uploadImage" .replace("{petId}", ApiClient.urlEncode(petId.toString())); - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -1005,8 +935,10 @@ private HttpRequest.Builder uploadFileRequestBuilder(@javax.annotation.Nonnull L if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1079,11 +1011,13 @@ public ApiResponse uploadFileWithRequiredFileWithHttpInfo(@jav private HttpRequest.Builder uploadFileWithRequiredFileRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFileWithRequiredFile"); + throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFileWithRequiredFile" + ); } // verify the required parameter 'requiredFile' is set if (requiredFile == null) { - throw new ApiException(400, "Missing the required parameter 'requiredFile' when calling uploadFileWithRequiredFile"); + throw new ApiException(400, "Missing the required parameter 'requiredFile' when calling uploadFileWithRequiredFile" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -1091,7 +1025,7 @@ private HttpRequest.Builder uploadFileWithRequiredFileRequestBuilder(@javax.anno String localVarPath = "/fake/{petId}/uploadImageWithRequiredFile" .replace("{petId}", ApiClient.urlEncode(petId.toString())); - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -1140,8 +1074,10 @@ private HttpRequest.Builder uploadFileWithRequiredFileRequestBuilder(@javax.anno if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/StoreApi.java index 1045c2c26c54..cb9c17d4a462 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/StoreApi.java @@ -61,19 +61,8 @@ public class StoreApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; - // Per-API Bearer authentication - private String bearerToken; - - // Per-API Basic authentication - private String username; - private String password; - - // Per-API API key authentication - private String apiKey; - private String apiKeyPrefix; - - // Per-API OAuth authentication - private String accessToken; + // Custom headers to be sent with every request from this API client + private final Map extraHeaders = new java.util.HashMap<>(); public StoreApi() { this(Configuration.getDefaultApiClient()); @@ -90,107 +79,26 @@ public StoreApi(ApiClient apiClient) { } /** - * Helper method to set access token for Bearer authentication. - * @param bearerToken Bearer token - * @return StoreApi + * Add a custom header to be sent with every request from this API client. + * @param name Header name + * @param value Header value + * @return this */ - public StoreApi setBearerToken(String bearerToken) { - this.bearerToken = bearerToken; + public StoreApi addHeader(String name, String value) { + this.extraHeaders.put(name, value); return this; } /** - * Helper method to set username for HTTP basic authentication. - * @param username Username - * @return StoreApi + * Remove a custom header. + * @param name Header name + * @return this */ - public StoreApi setUsername(String username) { - this.username = username; + public StoreApi removeHeader(String name) { + this.extraHeaders.remove(name); return this; } - /** - * Helper method to set password for HTTP basic authentication. - * @param password Password - * @return StoreApi - */ - public StoreApi setPassword(String password) { - this.password = password; - return this; - } - - /** - * Helper method to set API key value for API key authentication. - * @param apiKey API key - * @return StoreApi - */ - public StoreApi setApiKey(String apiKey) { - this.apiKey = apiKey; - return this; - } - - /** - * Helper method to set API key prefix for API key authentication. - * @param apiKeyPrefix API key prefix - * @return StoreApi - */ - public StoreApi setApiKeyPrefix(String apiKeyPrefix) { - this.apiKeyPrefix = apiKeyPrefix; - return this; - } - - /** - * Helper method to set access token for OAuth2 authentication. - * @param accessToken Access token - * @return StoreApi - */ - public StoreApi setAccessToken(String accessToken) { - this.accessToken = accessToken; - return this; - } - - /** - * Apply authentication settings directly to request headers. - * This avoids modifying the shared ApiClient's authentication state. - */ - private void applyAuthToHeaders(HttpRequest.Builder localVarRequestBuilder) { - if (bearerToken != null) { - localVarRequestBuilder.header("Authorization", "Bearer " + bearerToken); - } - if (username != null && password != null) { - String credentials = java.util.Base64.getEncoder().encodeToString((username + ":" + password).getBytes()); - localVarRequestBuilder.header("Authorization", "Basic " + credentials); - } - if (apiKey != null) { - - String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; - localVarRequestBuilder.header("api_key", keyValue); - - } - if (accessToken != null) { - localVarRequestBuilder.header("Authorization", "Bearer " + accessToken); - } - } - - /** - * Apply authentication settings directly to query parameters. - * This avoids modifying the shared ApiClient's authentication state. - */ - private String applyAuthToQueryParams(String queryString) { - if (apiKey != null) { - - String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; - String authParam = "api_key_query=" + keyValue; - if (queryString != null && !queryString.isEmpty()) { - return queryString + "&" + authParam; - } else { - return authParam; - } - - } - return queryString; - } - protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { String body = response.body() == null ? null : new String(response.body().readAllBytes()); @@ -259,7 +167,8 @@ public ApiResponse deleteOrderWithHttpInfo(@javax.annotation.Nonnull Strin private HttpRequest.Builder deleteOrderRequestBuilder(@javax.annotation.Nonnull String orderId) throws ApiException { // verify the required parameter 'orderId' is set if (orderId == null) { - throw new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder"); + throw new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -267,7 +176,7 @@ private HttpRequest.Builder deleteOrderRequestBuilder(@javax.annotation.Nonnull String localVarPath = "/store/order/{order_id}" .replace("{order_id}", ApiClient.urlEncode(orderId.toString())); - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -280,8 +189,10 @@ private HttpRequest.Builder deleteOrderRequestBuilder(@javax.annotation.Nonnull if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -351,7 +262,7 @@ private HttpRequest.Builder getInventoryRequestBuilder() throws ApiException { String localVarPath = "/store/inventory"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -364,8 +275,10 @@ private HttpRequest.Builder getInventoryRequestBuilder() throws ApiException { if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -434,7 +347,8 @@ public ApiResponse getOrderByIdWithHttpInfo(@javax.annotation.Nonnull Lon private HttpRequest.Builder getOrderByIdRequestBuilder(@javax.annotation.Nonnull Long orderId) throws ApiException { // verify the required parameter 'orderId' is set if (orderId == null) { - throw new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById"); + throw new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -442,7 +356,7 @@ private HttpRequest.Builder getOrderByIdRequestBuilder(@javax.annotation.Nonnull String localVarPath = "/store/order/{order_id}" .replace("{order_id}", ApiClient.urlEncode(orderId.toString())); - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -455,8 +369,10 @@ private HttpRequest.Builder getOrderByIdRequestBuilder(@javax.annotation.Nonnull if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -525,14 +441,15 @@ public ApiResponse placeOrderWithHttpInfo(@javax.annotation.Nonnull Order private HttpRequest.Builder placeOrderRequestBuilder(@javax.annotation.Nonnull Order order) throws ApiException { // verify the required parameter 'order' is set if (order == null) { - throw new ApiException(400, "Missing the required parameter 'order' when calling placeOrder"); + throw new ApiException(400, "Missing the required parameter 'order' when calling placeOrder" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/store/order"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -551,8 +468,10 @@ private HttpRequest.Builder placeOrderRequestBuilder(@javax.annotation.Nonnull O if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/UserApi.java index 93dc69f27b73..b96034434b0d 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/UserApi.java @@ -62,19 +62,8 @@ public class UserApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; - // Per-API Bearer authentication - private String bearerToken; - - // Per-API Basic authentication - private String username; - private String password; - - // Per-API API key authentication - private String apiKey; - private String apiKeyPrefix; - - // Per-API OAuth authentication - private String accessToken; + // Custom headers to be sent with every request from this API client + private final Map extraHeaders = new java.util.HashMap<>(); public UserApi() { this(Configuration.getDefaultApiClient()); @@ -91,107 +80,26 @@ public UserApi(ApiClient apiClient) { } /** - * Helper method to set access token for Bearer authentication. - * @param bearerToken Bearer token - * @return UserApi - */ - public UserApi setBearerToken(String bearerToken) { - this.bearerToken = bearerToken; - return this; - } - - /** - * Helper method to set username for HTTP basic authentication. - * @param username Username - * @return UserApi - */ - public UserApi setUsername(String username) { - this.username = username; - return this; - } - - /** - * Helper method to set password for HTTP basic authentication. - * @param password Password - * @return UserApi - */ - public UserApi setPassword(String password) { - this.password = password; - return this; - } - - /** - * Helper method to set API key value for API key authentication. - * @param apiKey API key - * @return UserApi - */ - public UserApi setApiKey(String apiKey) { - this.apiKey = apiKey; - return this; - } - - /** - * Helper method to set API key prefix for API key authentication. - * @param apiKeyPrefix API key prefix - * @return UserApi + * Add a custom header to be sent with every request from this API client. + * @param name Header name + * @param value Header value + * @return this */ - public UserApi setApiKeyPrefix(String apiKeyPrefix) { - this.apiKeyPrefix = apiKeyPrefix; + public UserApi addHeader(String name, String value) { + this.extraHeaders.put(name, value); return this; } /** - * Helper method to set access token for OAuth2 authentication. - * @param accessToken Access token - * @return UserApi + * Remove a custom header. + * @param name Header name + * @return this */ - public UserApi setAccessToken(String accessToken) { - this.accessToken = accessToken; + public UserApi removeHeader(String name) { + this.extraHeaders.remove(name); return this; } - /** - * Apply authentication settings directly to request headers. - * This avoids modifying the shared ApiClient's authentication state. - */ - private void applyAuthToHeaders(HttpRequest.Builder localVarRequestBuilder) { - if (bearerToken != null) { - localVarRequestBuilder.header("Authorization", "Bearer " + bearerToken); - } - if (username != null && password != null) { - String credentials = java.util.Base64.getEncoder().encodeToString((username + ":" + password).getBytes()); - localVarRequestBuilder.header("Authorization", "Basic " + credentials); - } - if (apiKey != null) { - - String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; - localVarRequestBuilder.header("api_key", keyValue); - - } - if (accessToken != null) { - localVarRequestBuilder.header("Authorization", "Bearer " + accessToken); - } - } - - /** - * Apply authentication settings directly to query parameters. - * This avoids modifying the shared ApiClient's authentication state. - */ - private String applyAuthToQueryParams(String queryString) { - if (apiKey != null) { - - String keyValue = apiKeyPrefix != null ? apiKeyPrefix + " " + apiKey : apiKey; - String authParam = "api_key_query=" + keyValue; - if (queryString != null && !queryString.isEmpty()) { - return queryString + "&" + authParam; - } else { - return authParam; - } - - } - return queryString; - } - protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { String body = response.body() == null ? null : new String(response.body().readAllBytes()); @@ -260,14 +168,15 @@ public ApiResponse createUserWithHttpInfo(@javax.annotation.Nonnull User u private HttpRequest.Builder createUserRequestBuilder(@javax.annotation.Nonnull User user) throws ApiException { // verify the required parameter 'user' is set if (user == null) { - throw new ApiException(400, "Missing the required parameter 'user' when calling createUser"); + throw new ApiException(400, "Missing the required parameter 'user' when calling createUser" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/user"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -286,8 +195,10 @@ private HttpRequest.Builder createUserRequestBuilder(@javax.annotation.Nonnull U if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -348,14 +259,15 @@ public ApiResponse createUsersWithArrayInputWithHttpInfo(@javax.annotation private HttpRequest.Builder createUsersWithArrayInputRequestBuilder(@javax.annotation.Nonnull List user) throws ApiException { // verify the required parameter 'user' is set if (user == null) { - throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithArrayInput"); + throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithArrayInput" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/user/createWithArray"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -374,8 +286,10 @@ private HttpRequest.Builder createUsersWithArrayInputRequestBuilder(@javax.annot if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -436,14 +350,15 @@ public ApiResponse createUsersWithListInputWithHttpInfo(@javax.annotation. private HttpRequest.Builder createUsersWithListInputRequestBuilder(@javax.annotation.Nonnull List user) throws ApiException { // verify the required parameter 'user' is set if (user == null) { - throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithListInput"); + throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithListInput" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/user/createWithList"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -462,8 +377,10 @@ private HttpRequest.Builder createUsersWithListInputRequestBuilder(@javax.annota if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -524,7 +441,8 @@ public ApiResponse deleteUserWithHttpInfo(@javax.annotation.Nonnull String private HttpRequest.Builder deleteUserRequestBuilder(@javax.annotation.Nonnull String username) throws ApiException { // verify the required parameter 'username' is set if (username == null) { - throw new ApiException(400, "Missing the required parameter 'username' when calling deleteUser"); + throw new ApiException(400, "Missing the required parameter 'username' when calling deleteUser" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -532,7 +450,7 @@ private HttpRequest.Builder deleteUserRequestBuilder(@javax.annotation.Nonnull S String localVarPath = "/user/{username}" .replace("{username}", ApiClient.urlEncode(username.toString())); - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -545,8 +463,10 @@ private HttpRequest.Builder deleteUserRequestBuilder(@javax.annotation.Nonnull S if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -615,7 +535,8 @@ public ApiResponse getUserByNameWithHttpInfo(@javax.annotation.Nonnull Str private HttpRequest.Builder getUserByNameRequestBuilder(@javax.annotation.Nonnull String username) throws ApiException { // verify the required parameter 'username' is set if (username == null) { - throw new ApiException(400, "Missing the required parameter 'username' when calling getUserByName"); + throw new ApiException(400, "Missing the required parameter 'username' when calling getUserByName" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -623,7 +544,7 @@ private HttpRequest.Builder getUserByNameRequestBuilder(@javax.annotation.Nonnul String localVarPath = "/user/{username}" .replace("{username}", ApiClient.urlEncode(username.toString())); - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -636,8 +557,10 @@ private HttpRequest.Builder getUserByNameRequestBuilder(@javax.annotation.Nonnul if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -708,11 +631,13 @@ public ApiResponse loginUserWithHttpInfo(@javax.annotation.Nonnull Strin private HttpRequest.Builder loginUserRequestBuilder(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException { // verify the required parameter 'username' is set if (username == null) { - throw new ApiException(400, "Missing the required parameter 'username' when calling loginUser"); + throw new ApiException(400, "Missing the required parameter 'username' when calling loginUser" + ); } // verify the required parameter 'password' is set if (password == null) { - throw new ApiException(400, "Missing the required parameter 'password' when calling loginUser"); + throw new ApiException(400, "Missing the required parameter 'password' when calling loginUser" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -733,10 +658,10 @@ private HttpRequest.Builder loginUserRequestBuilder(@javax.annotation.Nonnull St if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = applyAuthToQueryParams(queryJoiner.toString()); + String finalQuery = null; // No longer need to apply auth to query params localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); } else { - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -750,8 +675,10 @@ private HttpRequest.Builder loginUserRequestBuilder(@javax.annotation.Nonnull St if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -813,7 +740,7 @@ private HttpRequest.Builder logoutUserRequestBuilder() throws ApiException { String localVarPath = "/user/logout"; - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -826,8 +753,10 @@ private HttpRequest.Builder logoutUserRequestBuilder() throws ApiException { if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -890,11 +819,13 @@ public ApiResponse updateUserWithHttpInfo(@javax.annotation.Nonnull String private HttpRequest.Builder updateUserRequestBuilder(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user) throws ApiException { // verify the required parameter 'username' is set if (username == null) { - throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser"); + throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser" + ); } // verify the required parameter 'user' is set if (user == null) { - throw new ApiException(400, "Missing the required parameter 'user' when calling updateUser"); + throw new ApiException(400, "Missing the required parameter 'user' when calling updateUser" + ); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -902,7 +833,7 @@ private HttpRequest.Builder updateUserRequestBuilder(@javax.annotation.Nonnull S String localVarPath = "/user/{username}" .replace("{username}", ApiClient.urlEncode(username.toString())); - String authQuery = applyAuthToQueryParams(null); + String authQuery = null; // No longer need to apply auth to query params if (authQuery != null && !authQuery.isEmpty()) { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); } else { @@ -921,8 +852,10 @@ private HttpRequest.Builder updateUserRequestBuilder(@javax.annotation.Nonnull S if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Apply per-API authentication directly to the request - applyAuthToHeaders(localVarRequestBuilder); + // Add custom headers + for (Map.Entry entry : extraHeaders.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } From 5919c23bbe0e53fc2cba8ac035045887890a77c3 Mon Sep 17 00:00:00 2001 From: Ilya Nemtsev Date: Mon, 7 Jul 2025 16:53:36 +0700 Subject: [PATCH 09/17] further cleanup --- .../Java/libraries/native/api.mustache | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/native/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/native/api.mustache index db9c5ab7b520..e39fba69bb01 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/native/api.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/native/api.mustache @@ -465,24 +465,14 @@ public class {{classname}} { if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = null; // No longer need to apply auth to query params - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); + String queryString = queryJoiner.toString(); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryString)); } else { - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); } {{/hasQueryParams}} {{^hasQueryParams}} - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); {{/hasQueryParams}} {{#headerParams}} From c2b745e0d5426618bb80bc17d38545642c54188c Mon Sep 17 00:00:00 2001 From: Ilya Nemtsev Date: Mon, 7 Jul 2025 16:57:09 +0700 Subject: [PATCH 10/17] code style --- .../src/main/resources/Java/libraries/native/api.mustache | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/native/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/native/api.mustache index e39fba69bb01..ddacba25fc1c 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/native/api.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/native/api.mustache @@ -394,8 +394,7 @@ public class {{classname}} { {{#required}} // verify the required parameter '{{paramName}}' is set if ({{paramName}} == null) { - throw new ApiException(400, "Missing the required parameter '{{paramName}}' when calling {{operationId}}" - ); + throw new ApiException(400, "Missing the required parameter '{{paramName}}' when calling {{operationId}}"); } {{/required}} {{/allParams}} @@ -465,8 +464,7 @@ public class {{classname}} { if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String queryString = queryJoiner.toString(); - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryString)); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); } else { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); } From e6e570c5117cb6551e0c07d92a70322a8f71268b Mon Sep 17 00:00:00 2001 From: Ilya Nemtsev Date: Mon, 7 Jul 2025 18:42:38 +0700 Subject: [PATCH 11/17] regenerated samples --- .../org/openapitools/client/api/AuthApi.java | 14 +- .../org/openapitools/client/api/BodyApi.java | 73 +----- .../org/openapitools/client/api/FormApi.java | 24 +- .../openapitools/client/api/HeaderApi.java | 7 +- .../org/openapitools/client/api/PathApi.java | 19 +- .../org/openapitools/client/api/QueryApi.java | 100 ++------ .../client/api/AnotherFakeApi.java | 10 +- .../openapitools/client/api/DefaultApi.java | 7 +- .../org/openapitools/client/api/FakeApi.java | 218 ++++-------------- .../client/api/FakeClassnameTags123Api.java | 10 +- .../org/openapitools/client/api/PetApi.java | 99 ++------ .../org/openapitools/client/api/StoreApi.java | 37 +-- .../org/openapitools/client/api/UserApi.java | 86 ++----- .../org/openapitools/client/api/PetApi.java | 86 ++----- .../org/openapitools/client/api/StoreApi.java | 37 +-- .../org/openapitools/client/api/UserApi.java | 86 ++----- .../client/api/AnotherFakeApi.java | 10 +- .../openapitools/client/api/DefaultApi.java | 7 +- .../org/openapitools/client/api/FakeApi.java | 218 ++++-------------- .../client/api/FakeClassnameTags123Api.java | 10 +- .../org/openapitools/client/api/PetApi.java | 99 ++------ .../org/openapitools/client/api/StoreApi.java | 37 +-- .../org/openapitools/client/api/UserApi.java | 86 ++----- 23 files changed, 280 insertions(+), 1100 deletions(-) diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/AuthApi.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/AuthApi.java index 985bb1de0c35..674e1ea5e5f3 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/AuthApi.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/AuthApi.java @@ -166,12 +166,7 @@ private HttpRequest.Builder testAuthHttpBasicRequestBuilder() throws ApiExceptio String localVarPath = "/auth/http/basic"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "text/plain"); @@ -249,12 +244,7 @@ private HttpRequest.Builder testAuthHttpBearerRequestBuilder() throws ApiExcepti String localVarPath = "/auth/http/bearer"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "text/plain"); diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/BodyApi.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/BodyApi.java index 6ff0fd5ebf48..e64fe5d80827 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/BodyApi.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/BodyApi.java @@ -179,12 +179,7 @@ private HttpRequest.Builder testBinaryGifRequestBuilder() throws ApiException { String localVarPath = "/binary/gif"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "image/gif"); @@ -264,12 +259,7 @@ private HttpRequest.Builder testBodyApplicationOctetstreamBinaryRequestBuilder(@ String localVarPath = "/body/application/octetstream/binary"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/octet-stream"); localVarRequestBuilder.header("Accept", "text/plain"); @@ -352,20 +342,14 @@ public ApiResponse testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(@j private HttpRequest.Builder testBodyMultipartFormdataArrayOfBinaryRequestBuilder(@javax.annotation.Nonnull List files) throws ApiException { // verify the required parameter 'files' is set if (files == null) { - throw new ApiException(400, "Missing the required parameter 'files' when calling testBodyMultipartFormdataArrayOfBinary" - ); + throw new ApiException(400, "Missing the required parameter 'files' when calling testBodyMultipartFormdataArrayOfBinary"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/body/application/octetstream/array_of_binary"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "text/plain"); @@ -480,12 +464,7 @@ private HttpRequest.Builder testBodyMultipartFormdataSingleBinaryRequestBuilder( String localVarPath = "/body/application/octetstream/single_binary"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "text/plain"); @@ -601,12 +580,7 @@ private HttpRequest.Builder testEchoBodyAllOfPetRequestBuilder(@javax.annotation String localVarPath = "/echo/body/allOf/Pet"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -692,12 +666,7 @@ private HttpRequest.Builder testEchoBodyFreeFormObjectResponseStringRequestBuild String localVarPath = "/echo/body/FreeFormObject/response_string"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "text/plain"); @@ -786,12 +755,7 @@ private HttpRequest.Builder testEchoBodyPetRequestBuilder(@javax.annotation.Null String localVarPath = "/echo/body/Pet"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -877,12 +841,7 @@ private HttpRequest.Builder testEchoBodyPetResponseStringRequestBuilder(@javax.a String localVarPath = "/echo/body/Pet/response_string"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "text/plain"); @@ -971,12 +930,7 @@ private HttpRequest.Builder testEchoBodyStringEnumRequestBuilder(@javax.annotati String localVarPath = "/echo/body/string_enum"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -1062,12 +1016,7 @@ private HttpRequest.Builder testEchoBodyTagResponseStringRequestBuilder(@javax.a String localVarPath = "/echo/body/Tag/response_string"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "text/plain"); diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/FormApi.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/FormApi.java index 206d173a91be..26a57cc38d17 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/FormApi.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/FormApi.java @@ -179,12 +179,7 @@ private HttpRequest.Builder testFormIntegerBooleanStringRequestBuilder(@javax.an String localVarPath = "/form/integer/boolean/string"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "text/plain"); @@ -281,20 +276,14 @@ public ApiResponse testFormObjectMultipartWithHttpInfo(@javax.annotation private HttpRequest.Builder testFormObjectMultipartRequestBuilder(@javax.annotation.Nonnull TestFormObjectMultipartRequestMarker marker) throws ApiException { // verify the required parameter 'marker' is set if (marker == null) { - throw new ApiException(400, "Missing the required parameter 'marker' when calling testFormObjectMultipart" - ); + throw new ApiException(400, "Missing the required parameter 'marker' when calling testFormObjectMultipart"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/form/object/multipart"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "text/plain"); @@ -418,12 +407,7 @@ private HttpRequest.Builder testFormOneofRequestBuilder(@javax.annotation.Nullab String localVarPath = "/form/oneof"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "text/plain"); diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/HeaderApi.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/HeaderApi.java index ff4132803b9c..621787e95569 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/HeaderApi.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/HeaderApi.java @@ -183,12 +183,7 @@ private HttpRequest.Builder testHeaderIntegerBooleanStringEnumsRequestBuilder(@j String localVarPath = "/header/integer/boolean/string/enums"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); if (integerHeader != null) { localVarRequestBuilder.header("integer_header", integerHeader.toString()); diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/PathApi.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/PathApi.java index d507415be641..bde709bc6132 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/PathApi.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/PathApi.java @@ -178,23 +178,19 @@ public ApiResponse testsPathStringPathStringIntegerPathIntegerEnumNonref private HttpRequest.Builder testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathRequestBuilder(@javax.annotation.Nonnull String pathString, @javax.annotation.Nonnull Integer pathInteger, @javax.annotation.Nonnull String enumNonrefStringPath, @javax.annotation.Nonnull StringEnumRef enumRefStringPath) throws ApiException { // verify the required parameter 'pathString' is set if (pathString == null) { - throw new ApiException(400, "Missing the required parameter 'pathString' when calling testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath" - ); + throw new ApiException(400, "Missing the required parameter 'pathString' when calling testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath"); } // verify the required parameter 'pathInteger' is set if (pathInteger == null) { - throw new ApiException(400, "Missing the required parameter 'pathInteger' when calling testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath" - ); + throw new ApiException(400, "Missing the required parameter 'pathInteger' when calling testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath"); } // verify the required parameter 'enumNonrefStringPath' is set if (enumNonrefStringPath == null) { - throw new ApiException(400, "Missing the required parameter 'enumNonrefStringPath' when calling testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath" - ); + throw new ApiException(400, "Missing the required parameter 'enumNonrefStringPath' when calling testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath"); } // verify the required parameter 'enumRefStringPath' is set if (enumRefStringPath == null) { - throw new ApiException(400, "Missing the required parameter 'enumRefStringPath' when calling testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath" - ); + throw new ApiException(400, "Missing the required parameter 'enumRefStringPath' when calling testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -205,12 +201,7 @@ private HttpRequest.Builder testsPathStringPathStringIntegerPathIntegerEnumNonre .replace("{enum_nonref_string_path}", ApiClient.urlEncode(enumNonrefStringPath.toString())) .replace("{enum_ref_string_path}", ApiClient.urlEncode(enumRefStringPath.toString())); - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "text/plain"); diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/QueryApi.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/QueryApi.java index c57b73a42a9e..5f6c25dc7674 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/QueryApi.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/QueryApi.java @@ -197,15 +197,9 @@ private HttpRequest.Builder testEnumRefStringRequestBuilder(@javax.annotation.Nu if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = null; // No longer need to apply auth to query params - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); } else { - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); } localVarRequestBuilder.header("Accept", "text/plain"); @@ -306,15 +300,9 @@ private HttpRequest.Builder testQueryDatetimeDateStringRequestBuilder(@javax.ann if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = null; // No longer need to apply auth to query params - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); } else { - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); } localVarRequestBuilder.header("Accept", "text/plain"); @@ -415,15 +403,9 @@ private HttpRequest.Builder testQueryIntegerBooleanStringRequestBuilder(@javax.a if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = null; // No longer need to apply auth to query params - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); } else { - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); } localVarRequestBuilder.header("Accept", "text/plain"); @@ -521,15 +503,9 @@ private HttpRequest.Builder testQueryStyleDeepObjectExplodeTrueObjectRequestBuil if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = null; // No longer need to apply auth to query params - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); } else { - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); } localVarRequestBuilder.header("Accept", "text/plain"); @@ -627,15 +603,9 @@ private HttpRequest.Builder testQueryStyleDeepObjectExplodeTrueObjectAllOfReques if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = null; // No longer need to apply auth to query params - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); } else { - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); } localVarRequestBuilder.header("Accept", "text/plain"); @@ -728,15 +698,9 @@ private HttpRequest.Builder testQueryStyleFormExplodeFalseArrayIntegerRequestBui if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = null; // No longer need to apply auth to query params - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); } else { - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); } localVarRequestBuilder.header("Accept", "text/plain"); @@ -829,15 +793,9 @@ private HttpRequest.Builder testQueryStyleFormExplodeFalseArrayStringRequestBuil if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = null; // No longer need to apply auth to query params - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); } else { - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); } localVarRequestBuilder.header("Accept", "text/plain"); @@ -930,15 +888,9 @@ private HttpRequest.Builder testQueryStyleFormExplodeTrueArrayStringRequestBuild if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = null; // No longer need to apply auth to query params - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); } else { - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); } localVarRequestBuilder.header("Accept", "text/plain"); @@ -1036,15 +988,9 @@ private HttpRequest.Builder testQueryStyleFormExplodeTrueObjectRequestBuilder(@j if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = null; // No longer need to apply auth to query params - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); } else { - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); } localVarRequestBuilder.header("Accept", "text/plain"); @@ -1137,15 +1083,9 @@ private HttpRequest.Builder testQueryStyleFormExplodeTrueObjectAllOfRequestBuild if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = null; // No longer need to apply auth to query params - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); } else { - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); } localVarRequestBuilder.header("Accept", "text/plain"); diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/AnotherFakeApi.java index 6d8cb399b9cc..32c9e06780d5 100644 --- a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/AnotherFakeApi.java +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -180,20 +180,14 @@ public CompletableFuture> call123testSpecialTagsWithHttpInfo private HttpRequest.Builder call123testSpecialTagsRequestBuilder(@javax.annotation.Nonnull Client client) throws ApiException { // verify the required parameter 'client' is set if (client == null) { - throw new ApiException(400, "Missing the required parameter 'client' when calling call123testSpecialTags" - ); + throw new ApiException(400, "Missing the required parameter 'client' when calling call123testSpecialTags"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/another-fake/dummy"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/DefaultApi.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/DefaultApi.java index f96f737fe2b2..8728718237bf 100644 --- a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/DefaultApi.java +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/DefaultApi.java @@ -181,12 +181,7 @@ private HttpRequest.Builder fooGetRequestBuilder() throws ApiException { String localVarPath = "/foo"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "application/json"); diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeApi.java index 9e02107bba57..c96d7cceac7a 100644 --- a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeApi.java @@ -198,12 +198,7 @@ private HttpRequest.Builder fakeBigDecimalMapRequestBuilder() throws ApiExceptio String localVarPath = "/fake/BigDecimalMap"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "*/*"); @@ -294,12 +289,7 @@ private HttpRequest.Builder fakeHealthGetRequestBuilder() throws ApiException { String localVarPath = "/fake/health"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "application/json"); @@ -392,12 +382,7 @@ private HttpRequest.Builder fakeOuterBooleanSerializeRequestBuilder(@javax.annot String localVarPath = "/fake/outer/boolean"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "*/*"); @@ -496,12 +481,7 @@ private HttpRequest.Builder fakeOuterCompositeSerializeRequestBuilder(@javax.ann String localVarPath = "/fake/outer/composite"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "*/*"); @@ -600,12 +580,7 @@ private HttpRequest.Builder fakeOuterNumberSerializeRequestBuilder(@javax.annota String localVarPath = "/fake/outer/number"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "*/*"); @@ -704,12 +679,7 @@ private HttpRequest.Builder fakeOuterStringSerializeRequestBuilder(@javax.annota String localVarPath = "/fake/outer/string"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "*/*"); @@ -801,12 +771,7 @@ private HttpRequest.Builder getApplicationJsonUtf8RequestBuilder() throws ApiExc String localVarPath = "/fake/application_json_utf8"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "application/json;charset=utf-8"); @@ -897,12 +862,7 @@ private HttpRequest.Builder getArrayOfEnumsRequestBuilder() throws ApiException String localVarPath = "/fake/array-of-enums"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "application/json"); @@ -977,20 +937,14 @@ public CompletableFuture> testAdditionalPropertiesReferenceWit private HttpRequest.Builder testAdditionalPropertiesReferenceRequestBuilder(@javax.annotation.Nonnull Map requestBody) throws ApiException { // verify the required parameter 'requestBody' is set if (requestBody == null) { - throw new ApiException(400, "Missing the required parameter 'requestBody' when calling testAdditionalPropertiesReference" - ); + throw new ApiException(400, "Missing the required parameter 'requestBody' when calling testAdditionalPropertiesReference"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/fake/additionalProperties-reference"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -1071,20 +1025,14 @@ public CompletableFuture> testBodyWithFileSchemaWithHttpInfo(@ private HttpRequest.Builder testBodyWithFileSchemaRequestBuilder(@javax.annotation.Nonnull FileSchemaTestClass fileSchemaTestClass) throws ApiException { // verify the required parameter 'fileSchemaTestClass' is set if (fileSchemaTestClass == null) { - throw new ApiException(400, "Missing the required parameter 'fileSchemaTestClass' when calling testBodyWithFileSchema" - ); + throw new ApiException(400, "Missing the required parameter 'fileSchemaTestClass' when calling testBodyWithFileSchema"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/fake/body-with-file-schema"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -1167,13 +1115,11 @@ public CompletableFuture> testBodyWithQueryParamsWithHttpInfo( private HttpRequest.Builder testBodyWithQueryParamsRequestBuilder(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull User user) throws ApiException { // verify the required parameter 'query' is set if (query == null) { - throw new ApiException(400, "Missing the required parameter 'query' when calling testBodyWithQueryParams" - ); + throw new ApiException(400, "Missing the required parameter 'query' when calling testBodyWithQueryParams"); } // verify the required parameter 'user' is set if (user == null) { - throw new ApiException(400, "Missing the required parameter 'user' when calling testBodyWithQueryParams" - ); + throw new ApiException(400, "Missing the required parameter 'user' when calling testBodyWithQueryParams"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -1192,15 +1138,9 @@ private HttpRequest.Builder testBodyWithQueryParamsRequestBuilder(@javax.annotat if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = null; // No longer need to apply auth to query params - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); } else { - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); } localVarRequestBuilder.header("Content-Type", "application/json"); @@ -1297,20 +1237,14 @@ public CompletableFuture> testClientModelWithHttpInfo(@javax private HttpRequest.Builder testClientModelRequestBuilder(@javax.annotation.Nonnull Client client) throws ApiException { // verify the required parameter 'client' is set if (client == null) { - throw new ApiException(400, "Missing the required parameter 'client' when calling testClientModel" - ); + throw new ApiException(400, "Missing the required parameter 'client' when calling testClientModel"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/fake"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -1417,35 +1351,26 @@ public CompletableFuture> testEndpointParametersWithHttpInfo(@ private HttpRequest.Builder testEndpointParametersRequestBuilder(@javax.annotation.Nonnull BigDecimal number, @javax.annotation.Nonnull Double _double, @javax.annotation.Nonnull String patternWithoutDelimiter, @javax.annotation.Nonnull byte[] _byte, @javax.annotation.Nullable Integer integer, @javax.annotation.Nullable Integer int32, @javax.annotation.Nullable Long int64, @javax.annotation.Nullable Float _float, @javax.annotation.Nullable String string, @javax.annotation.Nullable File binary, @javax.annotation.Nullable LocalDate date, @javax.annotation.Nullable OffsetDateTime dateTime, @javax.annotation.Nullable String password, @javax.annotation.Nullable String paramCallback) throws ApiException { // verify the required parameter 'number' is set if (number == null) { - throw new ApiException(400, "Missing the required parameter 'number' when calling testEndpointParameters" - ); + throw new ApiException(400, "Missing the required parameter 'number' when calling testEndpointParameters"); } // verify the required parameter '_double' is set if (_double == null) { - throw new ApiException(400, "Missing the required parameter '_double' when calling testEndpointParameters" - ); + throw new ApiException(400, "Missing the required parameter '_double' when calling testEndpointParameters"); } // verify the required parameter 'patternWithoutDelimiter' is set if (patternWithoutDelimiter == null) { - throw new ApiException(400, "Missing the required parameter 'patternWithoutDelimiter' when calling testEndpointParameters" - ); + throw new ApiException(400, "Missing the required parameter 'patternWithoutDelimiter' when calling testEndpointParameters"); } // verify the required parameter '_byte' is set if (_byte == null) { - throw new ApiException(400, "Missing the required parameter '_byte' when calling testEndpointParameters" - ); + throw new ApiException(400, "Missing the required parameter '_byte' when calling testEndpointParameters"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/fake"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "application/json"); @@ -1608,15 +1533,9 @@ private HttpRequest.Builder testEnumParametersRequestBuilder(@javax.annotation.N if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = null; // No longer need to apply auth to query params - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); } else { - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); } if (enumHeaderStringArray != null) { @@ -1767,18 +1686,15 @@ public CompletableFuture> testGroupParametersWithHttpInfo(@jav private HttpRequest.Builder testGroupParametersRequestBuilder(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group, @javax.annotation.Nullable Integer stringGroup, @javax.annotation.Nullable Boolean booleanGroup, @javax.annotation.Nullable Long int64Group) throws ApiException { // verify the required parameter 'requiredStringGroup' is set if (requiredStringGroup == null) { - throw new ApiException(400, "Missing the required parameter 'requiredStringGroup' when calling testGroupParameters" - ); + throw new ApiException(400, "Missing the required parameter 'requiredStringGroup' when calling testGroupParameters"); } // verify the required parameter 'requiredBooleanGroup' is set if (requiredBooleanGroup == null) { - throw new ApiException(400, "Missing the required parameter 'requiredBooleanGroup' when calling testGroupParameters" - ); + throw new ApiException(400, "Missing the required parameter 'requiredBooleanGroup' when calling testGroupParameters"); } // verify the required parameter 'requiredInt64Group' is set if (requiredInt64Group == null) { - throw new ApiException(400, "Missing the required parameter 'requiredInt64Group' when calling testGroupParameters" - ); + throw new ApiException(400, "Missing the required parameter 'requiredInt64Group' when calling testGroupParameters"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -1803,15 +1719,9 @@ private HttpRequest.Builder testGroupParametersRequestBuilder(@javax.annotation. if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = null; // No longer need to apply auth to query params - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); } else { - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); } if (requiredBooleanGroup != null) { @@ -1982,20 +1892,14 @@ public CompletableFuture> testInlineAdditionalPropertiesWithHt private HttpRequest.Builder testInlineAdditionalPropertiesRequestBuilder(@javax.annotation.Nonnull Map requestBody) throws ApiException { // verify the required parameter 'requestBody' is set if (requestBody == null) { - throw new ApiException(400, "Missing the required parameter 'requestBody' when calling testInlineAdditionalProperties" - ); + throw new ApiException(400, "Missing the required parameter 'requestBody' when calling testInlineAdditionalProperties"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/fake/inline-additionalProperties"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -2076,20 +1980,14 @@ public CompletableFuture> testInlineFreeformAdditionalProperti private HttpRequest.Builder testInlineFreeformAdditionalPropertiesRequestBuilder(@javax.annotation.Nonnull TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest) throws ApiException { // verify the required parameter 'testInlineFreeformAdditionalPropertiesRequest' is set if (testInlineFreeformAdditionalPropertiesRequest == null) { - throw new ApiException(400, "Missing the required parameter 'testInlineFreeformAdditionalPropertiesRequest' when calling testInlineFreeformAdditionalProperties" - ); + throw new ApiException(400, "Missing the required parameter 'testInlineFreeformAdditionalPropertiesRequest' when calling testInlineFreeformAdditionalProperties"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/fake/inline-freeform-additionalProperties"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -2172,25 +2070,18 @@ public CompletableFuture> testJsonFormDataWithHttpInfo(@javax. private HttpRequest.Builder testJsonFormDataRequestBuilder(@javax.annotation.Nonnull String param, @javax.annotation.Nonnull String param2) throws ApiException { // verify the required parameter 'param' is set if (param == null) { - throw new ApiException(400, "Missing the required parameter 'param' when calling testJsonFormData" - ); + throw new ApiException(400, "Missing the required parameter 'param' when calling testJsonFormData"); } // verify the required parameter 'param2' is set if (param2 == null) { - throw new ApiException(400, "Missing the required parameter 'param2' when calling testJsonFormData" - ); + throw new ApiException(400, "Missing the required parameter 'param2' when calling testJsonFormData"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/fake/jsonFormData"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "application/json"); @@ -2290,28 +2181,23 @@ public CompletableFuture> testQueryParameterCollectionFormatWi private HttpRequest.Builder testQueryParameterCollectionFormatRequestBuilder(@javax.annotation.Nonnull List pipe, @javax.annotation.Nonnull List ioutil, @javax.annotation.Nonnull List http, @javax.annotation.Nonnull List url, @javax.annotation.Nonnull List context) throws ApiException { // verify the required parameter 'pipe' is set if (pipe == null) { - throw new ApiException(400, "Missing the required parameter 'pipe' when calling testQueryParameterCollectionFormat" - ); + throw new ApiException(400, "Missing the required parameter 'pipe' when calling testQueryParameterCollectionFormat"); } // verify the required parameter 'ioutil' is set if (ioutil == null) { - throw new ApiException(400, "Missing the required parameter 'ioutil' when calling testQueryParameterCollectionFormat" - ); + throw new ApiException(400, "Missing the required parameter 'ioutil' when calling testQueryParameterCollectionFormat"); } // verify the required parameter 'http' is set if (http == null) { - throw new ApiException(400, "Missing the required parameter 'http' when calling testQueryParameterCollectionFormat" - ); + throw new ApiException(400, "Missing the required parameter 'http' when calling testQueryParameterCollectionFormat"); } // verify the required parameter 'url' is set if (url == null) { - throw new ApiException(400, "Missing the required parameter 'url' when calling testQueryParameterCollectionFormat" - ); + throw new ApiException(400, "Missing the required parameter 'url' when calling testQueryParameterCollectionFormat"); } // verify the required parameter 'context' is set if (context == null) { - throw new ApiException(400, "Missing the required parameter 'context' when calling testQueryParameterCollectionFormat" - ); + throw new ApiException(400, "Missing the required parameter 'context' when calling testQueryParameterCollectionFormat"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -2338,15 +2224,9 @@ private HttpRequest.Builder testQueryParameterCollectionFormatRequestBuilder(@ja if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = null; // No longer need to apply auth to query params - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); } else { - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); } localVarRequestBuilder.header("Accept", "application/json"); @@ -2422,20 +2302,14 @@ public CompletableFuture> testStringMapReferenceWithHttpInfo(@ private HttpRequest.Builder testStringMapReferenceRequestBuilder(@javax.annotation.Nonnull Map requestBody) throws ApiException { // verify the required parameter 'requestBody' is set if (requestBody == null) { - throw new ApiException(400, "Missing the required parameter 'requestBody' when calling testStringMapReference" - ); + throw new ApiException(400, "Missing the required parameter 'requestBody' when calling testStringMapReference"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/fake/stringMap-reference"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java index 278c2beb6aeb..316a985c7fa5 100644 --- a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -186,20 +186,14 @@ public CompletableFuture> testClassnameWithHttpInfo(@javax.a private HttpRequest.Builder testClassnameRequestBuilder(@javax.annotation.Nonnull Client client) throws ApiException { // verify the required parameter 'client' is set if (client == null) { - throw new ApiException(400, "Missing the required parameter 'client' when calling testClassname" - ); + throw new ApiException(400, "Missing the required parameter 'client' when calling testClassname"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/fake_classname_test"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/PetApi.java index d7542d922d0e..e27c4e7798cf 100644 --- a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/PetApi.java @@ -173,20 +173,14 @@ public CompletableFuture> addPetWithHttpInfo(@javax.annotation private HttpRequest.Builder addPetRequestBuilder(@javax.annotation.Nonnull Pet pet) throws ApiException { // verify the required parameter 'pet' is set if (pet == null) { - throw new ApiException(400, "Missing the required parameter 'pet' when calling addPet" - ); + throw new ApiException(400, "Missing the required parameter 'pet' when calling addPet"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/pet"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -269,8 +263,7 @@ public CompletableFuture> deletePetWithHttpInfo(@javax.annotat private HttpRequest.Builder deletePetRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling deletePet" - ); + throw new ApiException(400, "Missing the required parameter 'petId' when calling deletePet"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -278,12 +271,7 @@ private HttpRequest.Builder deletePetRequestBuilder(@javax.annotation.Nonnull Lo String localVarPath = "/pet/{petId}" .replace("{petId}", ApiClient.urlEncode(petId.toString())); - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); if (apiKey != null) { localVarRequestBuilder.header("api_key", apiKey.toString()); @@ -376,8 +364,7 @@ public CompletableFuture>> findPetsByStatusWithHttpInfo(@j private HttpRequest.Builder findPetsByStatusRequestBuilder(@javax.annotation.Nonnull List status) throws ApiException { // verify the required parameter 'status' is set if (status == null) { - throw new ApiException(400, "Missing the required parameter 'status' when calling findPetsByStatus" - ); + throw new ApiException(400, "Missing the required parameter 'status' when calling findPetsByStatus"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -396,15 +383,9 @@ private HttpRequest.Builder findPetsByStatusRequestBuilder(@javax.annotation.Non if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = null; // No longer need to apply auth to query params - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); } else { - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); } localVarRequestBuilder.header("Accept", "application/xml, application/json"); @@ -499,8 +480,7 @@ public CompletableFuture>> findPetsByTagsWithHttpInfo(@jav private HttpRequest.Builder findPetsByTagsRequestBuilder(@javax.annotation.Nonnull List tags) throws ApiException { // verify the required parameter 'tags' is set if (tags == null) { - throw new ApiException(400, "Missing the required parameter 'tags' when calling findPetsByTags" - ); + throw new ApiException(400, "Missing the required parameter 'tags' when calling findPetsByTags"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -519,15 +499,9 @@ private HttpRequest.Builder findPetsByTagsRequestBuilder(@javax.annotation.Nonnu if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = null; // No longer need to apply auth to query params - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); } else { - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); } localVarRequestBuilder.header("Accept", "application/xml, application/json"); @@ -618,8 +592,7 @@ public CompletableFuture> getPetByIdWithHttpInfo(@javax.annotat private HttpRequest.Builder getPetByIdRequestBuilder(@javax.annotation.Nonnull Long petId) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetById" - ); + throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetById"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -627,12 +600,7 @@ private HttpRequest.Builder getPetByIdRequestBuilder(@javax.annotation.Nonnull L String localVarPath = "/pet/{petId}" .replace("{petId}", ApiClient.urlEncode(petId.toString())); - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "application/xml, application/json"); @@ -707,20 +675,14 @@ public CompletableFuture> updatePetWithHttpInfo(@javax.annotat private HttpRequest.Builder updatePetRequestBuilder(@javax.annotation.Nonnull Pet pet) throws ApiException { // verify the required parameter 'pet' is set if (pet == null) { - throw new ApiException(400, "Missing the required parameter 'pet' when calling updatePet" - ); + throw new ApiException(400, "Missing the required parameter 'pet' when calling updatePet"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/pet"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -805,8 +767,7 @@ public CompletableFuture> updatePetWithFormWithHttpInfo(@javax private HttpRequest.Builder updatePetWithFormRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling updatePetWithForm" - ); + throw new ApiException(400, "Missing the required parameter 'petId' when calling updatePetWithForm"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -814,12 +775,7 @@ private HttpRequest.Builder updatePetWithFormRequestBuilder(@javax.annotation.No String localVarPath = "/pet/{petId}" .replace("{petId}", ApiClient.urlEncode(petId.toString())); - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "application/json"); @@ -930,8 +886,7 @@ public CompletableFuture> uploadFileWithHttpInfo(@ private HttpRequest.Builder uploadFileRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFile" - ); + throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFile"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -939,12 +894,7 @@ private HttpRequest.Builder uploadFileRequestBuilder(@javax.annotation.Nonnull L String localVarPath = "/pet/{petId}/uploadImage" .replace("{petId}", ApiClient.urlEncode(petId.toString())); - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "application/json"); @@ -1074,13 +1024,11 @@ public CompletableFuture> uploadFileWithRequiredFi private HttpRequest.Builder uploadFileWithRequiredFileRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFileWithRequiredFile" - ); + throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFileWithRequiredFile"); } // verify the required parameter 'requiredFile' is set if (requiredFile == null) { - throw new ApiException(400, "Missing the required parameter 'requiredFile' when calling uploadFileWithRequiredFile" - ); + throw new ApiException(400, "Missing the required parameter 'requiredFile' when calling uploadFileWithRequiredFile"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -1088,12 +1036,7 @@ private HttpRequest.Builder uploadFileWithRequiredFileRequestBuilder(@javax.anno String localVarPath = "/fake/{petId}/uploadImageWithRequiredFile" .replace("{petId}", ApiClient.urlEncode(petId.toString())); - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "application/json"); diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/StoreApi.java index 3be0c00099a2..e407ae2a9889 100644 --- a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/StoreApi.java @@ -171,8 +171,7 @@ public CompletableFuture> deleteOrderWithHttpInfo(@javax.annot private HttpRequest.Builder deleteOrderRequestBuilder(@javax.annotation.Nonnull String orderId) throws ApiException { // verify the required parameter 'orderId' is set if (orderId == null) { - throw new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder" - ); + throw new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -180,12 +179,7 @@ private HttpRequest.Builder deleteOrderRequestBuilder(@javax.annotation.Nonnull String localVarPath = "/store/order/{order_id}" .replace("{order_id}", ApiClient.urlEncode(orderId.toString())); - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "application/json"); @@ -276,12 +270,7 @@ private HttpRequest.Builder getInventoryRequestBuilder() throws ApiException { String localVarPath = "/store/inventory"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "application/json"); @@ -371,8 +360,7 @@ public CompletableFuture> getOrderByIdWithHttpInfo(@javax.ann private HttpRequest.Builder getOrderByIdRequestBuilder(@javax.annotation.Nonnull Long orderId) throws ApiException { // verify the required parameter 'orderId' is set if (orderId == null) { - throw new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById" - ); + throw new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -380,12 +368,7 @@ private HttpRequest.Builder getOrderByIdRequestBuilder(@javax.annotation.Nonnull String localVarPath = "/store/order/{order_id}" .replace("{order_id}", ApiClient.urlEncode(orderId.toString())); - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "application/xml, application/json"); @@ -475,20 +458,14 @@ public CompletableFuture> placeOrderWithHttpInfo(@javax.annot private HttpRequest.Builder placeOrderRequestBuilder(@javax.annotation.Nonnull Order order) throws ApiException { // verify the required parameter 'order' is set if (order == null) { - throw new ApiException(400, "Missing the required parameter 'order' when calling placeOrder" - ); + throw new ApiException(400, "Missing the required parameter 'order' when calling placeOrder"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/store/order"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/xml, application/json"); diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/UserApi.java index 45b404334f95..29329fb99225 100644 --- a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/UserApi.java @@ -172,20 +172,14 @@ public CompletableFuture> createUserWithHttpInfo(@javax.annota private HttpRequest.Builder createUserRequestBuilder(@javax.annotation.Nonnull User user) throws ApiException { // verify the required parameter 'user' is set if (user == null) { - throw new ApiException(400, "Missing the required parameter 'user' when calling createUser" - ); + throw new ApiException(400, "Missing the required parameter 'user' when calling createUser"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/user"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -266,20 +260,14 @@ public CompletableFuture> createUsersWithArrayInputWithHttpInf private HttpRequest.Builder createUsersWithArrayInputRequestBuilder(@javax.annotation.Nonnull List user) throws ApiException { // verify the required parameter 'user' is set if (user == null) { - throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithArrayInput" - ); + throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithArrayInput"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/user/createWithArray"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -360,20 +348,14 @@ public CompletableFuture> createUsersWithListInputWithHttpInfo private HttpRequest.Builder createUsersWithListInputRequestBuilder(@javax.annotation.Nonnull List user) throws ApiException { // verify the required parameter 'user' is set if (user == null) { - throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithListInput" - ); + throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithListInput"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/user/createWithList"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -454,8 +436,7 @@ public CompletableFuture> deleteUserWithHttpInfo(@javax.annota private HttpRequest.Builder deleteUserRequestBuilder(@javax.annotation.Nonnull String username) throws ApiException { // verify the required parameter 'username' is set if (username == null) { - throw new ApiException(400, "Missing the required parameter 'username' when calling deleteUser" - ); + throw new ApiException(400, "Missing the required parameter 'username' when calling deleteUser"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -463,12 +444,7 @@ private HttpRequest.Builder deleteUserRequestBuilder(@javax.annotation.Nonnull S String localVarPath = "/user/{username}" .replace("{username}", ApiClient.urlEncode(username.toString())); - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "application/json"); @@ -558,8 +534,7 @@ public CompletableFuture> getUserByNameWithHttpInfo(@javax.ann private HttpRequest.Builder getUserByNameRequestBuilder(@javax.annotation.Nonnull String username) throws ApiException { // verify the required parameter 'username' is set if (username == null) { - throw new ApiException(400, "Missing the required parameter 'username' when calling getUserByName" - ); + throw new ApiException(400, "Missing the required parameter 'username' when calling getUserByName"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -567,12 +542,7 @@ private HttpRequest.Builder getUserByNameRequestBuilder(@javax.annotation.Nonnul String localVarPath = "/user/{username}" .replace("{username}", ApiClient.urlEncode(username.toString())); - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "application/xml, application/json"); @@ -664,13 +634,11 @@ public CompletableFuture> loginUserWithHttpInfo(@javax.annot private HttpRequest.Builder loginUserRequestBuilder(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException { // verify the required parameter 'username' is set if (username == null) { - throw new ApiException(400, "Missing the required parameter 'username' when calling loginUser" - ); + throw new ApiException(400, "Missing the required parameter 'username' when calling loginUser"); } // verify the required parameter 'password' is set if (password == null) { - throw new ApiException(400, "Missing the required parameter 'password' when calling loginUser" - ); + throw new ApiException(400, "Missing the required parameter 'password' when calling loginUser"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -691,15 +659,9 @@ private HttpRequest.Builder loginUserRequestBuilder(@javax.annotation.Nonnull St if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = null; // No longer need to apply auth to query params - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); } else { - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); } localVarRequestBuilder.header("Accept", "application/xml, application/json"); @@ -776,12 +738,7 @@ private HttpRequest.Builder logoutUserRequestBuilder() throws ApiException { String localVarPath = "/user/logout"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "application/json"); @@ -858,13 +815,11 @@ public CompletableFuture> updateUserWithHttpInfo(@javax.annota private HttpRequest.Builder updateUserRequestBuilder(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user) throws ApiException { // verify the required parameter 'username' is set if (username == null) { - throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser" - ); + throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser"); } // verify the required parameter 'user' is set if (user == null) { - throw new ApiException(400, "Missing the required parameter 'user' when calling updateUser" - ); + throw new ApiException(400, "Missing the required parameter 'user' when calling updateUser"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -872,12 +827,7 @@ private HttpRequest.Builder updateUserRequestBuilder(@javax.annotation.Nonnull S String localVarPath = "/user/{username}" .replace("{username}", ApiClient.urlEncode(username.toString())); - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); diff --git a/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/PetApi.java index b62b9f59aa30..0b7e8e0328a6 100644 --- a/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/PetApi.java @@ -177,20 +177,14 @@ public ApiResponse addPetWithHttpInfo(@jakarta.annotation.Nonnull Pet pet) private HttpRequest.Builder addPetRequestBuilder(@jakarta.annotation.Nonnull Pet pet) throws ApiException { // verify the required parameter 'pet' is set if (pet == null) { - throw new ApiException(400, "Missing the required parameter 'pet' when calling addPet" - ); + throw new ApiException(400, "Missing the required parameter 'pet' when calling addPet"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/pet"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/xml, application/json"); @@ -270,8 +264,7 @@ public ApiResponse deletePetWithHttpInfo(@jakarta.annotation.Nonnull Long private HttpRequest.Builder deletePetRequestBuilder(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String apiKey) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling deletePet" - ); + throw new ApiException(400, "Missing the required parameter 'petId' when calling deletePet"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -279,12 +272,7 @@ private HttpRequest.Builder deletePetRequestBuilder(@jakarta.annotation.Nonnull String localVarPath = "/pet/{petId}" .replace("{petId}", ApiClient.urlEncode(petId.toString())); - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); if (apiKey != null) { localVarRequestBuilder.header("api_key", apiKey.toString()); @@ -367,8 +355,7 @@ public ApiResponse> findPetsByStatusWithHttpInfo(@jakarta.annotation.N private HttpRequest.Builder findPetsByStatusRequestBuilder(@jakarta.annotation.Nonnull List status) throws ApiException { // verify the required parameter 'status' is set if (status == null) { - throw new ApiException(400, "Missing the required parameter 'status' when calling findPetsByStatus" - ); + throw new ApiException(400, "Missing the required parameter 'status' when calling findPetsByStatus"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -387,15 +374,9 @@ private HttpRequest.Builder findPetsByStatusRequestBuilder(@jakarta.annotation.N if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = null; // No longer need to apply auth to query params - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); } else { - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); } localVarRequestBuilder.header("Accept", "application/xml, application/json"); @@ -480,8 +461,7 @@ public ApiResponse> findPetsByTagsWithHttpInfo(@jakarta.annotation.Non private HttpRequest.Builder findPetsByTagsRequestBuilder(@jakarta.annotation.Nonnull List tags) throws ApiException { // verify the required parameter 'tags' is set if (tags == null) { - throw new ApiException(400, "Missing the required parameter 'tags' when calling findPetsByTags" - ); + throw new ApiException(400, "Missing the required parameter 'tags' when calling findPetsByTags"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -500,15 +480,9 @@ private HttpRequest.Builder findPetsByTagsRequestBuilder(@jakarta.annotation.Non if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = null; // No longer need to apply auth to query params - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); } else { - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); } localVarRequestBuilder.header("Accept", "application/xml, application/json"); @@ -589,8 +563,7 @@ public ApiResponse getPetByIdWithHttpInfo(@jakarta.annotation.Nonnull Long private HttpRequest.Builder getPetByIdRequestBuilder(@jakarta.annotation.Nonnull Long petId) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetById" - ); + throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetById"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -598,12 +571,7 @@ private HttpRequest.Builder getPetByIdRequestBuilder(@jakarta.annotation.Nonnull String localVarPath = "/pet/{petId}" .replace("{petId}", ApiClient.urlEncode(petId.toString())); - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "application/xml, application/json"); @@ -687,20 +655,14 @@ public ApiResponse updatePetWithHttpInfo(@jakarta.annotation.Nonnull Pet pe private HttpRequest.Builder updatePetRequestBuilder(@jakarta.annotation.Nonnull Pet pet) throws ApiException { // verify the required parameter 'pet' is set if (pet == null) { - throw new ApiException(400, "Missing the required parameter 'pet' when calling updatePet" - ); + throw new ApiException(400, "Missing the required parameter 'pet' when calling updatePet"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/pet"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/xml, application/json"); @@ -782,8 +744,7 @@ public ApiResponse updatePetWithFormWithHttpInfo(@jakarta.annotation.Nonnu private HttpRequest.Builder updatePetWithFormRequestBuilder(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String name, @jakarta.annotation.Nullable String status) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling updatePetWithForm" - ); + throw new ApiException(400, "Missing the required parameter 'petId' when calling updatePetWithForm"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -791,12 +752,7 @@ private HttpRequest.Builder updatePetWithFormRequestBuilder(@jakarta.annotation. String localVarPath = "/pet/{petId}" .replace("{petId}", ApiClient.urlEncode(petId.toString())); - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "application/json"); @@ -897,8 +853,7 @@ public ApiResponse uploadFileWithHttpInfo(@jakarta.annotation. private HttpRequest.Builder uploadFileRequestBuilder(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String additionalMetadata, @jakarta.annotation.Nullable File _file) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFile" - ); + throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFile"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -906,12 +861,7 @@ private HttpRequest.Builder uploadFileRequestBuilder(@jakarta.annotation.Nonnull String localVarPath = "/pet/{petId}/uploadImage" .replace("{petId}", ApiClient.urlEncode(petId.toString())); - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "application/json"); diff --git a/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/StoreApi.java index 0b9cf2632a16..39e63a2bfd55 100644 --- a/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/StoreApi.java @@ -167,8 +167,7 @@ public ApiResponse deleteOrderWithHttpInfo(@jakarta.annotation.Nonnull Str private HttpRequest.Builder deleteOrderRequestBuilder(@jakarta.annotation.Nonnull String orderId) throws ApiException { // verify the required parameter 'orderId' is set if (orderId == null) { - throw new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder" - ); + throw new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -176,12 +175,7 @@ private HttpRequest.Builder deleteOrderRequestBuilder(@jakarta.annotation.Nonnul String localVarPath = "/store/order/{orderId}" .replace("{orderId}", ApiClient.urlEncode(orderId.toString())); - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "application/json"); @@ -262,12 +256,7 @@ private HttpRequest.Builder getInventoryRequestBuilder() throws ApiException { String localVarPath = "/store/inventory"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "application/json"); @@ -347,8 +336,7 @@ public ApiResponse getOrderByIdWithHttpInfo(@jakarta.annotation.Nonnull L private HttpRequest.Builder getOrderByIdRequestBuilder(@jakarta.annotation.Nonnull Long orderId) throws ApiException { // verify the required parameter 'orderId' is set if (orderId == null) { - throw new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById" - ); + throw new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -356,12 +344,7 @@ private HttpRequest.Builder getOrderByIdRequestBuilder(@jakarta.annotation.Nonnu String localVarPath = "/store/order/{orderId}" .replace("{orderId}", ApiClient.urlEncode(orderId.toString())); - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "application/xml, application/json"); @@ -441,20 +424,14 @@ public ApiResponse placeOrderWithHttpInfo(@jakarta.annotation.Nonnull Ord private HttpRequest.Builder placeOrderRequestBuilder(@jakarta.annotation.Nonnull Order order) throws ApiException { // verify the required parameter 'order' is set if (order == null) { - throw new ApiException(400, "Missing the required parameter 'order' when calling placeOrder" - ); + throw new ApiException(400, "Missing the required parameter 'order' when calling placeOrder"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/store/order"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/xml, application/json"); diff --git a/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/UserApi.java index 6c05aa4e40bd..a2ddf7ab8727 100644 --- a/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/UserApi.java @@ -168,20 +168,14 @@ public ApiResponse createUserWithHttpInfo(@jakarta.annotation.Nonnull User private HttpRequest.Builder createUserRequestBuilder(@jakarta.annotation.Nonnull User user) throws ApiException { // verify the required parameter 'user' is set if (user == null) { - throw new ApiException(400, "Missing the required parameter 'user' when calling createUser" - ); + throw new ApiException(400, "Missing the required parameter 'user' when calling createUser"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/user"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -259,20 +253,14 @@ public ApiResponse createUsersWithArrayInputWithHttpInfo(@jakarta.annotati private HttpRequest.Builder createUsersWithArrayInputRequestBuilder(@jakarta.annotation.Nonnull List user) throws ApiException { // verify the required parameter 'user' is set if (user == null) { - throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithArrayInput" - ); + throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithArrayInput"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/user/createWithArray"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -350,20 +338,14 @@ public ApiResponse createUsersWithListInputWithHttpInfo(@jakarta.annotatio private HttpRequest.Builder createUsersWithListInputRequestBuilder(@jakarta.annotation.Nonnull List user) throws ApiException { // verify the required parameter 'user' is set if (user == null) { - throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithListInput" - ); + throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithListInput"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/user/createWithList"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -441,8 +423,7 @@ public ApiResponse deleteUserWithHttpInfo(@jakarta.annotation.Nonnull Stri private HttpRequest.Builder deleteUserRequestBuilder(@jakarta.annotation.Nonnull String username) throws ApiException { // verify the required parameter 'username' is set if (username == null) { - throw new ApiException(400, "Missing the required parameter 'username' when calling deleteUser" - ); + throw new ApiException(400, "Missing the required parameter 'username' when calling deleteUser"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -450,12 +431,7 @@ private HttpRequest.Builder deleteUserRequestBuilder(@jakarta.annotation.Nonnull String localVarPath = "/user/{username}" .replace("{username}", ApiClient.urlEncode(username.toString())); - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "application/json"); @@ -535,8 +511,7 @@ public ApiResponse getUserByNameWithHttpInfo(@jakarta.annotation.Nonnull S private HttpRequest.Builder getUserByNameRequestBuilder(@jakarta.annotation.Nonnull String username) throws ApiException { // verify the required parameter 'username' is set if (username == null) { - throw new ApiException(400, "Missing the required parameter 'username' when calling getUserByName" - ); + throw new ApiException(400, "Missing the required parameter 'username' when calling getUserByName"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -544,12 +519,7 @@ private HttpRequest.Builder getUserByNameRequestBuilder(@jakarta.annotation.Nonn String localVarPath = "/user/{username}" .replace("{username}", ApiClient.urlEncode(username.toString())); - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "application/xml, application/json"); @@ -631,13 +601,11 @@ public ApiResponse loginUserWithHttpInfo(@jakarta.annotation.Nonnull Str private HttpRequest.Builder loginUserRequestBuilder(@jakarta.annotation.Nonnull String username, @jakarta.annotation.Nonnull String password) throws ApiException { // verify the required parameter 'username' is set if (username == null) { - throw new ApiException(400, "Missing the required parameter 'username' when calling loginUser" - ); + throw new ApiException(400, "Missing the required parameter 'username' when calling loginUser"); } // verify the required parameter 'password' is set if (password == null) { - throw new ApiException(400, "Missing the required parameter 'password' when calling loginUser" - ); + throw new ApiException(400, "Missing the required parameter 'password' when calling loginUser"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -658,15 +626,9 @@ private HttpRequest.Builder loginUserRequestBuilder(@jakarta.annotation.Nonnull if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = null; // No longer need to apply auth to query params - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); } else { - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); } localVarRequestBuilder.header("Accept", "application/xml, application/json"); @@ -740,12 +702,7 @@ private HttpRequest.Builder logoutUserRequestBuilder() throws ApiException { String localVarPath = "/user/logout"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "application/json"); @@ -819,13 +776,11 @@ public ApiResponse updateUserWithHttpInfo(@jakarta.annotation.Nonnull Stri private HttpRequest.Builder updateUserRequestBuilder(@jakarta.annotation.Nonnull String username, @jakarta.annotation.Nonnull User user) throws ApiException { // verify the required parameter 'username' is set if (username == null) { - throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser" - ); + throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser"); } // verify the required parameter 'user' is set if (user == null) { - throw new ApiException(400, "Missing the required parameter 'user' when calling updateUser" - ); + throw new ApiException(400, "Missing the required parameter 'user' when calling updateUser"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -833,12 +788,7 @@ private HttpRequest.Builder updateUserRequestBuilder(@jakarta.annotation.Nonnull String localVarPath = "/user/{username}" .replace("{username}", ApiClient.urlEncode(username.toString())); - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/AnotherFakeApi.java index 54b3b3017c76..6693c39e4b3e 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/AnotherFakeApi.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -169,20 +169,14 @@ public ApiResponse call123testSpecialTagsWithHttpInfo(@javax.annotation. private HttpRequest.Builder call123testSpecialTagsRequestBuilder(@javax.annotation.Nonnull Client client) throws ApiException { // verify the required parameter 'client' is set if (client == null) { - throw new ApiException(400, "Missing the required parameter 'client' when calling call123testSpecialTags" - ); + throw new ApiException(400, "Missing the required parameter 'client' when calling call123testSpecialTags"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/another-fake/dummy"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/DefaultApi.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/DefaultApi.java index 6abfc00d126e..6abf340a6872 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/DefaultApi.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/DefaultApi.java @@ -170,12 +170,7 @@ private HttpRequest.Builder fooGetRequestBuilder() throws ApiException { String localVarPath = "/foo"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "application/json"); diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeApi.java index 3cb8867924b5..ddc79c79929d 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeApi.java @@ -187,12 +187,7 @@ private HttpRequest.Builder fakeBigDecimalMapRequestBuilder() throws ApiExceptio String localVarPath = "/fake/BigDecimalMap"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "*/*"); @@ -273,12 +268,7 @@ private HttpRequest.Builder fakeHealthGetRequestBuilder() throws ApiException { String localVarPath = "/fake/health"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "application/json"); @@ -361,12 +351,7 @@ private HttpRequest.Builder fakeOuterBooleanSerializeRequestBuilder(@javax.annot String localVarPath = "/fake/outer/boolean"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "*/*"); @@ -455,12 +440,7 @@ private HttpRequest.Builder fakeOuterCompositeSerializeRequestBuilder(@javax.ann String localVarPath = "/fake/outer/composite"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "*/*"); @@ -549,12 +529,7 @@ private HttpRequest.Builder fakeOuterNumberSerializeRequestBuilder(@javax.annota String localVarPath = "/fake/outer/number"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "*/*"); @@ -643,12 +618,7 @@ private HttpRequest.Builder fakeOuterStringSerializeRequestBuilder(@javax.annota String localVarPath = "/fake/outer/string"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "*/*"); @@ -730,12 +700,7 @@ private HttpRequest.Builder getApplicationJsonUtf8RequestBuilder() throws ApiExc String localVarPath = "/fake/application_json_utf8"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "application/json;charset=utf-8"); @@ -816,12 +781,7 @@ private HttpRequest.Builder getArrayOfEnumsRequestBuilder() throws ApiException String localVarPath = "/fake/array-of-enums"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "application/json"); @@ -893,20 +853,14 @@ public ApiResponse testAdditionalPropertiesReferenceWithHttpInfo(@javax.an private HttpRequest.Builder testAdditionalPropertiesReferenceRequestBuilder(@javax.annotation.Nonnull Map requestBody) throws ApiException { // verify the required parameter 'requestBody' is set if (requestBody == null) { - throw new ApiException(400, "Missing the required parameter 'requestBody' when calling testAdditionalPropertiesReference" - ); + throw new ApiException(400, "Missing the required parameter 'requestBody' when calling testAdditionalPropertiesReference"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/fake/additionalProperties-reference"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -984,20 +938,14 @@ public ApiResponse testBodyWithFileSchemaWithHttpInfo(@javax.annotation.No private HttpRequest.Builder testBodyWithFileSchemaRequestBuilder(@javax.annotation.Nonnull FileSchemaTestClass fileSchemaTestClass) throws ApiException { // verify the required parameter 'fileSchemaTestClass' is set if (fileSchemaTestClass == null) { - throw new ApiException(400, "Missing the required parameter 'fileSchemaTestClass' when calling testBodyWithFileSchema" - ); + throw new ApiException(400, "Missing the required parameter 'fileSchemaTestClass' when calling testBodyWithFileSchema"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/fake/body-with-file-schema"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -1077,13 +1025,11 @@ public ApiResponse testBodyWithQueryParamsWithHttpInfo(@javax.annotation.N private HttpRequest.Builder testBodyWithQueryParamsRequestBuilder(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull User user) throws ApiException { // verify the required parameter 'query' is set if (query == null) { - throw new ApiException(400, "Missing the required parameter 'query' when calling testBodyWithQueryParams" - ); + throw new ApiException(400, "Missing the required parameter 'query' when calling testBodyWithQueryParams"); } // verify the required parameter 'user' is set if (user == null) { - throw new ApiException(400, "Missing the required parameter 'user' when calling testBodyWithQueryParams" - ); + throw new ApiException(400, "Missing the required parameter 'user' when calling testBodyWithQueryParams"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -1102,15 +1048,9 @@ private HttpRequest.Builder testBodyWithQueryParamsRequestBuilder(@javax.annotat if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = null; // No longer need to apply auth to query params - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); } else { - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); } localVarRequestBuilder.header("Content-Type", "application/json"); @@ -1197,20 +1137,14 @@ public ApiResponse testClientModelWithHttpInfo(@javax.annotation.Nonnull private HttpRequest.Builder testClientModelRequestBuilder(@javax.annotation.Nonnull Client client) throws ApiException { // verify the required parameter 'client' is set if (client == null) { - throw new ApiException(400, "Missing the required parameter 'client' when calling testClientModel" - ); + throw new ApiException(400, "Missing the required parameter 'client' when calling testClientModel"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/fake"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -1314,35 +1248,26 @@ public ApiResponse testEndpointParametersWithHttpInfo(@javax.annotation.No private HttpRequest.Builder testEndpointParametersRequestBuilder(@javax.annotation.Nonnull BigDecimal number, @javax.annotation.Nonnull Double _double, @javax.annotation.Nonnull String patternWithoutDelimiter, @javax.annotation.Nonnull byte[] _byte, @javax.annotation.Nullable Integer integer, @javax.annotation.Nullable Integer int32, @javax.annotation.Nullable Long int64, @javax.annotation.Nullable Float _float, @javax.annotation.Nullable String string, @javax.annotation.Nullable File binary, @javax.annotation.Nullable LocalDate date, @javax.annotation.Nullable OffsetDateTime dateTime, @javax.annotation.Nullable String password, @javax.annotation.Nullable String paramCallback) throws ApiException { // verify the required parameter 'number' is set if (number == null) { - throw new ApiException(400, "Missing the required parameter 'number' when calling testEndpointParameters" - ); + throw new ApiException(400, "Missing the required parameter 'number' when calling testEndpointParameters"); } // verify the required parameter '_double' is set if (_double == null) { - throw new ApiException(400, "Missing the required parameter '_double' when calling testEndpointParameters" - ); + throw new ApiException(400, "Missing the required parameter '_double' when calling testEndpointParameters"); } // verify the required parameter 'patternWithoutDelimiter' is set if (patternWithoutDelimiter == null) { - throw new ApiException(400, "Missing the required parameter 'patternWithoutDelimiter' when calling testEndpointParameters" - ); + throw new ApiException(400, "Missing the required parameter 'patternWithoutDelimiter' when calling testEndpointParameters"); } // verify the required parameter '_byte' is set if (_byte == null) { - throw new ApiException(400, "Missing the required parameter '_byte' when calling testEndpointParameters" - ); + throw new ApiException(400, "Missing the required parameter '_byte' when calling testEndpointParameters"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/fake"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "application/json"); @@ -1502,15 +1427,9 @@ private HttpRequest.Builder testEnumParametersRequestBuilder(@javax.annotation.N if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = null; // No longer need to apply auth to query params - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); } else { - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); } if (enumHeaderStringArray != null) { @@ -1657,18 +1576,15 @@ public ApiResponse testGroupParametersWithHttpInfo(@javax.annotation.Nonnu private HttpRequest.Builder testGroupParametersRequestBuilder(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group, @javax.annotation.Nullable Integer stringGroup, @javax.annotation.Nullable Boolean booleanGroup, @javax.annotation.Nullable Long int64Group) throws ApiException { // verify the required parameter 'requiredStringGroup' is set if (requiredStringGroup == null) { - throw new ApiException(400, "Missing the required parameter 'requiredStringGroup' when calling testGroupParameters" - ); + throw new ApiException(400, "Missing the required parameter 'requiredStringGroup' when calling testGroupParameters"); } // verify the required parameter 'requiredBooleanGroup' is set if (requiredBooleanGroup == null) { - throw new ApiException(400, "Missing the required parameter 'requiredBooleanGroup' when calling testGroupParameters" - ); + throw new ApiException(400, "Missing the required parameter 'requiredBooleanGroup' when calling testGroupParameters"); } // verify the required parameter 'requiredInt64Group' is set if (requiredInt64Group == null) { - throw new ApiException(400, "Missing the required parameter 'requiredInt64Group' when calling testGroupParameters" - ); + throw new ApiException(400, "Missing the required parameter 'requiredInt64Group' when calling testGroupParameters"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -1693,15 +1609,9 @@ private HttpRequest.Builder testGroupParametersRequestBuilder(@javax.annotation. if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = null; // No longer need to apply auth to query params - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); } else { - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); } if (requiredBooleanGroup != null) { @@ -1869,20 +1779,14 @@ public ApiResponse testInlineAdditionalPropertiesWithHttpInfo(@javax.annot private HttpRequest.Builder testInlineAdditionalPropertiesRequestBuilder(@javax.annotation.Nonnull Map requestBody) throws ApiException { // verify the required parameter 'requestBody' is set if (requestBody == null) { - throw new ApiException(400, "Missing the required parameter 'requestBody' when calling testInlineAdditionalProperties" - ); + throw new ApiException(400, "Missing the required parameter 'requestBody' when calling testInlineAdditionalProperties"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/fake/inline-additionalProperties"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -1960,20 +1864,14 @@ public ApiResponse testInlineFreeformAdditionalPropertiesWithHttpInfo(@jav private HttpRequest.Builder testInlineFreeformAdditionalPropertiesRequestBuilder(@javax.annotation.Nonnull TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest) throws ApiException { // verify the required parameter 'testInlineFreeformAdditionalPropertiesRequest' is set if (testInlineFreeformAdditionalPropertiesRequest == null) { - throw new ApiException(400, "Missing the required parameter 'testInlineFreeformAdditionalPropertiesRequest' when calling testInlineFreeformAdditionalProperties" - ); + throw new ApiException(400, "Missing the required parameter 'testInlineFreeformAdditionalPropertiesRequest' when calling testInlineFreeformAdditionalProperties"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/fake/inline-freeform-additionalProperties"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -2053,25 +1951,18 @@ public ApiResponse testJsonFormDataWithHttpInfo(@javax.annotation.Nonnull private HttpRequest.Builder testJsonFormDataRequestBuilder(@javax.annotation.Nonnull String param, @javax.annotation.Nonnull String param2) throws ApiException { // verify the required parameter 'param' is set if (param == null) { - throw new ApiException(400, "Missing the required parameter 'param' when calling testJsonFormData" - ); + throw new ApiException(400, "Missing the required parameter 'param' when calling testJsonFormData"); } // verify the required parameter 'param2' is set if (param2 == null) { - throw new ApiException(400, "Missing the required parameter 'param2' when calling testJsonFormData" - ); + throw new ApiException(400, "Missing the required parameter 'param2' when calling testJsonFormData"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/fake/jsonFormData"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "application/json"); @@ -2168,28 +2059,23 @@ public ApiResponse testQueryParameterCollectionFormatWithHttpInfo(@javax.a private HttpRequest.Builder testQueryParameterCollectionFormatRequestBuilder(@javax.annotation.Nonnull List pipe, @javax.annotation.Nonnull List ioutil, @javax.annotation.Nonnull List http, @javax.annotation.Nonnull List url, @javax.annotation.Nonnull List context) throws ApiException { // verify the required parameter 'pipe' is set if (pipe == null) { - throw new ApiException(400, "Missing the required parameter 'pipe' when calling testQueryParameterCollectionFormat" - ); + throw new ApiException(400, "Missing the required parameter 'pipe' when calling testQueryParameterCollectionFormat"); } // verify the required parameter 'ioutil' is set if (ioutil == null) { - throw new ApiException(400, "Missing the required parameter 'ioutil' when calling testQueryParameterCollectionFormat" - ); + throw new ApiException(400, "Missing the required parameter 'ioutil' when calling testQueryParameterCollectionFormat"); } // verify the required parameter 'http' is set if (http == null) { - throw new ApiException(400, "Missing the required parameter 'http' when calling testQueryParameterCollectionFormat" - ); + throw new ApiException(400, "Missing the required parameter 'http' when calling testQueryParameterCollectionFormat"); } // verify the required parameter 'url' is set if (url == null) { - throw new ApiException(400, "Missing the required parameter 'url' when calling testQueryParameterCollectionFormat" - ); + throw new ApiException(400, "Missing the required parameter 'url' when calling testQueryParameterCollectionFormat"); } // verify the required parameter 'context' is set if (context == null) { - throw new ApiException(400, "Missing the required parameter 'context' when calling testQueryParameterCollectionFormat" - ); + throw new ApiException(400, "Missing the required parameter 'context' when calling testQueryParameterCollectionFormat"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -2216,15 +2102,9 @@ private HttpRequest.Builder testQueryParameterCollectionFormatRequestBuilder(@ja if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = null; // No longer need to apply auth to query params - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); } else { - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); } localVarRequestBuilder.header("Accept", "application/json"); @@ -2297,20 +2177,14 @@ public ApiResponse testStringMapReferenceWithHttpInfo(@javax.annotation.No private HttpRequest.Builder testStringMapReferenceRequestBuilder(@javax.annotation.Nonnull Map requestBody) throws ApiException { // verify the required parameter 'requestBody' is set if (requestBody == null) { - throw new ApiException(400, "Missing the required parameter 'requestBody' when calling testStringMapReference" - ); + throw new ApiException(400, "Missing the required parameter 'requestBody' when calling testStringMapReference"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/fake/stringMap-reference"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java index 0395541d9169..8deff6965b77 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -175,20 +175,14 @@ public ApiResponse testClassnameWithHttpInfo(@javax.annotation.Nonnull C private HttpRequest.Builder testClassnameRequestBuilder(@javax.annotation.Nonnull Client client) throws ApiException { // verify the required parameter 'client' is set if (client == null) { - throw new ApiException(400, "Missing the required parameter 'client' when calling testClassname" - ); + throw new ApiException(400, "Missing the required parameter 'client' when calling testClassname"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/fake_classname_test"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/PetApi.java index f7e6691637f7..b3b111ff23c1 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/PetApi.java @@ -169,20 +169,14 @@ public ApiResponse addPetWithHttpInfo(@javax.annotation.Nonnull Pet pet) t private HttpRequest.Builder addPetRequestBuilder(@javax.annotation.Nonnull Pet pet) throws ApiException { // verify the required parameter 'pet' is set if (pet == null) { - throw new ApiException(400, "Missing the required parameter 'pet' when calling addPet" - ); + throw new ApiException(400, "Missing the required parameter 'pet' when calling addPet"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/pet"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -262,8 +256,7 @@ public ApiResponse deletePetWithHttpInfo(@javax.annotation.Nonnull Long pe private HttpRequest.Builder deletePetRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling deletePet" - ); + throw new ApiException(400, "Missing the required parameter 'petId' when calling deletePet"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -271,12 +264,7 @@ private HttpRequest.Builder deletePetRequestBuilder(@javax.annotation.Nonnull Lo String localVarPath = "/pet/{petId}" .replace("{petId}", ApiClient.urlEncode(petId.toString())); - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); if (apiKey != null) { localVarRequestBuilder.header("api_key", apiKey.toString()); @@ -359,8 +347,7 @@ public ApiResponse> findPetsByStatusWithHttpInfo(@javax.annotation.Non private HttpRequest.Builder findPetsByStatusRequestBuilder(@javax.annotation.Nonnull List status) throws ApiException { // verify the required parameter 'status' is set if (status == null) { - throw new ApiException(400, "Missing the required parameter 'status' when calling findPetsByStatus" - ); + throw new ApiException(400, "Missing the required parameter 'status' when calling findPetsByStatus"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -379,15 +366,9 @@ private HttpRequest.Builder findPetsByStatusRequestBuilder(@javax.annotation.Non if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = null; // No longer need to apply auth to query params - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); } else { - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); } localVarRequestBuilder.header("Accept", "application/xml, application/json"); @@ -472,8 +453,7 @@ public ApiResponse> findPetsByTagsWithHttpInfo(@javax.annotation.Nonnu private HttpRequest.Builder findPetsByTagsRequestBuilder(@javax.annotation.Nonnull List tags) throws ApiException { // verify the required parameter 'tags' is set if (tags == null) { - throw new ApiException(400, "Missing the required parameter 'tags' when calling findPetsByTags" - ); + throw new ApiException(400, "Missing the required parameter 'tags' when calling findPetsByTags"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -492,15 +472,9 @@ private HttpRequest.Builder findPetsByTagsRequestBuilder(@javax.annotation.Nonnu if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = null; // No longer need to apply auth to query params - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); } else { - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); } localVarRequestBuilder.header("Accept", "application/xml, application/json"); @@ -581,8 +555,7 @@ public ApiResponse getPetByIdWithHttpInfo(@javax.annotation.Nonnull Long pe private HttpRequest.Builder getPetByIdRequestBuilder(@javax.annotation.Nonnull Long petId) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetById" - ); + throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetById"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -590,12 +563,7 @@ private HttpRequest.Builder getPetByIdRequestBuilder(@javax.annotation.Nonnull L String localVarPath = "/pet/{petId}" .replace("{petId}", ApiClient.urlEncode(petId.toString())); - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "application/xml, application/json"); @@ -667,20 +635,14 @@ public ApiResponse updatePetWithHttpInfo(@javax.annotation.Nonnull Pet pet private HttpRequest.Builder updatePetRequestBuilder(@javax.annotation.Nonnull Pet pet) throws ApiException { // verify the required parameter 'pet' is set if (pet == null) { - throw new ApiException(400, "Missing the required parameter 'pet' when calling updatePet" - ); + throw new ApiException(400, "Missing the required parameter 'pet' when calling updatePet"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/pet"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -762,8 +724,7 @@ public ApiResponse updatePetWithFormWithHttpInfo(@javax.annotation.Nonnull private HttpRequest.Builder updatePetWithFormRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling updatePetWithForm" - ); + throw new ApiException(400, "Missing the required parameter 'petId' when calling updatePetWithForm"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -771,12 +732,7 @@ private HttpRequest.Builder updatePetWithFormRequestBuilder(@javax.annotation.No String localVarPath = "/pet/{petId}" .replace("{petId}", ApiClient.urlEncode(petId.toString())); - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "application/json"); @@ -877,8 +833,7 @@ public ApiResponse uploadFileWithHttpInfo(@javax.annotation.No private HttpRequest.Builder uploadFileRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFile" - ); + throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFile"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -886,12 +841,7 @@ private HttpRequest.Builder uploadFileRequestBuilder(@javax.annotation.Nonnull L String localVarPath = "/pet/{petId}/uploadImage" .replace("{petId}", ApiClient.urlEncode(petId.toString())); - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "application/json"); @@ -1011,13 +961,11 @@ public ApiResponse uploadFileWithRequiredFileWithHttpInfo(@jav private HttpRequest.Builder uploadFileWithRequiredFileRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFileWithRequiredFile" - ); + throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFileWithRequiredFile"); } // verify the required parameter 'requiredFile' is set if (requiredFile == null) { - throw new ApiException(400, "Missing the required parameter 'requiredFile' when calling uploadFileWithRequiredFile" - ); + throw new ApiException(400, "Missing the required parameter 'requiredFile' when calling uploadFileWithRequiredFile"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -1025,12 +973,7 @@ private HttpRequest.Builder uploadFileWithRequiredFileRequestBuilder(@javax.anno String localVarPath = "/fake/{petId}/uploadImageWithRequiredFile" .replace("{petId}", ApiClient.urlEncode(petId.toString())); - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "application/json"); diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/StoreApi.java index cb9c17d4a462..6f2b83415dc6 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/StoreApi.java @@ -167,8 +167,7 @@ public ApiResponse deleteOrderWithHttpInfo(@javax.annotation.Nonnull Strin private HttpRequest.Builder deleteOrderRequestBuilder(@javax.annotation.Nonnull String orderId) throws ApiException { // verify the required parameter 'orderId' is set if (orderId == null) { - throw new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder" - ); + throw new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -176,12 +175,7 @@ private HttpRequest.Builder deleteOrderRequestBuilder(@javax.annotation.Nonnull String localVarPath = "/store/order/{order_id}" .replace("{order_id}", ApiClient.urlEncode(orderId.toString())); - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "application/json"); @@ -262,12 +256,7 @@ private HttpRequest.Builder getInventoryRequestBuilder() throws ApiException { String localVarPath = "/store/inventory"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "application/json"); @@ -347,8 +336,7 @@ public ApiResponse getOrderByIdWithHttpInfo(@javax.annotation.Nonnull Lon private HttpRequest.Builder getOrderByIdRequestBuilder(@javax.annotation.Nonnull Long orderId) throws ApiException { // verify the required parameter 'orderId' is set if (orderId == null) { - throw new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById" - ); + throw new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -356,12 +344,7 @@ private HttpRequest.Builder getOrderByIdRequestBuilder(@javax.annotation.Nonnull String localVarPath = "/store/order/{order_id}" .replace("{order_id}", ApiClient.urlEncode(orderId.toString())); - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "application/xml, application/json"); @@ -441,20 +424,14 @@ public ApiResponse placeOrderWithHttpInfo(@javax.annotation.Nonnull Order private HttpRequest.Builder placeOrderRequestBuilder(@javax.annotation.Nonnull Order order) throws ApiException { // verify the required parameter 'order' is set if (order == null) { - throw new ApiException(400, "Missing the required parameter 'order' when calling placeOrder" - ); + throw new ApiException(400, "Missing the required parameter 'order' when calling placeOrder"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/store/order"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/xml, application/json"); diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/UserApi.java index b96034434b0d..95029e09153a 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/UserApi.java @@ -168,20 +168,14 @@ public ApiResponse createUserWithHttpInfo(@javax.annotation.Nonnull User u private HttpRequest.Builder createUserRequestBuilder(@javax.annotation.Nonnull User user) throws ApiException { // verify the required parameter 'user' is set if (user == null) { - throw new ApiException(400, "Missing the required parameter 'user' when calling createUser" - ); + throw new ApiException(400, "Missing the required parameter 'user' when calling createUser"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/user"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -259,20 +253,14 @@ public ApiResponse createUsersWithArrayInputWithHttpInfo(@javax.annotation private HttpRequest.Builder createUsersWithArrayInputRequestBuilder(@javax.annotation.Nonnull List user) throws ApiException { // verify the required parameter 'user' is set if (user == null) { - throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithArrayInput" - ); + throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithArrayInput"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/user/createWithArray"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -350,20 +338,14 @@ public ApiResponse createUsersWithListInputWithHttpInfo(@javax.annotation. private HttpRequest.Builder createUsersWithListInputRequestBuilder(@javax.annotation.Nonnull List user) throws ApiException { // verify the required parameter 'user' is set if (user == null) { - throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithListInput" - ); + throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithListInput"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); String localVarPath = "/user/createWithList"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); @@ -441,8 +423,7 @@ public ApiResponse deleteUserWithHttpInfo(@javax.annotation.Nonnull String private HttpRequest.Builder deleteUserRequestBuilder(@javax.annotation.Nonnull String username) throws ApiException { // verify the required parameter 'username' is set if (username == null) { - throw new ApiException(400, "Missing the required parameter 'username' when calling deleteUser" - ); + throw new ApiException(400, "Missing the required parameter 'username' when calling deleteUser"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -450,12 +431,7 @@ private HttpRequest.Builder deleteUserRequestBuilder(@javax.annotation.Nonnull S String localVarPath = "/user/{username}" .replace("{username}", ApiClient.urlEncode(username.toString())); - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "application/json"); @@ -535,8 +511,7 @@ public ApiResponse getUserByNameWithHttpInfo(@javax.annotation.Nonnull Str private HttpRequest.Builder getUserByNameRequestBuilder(@javax.annotation.Nonnull String username) throws ApiException { // verify the required parameter 'username' is set if (username == null) { - throw new ApiException(400, "Missing the required parameter 'username' when calling getUserByName" - ); + throw new ApiException(400, "Missing the required parameter 'username' when calling getUserByName"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -544,12 +519,7 @@ private HttpRequest.Builder getUserByNameRequestBuilder(@javax.annotation.Nonnul String localVarPath = "/user/{username}" .replace("{username}", ApiClient.urlEncode(username.toString())); - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "application/xml, application/json"); @@ -631,13 +601,11 @@ public ApiResponse loginUserWithHttpInfo(@javax.annotation.Nonnull Strin private HttpRequest.Builder loginUserRequestBuilder(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException { // verify the required parameter 'username' is set if (username == null) { - throw new ApiException(400, "Missing the required parameter 'username' when calling loginUser" - ); + throw new ApiException(400, "Missing the required parameter 'username' when calling loginUser"); } // verify the required parameter 'password' is set if (password == null) { - throw new ApiException(400, "Missing the required parameter 'password' when calling loginUser" - ); + throw new ApiException(400, "Missing the required parameter 'password' when calling loginUser"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -658,15 +626,9 @@ private HttpRequest.Builder loginUserRequestBuilder(@javax.annotation.Nonnull St if (localVarQueryStringJoiner.length() != 0) { queryJoiner.add(localVarQueryStringJoiner.toString()); } - String finalQuery = null; // No longer need to apply auth to query params - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + finalQuery)); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); } else { - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); } localVarRequestBuilder.header("Accept", "application/xml, application/json"); @@ -740,12 +702,7 @@ private HttpRequest.Builder logoutUserRequestBuilder() throws ApiException { String localVarPath = "/user/logout"; - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Accept", "application/json"); @@ -819,13 +776,11 @@ public ApiResponse updateUserWithHttpInfo(@javax.annotation.Nonnull String private HttpRequest.Builder updateUserRequestBuilder(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user) throws ApiException { // verify the required parameter 'username' is set if (username == null) { - throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser" - ); + throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser"); } // verify the required parameter 'user' is set if (user == null) { - throw new ApiException(400, "Missing the required parameter 'user' when calling updateUser" - ); + throw new ApiException(400, "Missing the required parameter 'user' when calling updateUser"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -833,12 +788,7 @@ private HttpRequest.Builder updateUserRequestBuilder(@javax.annotation.Nonnull S String localVarPath = "/user/{username}" .replace("{username}", ApiClient.urlEncode(username.toString())); - String authQuery = null; // No longer need to apply auth to query params - if (authQuery != null && !authQuery.isEmpty()) { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + authQuery)); - } else { - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); - } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); localVarRequestBuilder.header("Content-Type", "application/json"); localVarRequestBuilder.header("Accept", "application/json"); From fbe1c49e7ee57f99a068b16e290803690f5ac9f1 Mon Sep 17 00:00:00 2001 From: Ilya Nemtsev Date: Tue, 8 Jul 2025 17:31:08 +0700 Subject: [PATCH 12/17] made header assignment more explicit, per each method --- .../Java/libraries/native/api.mustache | 152 ++++++++++++++---- 1 file changed, 118 insertions(+), 34 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/native/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/native/api.mustache index ddacba25fc1c..ef31558c4689 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/native/api.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/native/api.mustache @@ -64,9 +64,6 @@ public class {{classname}} { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; - // Custom headers to be sent with every request from this API client - private final Map extraHeaders = new java.util.HashMap<>(); - public {{classname}}() { this(Configuration.getDefaultApiClient()); } @@ -81,27 +78,6 @@ public class {{classname}} { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } - /** - * Add a custom header to be sent with every request from this API client. - * @param name Header name - * @param value Header value - * @return this - */ - public {{classname}} addHeader(String name, String value) { - this.extraHeaders.put(name, value); - return this; - } - - /** - * Remove a custom header. - * @param name Header name - * @return this - */ - public {{classname}} removeHeader(String name) { - this.extraHeaders.remove(name); - return this; - } - {{#asyncNative}} private ApiException getApiException(String operationId, HttpResponse response) { @@ -153,11 +129,40 @@ public class {{classname}} { @Deprecated {{/isDeprecated}} public {{#returnType}}{{#asyncNative}}CompletableFuture<{{{returnType}}}>{{/asyncNative}}{{^asyncNative}}{{{returnType}}}{{/asyncNative}}{{/returnType}}{{^returnType}}{{#asyncNative}}CompletableFuture{{/asyncNative}}{{^asyncNative}}void{{/asyncNative}}{{/returnType}} {{operationId}}(API{{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}Request apiRequest) throws ApiException { + return {{operationId}}(apiRequest, null); + } + + /** + * {{summary}} + * {{notes}} + * @param apiRequest {@link API{{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}Request} + * @param headers Optional headers to include in the request + {{#returnType}} + * @return {{#asyncNative}}CompletableFuture<{{/asyncNative}}{{returnType}}{{#asyncNative}}>{{/asyncNative}} + {{/returnType}} + {{^returnType}} + {{#asyncNative}} + * @return CompletableFuture<Void> + {{/asyncNative}} + {{/returnType}} + * @throws ApiException if fails to make API call + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + {{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation + {{/externalDocs}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + public {{#returnType}}{{#asyncNative}}CompletableFuture<{{{returnType}}}>{{/asyncNative}}{{^asyncNative}}{{{returnType}}}{{/asyncNative}}{{/returnType}}{{^returnType}}{{#asyncNative}}CompletableFuture{{/asyncNative}}{{^asyncNative}}void{{/asyncNative}}{{/returnType}} {{operationId}}(API{{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}Request apiRequest, Map headers) throws ApiException { {{#allParams}} {{>nullable_var_annotations}} {{{dataType}}} {{paramName}} = apiRequest.{{paramName}}(); {{/allParams}} - {{#returnType}}return {{/returnType}}{{^returnType}}{{#asyncNative}}return {{/asyncNative}}{{/returnType}}{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); + {{#returnType}}return {{/returnType}}{{^returnType}}{{#asyncNative}}return {{/asyncNative}}{{/returnType}}{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#allParams}}, {{/allParams}}headers); } /** @@ -178,10 +183,32 @@ public class {{classname}} { @Deprecated {{/isDeprecated}} public {{#asyncNative}}CompletableFuture<{{/asyncNative}}ApiResponse<{{{returnType}}}{{^returnType}}Void{{/returnType}}>{{#asyncNative}}>{{/asyncNative}} {{operationId}}WithHttpInfo(API{{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}Request apiRequest) throws ApiException { + return {{operationId}}WithHttpInfo(apiRequest, null); + } + + /** + * {{summary}} + * {{notes}} + * @param apiRequest {@link API{{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}Request} + * @param headers Optional headers to include in the request + * @return {{#asyncNative}}CompletableFuture<{{/asyncNative}}ApiResponse<{{returnType}}{{^returnType}}Void{{/returnType}}>{{#asyncNative}}>{{/asyncNative}} + * @throws ApiException if fails to make API call + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + {{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation + {{/externalDocs}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + public {{#asyncNative}}CompletableFuture<{{/asyncNative}}ApiResponse<{{{returnType}}}{{^returnType}}Void{{/returnType}}>{{#asyncNative}}>{{/asyncNative}} {{operationId}}WithHttpInfo(API{{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}Request apiRequest, Map headers) throws ApiException { {{#allParams}} {{{dataType}}} {{paramName}} = apiRequest.{{paramName}}(); {{/allParams}} - return {{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); + return {{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#allParams}}, {{/allParams}}headers); } {{/hasParams}} @@ -213,15 +240,46 @@ public class {{classname}} { @Deprecated {{/isDeprecated}} public {{#returnType}}{{#asyncNative}}CompletableFuture<{{{returnType}}}>{{/asyncNative}}{{^asyncNative}}{{{returnType}}}{{/asyncNative}}{{/returnType}}{{^returnType}}{{#asyncNative}}CompletableFuture{{/asyncNative}}{{^asyncNative}}void{{/asyncNative}}{{/returnType}} {{operationId}}({{#allParams}}{{>nullable_var_annotations}} {{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { + return {{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}, null); + } + + /** + * {{summary}} + * {{notes}} + {{#allParams}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}} + {{/allParams}} + * @param headers Optional headers to include in the request + {{#returnType}} + * @return {{#asyncNative}}CompletableFuture<{{/asyncNative}}{{returnType}}{{#asyncNative}}>{{/asyncNative}} + {{/returnType}} + {{^returnType}} + {{#asyncNative}} + * @return CompletableFuture<Void> + {{/asyncNative}} + {{/returnType}} + * @throws ApiException if fails to make API call + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + {{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation + {{/externalDocs}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + public {{#returnType}}{{#asyncNative}}CompletableFuture<{{{returnType}}}>{{/asyncNative}}{{^asyncNative}}{{{returnType}}}{{/asyncNative}}{{/returnType}}{{^returnType}}{{#asyncNative}}CompletableFuture{{/asyncNative}}{{^asyncNative}}void{{/asyncNative}}{{/returnType}} {{operationId}}({{#allParams}}{{>nullable_var_annotations}} {{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#allParams}}, {{/allParams}}Map headers) throws ApiException { {{^asyncNative}} - {{#returnType}}ApiResponse<{{{.}}}> localVarResponse = {{/returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); + {{#returnType}}ApiResponse<{{{.}}}> localVarResponse = {{/returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#allParams}}, {{/allParams}}headers); {{#returnType}} return localVarResponse.getData(); {{/returnType}} {{/asyncNative}} {{#asyncNative}} try { - HttpRequest.Builder localVarRequestBuilder = {{operationId}}RequestBuilder({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); + HttpRequest.Builder localVarRequestBuilder = {{operationId}}RequestBuilder({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#allParams}}, {{/allParams}}headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -269,8 +327,32 @@ public class {{classname}} { @Deprecated {{/isDeprecated}} public {{#asyncNative}}CompletableFuture<{{/asyncNative}}ApiResponse<{{{returnType}}}{{^returnType}}Void{{/returnType}}>{{#asyncNative}}>{{/asyncNative}} {{operationId}}WithHttpInfo({{#allParams}}{{>nullable_var_annotations}} {{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { + return {{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}, null); + } + + /** + * {{summary}} + * {{notes}} + {{#allParams}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}} + {{/allParams}} + * @param headers Optional headers to include in the request + * @return {{#asyncNative}}CompletableFuture<{{/asyncNative}}ApiResponse<{{returnType}}{{^returnType}}Void{{/returnType}}>{{#asyncNative}}>{{/asyncNative}} + * @throws ApiException if fails to make API call + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + {{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation + {{/externalDocs}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + public {{#asyncNative}}CompletableFuture<{{/asyncNative}}ApiResponse<{{{returnType}}}{{^returnType}}Void{{/returnType}}>{{#asyncNative}}>{{/asyncNative}} {{operationId}}WithHttpInfo({{#allParams}}{{>nullable_var_annotations}} {{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#allParams}}, {{/allParams}}Map headers) throws ApiException { {{^asyncNative}} - HttpRequest.Builder localVarRequestBuilder = {{operationId}}RequestBuilder({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); + HttpRequest.Builder localVarRequestBuilder = {{operationId}}RequestBuilder({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#allParams}}, {{/allParams}}headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -352,7 +434,7 @@ public class {{classname}} { {{/asyncNative}} {{#asyncNative}} try { - HttpRequest.Builder localVarRequestBuilder = {{operationId}}RequestBuilder({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); + HttpRequest.Builder localVarRequestBuilder = {{operationId}}RequestBuilder({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#allParams}}, {{/allParams}}headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -389,7 +471,7 @@ public class {{classname}} { {{/asyncNative}} } - private HttpRequest.Builder {{operationId}}RequestBuilder({{#allParams}}{{>nullable_var_annotations}} {{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { + private HttpRequest.Builder {{operationId}}RequestBuilder({{#allParams}}{{>nullable_var_annotations}} {{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#allParams}}, {{/allParams}}Map headers) throws ApiException { {{#allParams}} {{#required}} // verify the required parameter '{{paramName}}' is set @@ -594,9 +676,11 @@ public class {{classname}} { if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); From 61014c08a212ccc37ff4eadad298e394710e0703 Mon Sep 17 00:00:00 2001 From: Ilya Nemtsev Date: Tue, 8 Jul 2025 20:50:23 +0700 Subject: [PATCH 13/17] fixed extra comma --- .../resources/Java/libraries/native/api.mustache | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/native/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/native/api.mustache index ef31558c4689..70348f5cf65c 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/native/api.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/native/api.mustache @@ -162,7 +162,7 @@ public class {{classname}} { {{>nullable_var_annotations}} {{{dataType}}} {{paramName}} = apiRequest.{{paramName}}(); {{/allParams}} - {{#returnType}}return {{/returnType}}{{^returnType}}{{#asyncNative}}return {{/asyncNative}}{{/returnType}}{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#allParams}}, {{/allParams}}headers); + {{#returnType}}return {{/returnType}}{{^returnType}}{{#asyncNative}}return {{/asyncNative}}{{/returnType}}{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}headers); } /** @@ -208,7 +208,7 @@ public class {{classname}} { {{#allParams}} {{{dataType}}} {{paramName}} = apiRequest.{{paramName}}(); {{/allParams}} - return {{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#allParams}}, {{/allParams}}headers); + return {{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}headers); } {{/hasParams}} @@ -270,9 +270,9 @@ public class {{classname}} { {{#isDeprecated}} @Deprecated {{/isDeprecated}} - public {{#returnType}}{{#asyncNative}}CompletableFuture<{{{returnType}}}>{{/asyncNative}}{{^asyncNative}}{{{returnType}}}{{/asyncNative}}{{/returnType}}{{^returnType}}{{#asyncNative}}CompletableFuture{{/asyncNative}}{{^asyncNative}}void{{/asyncNative}}{{/returnType}} {{operationId}}({{#allParams}}{{>nullable_var_annotations}} {{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#allParams}}, {{/allParams}}Map headers) throws ApiException { + public {{#returnType}}{{#asyncNative}}CompletableFuture<{{{returnType}}}>{{/asyncNative}}{{^asyncNative}}{{{returnType}}}{{/asyncNative}}{{/returnType}}{{^returnType}}{{#asyncNative}}CompletableFuture{{/asyncNative}}{{^asyncNative}}void{{/asyncNative}}{{/returnType}} {{operationId}}({{#allParams}}{{>nullable_var_annotations}} {{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}Map headers) throws ApiException { {{^asyncNative}} - {{#returnType}}ApiResponse<{{{.}}}> localVarResponse = {{/returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#allParams}}, {{/allParams}}headers); + {{#returnType}}ApiResponse<{{{.}}}> localVarResponse = {{/returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}headers); {{#returnType}} return localVarResponse.getData(); {{/returnType}} @@ -350,9 +350,9 @@ public class {{classname}} { {{#isDeprecated}} @Deprecated {{/isDeprecated}} - public {{#asyncNative}}CompletableFuture<{{/asyncNative}}ApiResponse<{{{returnType}}}{{^returnType}}Void{{/returnType}}>{{#asyncNative}}>{{/asyncNative}} {{operationId}}WithHttpInfo({{#allParams}}{{>nullable_var_annotations}} {{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#allParams}}, {{/allParams}}Map headers) throws ApiException { + public {{#asyncNative}}CompletableFuture<{{/asyncNative}}ApiResponse<{{{returnType}}}{{^returnType}}Void{{/returnType}}>{{#asyncNative}}>{{/asyncNative}} {{operationId}}WithHttpInfo({{#allParams}}{{>nullable_var_annotations}} {{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}Map headers) throws ApiException { {{^asyncNative}} - HttpRequest.Builder localVarRequestBuilder = {{operationId}}RequestBuilder({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#allParams}}, {{/allParams}}headers); + HttpRequest.Builder localVarRequestBuilder = {{operationId}}RequestBuilder({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -434,7 +434,7 @@ public class {{classname}} { {{/asyncNative}} {{#asyncNative}} try { - HttpRequest.Builder localVarRequestBuilder = {{operationId}}RequestBuilder({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#allParams}}, {{/allParams}}headers); + HttpRequest.Builder localVarRequestBuilder = {{operationId}}RequestBuilder({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -471,7 +471,7 @@ public class {{classname}} { {{/asyncNative}} } - private HttpRequest.Builder {{operationId}}RequestBuilder({{#allParams}}{{>nullable_var_annotations}} {{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#allParams}}, {{/allParams}}Map headers) throws ApiException { + private HttpRequest.Builder {{operationId}}RequestBuilder({{#allParams}}{{>nullable_var_annotations}} {{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}Map headers) throws ApiException { {{#allParams}} {{#required}} // verify the required parameter '{{paramName}}' is set From 37eabc647ab53b66ae2d09e906de175111a3b392 Mon Sep 17 00:00:00 2001 From: Ilya Nemtsev Date: Tue, 8 Jul 2025 21:30:11 +0700 Subject: [PATCH 14/17] fixed commas, regenerated samples --- .../Java/libraries/native/api.mustache | 8 +- .../org/openapitools/client/api/AuthApi.java | 96 +- .../org/openapitools/client/api/BodyApi.java | 402 ++++-- .../org/openapitools/client/api/FormApi.java | 152 ++- .../openapitools/client/api/HeaderApi.java | 70 +- .../org/openapitools/client/api/PathApi.java | 68 +- .../org/openapitools/client/api/QueryApi.java | 414 ++++-- .../client/api/AnotherFakeApi.java | 62 +- .../openapitools/client/api/DefaultApi.java | 60 +- .../org/openapitools/client/api/FakeApi.java | 866 ++++++++++-- .../client/api/FakeClassnameTags123Api.java | 62 +- .../org/openapitools/client/api/PetApi.java | 384 ++++-- .../org/openapitools/client/api/StoreApi.java | 174 ++- .../org/openapitools/client/api/UserApi.java | 330 ++++- .../org/openapitools/client/api/PetApi.java | 344 ++++- .../org/openapitools/client/api/StoreApi.java | 173 ++- .../org/openapitools/client/api/UserApi.java | 324 ++++- .../client/api/AnotherFakeApi.java | 62 +- .../openapitools/client/api/DefaultApi.java | 60 +- .../org/openapitools/client/api/FakeApi.java | 854 ++++++++++-- .../client/api/FakeClassnameTags123Api.java | 62 +- .../org/openapitools/client/api/PetApi.java | 380 ++++-- .../org/openapitools/client/api/StoreApi.java | 173 ++- .../org/openapitools/client/api/UserApi.java | 324 ++++- .../.github/workflows/maven.yml | 30 + .../native/test-regenerated-fixed/.gitignore | 21 + .../.openapi-generator-ignore | 23 + .../.openapi-generator/FILES | 56 + .../.openapi-generator/VERSION | 1 + .../native/test-regenerated-fixed/.travis.yml | 16 + .../native/test-regenerated-fixed/README.md | 197 +++ .../test-regenerated-fixed/api/openapi.yaml | 865 ++++++++++++ .../test-regenerated-fixed/build.gradle | 109 ++ .../native/test-regenerated-fixed/build.sbt | 1 + .../test-regenerated-fixed/docs/Category.md | 15 + .../docs/ModelApiResponse.md | 16 + .../test-regenerated-fixed/docs/Order.md | 29 + .../native/test-regenerated-fixed/docs/Pet.md | 29 + .../test-regenerated-fixed/docs/PetApi.md | 1212 +++++++++++++++++ .../test-regenerated-fixed/docs/StoreApi.md | 564 ++++++++ .../native/test-regenerated-fixed/docs/Tag.md | 15 + .../test-regenerated-fixed/docs/User.md | 21 + .../test-regenerated-fixed/docs/UserApi.md | 1178 ++++++++++++++++ .../native/test-regenerated-fixed/git_push.sh | 57 + .../test-regenerated-fixed/gradle.properties | 6 + .../gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 43453 bytes .../gradle/wrapper/gradle-wrapper.properties | 7 + .../native/test-regenerated-fixed/gradlew | 249 ++++ .../native/test-regenerated-fixed/gradlew.bat | 92 ++ .../native/test-regenerated-fixed/pom.xml | 264 ++++ .../test-regenerated-fixed/settings.gradle | 1 + .../src/main/AndroidManifest.xml | 3 + .../org/openapitools/client/ApiClient.java | 457 +++++++ .../org/openapitools/client/ApiException.java | 92 ++ .../org/openapitools/client/ApiResponse.java | 60 + .../openapitools/client/Configuration.java | 63 + .../java/org/openapitools/client/JSON.java | 264 ++++ .../java/org/openapitools/client/Pair.java | 37 + .../client/RFC3339DateFormat.java | 58 + .../client/RFC3339InstantDeserializer.java | 100 ++ .../client/RFC3339JavaTimeModule.java | 32 + .../client/ServerConfiguration.java | 72 + .../openapitools/client/ServerVariable.java | 37 + .../org/openapitools/client/api/PetApi.java | 1110 +++++++++++++++ .../org/openapitools/client/api/StoreApi.java | 535 ++++++++ .../org/openapitools/client/api/UserApi.java | 995 ++++++++++++++ .../client/model/AbstractOpenApiSchema.java | 147 ++ .../openapitools/client/model/Category.java | 187 +++ .../client/model/ModelApiResponse.java | 223 +++ .../org/openapitools/client/model/Order.java | 369 +++++ .../org/openapitools/client/model/Pet.java | 397 ++++++ .../org/openapitools/client/model/Tag.java | 187 +++ .../org/openapitools/client/model/User.java | 403 ++++++ .../openapitools/client/api/PetApiTest.java | 180 +++ .../openapitools/client/api/StoreApiTest.java | 104 ++ .../openapitools/client/api/UserApiTest.java | 175 +++ .../client/model/CategoryTest.java | 56 + .../client/model/ModelApiResponseTest.java | 64 + .../openapitools/client/model/OrderTest.java | 89 ++ .../openapitools/client/model/PetTest.java | 92 ++ .../openapitools/client/model/TagTest.java | 56 + .../openapitools/client/model/UserTest.java | 104 ++ .../.github/workflows/maven.yml | 30 + .../native/test-regenerated-fixed2/.gitignore | 21 + .../.openapi-generator-ignore | 23 + .../.openapi-generator/FILES | 56 + .../.openapi-generator/VERSION | 1 + .../test-regenerated-fixed2/.travis.yml | 16 + .../native/test-regenerated-fixed2/README.md | 197 +++ .../test-regenerated-fixed2/api/openapi.yaml | 865 ++++++++++++ .../test-regenerated-fixed2/build.gradle | 109 ++ .../native/test-regenerated-fixed2/build.sbt | 1 + .../test-regenerated-fixed2/docs/Category.md | 15 + .../docs/ModelApiResponse.md | 16 + .../test-regenerated-fixed2/docs/Order.md | 29 + .../test-regenerated-fixed2/docs/Pet.md | 29 + .../test-regenerated-fixed2/docs/PetApi.md | 1212 +++++++++++++++++ .../test-regenerated-fixed2/docs/StoreApi.md | 564 ++++++++ .../test-regenerated-fixed2/docs/Tag.md | 15 + .../test-regenerated-fixed2/docs/User.md | 21 + .../test-regenerated-fixed2/docs/UserApi.md | 1178 ++++++++++++++++ .../test-regenerated-fixed2/git_push.sh | 57 + .../test-regenerated-fixed2/gradle.properties | 6 + .../gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 43453 bytes .../gradle/wrapper/gradle-wrapper.properties | 7 + .../native/test-regenerated-fixed2/gradlew | 249 ++++ .../test-regenerated-fixed2/gradlew.bat | 92 ++ .../native/test-regenerated-fixed2/pom.xml | 264 ++++ .../test-regenerated-fixed2/settings.gradle | 1 + .../src/main/AndroidManifest.xml | 3 + .../org/openapitools/client/ApiClient.java | 457 +++++++ .../org/openapitools/client/ApiException.java | 92 ++ .../org/openapitools/client/ApiResponse.java | 60 + .../openapitools/client/Configuration.java | 63 + .../java/org/openapitools/client/JSON.java | 264 ++++ .../java/org/openapitools/client/Pair.java | 37 + .../client/RFC3339DateFormat.java | 58 + .../client/RFC3339InstantDeserializer.java | 100 ++ .../client/RFC3339JavaTimeModule.java | 32 + .../client/ServerConfiguration.java | 72 + .../openapitools/client/ServerVariable.java | 37 + .../org/openapitools/client/api/PetApi.java | 1110 +++++++++++++++ .../org/openapitools/client/api/StoreApi.java | 535 ++++++++ .../org/openapitools/client/api/UserApi.java | 995 ++++++++++++++ .../client/model/AbstractOpenApiSchema.java | 147 ++ .../openapitools/client/model/Category.java | 187 +++ .../client/model/ModelApiResponse.java | 223 +++ .../org/openapitools/client/model/Order.java | 369 +++++ .../org/openapitools/client/model/Pet.java | 397 ++++++ .../org/openapitools/client/model/Tag.java | 187 +++ .../org/openapitools/client/model/User.java | 403 ++++++ .../openapitools/client/api/PetApiTest.java | 180 +++ .../openapitools/client/api/StoreApiTest.java | 104 ++ .../openapitools/client/api/UserApiTest.java | 175 +++ .../client/model/CategoryTest.java | 56 + .../client/model/ModelApiResponseTest.java | 64 + .../openapitools/client/model/OrderTest.java | 89 ++ .../openapitools/client/model/PetTest.java | 92 ++ .../openapitools/client/model/TagTest.java | 56 + .../openapitools/client/model/UserTest.java | 104 ++ .../.github/workflows/maven.yml | 30 + .../native/test-regenerated-fixed3/.gitignore | 21 + .../.openapi-generator-ignore | 23 + .../.openapi-generator/FILES | 56 + .../.openapi-generator/VERSION | 1 + .../test-regenerated-fixed3/.travis.yml | 16 + .../native/test-regenerated-fixed3/README.md | 197 +++ .../test-regenerated-fixed3/api/openapi.yaml | 865 ++++++++++++ .../test-regenerated-fixed3/build.gradle | 109 ++ .../native/test-regenerated-fixed3/build.sbt | 1 + .../test-regenerated-fixed3/docs/Category.md | 15 + .../docs/ModelApiResponse.md | 16 + .../test-regenerated-fixed3/docs/Order.md | 29 + .../test-regenerated-fixed3/docs/Pet.md | 29 + .../test-regenerated-fixed3/docs/PetApi.md | 1212 +++++++++++++++++ .../test-regenerated-fixed3/docs/StoreApi.md | 564 ++++++++ .../test-regenerated-fixed3/docs/Tag.md | 15 + .../test-regenerated-fixed3/docs/User.md | 21 + .../test-regenerated-fixed3/docs/UserApi.md | 1178 ++++++++++++++++ .../test-regenerated-fixed3/git_push.sh | 57 + .../test-regenerated-fixed3/gradle.properties | 6 + .../gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 43453 bytes .../gradle/wrapper/gradle-wrapper.properties | 7 + .../native/test-regenerated-fixed3/gradlew | 249 ++++ .../test-regenerated-fixed3/gradlew.bat | 92 ++ .../native/test-regenerated-fixed3/pom.xml | 264 ++++ .../test-regenerated-fixed3/settings.gradle | 1 + .../src/main/AndroidManifest.xml | 3 + .../org/openapitools/client/ApiClient.java | 457 +++++++ .../org/openapitools/client/ApiException.java | 92 ++ .../org/openapitools/client/ApiResponse.java | 60 + .../openapitools/client/Configuration.java | 63 + .../java/org/openapitools/client/JSON.java | 264 ++++ .../java/org/openapitools/client/Pair.java | 37 + .../client/RFC3339DateFormat.java | 58 + .../client/RFC3339InstantDeserializer.java | 100 ++ .../client/RFC3339JavaTimeModule.java | 32 + .../client/ServerConfiguration.java | 72 + .../openapitools/client/ServerVariable.java | 37 + .../org/openapitools/client/api/PetApi.java | 1110 +++++++++++++++ .../org/openapitools/client/api/StoreApi.java | 535 ++++++++ .../org/openapitools/client/api/UserApi.java | 995 ++++++++++++++ .../client/model/AbstractOpenApiSchema.java | 147 ++ .../openapitools/client/model/Category.java | 187 +++ .../client/model/ModelApiResponse.java | 223 +++ .../org/openapitools/client/model/Order.java | 369 +++++ .../org/openapitools/client/model/Pet.java | 397 ++++++ .../org/openapitools/client/model/Tag.java | 187 +++ .../org/openapitools/client/model/User.java | 403 ++++++ .../openapitools/client/api/PetApiTest.java | 180 +++ .../openapitools/client/api/StoreApiTest.java | 104 ++ .../openapitools/client/api/UserApiTest.java | 175 +++ .../client/model/CategoryTest.java | 56 + .../client/model/ModelApiResponseTest.java | 64 + .../openapitools/client/model/OrderTest.java | 89 ++ .../openapitools/client/model/PetTest.java | 92 ++ .../openapitools/client/model/TagTest.java | 56 + .../openapitools/client/model/UserTest.java | 104 ++ .../.github/workflows/maven.yml | 30 + .../java/native/test-regenerated/.gitignore | 21 + .../.openapi-generator-ignore | 23 + .../test-regenerated/.openapi-generator/FILES | 56 + .../.openapi-generator/VERSION | 1 + .../java/native/test-regenerated/.travis.yml | 16 + .../java/native/test-regenerated/README.md | 197 +++ .../native/test-regenerated/api/openapi.yaml | 865 ++++++++++++ .../java/native/test-regenerated/build.gradle | 109 ++ .../java/native/test-regenerated/build.sbt | 1 + .../native/test-regenerated/docs/Category.md | 15 + .../test-regenerated/docs/ModelApiResponse.md | 16 + .../native/test-regenerated/docs/Order.md | 29 + .../java/native/test-regenerated/docs/Pet.md | 29 + .../native/test-regenerated/docs/PetApi.md | 1212 +++++++++++++++++ .../native/test-regenerated/docs/StoreApi.md | 564 ++++++++ .../java/native/test-regenerated/docs/Tag.md | 15 + .../java/native/test-regenerated/docs/User.md | 21 + .../native/test-regenerated/docs/UserApi.md | 1178 ++++++++++++++++ .../java/native/test-regenerated/git_push.sh | 57 + .../native/test-regenerated/gradle.properties | 6 + .../gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 43453 bytes .../gradle/wrapper/gradle-wrapper.properties | 7 + .../java/native/test-regenerated/gradlew | 249 ++++ .../java/native/test-regenerated/gradlew.bat | 92 ++ .../java/native/test-regenerated/pom.xml | 264 ++++ .../native/test-regenerated/settings.gradle | 1 + .../src/main/AndroidManifest.xml | 3 + .../org/openapitools/client/ApiClient.java | 457 +++++++ .../org/openapitools/client/ApiException.java | 92 ++ .../org/openapitools/client/ApiResponse.java | 60 + .../openapitools/client/Configuration.java | 63 + .../java/org/openapitools/client/JSON.java | 264 ++++ .../java/org/openapitools/client/Pair.java | 37 + .../client/RFC3339DateFormat.java | 58 + .../client/RFC3339InstantDeserializer.java | 100 ++ .../client/RFC3339JavaTimeModule.java | 32 + .../client/ServerConfiguration.java | 72 + .../openapitools/client/ServerVariable.java | 37 + .../org/openapitools/client/api/PetApi.java | 1110 +++++++++++++++ .../org/openapitools/client/api/StoreApi.java | 535 ++++++++ .../org/openapitools/client/api/UserApi.java | 995 ++++++++++++++ .../client/model/AbstractOpenApiSchema.java | 147 ++ .../openapitools/client/model/Category.java | 187 +++ .../client/model/ModelApiResponse.java | 223 +++ .../org/openapitools/client/model/Order.java | 369 +++++ .../org/openapitools/client/model/Pet.java | 397 ++++++ .../org/openapitools/client/model/Tag.java | 187 +++ .../org/openapitools/client/model/User.java | 403 ++++++ .../openapitools/client/api/PetApiTest.java | 180 +++ .../openapitools/client/api/StoreApiTest.java | 104 ++ .../openapitools/client/api/UserApiTest.java | 175 +++ .../client/model/CategoryTest.java | 56 + .../client/model/ModelApiResponseTest.java | 64 + .../openapitools/client/model/OrderTest.java | 89 ++ .../openapitools/client/model/PetTest.java | 92 ++ .../openapitools/client/model/TagTest.java | 56 + .../openapitools/client/model/UserTest.java | 104 ++ 256 files changed, 51822 insertions(+), 1370 deletions(-) create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/.github/workflows/maven.yml create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/.gitignore create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/.openapi-generator-ignore create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/.openapi-generator/FILES create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/.openapi-generator/VERSION create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/.travis.yml create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/README.md create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/api/openapi.yaml create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/build.gradle create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/build.sbt create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/docs/Category.md create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/docs/ModelApiResponse.md create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/docs/Order.md create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/docs/Pet.md create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/docs/PetApi.md create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/docs/StoreApi.md create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/docs/Tag.md create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/docs/User.md create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/docs/UserApi.md create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/git_push.sh create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/gradle.properties create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/gradle/wrapper/gradle-wrapper.jar create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/gradle/wrapper/gradle-wrapper.properties create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/gradlew create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/gradlew.bat create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/pom.xml create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/settings.gradle create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/src/main/AndroidManifest.xml create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/ApiClient.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/ApiException.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/ApiResponse.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/Configuration.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/JSON.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/Pair.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/RFC3339DateFormat.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/RFC3339InstantDeserializer.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/RFC3339JavaTimeModule.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/ServerConfiguration.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/ServerVariable.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/api/PetApi.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/api/StoreApi.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/api/UserApi.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/model/Category.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/model/ModelApiResponse.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/model/Order.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/model/Pet.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/model/Tag.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/model/User.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/src/test/java/org/openapitools/client/api/PetApiTest.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/src/test/java/org/openapitools/client/api/StoreApiTest.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/src/test/java/org/openapitools/client/api/UserApiTest.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/src/test/java/org/openapitools/client/model/CategoryTest.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/src/test/java/org/openapitools/client/model/OrderTest.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/src/test/java/org/openapitools/client/model/PetTest.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/src/test/java/org/openapitools/client/model/TagTest.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed/src/test/java/org/openapitools/client/model/UserTest.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/.github/workflows/maven.yml create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/.gitignore create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/.openapi-generator-ignore create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/.openapi-generator/FILES create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/.openapi-generator/VERSION create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/.travis.yml create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/README.md create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/api/openapi.yaml create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/build.gradle create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/build.sbt create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/docs/Category.md create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/docs/ModelApiResponse.md create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/docs/Order.md create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/docs/Pet.md create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/docs/PetApi.md create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/docs/StoreApi.md create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/docs/Tag.md create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/docs/User.md create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/docs/UserApi.md create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/git_push.sh create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/gradle.properties create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/gradle/wrapper/gradle-wrapper.jar create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/gradle/wrapper/gradle-wrapper.properties create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/gradlew create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/gradlew.bat create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/pom.xml create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/settings.gradle create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/src/main/AndroidManifest.xml create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/ApiClient.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/ApiException.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/ApiResponse.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/Configuration.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/JSON.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/Pair.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/RFC3339DateFormat.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/RFC3339InstantDeserializer.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/RFC3339JavaTimeModule.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/ServerConfiguration.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/ServerVariable.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/api/PetApi.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/api/StoreApi.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/api/UserApi.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/model/Category.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/model/ModelApiResponse.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/model/Order.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/model/Pet.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/model/Tag.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/model/User.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/src/test/java/org/openapitools/client/api/PetApiTest.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/src/test/java/org/openapitools/client/api/StoreApiTest.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/src/test/java/org/openapitools/client/api/UserApiTest.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/src/test/java/org/openapitools/client/model/CategoryTest.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/src/test/java/org/openapitools/client/model/OrderTest.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/src/test/java/org/openapitools/client/model/PetTest.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/src/test/java/org/openapitools/client/model/TagTest.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed2/src/test/java/org/openapitools/client/model/UserTest.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/.github/workflows/maven.yml create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/.gitignore create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/.openapi-generator-ignore create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/.openapi-generator/FILES create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/.openapi-generator/VERSION create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/.travis.yml create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/README.md create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/api/openapi.yaml create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/build.gradle create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/build.sbt create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/docs/Category.md create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/docs/ModelApiResponse.md create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/docs/Order.md create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/docs/Pet.md create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/docs/PetApi.md create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/docs/StoreApi.md create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/docs/Tag.md create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/docs/User.md create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/docs/UserApi.md create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/git_push.sh create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/gradle.properties create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/gradle/wrapper/gradle-wrapper.jar create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/gradle/wrapper/gradle-wrapper.properties create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/gradlew create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/gradlew.bat create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/pom.xml create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/settings.gradle create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/src/main/AndroidManifest.xml create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/ApiClient.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/ApiException.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/ApiResponse.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/Configuration.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/JSON.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/Pair.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/RFC3339DateFormat.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/RFC3339InstantDeserializer.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/RFC3339JavaTimeModule.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/ServerConfiguration.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/ServerVariable.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/api/PetApi.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/api/StoreApi.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/api/UserApi.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/model/Category.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/model/ModelApiResponse.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/model/Order.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/model/Pet.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/model/Tag.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/model/User.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/src/test/java/org/openapitools/client/api/PetApiTest.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/src/test/java/org/openapitools/client/api/StoreApiTest.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/src/test/java/org/openapitools/client/api/UserApiTest.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/src/test/java/org/openapitools/client/model/CategoryTest.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/src/test/java/org/openapitools/client/model/OrderTest.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/src/test/java/org/openapitools/client/model/PetTest.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/src/test/java/org/openapitools/client/model/TagTest.java create mode 100644 samples/client/petstore/java/native/test-regenerated-fixed3/src/test/java/org/openapitools/client/model/UserTest.java create mode 100644 samples/client/petstore/java/native/test-regenerated/.github/workflows/maven.yml create mode 100644 samples/client/petstore/java/native/test-regenerated/.gitignore create mode 100644 samples/client/petstore/java/native/test-regenerated/.openapi-generator-ignore create mode 100644 samples/client/petstore/java/native/test-regenerated/.openapi-generator/FILES create mode 100644 samples/client/petstore/java/native/test-regenerated/.openapi-generator/VERSION create mode 100644 samples/client/petstore/java/native/test-regenerated/.travis.yml create mode 100644 samples/client/petstore/java/native/test-regenerated/README.md create mode 100644 samples/client/petstore/java/native/test-regenerated/api/openapi.yaml create mode 100644 samples/client/petstore/java/native/test-regenerated/build.gradle create mode 100644 samples/client/petstore/java/native/test-regenerated/build.sbt create mode 100644 samples/client/petstore/java/native/test-regenerated/docs/Category.md create mode 100644 samples/client/petstore/java/native/test-regenerated/docs/ModelApiResponse.md create mode 100644 samples/client/petstore/java/native/test-regenerated/docs/Order.md create mode 100644 samples/client/petstore/java/native/test-regenerated/docs/Pet.md create mode 100644 samples/client/petstore/java/native/test-regenerated/docs/PetApi.md create mode 100644 samples/client/petstore/java/native/test-regenerated/docs/StoreApi.md create mode 100644 samples/client/petstore/java/native/test-regenerated/docs/Tag.md create mode 100644 samples/client/petstore/java/native/test-regenerated/docs/User.md create mode 100644 samples/client/petstore/java/native/test-regenerated/docs/UserApi.md create mode 100644 samples/client/petstore/java/native/test-regenerated/git_push.sh create mode 100644 samples/client/petstore/java/native/test-regenerated/gradle.properties create mode 100644 samples/client/petstore/java/native/test-regenerated/gradle/wrapper/gradle-wrapper.jar create mode 100644 samples/client/petstore/java/native/test-regenerated/gradle/wrapper/gradle-wrapper.properties create mode 100644 samples/client/petstore/java/native/test-regenerated/gradlew create mode 100644 samples/client/petstore/java/native/test-regenerated/gradlew.bat create mode 100644 samples/client/petstore/java/native/test-regenerated/pom.xml create mode 100644 samples/client/petstore/java/native/test-regenerated/settings.gradle create mode 100644 samples/client/petstore/java/native/test-regenerated/src/main/AndroidManifest.xml create mode 100644 samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/ApiClient.java create mode 100644 samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/ApiException.java create mode 100644 samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/ApiResponse.java create mode 100644 samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/Configuration.java create mode 100644 samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/JSON.java create mode 100644 samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/Pair.java create mode 100644 samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/RFC3339DateFormat.java create mode 100644 samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/RFC3339InstantDeserializer.java create mode 100644 samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/RFC3339JavaTimeModule.java create mode 100644 samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/ServerConfiguration.java create mode 100644 samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/ServerVariable.java create mode 100644 samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/api/PetApi.java create mode 100644 samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/api/StoreApi.java create mode 100644 samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/api/UserApi.java create mode 100644 samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java create mode 100644 samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/model/Category.java create mode 100644 samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/model/ModelApiResponse.java create mode 100644 samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/model/Order.java create mode 100644 samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/model/Pet.java create mode 100644 samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/model/Tag.java create mode 100644 samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/model/User.java create mode 100644 samples/client/petstore/java/native/test-regenerated/src/test/java/org/openapitools/client/api/PetApiTest.java create mode 100644 samples/client/petstore/java/native/test-regenerated/src/test/java/org/openapitools/client/api/StoreApiTest.java create mode 100644 samples/client/petstore/java/native/test-regenerated/src/test/java/org/openapitools/client/api/UserApiTest.java create mode 100644 samples/client/petstore/java/native/test-regenerated/src/test/java/org/openapitools/client/model/CategoryTest.java create mode 100644 samples/client/petstore/java/native/test-regenerated/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java create mode 100644 samples/client/petstore/java/native/test-regenerated/src/test/java/org/openapitools/client/model/OrderTest.java create mode 100644 samples/client/petstore/java/native/test-regenerated/src/test/java/org/openapitools/client/model/PetTest.java create mode 100644 samples/client/petstore/java/native/test-regenerated/src/test/java/org/openapitools/client/model/TagTest.java create mode 100644 samples/client/petstore/java/native/test-regenerated/src/test/java/org/openapitools/client/model/UserTest.java diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/native/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/native/api.mustache index 70348f5cf65c..c04904caf697 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/native/api.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/native/api.mustache @@ -129,7 +129,7 @@ public class {{classname}} { @Deprecated {{/isDeprecated}} public {{#returnType}}{{#asyncNative}}CompletableFuture<{{{returnType}}}>{{/asyncNative}}{{^asyncNative}}{{{returnType}}}{{/asyncNative}}{{/returnType}}{{^returnType}}{{#asyncNative}}CompletableFuture{{/asyncNative}}{{^asyncNative}}void{{/asyncNative}}{{/returnType}} {{operationId}}(API{{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}Request apiRequest) throws ApiException { - return {{operationId}}(apiRequest, null); + {{#returnType}}return {{/returnType}}{{^returnType}}{{#asyncNative}}return {{/asyncNative}}{{/returnType}}{{operationId}}(apiRequest, null); } /** @@ -240,7 +240,7 @@ public class {{classname}} { @Deprecated {{/isDeprecated}} public {{#returnType}}{{#asyncNative}}CompletableFuture<{{{returnType}}}>{{/asyncNative}}{{^asyncNative}}{{{returnType}}}{{/asyncNative}}{{/returnType}}{{^returnType}}{{#asyncNative}}CompletableFuture{{/asyncNative}}{{^asyncNative}}void{{/asyncNative}}{{/returnType}} {{operationId}}({{#allParams}}{{>nullable_var_annotations}} {{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { - return {{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}, null); + {{#returnType}}return {{/returnType}}{{^returnType}}{{#asyncNative}}return {{/asyncNative}}{{/returnType}}{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}null); } /** @@ -279,7 +279,7 @@ public class {{classname}} { {{/asyncNative}} {{#asyncNative}} try { - HttpRequest.Builder localVarRequestBuilder = {{operationId}}RequestBuilder({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#allParams}}, {{/allParams}}headers); + HttpRequest.Builder localVarRequestBuilder = {{operationId}}RequestBuilder({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -327,7 +327,7 @@ public class {{classname}} { @Deprecated {{/isDeprecated}} public {{#asyncNative}}CompletableFuture<{{/asyncNative}}ApiResponse<{{{returnType}}}{{^returnType}}Void{{/returnType}}>{{#asyncNative}}>{{/asyncNative}} {{operationId}}WithHttpInfo({{#allParams}}{{>nullable_var_annotations}} {{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { - return {{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}, null); + return {{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}null); } /** diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/AuthApi.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/AuthApi.java index 674e1ea5e5f3..69a5917dfb3d 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/AuthApi.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/AuthApi.java @@ -54,9 +54,6 @@ public class AuthApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; - // Custom headers to be sent with every request from this API client - private final Map extraHeaders = new java.util.HashMap<>(); - public AuthApi() { this(Configuration.getDefaultApiClient()); } @@ -71,27 +68,6 @@ public AuthApi(ApiClient apiClient) { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } - /** - * Add a custom header to be sent with every request from this API client. - * @param name Header name - * @param value Header value - * @return this - */ - public AuthApi addHeader(String name, String value) { - this.extraHeaders.put(name, value); - return this; - } - - /** - * Remove a custom header. - * @param name Header name - * @return this - */ - public AuthApi removeHeader(String name) { - this.extraHeaders.remove(name); - return this; - } - protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { String body = response.body() == null ? null : new String(response.body().readAllBytes()); @@ -113,7 +89,18 @@ private String formatExceptionMessage(String operationId, int statusCode, String * @throws ApiException if fails to make API call */ public String testAuthHttpBasic() throws ApiException { - ApiResponse localVarResponse = testAuthHttpBasicWithHttpInfo(); + return testAuthHttpBasic(null); + } + + /** + * To test HTTP basic authentication + * To test HTTP basic authentication + * @param headers Optional headers to include in the request + * @return String + * @throws ApiException if fails to make API call + */ + public String testAuthHttpBasic(Map headers) throws ApiException { + ApiResponse localVarResponse = testAuthHttpBasicWithHttpInfo(headers); return localVarResponse.getData(); } @@ -124,7 +111,18 @@ public String testAuthHttpBasic() throws ApiException { * @throws ApiException if fails to make API call */ public ApiResponse testAuthHttpBasicWithHttpInfo() throws ApiException { - HttpRequest.Builder localVarRequestBuilder = testAuthHttpBasicRequestBuilder(); + return testAuthHttpBasicWithHttpInfo(null); + } + + /** + * To test HTTP basic authentication + * To test HTTP basic authentication + * @param headers Optional headers to include in the request + * @return ApiResponse<String> + * @throws ApiException if fails to make API call + */ + public ApiResponse testAuthHttpBasicWithHttpInfo(Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = testAuthHttpBasicRequestBuilder(headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -160,7 +158,7 @@ public ApiResponse testAuthHttpBasicWithHttpInfo() throws ApiException { } } - private HttpRequest.Builder testAuthHttpBasicRequestBuilder() throws ApiException { + private HttpRequest.Builder testAuthHttpBasicRequestBuilder(Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -174,9 +172,11 @@ private HttpRequest.Builder testAuthHttpBasicRequestBuilder() throws ApiExceptio if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -191,7 +191,18 @@ private HttpRequest.Builder testAuthHttpBasicRequestBuilder() throws ApiExceptio * @throws ApiException if fails to make API call */ public String testAuthHttpBearer() throws ApiException { - ApiResponse localVarResponse = testAuthHttpBearerWithHttpInfo(); + return testAuthHttpBearer(null); + } + + /** + * To test HTTP bearer authentication + * To test HTTP bearer authentication + * @param headers Optional headers to include in the request + * @return String + * @throws ApiException if fails to make API call + */ + public String testAuthHttpBearer(Map headers) throws ApiException { + ApiResponse localVarResponse = testAuthHttpBearerWithHttpInfo(headers); return localVarResponse.getData(); } @@ -202,7 +213,18 @@ public String testAuthHttpBearer() throws ApiException { * @throws ApiException if fails to make API call */ public ApiResponse testAuthHttpBearerWithHttpInfo() throws ApiException { - HttpRequest.Builder localVarRequestBuilder = testAuthHttpBearerRequestBuilder(); + return testAuthHttpBearerWithHttpInfo(null); + } + + /** + * To test HTTP bearer authentication + * To test HTTP bearer authentication + * @param headers Optional headers to include in the request + * @return ApiResponse<String> + * @throws ApiException if fails to make API call + */ + public ApiResponse testAuthHttpBearerWithHttpInfo(Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = testAuthHttpBearerRequestBuilder(headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -238,7 +260,7 @@ public ApiResponse testAuthHttpBearerWithHttpInfo() throws ApiException } } - private HttpRequest.Builder testAuthHttpBearerRequestBuilder() throws ApiException { + private HttpRequest.Builder testAuthHttpBearerRequestBuilder(Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -252,9 +274,11 @@ private HttpRequest.Builder testAuthHttpBearerRequestBuilder() throws ApiExcepti if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/BodyApi.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/BodyApi.java index e64fe5d80827..705b528ca1c3 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/BodyApi.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/BodyApi.java @@ -64,9 +64,6 @@ public class BodyApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; - // Custom headers to be sent with every request from this API client - private final Map extraHeaders = new java.util.HashMap<>(); - public BodyApi() { this(Configuration.getDefaultApiClient()); } @@ -81,27 +78,6 @@ public BodyApi(ApiClient apiClient) { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } - /** - * Add a custom header to be sent with every request from this API client. - * @param name Header name - * @param value Header value - * @return this - */ - public BodyApi addHeader(String name, String value) { - this.extraHeaders.put(name, value); - return this; - } - - /** - * Remove a custom header. - * @param name Header name - * @return this - */ - public BodyApi removeHeader(String name) { - this.extraHeaders.remove(name); - return this; - } - protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { String body = response.body() == null ? null : new String(response.body().readAllBytes()); @@ -123,7 +99,18 @@ private String formatExceptionMessage(String operationId, int statusCode, String * @throws ApiException if fails to make API call */ public File testBinaryGif() throws ApiException { - ApiResponse localVarResponse = testBinaryGifWithHttpInfo(); + return testBinaryGif(null); + } + + /** + * Test binary (gif) response body + * Test binary (gif) response body + * @param headers Optional headers to include in the request + * @return File + * @throws ApiException if fails to make API call + */ + public File testBinaryGif(Map headers) throws ApiException { + ApiResponse localVarResponse = testBinaryGifWithHttpInfo(headers); return localVarResponse.getData(); } @@ -134,7 +121,18 @@ public File testBinaryGif() throws ApiException { * @throws ApiException if fails to make API call */ public ApiResponse testBinaryGifWithHttpInfo() throws ApiException { - HttpRequest.Builder localVarRequestBuilder = testBinaryGifRequestBuilder(); + return testBinaryGifWithHttpInfo(null); + } + + /** + * Test binary (gif) response body + * Test binary (gif) response body + * @param headers Optional headers to include in the request + * @return ApiResponse<File> + * @throws ApiException if fails to make API call + */ + public ApiResponse testBinaryGifWithHttpInfo(Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = testBinaryGifRequestBuilder(headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -173,7 +171,7 @@ public ApiResponse testBinaryGifWithHttpInfo() throws ApiException { } } - private HttpRequest.Builder testBinaryGifRequestBuilder() throws ApiException { + private HttpRequest.Builder testBinaryGifRequestBuilder(Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -187,9 +185,11 @@ private HttpRequest.Builder testBinaryGifRequestBuilder() throws ApiException { if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -205,7 +205,19 @@ private HttpRequest.Builder testBinaryGifRequestBuilder() throws ApiException { * @throws ApiException if fails to make API call */ public String testBodyApplicationOctetstreamBinary(@javax.annotation.Nullable File body) throws ApiException { - ApiResponse localVarResponse = testBodyApplicationOctetstreamBinaryWithHttpInfo(body); + return testBodyApplicationOctetstreamBinary(body, null); + } + + /** + * Test body parameter(s) + * Test body parameter(s) + * @param body (optional) + * @param headers Optional headers to include in the request + * @return String + * @throws ApiException if fails to make API call + */ + public String testBodyApplicationOctetstreamBinary(@javax.annotation.Nullable File body, Map headers) throws ApiException { + ApiResponse localVarResponse = testBodyApplicationOctetstreamBinaryWithHttpInfo(body, headers); return localVarResponse.getData(); } @@ -217,7 +229,19 @@ public String testBodyApplicationOctetstreamBinary(@javax.annotation.Nullable Fi * @throws ApiException if fails to make API call */ public ApiResponse testBodyApplicationOctetstreamBinaryWithHttpInfo(@javax.annotation.Nullable File body) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = testBodyApplicationOctetstreamBinaryRequestBuilder(body); + return testBodyApplicationOctetstreamBinaryWithHttpInfo(body, null); + } + + /** + * Test body parameter(s) + * Test body parameter(s) + * @param body (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<String> + * @throws ApiException if fails to make API call + */ + public ApiResponse testBodyApplicationOctetstreamBinaryWithHttpInfo(@javax.annotation.Nullable File body, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = testBodyApplicationOctetstreamBinaryRequestBuilder(body, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -253,7 +277,7 @@ public ApiResponse testBodyApplicationOctetstreamBinaryWithHttpInfo(@jav } } - private HttpRequest.Builder testBodyApplicationOctetstreamBinaryRequestBuilder(@javax.annotation.Nullable File body) throws ApiException { + private HttpRequest.Builder testBodyApplicationOctetstreamBinaryRequestBuilder(@javax.annotation.Nullable File body, Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -273,9 +297,11 @@ private HttpRequest.Builder testBodyApplicationOctetstreamBinaryRequestBuilder(@ if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -291,7 +317,19 @@ private HttpRequest.Builder testBodyApplicationOctetstreamBinaryRequestBuilder(@ * @throws ApiException if fails to make API call */ public String testBodyMultipartFormdataArrayOfBinary(@javax.annotation.Nonnull List files) throws ApiException { - ApiResponse localVarResponse = testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(files); + return testBodyMultipartFormdataArrayOfBinary(files, null); + } + + /** + * Test array of binary in multipart mime + * Test array of binary in multipart mime + * @param files (required) + * @param headers Optional headers to include in the request + * @return String + * @throws ApiException if fails to make API call + */ + public String testBodyMultipartFormdataArrayOfBinary(@javax.annotation.Nonnull List files, Map headers) throws ApiException { + ApiResponse localVarResponse = testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(files, headers); return localVarResponse.getData(); } @@ -303,7 +341,19 @@ public String testBodyMultipartFormdataArrayOfBinary(@javax.annotation.Nonnull L * @throws ApiException if fails to make API call */ public ApiResponse testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(@javax.annotation.Nonnull List files) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = testBodyMultipartFormdataArrayOfBinaryRequestBuilder(files); + return testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(files, null); + } + + /** + * Test array of binary in multipart mime + * Test array of binary in multipart mime + * @param files (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<String> + * @throws ApiException if fails to make API call + */ + public ApiResponse testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(@javax.annotation.Nonnull List files, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = testBodyMultipartFormdataArrayOfBinaryRequestBuilder(files, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -339,7 +389,7 @@ public ApiResponse testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(@j } } - private HttpRequest.Builder testBodyMultipartFormdataArrayOfBinaryRequestBuilder(@javax.annotation.Nonnull List files) throws ApiException { + private HttpRequest.Builder testBodyMultipartFormdataArrayOfBinaryRequestBuilder(@javax.annotation.Nonnull List files, Map headers) throws ApiException { // verify the required parameter 'files' is set if (files == null) { throw new ApiException(400, "Missing the required parameter 'files' when calling testBodyMultipartFormdataArrayOfBinary"); @@ -392,9 +442,11 @@ private HttpRequest.Builder testBodyMultipartFormdataArrayOfBinaryRequestBuilder if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -410,7 +462,19 @@ private HttpRequest.Builder testBodyMultipartFormdataArrayOfBinaryRequestBuilder * @throws ApiException if fails to make API call */ public String testBodyMultipartFormdataSingleBinary(@javax.annotation.Nullable File myFile) throws ApiException { - ApiResponse localVarResponse = testBodyMultipartFormdataSingleBinaryWithHttpInfo(myFile); + return testBodyMultipartFormdataSingleBinary(myFile, null); + } + + /** + * Test single binary in multipart mime + * Test single binary in multipart mime + * @param myFile (optional) + * @param headers Optional headers to include in the request + * @return String + * @throws ApiException if fails to make API call + */ + public String testBodyMultipartFormdataSingleBinary(@javax.annotation.Nullable File myFile, Map headers) throws ApiException { + ApiResponse localVarResponse = testBodyMultipartFormdataSingleBinaryWithHttpInfo(myFile, headers); return localVarResponse.getData(); } @@ -422,7 +486,19 @@ public String testBodyMultipartFormdataSingleBinary(@javax.annotation.Nullable F * @throws ApiException if fails to make API call */ public ApiResponse testBodyMultipartFormdataSingleBinaryWithHttpInfo(@javax.annotation.Nullable File myFile) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = testBodyMultipartFormdataSingleBinaryRequestBuilder(myFile); + return testBodyMultipartFormdataSingleBinaryWithHttpInfo(myFile, null); + } + + /** + * Test single binary in multipart mime + * Test single binary in multipart mime + * @param myFile (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<String> + * @throws ApiException if fails to make API call + */ + public ApiResponse testBodyMultipartFormdataSingleBinaryWithHttpInfo(@javax.annotation.Nullable File myFile, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = testBodyMultipartFormdataSingleBinaryRequestBuilder(myFile, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -458,7 +534,7 @@ public ApiResponse testBodyMultipartFormdataSingleBinaryWithHttpInfo(@ja } } - private HttpRequest.Builder testBodyMultipartFormdataSingleBinaryRequestBuilder(@javax.annotation.Nullable File myFile) throws ApiException { + private HttpRequest.Builder testBodyMultipartFormdataSingleBinaryRequestBuilder(@javax.annotation.Nullable File myFile, Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -505,9 +581,11 @@ private HttpRequest.Builder testBodyMultipartFormdataSingleBinaryRequestBuilder( if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -523,7 +601,19 @@ private HttpRequest.Builder testBodyMultipartFormdataSingleBinaryRequestBuilder( * @throws ApiException if fails to make API call */ public Pet testEchoBodyAllOfPet(@javax.annotation.Nullable Pet pet) throws ApiException { - ApiResponse localVarResponse = testEchoBodyAllOfPetWithHttpInfo(pet); + return testEchoBodyAllOfPet(pet, null); + } + + /** + * Test body parameter(s) + * Test body parameter(s) + * @param pet Pet object that needs to be added to the store (optional) + * @param headers Optional headers to include in the request + * @return Pet + * @throws ApiException if fails to make API call + */ + public Pet testEchoBodyAllOfPet(@javax.annotation.Nullable Pet pet, Map headers) throws ApiException { + ApiResponse localVarResponse = testEchoBodyAllOfPetWithHttpInfo(pet, headers); return localVarResponse.getData(); } @@ -535,7 +625,19 @@ public Pet testEchoBodyAllOfPet(@javax.annotation.Nullable Pet pet) throws ApiEx * @throws ApiException if fails to make API call */ public ApiResponse testEchoBodyAllOfPetWithHttpInfo(@javax.annotation.Nullable Pet pet) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = testEchoBodyAllOfPetRequestBuilder(pet); + return testEchoBodyAllOfPetWithHttpInfo(pet, null); + } + + /** + * Test body parameter(s) + * Test body parameter(s) + * @param pet Pet object that needs to be added to the store (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<Pet> + * @throws ApiException if fails to make API call + */ + public ApiResponse testEchoBodyAllOfPetWithHttpInfo(@javax.annotation.Nullable Pet pet, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = testEchoBodyAllOfPetRequestBuilder(pet, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -574,7 +676,7 @@ public ApiResponse testEchoBodyAllOfPetWithHttpInfo(@javax.annotation.Nulla } } - private HttpRequest.Builder testEchoBodyAllOfPetRequestBuilder(@javax.annotation.Nullable Pet pet) throws ApiException { + private HttpRequest.Builder testEchoBodyAllOfPetRequestBuilder(@javax.annotation.Nullable Pet pet, Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -594,9 +696,11 @@ private HttpRequest.Builder testEchoBodyAllOfPetRequestBuilder(@javax.annotation if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -612,7 +716,19 @@ private HttpRequest.Builder testEchoBodyAllOfPetRequestBuilder(@javax.annotation * @throws ApiException if fails to make API call */ public String testEchoBodyFreeFormObjectResponseString(@javax.annotation.Nullable Object body) throws ApiException { - ApiResponse localVarResponse = testEchoBodyFreeFormObjectResponseStringWithHttpInfo(body); + return testEchoBodyFreeFormObjectResponseString(body, null); + } + + /** + * Test free form object + * Test free form object + * @param body Free form object (optional) + * @param headers Optional headers to include in the request + * @return String + * @throws ApiException if fails to make API call + */ + public String testEchoBodyFreeFormObjectResponseString(@javax.annotation.Nullable Object body, Map headers) throws ApiException { + ApiResponse localVarResponse = testEchoBodyFreeFormObjectResponseStringWithHttpInfo(body, headers); return localVarResponse.getData(); } @@ -624,7 +740,19 @@ public String testEchoBodyFreeFormObjectResponseString(@javax.annotation.Nullabl * @throws ApiException if fails to make API call */ public ApiResponse testEchoBodyFreeFormObjectResponseStringWithHttpInfo(@javax.annotation.Nullable Object body) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = testEchoBodyFreeFormObjectResponseStringRequestBuilder(body); + return testEchoBodyFreeFormObjectResponseStringWithHttpInfo(body, null); + } + + /** + * Test free form object + * Test free form object + * @param body Free form object (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<String> + * @throws ApiException if fails to make API call + */ + public ApiResponse testEchoBodyFreeFormObjectResponseStringWithHttpInfo(@javax.annotation.Nullable Object body, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = testEchoBodyFreeFormObjectResponseStringRequestBuilder(body, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -660,7 +788,7 @@ public ApiResponse testEchoBodyFreeFormObjectResponseStringWithHttpInfo( } } - private HttpRequest.Builder testEchoBodyFreeFormObjectResponseStringRequestBuilder(@javax.annotation.Nullable Object body) throws ApiException { + private HttpRequest.Builder testEchoBodyFreeFormObjectResponseStringRequestBuilder(@javax.annotation.Nullable Object body, Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -680,9 +808,11 @@ private HttpRequest.Builder testEchoBodyFreeFormObjectResponseStringRequestBuild if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -698,7 +828,19 @@ private HttpRequest.Builder testEchoBodyFreeFormObjectResponseStringRequestBuild * @throws ApiException if fails to make API call */ public Pet testEchoBodyPet(@javax.annotation.Nullable Pet pet) throws ApiException { - ApiResponse localVarResponse = testEchoBodyPetWithHttpInfo(pet); + return testEchoBodyPet(pet, null); + } + + /** + * Test body parameter(s) + * Test body parameter(s) + * @param pet Pet object that needs to be added to the store (optional) + * @param headers Optional headers to include in the request + * @return Pet + * @throws ApiException if fails to make API call + */ + public Pet testEchoBodyPet(@javax.annotation.Nullable Pet pet, Map headers) throws ApiException { + ApiResponse localVarResponse = testEchoBodyPetWithHttpInfo(pet, headers); return localVarResponse.getData(); } @@ -710,7 +852,19 @@ public Pet testEchoBodyPet(@javax.annotation.Nullable Pet pet) throws ApiExcepti * @throws ApiException if fails to make API call */ public ApiResponse testEchoBodyPetWithHttpInfo(@javax.annotation.Nullable Pet pet) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = testEchoBodyPetRequestBuilder(pet); + return testEchoBodyPetWithHttpInfo(pet, null); + } + + /** + * Test body parameter(s) + * Test body parameter(s) + * @param pet Pet object that needs to be added to the store (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<Pet> + * @throws ApiException if fails to make API call + */ + public ApiResponse testEchoBodyPetWithHttpInfo(@javax.annotation.Nullable Pet pet, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = testEchoBodyPetRequestBuilder(pet, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -749,7 +903,7 @@ public ApiResponse testEchoBodyPetWithHttpInfo(@javax.annotation.Nullable P } } - private HttpRequest.Builder testEchoBodyPetRequestBuilder(@javax.annotation.Nullable Pet pet) throws ApiException { + private HttpRequest.Builder testEchoBodyPetRequestBuilder(@javax.annotation.Nullable Pet pet, Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -769,9 +923,11 @@ private HttpRequest.Builder testEchoBodyPetRequestBuilder(@javax.annotation.Null if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -787,7 +943,19 @@ private HttpRequest.Builder testEchoBodyPetRequestBuilder(@javax.annotation.Null * @throws ApiException if fails to make API call */ public String testEchoBodyPetResponseString(@javax.annotation.Nullable Pet pet) throws ApiException { - ApiResponse localVarResponse = testEchoBodyPetResponseStringWithHttpInfo(pet); + return testEchoBodyPetResponseString(pet, null); + } + + /** + * Test empty response body + * Test empty response body + * @param pet Pet object that needs to be added to the store (optional) + * @param headers Optional headers to include in the request + * @return String + * @throws ApiException if fails to make API call + */ + public String testEchoBodyPetResponseString(@javax.annotation.Nullable Pet pet, Map headers) throws ApiException { + ApiResponse localVarResponse = testEchoBodyPetResponseStringWithHttpInfo(pet, headers); return localVarResponse.getData(); } @@ -799,7 +967,19 @@ public String testEchoBodyPetResponseString(@javax.annotation.Nullable Pet pet) * @throws ApiException if fails to make API call */ public ApiResponse testEchoBodyPetResponseStringWithHttpInfo(@javax.annotation.Nullable Pet pet) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = testEchoBodyPetResponseStringRequestBuilder(pet); + return testEchoBodyPetResponseStringWithHttpInfo(pet, null); + } + + /** + * Test empty response body + * Test empty response body + * @param pet Pet object that needs to be added to the store (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<String> + * @throws ApiException if fails to make API call + */ + public ApiResponse testEchoBodyPetResponseStringWithHttpInfo(@javax.annotation.Nullable Pet pet, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = testEchoBodyPetResponseStringRequestBuilder(pet, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -835,7 +1015,7 @@ public ApiResponse testEchoBodyPetResponseStringWithHttpInfo(@javax.anno } } - private HttpRequest.Builder testEchoBodyPetResponseStringRequestBuilder(@javax.annotation.Nullable Pet pet) throws ApiException { + private HttpRequest.Builder testEchoBodyPetResponseStringRequestBuilder(@javax.annotation.Nullable Pet pet, Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -855,9 +1035,11 @@ private HttpRequest.Builder testEchoBodyPetResponseStringRequestBuilder(@javax.a if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -873,7 +1055,19 @@ private HttpRequest.Builder testEchoBodyPetResponseStringRequestBuilder(@javax.a * @throws ApiException if fails to make API call */ public StringEnumRef testEchoBodyStringEnum(@javax.annotation.Nullable String body) throws ApiException { - ApiResponse localVarResponse = testEchoBodyStringEnumWithHttpInfo(body); + return testEchoBodyStringEnum(body, null); + } + + /** + * Test string enum response body + * Test string enum response body + * @param body String enum (optional) + * @param headers Optional headers to include in the request + * @return StringEnumRef + * @throws ApiException if fails to make API call + */ + public StringEnumRef testEchoBodyStringEnum(@javax.annotation.Nullable String body, Map headers) throws ApiException { + ApiResponse localVarResponse = testEchoBodyStringEnumWithHttpInfo(body, headers); return localVarResponse.getData(); } @@ -885,7 +1079,19 @@ public StringEnumRef testEchoBodyStringEnum(@javax.annotation.Nullable String bo * @throws ApiException if fails to make API call */ public ApiResponse testEchoBodyStringEnumWithHttpInfo(@javax.annotation.Nullable String body) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = testEchoBodyStringEnumRequestBuilder(body); + return testEchoBodyStringEnumWithHttpInfo(body, null); + } + + /** + * Test string enum response body + * Test string enum response body + * @param body String enum (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<StringEnumRef> + * @throws ApiException if fails to make API call + */ + public ApiResponse testEchoBodyStringEnumWithHttpInfo(@javax.annotation.Nullable String body, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = testEchoBodyStringEnumRequestBuilder(body, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -924,7 +1130,7 @@ public ApiResponse testEchoBodyStringEnumWithHttpInfo(@javax.anno } } - private HttpRequest.Builder testEchoBodyStringEnumRequestBuilder(@javax.annotation.Nullable String body) throws ApiException { + private HttpRequest.Builder testEchoBodyStringEnumRequestBuilder(@javax.annotation.Nullable String body, Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -944,9 +1150,11 @@ private HttpRequest.Builder testEchoBodyStringEnumRequestBuilder(@javax.annotati if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -962,7 +1170,19 @@ private HttpRequest.Builder testEchoBodyStringEnumRequestBuilder(@javax.annotati * @throws ApiException if fails to make API call */ public String testEchoBodyTagResponseString(@javax.annotation.Nullable Tag tag) throws ApiException { - ApiResponse localVarResponse = testEchoBodyTagResponseStringWithHttpInfo(tag); + return testEchoBodyTagResponseString(tag, null); + } + + /** + * Test empty json (request body) + * Test empty json (request body) + * @param tag Tag object (optional) + * @param headers Optional headers to include in the request + * @return String + * @throws ApiException if fails to make API call + */ + public String testEchoBodyTagResponseString(@javax.annotation.Nullable Tag tag, Map headers) throws ApiException { + ApiResponse localVarResponse = testEchoBodyTagResponseStringWithHttpInfo(tag, headers); return localVarResponse.getData(); } @@ -974,7 +1194,19 @@ public String testEchoBodyTagResponseString(@javax.annotation.Nullable Tag tag) * @throws ApiException if fails to make API call */ public ApiResponse testEchoBodyTagResponseStringWithHttpInfo(@javax.annotation.Nullable Tag tag) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = testEchoBodyTagResponseStringRequestBuilder(tag); + return testEchoBodyTagResponseStringWithHttpInfo(tag, null); + } + + /** + * Test empty json (request body) + * Test empty json (request body) + * @param tag Tag object (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<String> + * @throws ApiException if fails to make API call + */ + public ApiResponse testEchoBodyTagResponseStringWithHttpInfo(@javax.annotation.Nullable Tag tag, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = testEchoBodyTagResponseStringRequestBuilder(tag, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -1010,7 +1242,7 @@ public ApiResponse testEchoBodyTagResponseStringWithHttpInfo(@javax.anno } } - private HttpRequest.Builder testEchoBodyTagResponseStringRequestBuilder(@javax.annotation.Nullable Tag tag) throws ApiException { + private HttpRequest.Builder testEchoBodyTagResponseStringRequestBuilder(@javax.annotation.Nullable Tag tag, Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -1030,9 +1262,11 @@ private HttpRequest.Builder testEchoBodyTagResponseStringRequestBuilder(@javax.a if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/FormApi.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/FormApi.java index 26a57cc38d17..630492693f20 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/FormApi.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/FormApi.java @@ -61,9 +61,6 @@ public class FormApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; - // Custom headers to be sent with every request from this API client - private final Map extraHeaders = new java.util.HashMap<>(); - public FormApi() { this(Configuration.getDefaultApiClient()); } @@ -78,27 +75,6 @@ public FormApi(ApiClient apiClient) { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } - /** - * Add a custom header to be sent with every request from this API client. - * @param name Header name - * @param value Header value - * @return this - */ - public FormApi addHeader(String name, String value) { - this.extraHeaders.put(name, value); - return this; - } - - /** - * Remove a custom header. - * @param name Header name - * @return this - */ - public FormApi removeHeader(String name) { - this.extraHeaders.remove(name); - return this; - } - protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { String body = response.body() == null ? null : new String(response.body().readAllBytes()); @@ -123,7 +99,21 @@ private String formatExceptionMessage(String operationId, int statusCode, String * @throws ApiException if fails to make API call */ public String testFormIntegerBooleanString(@javax.annotation.Nullable Integer integerForm, @javax.annotation.Nullable Boolean booleanForm, @javax.annotation.Nullable String stringForm) throws ApiException { - ApiResponse localVarResponse = testFormIntegerBooleanStringWithHttpInfo(integerForm, booleanForm, stringForm); + return testFormIntegerBooleanString(integerForm, booleanForm, stringForm, null); + } + + /** + * Test form parameter(s) + * Test form parameter(s) + * @param integerForm (optional) + * @param booleanForm (optional) + * @param stringForm (optional) + * @param headers Optional headers to include in the request + * @return String + * @throws ApiException if fails to make API call + */ + public String testFormIntegerBooleanString(@javax.annotation.Nullable Integer integerForm, @javax.annotation.Nullable Boolean booleanForm, @javax.annotation.Nullable String stringForm, Map headers) throws ApiException { + ApiResponse localVarResponse = testFormIntegerBooleanStringWithHttpInfo(integerForm, booleanForm, stringForm, headers); return localVarResponse.getData(); } @@ -137,7 +127,21 @@ public String testFormIntegerBooleanString(@javax.annotation.Nullable Integer in * @throws ApiException if fails to make API call */ public ApiResponse testFormIntegerBooleanStringWithHttpInfo(@javax.annotation.Nullable Integer integerForm, @javax.annotation.Nullable Boolean booleanForm, @javax.annotation.Nullable String stringForm) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = testFormIntegerBooleanStringRequestBuilder(integerForm, booleanForm, stringForm); + return testFormIntegerBooleanStringWithHttpInfo(integerForm, booleanForm, stringForm, null); + } + + /** + * Test form parameter(s) + * Test form parameter(s) + * @param integerForm (optional) + * @param booleanForm (optional) + * @param stringForm (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<String> + * @throws ApiException if fails to make API call + */ + public ApiResponse testFormIntegerBooleanStringWithHttpInfo(@javax.annotation.Nullable Integer integerForm, @javax.annotation.Nullable Boolean booleanForm, @javax.annotation.Nullable String stringForm, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = testFormIntegerBooleanStringRequestBuilder(integerForm, booleanForm, stringForm, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -173,7 +177,7 @@ public ApiResponse testFormIntegerBooleanStringWithHttpInfo(@javax.annot } } - private HttpRequest.Builder testFormIntegerBooleanStringRequestBuilder(@javax.annotation.Nullable Integer integerForm, @javax.annotation.Nullable Boolean booleanForm, @javax.annotation.Nullable String stringForm) throws ApiException { + private HttpRequest.Builder testFormIntegerBooleanStringRequestBuilder(@javax.annotation.Nullable Integer integerForm, @javax.annotation.Nullable Boolean booleanForm, @javax.annotation.Nullable String stringForm, Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -207,9 +211,11 @@ private HttpRequest.Builder testFormIntegerBooleanStringRequestBuilder(@javax.an if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -225,7 +231,19 @@ private HttpRequest.Builder testFormIntegerBooleanStringRequestBuilder(@javax.an * @throws ApiException if fails to make API call */ public String testFormObjectMultipart(@javax.annotation.Nonnull TestFormObjectMultipartRequestMarker marker) throws ApiException { - ApiResponse localVarResponse = testFormObjectMultipartWithHttpInfo(marker); + return testFormObjectMultipart(marker, null); + } + + /** + * Test form parameter(s) for multipart schema + * Test form parameter(s) for multipart schema + * @param marker (required) + * @param headers Optional headers to include in the request + * @return String + * @throws ApiException if fails to make API call + */ + public String testFormObjectMultipart(@javax.annotation.Nonnull TestFormObjectMultipartRequestMarker marker, Map headers) throws ApiException { + ApiResponse localVarResponse = testFormObjectMultipartWithHttpInfo(marker, headers); return localVarResponse.getData(); } @@ -237,7 +255,19 @@ public String testFormObjectMultipart(@javax.annotation.Nonnull TestFormObjectMu * @throws ApiException if fails to make API call */ public ApiResponse testFormObjectMultipartWithHttpInfo(@javax.annotation.Nonnull TestFormObjectMultipartRequestMarker marker) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = testFormObjectMultipartRequestBuilder(marker); + return testFormObjectMultipartWithHttpInfo(marker, null); + } + + /** + * Test form parameter(s) for multipart schema + * Test form parameter(s) for multipart schema + * @param marker (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<String> + * @throws ApiException if fails to make API call + */ + public ApiResponse testFormObjectMultipartWithHttpInfo(@javax.annotation.Nonnull TestFormObjectMultipartRequestMarker marker, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = testFormObjectMultipartRequestBuilder(marker, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -273,7 +303,7 @@ public ApiResponse testFormObjectMultipartWithHttpInfo(@javax.annotation } } - private HttpRequest.Builder testFormObjectMultipartRequestBuilder(@javax.annotation.Nonnull TestFormObjectMultipartRequestMarker marker) throws ApiException { + private HttpRequest.Builder testFormObjectMultipartRequestBuilder(@javax.annotation.Nonnull TestFormObjectMultipartRequestMarker marker, Map headers) throws ApiException { // verify the required parameter 'marker' is set if (marker == null) { throw new ApiException(400, "Missing the required parameter 'marker' when calling testFormObjectMultipart"); @@ -325,9 +355,11 @@ private HttpRequest.Builder testFormObjectMultipartRequestBuilder(@javax.annotat if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -348,7 +380,24 @@ private HttpRequest.Builder testFormObjectMultipartRequestBuilder(@javax.annotat * @throws ApiException if fails to make API call */ public String testFormOneof(@javax.annotation.Nullable String form1, @javax.annotation.Nullable Integer form2, @javax.annotation.Nullable String form3, @javax.annotation.Nullable Boolean form4, @javax.annotation.Nullable Long id, @javax.annotation.Nullable String name) throws ApiException { - ApiResponse localVarResponse = testFormOneofWithHttpInfo(form1, form2, form3, form4, id, name); + return testFormOneof(form1, form2, form3, form4, id, name, null); + } + + /** + * Test form parameter(s) for oneOf schema + * Test form parameter(s) for oneOf schema + * @param form1 (optional) + * @param form2 (optional) + * @param form3 (optional) + * @param form4 (optional) + * @param id (optional) + * @param name (optional) + * @param headers Optional headers to include in the request + * @return String + * @throws ApiException if fails to make API call + */ + public String testFormOneof(@javax.annotation.Nullable String form1, @javax.annotation.Nullable Integer form2, @javax.annotation.Nullable String form3, @javax.annotation.Nullable Boolean form4, @javax.annotation.Nullable Long id, @javax.annotation.Nullable String name, Map headers) throws ApiException { + ApiResponse localVarResponse = testFormOneofWithHttpInfo(form1, form2, form3, form4, id, name, headers); return localVarResponse.getData(); } @@ -365,7 +414,24 @@ public String testFormOneof(@javax.annotation.Nullable String form1, @javax.anno * @throws ApiException if fails to make API call */ public ApiResponse testFormOneofWithHttpInfo(@javax.annotation.Nullable String form1, @javax.annotation.Nullable Integer form2, @javax.annotation.Nullable String form3, @javax.annotation.Nullable Boolean form4, @javax.annotation.Nullable Long id, @javax.annotation.Nullable String name) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = testFormOneofRequestBuilder(form1, form2, form3, form4, id, name); + return testFormOneofWithHttpInfo(form1, form2, form3, form4, id, name, null); + } + + /** + * Test form parameter(s) for oneOf schema + * Test form parameter(s) for oneOf schema + * @param form1 (optional) + * @param form2 (optional) + * @param form3 (optional) + * @param form4 (optional) + * @param id (optional) + * @param name (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<String> + * @throws ApiException if fails to make API call + */ + public ApiResponse testFormOneofWithHttpInfo(@javax.annotation.Nullable String form1, @javax.annotation.Nullable Integer form2, @javax.annotation.Nullable String form3, @javax.annotation.Nullable Boolean form4, @javax.annotation.Nullable Long id, @javax.annotation.Nullable String name, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = testFormOneofRequestBuilder(form1, form2, form3, form4, id, name, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -401,7 +467,7 @@ public ApiResponse testFormOneofWithHttpInfo(@javax.annotation.Nullable } } - private HttpRequest.Builder testFormOneofRequestBuilder(@javax.annotation.Nullable String form1, @javax.annotation.Nullable Integer form2, @javax.annotation.Nullable String form3, @javax.annotation.Nullable Boolean form4, @javax.annotation.Nullable Long id, @javax.annotation.Nullable String name) throws ApiException { + private HttpRequest.Builder testFormOneofRequestBuilder(@javax.annotation.Nullable String form1, @javax.annotation.Nullable Integer form2, @javax.annotation.Nullable String form3, @javax.annotation.Nullable Boolean form4, @javax.annotation.Nullable Long id, @javax.annotation.Nullable String name, Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -444,9 +510,11 @@ private HttpRequest.Builder testFormOneofRequestBuilder(@javax.annotation.Nullab if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/HeaderApi.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/HeaderApi.java index 621787e95569..d8c89229c4e5 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/HeaderApi.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/HeaderApi.java @@ -61,9 +61,6 @@ public class HeaderApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; - // Custom headers to be sent with every request from this API client - private final Map extraHeaders = new java.util.HashMap<>(); - public HeaderApi() { this(Configuration.getDefaultApiClient()); } @@ -78,27 +75,6 @@ public HeaderApi(ApiClient apiClient) { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } - /** - * Add a custom header to be sent with every request from this API client. - * @param name Header name - * @param value Header value - * @return this - */ - public HeaderApi addHeader(String name, String value) { - this.extraHeaders.put(name, value); - return this; - } - - /** - * Remove a custom header. - * @param name Header name - * @return this - */ - public HeaderApi removeHeader(String name) { - this.extraHeaders.remove(name); - return this; - } - protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { String body = response.body() == null ? null : new String(response.body().readAllBytes()); @@ -125,7 +101,23 @@ private String formatExceptionMessage(String operationId, int statusCode, String * @throws ApiException if fails to make API call */ public String testHeaderIntegerBooleanStringEnums(@javax.annotation.Nullable Integer integerHeader, @javax.annotation.Nullable Boolean booleanHeader, @javax.annotation.Nullable String stringHeader, @javax.annotation.Nullable String enumNonrefStringHeader, @javax.annotation.Nullable StringEnumRef enumRefStringHeader) throws ApiException { - ApiResponse localVarResponse = testHeaderIntegerBooleanStringEnumsWithHttpInfo(integerHeader, booleanHeader, stringHeader, enumNonrefStringHeader, enumRefStringHeader); + return testHeaderIntegerBooleanStringEnums(integerHeader, booleanHeader, stringHeader, enumNonrefStringHeader, enumRefStringHeader, null); + } + + /** + * Test header parameter(s) + * Test header parameter(s) + * @param integerHeader (optional) + * @param booleanHeader (optional) + * @param stringHeader (optional) + * @param enumNonrefStringHeader (optional) + * @param enumRefStringHeader (optional) + * @param headers Optional headers to include in the request + * @return String + * @throws ApiException if fails to make API call + */ + public String testHeaderIntegerBooleanStringEnums(@javax.annotation.Nullable Integer integerHeader, @javax.annotation.Nullable Boolean booleanHeader, @javax.annotation.Nullable String stringHeader, @javax.annotation.Nullable String enumNonrefStringHeader, @javax.annotation.Nullable StringEnumRef enumRefStringHeader, Map headers) throws ApiException { + ApiResponse localVarResponse = testHeaderIntegerBooleanStringEnumsWithHttpInfo(integerHeader, booleanHeader, stringHeader, enumNonrefStringHeader, enumRefStringHeader, headers); return localVarResponse.getData(); } @@ -141,7 +133,23 @@ public String testHeaderIntegerBooleanStringEnums(@javax.annotation.Nullable Int * @throws ApiException if fails to make API call */ public ApiResponse testHeaderIntegerBooleanStringEnumsWithHttpInfo(@javax.annotation.Nullable Integer integerHeader, @javax.annotation.Nullable Boolean booleanHeader, @javax.annotation.Nullable String stringHeader, @javax.annotation.Nullable String enumNonrefStringHeader, @javax.annotation.Nullable StringEnumRef enumRefStringHeader) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = testHeaderIntegerBooleanStringEnumsRequestBuilder(integerHeader, booleanHeader, stringHeader, enumNonrefStringHeader, enumRefStringHeader); + return testHeaderIntegerBooleanStringEnumsWithHttpInfo(integerHeader, booleanHeader, stringHeader, enumNonrefStringHeader, enumRefStringHeader, null); + } + + /** + * Test header parameter(s) + * Test header parameter(s) + * @param integerHeader (optional) + * @param booleanHeader (optional) + * @param stringHeader (optional) + * @param enumNonrefStringHeader (optional) + * @param enumRefStringHeader (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<String> + * @throws ApiException if fails to make API call + */ + public ApiResponse testHeaderIntegerBooleanStringEnumsWithHttpInfo(@javax.annotation.Nullable Integer integerHeader, @javax.annotation.Nullable Boolean booleanHeader, @javax.annotation.Nullable String stringHeader, @javax.annotation.Nullable String enumNonrefStringHeader, @javax.annotation.Nullable StringEnumRef enumRefStringHeader, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = testHeaderIntegerBooleanStringEnumsRequestBuilder(integerHeader, booleanHeader, stringHeader, enumNonrefStringHeader, enumRefStringHeader, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -177,7 +185,7 @@ public ApiResponse testHeaderIntegerBooleanStringEnumsWithHttpInfo(@java } } - private HttpRequest.Builder testHeaderIntegerBooleanStringEnumsRequestBuilder(@javax.annotation.Nullable Integer integerHeader, @javax.annotation.Nullable Boolean booleanHeader, @javax.annotation.Nullable String stringHeader, @javax.annotation.Nullable String enumNonrefStringHeader, @javax.annotation.Nullable StringEnumRef enumRefStringHeader) throws ApiException { + private HttpRequest.Builder testHeaderIntegerBooleanStringEnumsRequestBuilder(@javax.annotation.Nullable Integer integerHeader, @javax.annotation.Nullable Boolean booleanHeader, @javax.annotation.Nullable String stringHeader, @javax.annotation.Nullable String enumNonrefStringHeader, @javax.annotation.Nullable StringEnumRef enumRefStringHeader, Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -206,9 +214,11 @@ private HttpRequest.Builder testHeaderIntegerBooleanStringEnumsRequestBuilder(@j if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/PathApi.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/PathApi.java index bde709bc6132..34cd0356503a 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/PathApi.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/PathApi.java @@ -61,9 +61,6 @@ public class PathApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; - // Custom headers to be sent with every request from this API client - private final Map extraHeaders = new java.util.HashMap<>(); - public PathApi() { this(Configuration.getDefaultApiClient()); } @@ -78,27 +75,6 @@ public PathApi(ApiClient apiClient) { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } - /** - * Add a custom header to be sent with every request from this API client. - * @param name Header name - * @param value Header value - * @return this - */ - public PathApi addHeader(String name, String value) { - this.extraHeaders.put(name, value); - return this; - } - - /** - * Remove a custom header. - * @param name Header name - * @return this - */ - public PathApi removeHeader(String name) { - this.extraHeaders.remove(name); - return this; - } - protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { String body = response.body() == null ? null : new String(response.body().readAllBytes()); @@ -124,7 +100,22 @@ private String formatExceptionMessage(String operationId, int statusCode, String * @throws ApiException if fails to make API call */ public String testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(@javax.annotation.Nonnull String pathString, @javax.annotation.Nonnull Integer pathInteger, @javax.annotation.Nonnull String enumNonrefStringPath, @javax.annotation.Nonnull StringEnumRef enumRefStringPath) throws ApiException { - ApiResponse localVarResponse = testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(pathString, pathInteger, enumNonrefStringPath, enumRefStringPath); + return testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(pathString, pathInteger, enumNonrefStringPath, enumRefStringPath, null); + } + + /** + * Test path parameter(s) + * Test path parameter(s) + * @param pathString (required) + * @param pathInteger (required) + * @param enumNonrefStringPath (required) + * @param enumRefStringPath (required) + * @param headers Optional headers to include in the request + * @return String + * @throws ApiException if fails to make API call + */ + public String testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(@javax.annotation.Nonnull String pathString, @javax.annotation.Nonnull Integer pathInteger, @javax.annotation.Nonnull String enumNonrefStringPath, @javax.annotation.Nonnull StringEnumRef enumRefStringPath, Map headers) throws ApiException { + ApiResponse localVarResponse = testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(pathString, pathInteger, enumNonrefStringPath, enumRefStringPath, headers); return localVarResponse.getData(); } @@ -139,7 +130,22 @@ public String testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnu * @throws ApiException if fails to make API call */ public ApiResponse testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(@javax.annotation.Nonnull String pathString, @javax.annotation.Nonnull Integer pathInteger, @javax.annotation.Nonnull String enumNonrefStringPath, @javax.annotation.Nonnull StringEnumRef enumRefStringPath) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathRequestBuilder(pathString, pathInteger, enumNonrefStringPath, enumRefStringPath); + return testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(pathString, pathInteger, enumNonrefStringPath, enumRefStringPath, null); + } + + /** + * Test path parameter(s) + * Test path parameter(s) + * @param pathString (required) + * @param pathInteger (required) + * @param enumNonrefStringPath (required) + * @param enumRefStringPath (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<String> + * @throws ApiException if fails to make API call + */ + public ApiResponse testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(@javax.annotation.Nonnull String pathString, @javax.annotation.Nonnull Integer pathInteger, @javax.annotation.Nonnull String enumNonrefStringPath, @javax.annotation.Nonnull StringEnumRef enumRefStringPath, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathRequestBuilder(pathString, pathInteger, enumNonrefStringPath, enumRefStringPath, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -175,7 +181,7 @@ public ApiResponse testsPathStringPathStringIntegerPathIntegerEnumNonref } } - private HttpRequest.Builder testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathRequestBuilder(@javax.annotation.Nonnull String pathString, @javax.annotation.Nonnull Integer pathInteger, @javax.annotation.Nonnull String enumNonrefStringPath, @javax.annotation.Nonnull StringEnumRef enumRefStringPath) throws ApiException { + private HttpRequest.Builder testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathRequestBuilder(@javax.annotation.Nonnull String pathString, @javax.annotation.Nonnull Integer pathInteger, @javax.annotation.Nonnull String enumNonrefStringPath, @javax.annotation.Nonnull StringEnumRef enumRefStringPath, Map headers) throws ApiException { // verify the required parameter 'pathString' is set if (pathString == null) { throw new ApiException(400, "Missing the required parameter 'pathString' when calling testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath"); @@ -209,9 +215,11 @@ private HttpRequest.Builder testsPathStringPathStringIntegerPathIntegerEnumNonre if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/QueryApi.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/QueryApi.java index 5f6c25dc7674..939771491b04 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/QueryApi.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/QueryApi.java @@ -67,9 +67,6 @@ public class QueryApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; - // Custom headers to be sent with every request from this API client - private final Map extraHeaders = new java.util.HashMap<>(); - public QueryApi() { this(Configuration.getDefaultApiClient()); } @@ -84,27 +81,6 @@ public QueryApi(ApiClient apiClient) { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } - /** - * Add a custom header to be sent with every request from this API client. - * @param name Header name - * @param value Header value - * @return this - */ - public QueryApi addHeader(String name, String value) { - this.extraHeaders.put(name, value); - return this; - } - - /** - * Remove a custom header. - * @param name Header name - * @return this - */ - public QueryApi removeHeader(String name) { - this.extraHeaders.remove(name); - return this; - } - protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { String body = response.body() == null ? null : new String(response.body().readAllBytes()); @@ -128,7 +104,20 @@ private String formatExceptionMessage(String operationId, int statusCode, String * @throws ApiException if fails to make API call */ public String testEnumRefString(@javax.annotation.Nullable String enumNonrefStringQuery, @javax.annotation.Nullable StringEnumRef enumRefStringQuery) throws ApiException { - ApiResponse localVarResponse = testEnumRefStringWithHttpInfo(enumNonrefStringQuery, enumRefStringQuery); + return testEnumRefString(enumNonrefStringQuery, enumRefStringQuery, null); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param enumNonrefStringQuery (optional) + * @param enumRefStringQuery (optional) + * @param headers Optional headers to include in the request + * @return String + * @throws ApiException if fails to make API call + */ + public String testEnumRefString(@javax.annotation.Nullable String enumNonrefStringQuery, @javax.annotation.Nullable StringEnumRef enumRefStringQuery, Map headers) throws ApiException { + ApiResponse localVarResponse = testEnumRefStringWithHttpInfo(enumNonrefStringQuery, enumRefStringQuery, headers); return localVarResponse.getData(); } @@ -141,7 +130,20 @@ public String testEnumRefString(@javax.annotation.Nullable String enumNonrefStri * @throws ApiException if fails to make API call */ public ApiResponse testEnumRefStringWithHttpInfo(@javax.annotation.Nullable String enumNonrefStringQuery, @javax.annotation.Nullable StringEnumRef enumRefStringQuery) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = testEnumRefStringRequestBuilder(enumNonrefStringQuery, enumRefStringQuery); + return testEnumRefStringWithHttpInfo(enumNonrefStringQuery, enumRefStringQuery, null); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param enumNonrefStringQuery (optional) + * @param enumRefStringQuery (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<String> + * @throws ApiException if fails to make API call + */ + public ApiResponse testEnumRefStringWithHttpInfo(@javax.annotation.Nullable String enumNonrefStringQuery, @javax.annotation.Nullable StringEnumRef enumRefStringQuery, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = testEnumRefStringRequestBuilder(enumNonrefStringQuery, enumRefStringQuery, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -177,7 +179,7 @@ public ApiResponse testEnumRefStringWithHttpInfo(@javax.annotation.Nulla } } - private HttpRequest.Builder testEnumRefStringRequestBuilder(@javax.annotation.Nullable String enumNonrefStringQuery, @javax.annotation.Nullable StringEnumRef enumRefStringQuery) throws ApiException { + private HttpRequest.Builder testEnumRefStringRequestBuilder(@javax.annotation.Nullable String enumNonrefStringQuery, @javax.annotation.Nullable StringEnumRef enumRefStringQuery, Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -208,9 +210,11 @@ private HttpRequest.Builder testEnumRefStringRequestBuilder(@javax.annotation.Nu if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -228,7 +232,21 @@ private HttpRequest.Builder testEnumRefStringRequestBuilder(@javax.annotation.Nu * @throws ApiException if fails to make API call */ public String testQueryDatetimeDateString(@javax.annotation.Nullable Instant datetimeQuery, @javax.annotation.Nullable LocalDate dateQuery, @javax.annotation.Nullable String stringQuery) throws ApiException { - ApiResponse localVarResponse = testQueryDatetimeDateStringWithHttpInfo(datetimeQuery, dateQuery, stringQuery); + return testQueryDatetimeDateString(datetimeQuery, dateQuery, stringQuery, null); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param datetimeQuery (optional) + * @param dateQuery (optional) + * @param stringQuery (optional) + * @param headers Optional headers to include in the request + * @return String + * @throws ApiException if fails to make API call + */ + public String testQueryDatetimeDateString(@javax.annotation.Nullable Instant datetimeQuery, @javax.annotation.Nullable LocalDate dateQuery, @javax.annotation.Nullable String stringQuery, Map headers) throws ApiException { + ApiResponse localVarResponse = testQueryDatetimeDateStringWithHttpInfo(datetimeQuery, dateQuery, stringQuery, headers); return localVarResponse.getData(); } @@ -242,7 +260,21 @@ public String testQueryDatetimeDateString(@javax.annotation.Nullable Instant dat * @throws ApiException if fails to make API call */ public ApiResponse testQueryDatetimeDateStringWithHttpInfo(@javax.annotation.Nullable Instant datetimeQuery, @javax.annotation.Nullable LocalDate dateQuery, @javax.annotation.Nullable String stringQuery) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = testQueryDatetimeDateStringRequestBuilder(datetimeQuery, dateQuery, stringQuery); + return testQueryDatetimeDateStringWithHttpInfo(datetimeQuery, dateQuery, stringQuery, null); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param datetimeQuery (optional) + * @param dateQuery (optional) + * @param stringQuery (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<String> + * @throws ApiException if fails to make API call + */ + public ApiResponse testQueryDatetimeDateStringWithHttpInfo(@javax.annotation.Nullable Instant datetimeQuery, @javax.annotation.Nullable LocalDate dateQuery, @javax.annotation.Nullable String stringQuery, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = testQueryDatetimeDateStringRequestBuilder(datetimeQuery, dateQuery, stringQuery, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -278,7 +310,7 @@ public ApiResponse testQueryDatetimeDateStringWithHttpInfo(@javax.annota } } - private HttpRequest.Builder testQueryDatetimeDateStringRequestBuilder(@javax.annotation.Nullable Instant datetimeQuery, @javax.annotation.Nullable LocalDate dateQuery, @javax.annotation.Nullable String stringQuery) throws ApiException { + private HttpRequest.Builder testQueryDatetimeDateStringRequestBuilder(@javax.annotation.Nullable Instant datetimeQuery, @javax.annotation.Nullable LocalDate dateQuery, @javax.annotation.Nullable String stringQuery, Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -311,9 +343,11 @@ private HttpRequest.Builder testQueryDatetimeDateStringRequestBuilder(@javax.ann if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -331,7 +365,21 @@ private HttpRequest.Builder testQueryDatetimeDateStringRequestBuilder(@javax.ann * @throws ApiException if fails to make API call */ public String testQueryIntegerBooleanString(@javax.annotation.Nullable Integer integerQuery, @javax.annotation.Nullable Boolean booleanQuery, @javax.annotation.Nullable String stringQuery) throws ApiException { - ApiResponse localVarResponse = testQueryIntegerBooleanStringWithHttpInfo(integerQuery, booleanQuery, stringQuery); + return testQueryIntegerBooleanString(integerQuery, booleanQuery, stringQuery, null); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param integerQuery (optional) + * @param booleanQuery (optional) + * @param stringQuery (optional) + * @param headers Optional headers to include in the request + * @return String + * @throws ApiException if fails to make API call + */ + public String testQueryIntegerBooleanString(@javax.annotation.Nullable Integer integerQuery, @javax.annotation.Nullable Boolean booleanQuery, @javax.annotation.Nullable String stringQuery, Map headers) throws ApiException { + ApiResponse localVarResponse = testQueryIntegerBooleanStringWithHttpInfo(integerQuery, booleanQuery, stringQuery, headers); return localVarResponse.getData(); } @@ -345,7 +393,21 @@ public String testQueryIntegerBooleanString(@javax.annotation.Nullable Integer i * @throws ApiException if fails to make API call */ public ApiResponse testQueryIntegerBooleanStringWithHttpInfo(@javax.annotation.Nullable Integer integerQuery, @javax.annotation.Nullable Boolean booleanQuery, @javax.annotation.Nullable String stringQuery) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = testQueryIntegerBooleanStringRequestBuilder(integerQuery, booleanQuery, stringQuery); + return testQueryIntegerBooleanStringWithHttpInfo(integerQuery, booleanQuery, stringQuery, null); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param integerQuery (optional) + * @param booleanQuery (optional) + * @param stringQuery (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<String> + * @throws ApiException if fails to make API call + */ + public ApiResponse testQueryIntegerBooleanStringWithHttpInfo(@javax.annotation.Nullable Integer integerQuery, @javax.annotation.Nullable Boolean booleanQuery, @javax.annotation.Nullable String stringQuery, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = testQueryIntegerBooleanStringRequestBuilder(integerQuery, booleanQuery, stringQuery, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -381,7 +443,7 @@ public ApiResponse testQueryIntegerBooleanStringWithHttpInfo(@javax.anno } } - private HttpRequest.Builder testQueryIntegerBooleanStringRequestBuilder(@javax.annotation.Nullable Integer integerQuery, @javax.annotation.Nullable Boolean booleanQuery, @javax.annotation.Nullable String stringQuery) throws ApiException { + private HttpRequest.Builder testQueryIntegerBooleanStringRequestBuilder(@javax.annotation.Nullable Integer integerQuery, @javax.annotation.Nullable Boolean booleanQuery, @javax.annotation.Nullable String stringQuery, Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -414,9 +476,11 @@ private HttpRequest.Builder testQueryIntegerBooleanStringRequestBuilder(@javax.a if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -432,7 +496,19 @@ private HttpRequest.Builder testQueryIntegerBooleanStringRequestBuilder(@javax.a * @throws ApiException if fails to make API call */ public String testQueryStyleDeepObjectExplodeTrueObject(@javax.annotation.Nullable Pet queryObject) throws ApiException { - ApiResponse localVarResponse = testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(queryObject); + return testQueryStyleDeepObjectExplodeTrueObject(queryObject, null); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param queryObject (optional) + * @param headers Optional headers to include in the request + * @return String + * @throws ApiException if fails to make API call + */ + public String testQueryStyleDeepObjectExplodeTrueObject(@javax.annotation.Nullable Pet queryObject, Map headers) throws ApiException { + ApiResponse localVarResponse = testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(queryObject, headers); return localVarResponse.getData(); } @@ -444,7 +520,19 @@ public String testQueryStyleDeepObjectExplodeTrueObject(@javax.annotation.Nullab * @throws ApiException if fails to make API call */ public ApiResponse testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(@javax.annotation.Nullable Pet queryObject) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = testQueryStyleDeepObjectExplodeTrueObjectRequestBuilder(queryObject); + return testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(queryObject, null); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param queryObject (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<String> + * @throws ApiException if fails to make API call + */ + public ApiResponse testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(@javax.annotation.Nullable Pet queryObject, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = testQueryStyleDeepObjectExplodeTrueObjectRequestBuilder(queryObject, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -480,7 +568,7 @@ public ApiResponse testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo } } - private HttpRequest.Builder testQueryStyleDeepObjectExplodeTrueObjectRequestBuilder(@javax.annotation.Nullable Pet queryObject) throws ApiException { + private HttpRequest.Builder testQueryStyleDeepObjectExplodeTrueObjectRequestBuilder(@javax.annotation.Nullable Pet queryObject, Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -514,9 +602,11 @@ private HttpRequest.Builder testQueryStyleDeepObjectExplodeTrueObjectRequestBuil if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -532,7 +622,19 @@ private HttpRequest.Builder testQueryStyleDeepObjectExplodeTrueObjectRequestBuil * @throws ApiException if fails to make API call */ public String testQueryStyleDeepObjectExplodeTrueObjectAllOf(@javax.annotation.Nullable TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter queryObject) throws ApiException { - ApiResponse localVarResponse = testQueryStyleDeepObjectExplodeTrueObjectAllOfWithHttpInfo(queryObject); + return testQueryStyleDeepObjectExplodeTrueObjectAllOf(queryObject, null); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param queryObject (optional) + * @param headers Optional headers to include in the request + * @return String + * @throws ApiException if fails to make API call + */ + public String testQueryStyleDeepObjectExplodeTrueObjectAllOf(@javax.annotation.Nullable TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter queryObject, Map headers) throws ApiException { + ApiResponse localVarResponse = testQueryStyleDeepObjectExplodeTrueObjectAllOfWithHttpInfo(queryObject, headers); return localVarResponse.getData(); } @@ -544,7 +646,19 @@ public String testQueryStyleDeepObjectExplodeTrueObjectAllOf(@javax.annotation.N * @throws ApiException if fails to make API call */ public ApiResponse testQueryStyleDeepObjectExplodeTrueObjectAllOfWithHttpInfo(@javax.annotation.Nullable TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter queryObject) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = testQueryStyleDeepObjectExplodeTrueObjectAllOfRequestBuilder(queryObject); + return testQueryStyleDeepObjectExplodeTrueObjectAllOfWithHttpInfo(queryObject, null); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param queryObject (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<String> + * @throws ApiException if fails to make API call + */ + public ApiResponse testQueryStyleDeepObjectExplodeTrueObjectAllOfWithHttpInfo(@javax.annotation.Nullable TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter queryObject, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = testQueryStyleDeepObjectExplodeTrueObjectAllOfRequestBuilder(queryObject, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -580,7 +694,7 @@ public ApiResponse testQueryStyleDeepObjectExplodeTrueObjectAllOfWithHtt } } - private HttpRequest.Builder testQueryStyleDeepObjectExplodeTrueObjectAllOfRequestBuilder(@javax.annotation.Nullable TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter queryObject) throws ApiException { + private HttpRequest.Builder testQueryStyleDeepObjectExplodeTrueObjectAllOfRequestBuilder(@javax.annotation.Nullable TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter queryObject, Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -614,9 +728,11 @@ private HttpRequest.Builder testQueryStyleDeepObjectExplodeTrueObjectAllOfReques if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -632,7 +748,19 @@ private HttpRequest.Builder testQueryStyleDeepObjectExplodeTrueObjectAllOfReques * @throws ApiException if fails to make API call */ public String testQueryStyleFormExplodeFalseArrayInteger(@javax.annotation.Nullable List queryObject) throws ApiException { - ApiResponse localVarResponse = testQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo(queryObject); + return testQueryStyleFormExplodeFalseArrayInteger(queryObject, null); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param queryObject (optional) + * @param headers Optional headers to include in the request + * @return String + * @throws ApiException if fails to make API call + */ + public String testQueryStyleFormExplodeFalseArrayInteger(@javax.annotation.Nullable List queryObject, Map headers) throws ApiException { + ApiResponse localVarResponse = testQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo(queryObject, headers); return localVarResponse.getData(); } @@ -644,7 +772,19 @@ public String testQueryStyleFormExplodeFalseArrayInteger(@javax.annotation.Nulla * @throws ApiException if fails to make API call */ public ApiResponse testQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo(@javax.annotation.Nullable List queryObject) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = testQueryStyleFormExplodeFalseArrayIntegerRequestBuilder(queryObject); + return testQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo(queryObject, null); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param queryObject (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<String> + * @throws ApiException if fails to make API call + */ + public ApiResponse testQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo(@javax.annotation.Nullable List queryObject, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = testQueryStyleFormExplodeFalseArrayIntegerRequestBuilder(queryObject, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -680,7 +820,7 @@ public ApiResponse testQueryStyleFormExplodeFalseArrayIntegerWithHttpInf } } - private HttpRequest.Builder testQueryStyleFormExplodeFalseArrayIntegerRequestBuilder(@javax.annotation.Nullable List queryObject) throws ApiException { + private HttpRequest.Builder testQueryStyleFormExplodeFalseArrayIntegerRequestBuilder(@javax.annotation.Nullable List queryObject, Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -709,9 +849,11 @@ private HttpRequest.Builder testQueryStyleFormExplodeFalseArrayIntegerRequestBui if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -727,7 +869,19 @@ private HttpRequest.Builder testQueryStyleFormExplodeFalseArrayIntegerRequestBui * @throws ApiException if fails to make API call */ public String testQueryStyleFormExplodeFalseArrayString(@javax.annotation.Nullable List queryObject) throws ApiException { - ApiResponse localVarResponse = testQueryStyleFormExplodeFalseArrayStringWithHttpInfo(queryObject); + return testQueryStyleFormExplodeFalseArrayString(queryObject, null); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param queryObject (optional) + * @param headers Optional headers to include in the request + * @return String + * @throws ApiException if fails to make API call + */ + public String testQueryStyleFormExplodeFalseArrayString(@javax.annotation.Nullable List queryObject, Map headers) throws ApiException { + ApiResponse localVarResponse = testQueryStyleFormExplodeFalseArrayStringWithHttpInfo(queryObject, headers); return localVarResponse.getData(); } @@ -739,7 +893,19 @@ public String testQueryStyleFormExplodeFalseArrayString(@javax.annotation.Nullab * @throws ApiException if fails to make API call */ public ApiResponse testQueryStyleFormExplodeFalseArrayStringWithHttpInfo(@javax.annotation.Nullable List queryObject) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = testQueryStyleFormExplodeFalseArrayStringRequestBuilder(queryObject); + return testQueryStyleFormExplodeFalseArrayStringWithHttpInfo(queryObject, null); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param queryObject (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<String> + * @throws ApiException if fails to make API call + */ + public ApiResponse testQueryStyleFormExplodeFalseArrayStringWithHttpInfo(@javax.annotation.Nullable List queryObject, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = testQueryStyleFormExplodeFalseArrayStringRequestBuilder(queryObject, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -775,7 +941,7 @@ public ApiResponse testQueryStyleFormExplodeFalseArrayStringWithHttpInfo } } - private HttpRequest.Builder testQueryStyleFormExplodeFalseArrayStringRequestBuilder(@javax.annotation.Nullable List queryObject) throws ApiException { + private HttpRequest.Builder testQueryStyleFormExplodeFalseArrayStringRequestBuilder(@javax.annotation.Nullable List queryObject, Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -804,9 +970,11 @@ private HttpRequest.Builder testQueryStyleFormExplodeFalseArrayStringRequestBuil if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -822,7 +990,19 @@ private HttpRequest.Builder testQueryStyleFormExplodeFalseArrayStringRequestBuil * @throws ApiException if fails to make API call */ public String testQueryStyleFormExplodeTrueArrayString(@javax.annotation.Nullable TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter queryObject) throws ApiException { - ApiResponse localVarResponse = testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(queryObject); + return testQueryStyleFormExplodeTrueArrayString(queryObject, null); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param queryObject (optional) + * @param headers Optional headers to include in the request + * @return String + * @throws ApiException if fails to make API call + */ + public String testQueryStyleFormExplodeTrueArrayString(@javax.annotation.Nullable TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter queryObject, Map headers) throws ApiException { + ApiResponse localVarResponse = testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(queryObject, headers); return localVarResponse.getData(); } @@ -834,7 +1014,19 @@ public String testQueryStyleFormExplodeTrueArrayString(@javax.annotation.Nullabl * @throws ApiException if fails to make API call */ public ApiResponse testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(@javax.annotation.Nullable TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter queryObject) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = testQueryStyleFormExplodeTrueArrayStringRequestBuilder(queryObject); + return testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(queryObject, null); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param queryObject (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<String> + * @throws ApiException if fails to make API call + */ + public ApiResponse testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(@javax.annotation.Nullable TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter queryObject, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = testQueryStyleFormExplodeTrueArrayStringRequestBuilder(queryObject, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -870,7 +1062,7 @@ public ApiResponse testQueryStyleFormExplodeTrueArrayStringWithHttpInfo( } } - private HttpRequest.Builder testQueryStyleFormExplodeTrueArrayStringRequestBuilder(@javax.annotation.Nullable TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter queryObject) throws ApiException { + private HttpRequest.Builder testQueryStyleFormExplodeTrueArrayStringRequestBuilder(@javax.annotation.Nullable TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter queryObject, Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -899,9 +1091,11 @@ private HttpRequest.Builder testQueryStyleFormExplodeTrueArrayStringRequestBuild if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -917,7 +1111,19 @@ private HttpRequest.Builder testQueryStyleFormExplodeTrueArrayStringRequestBuild * @throws ApiException if fails to make API call */ public String testQueryStyleFormExplodeTrueObject(@javax.annotation.Nullable Pet queryObject) throws ApiException { - ApiResponse localVarResponse = testQueryStyleFormExplodeTrueObjectWithHttpInfo(queryObject); + return testQueryStyleFormExplodeTrueObject(queryObject, null); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param queryObject (optional) + * @param headers Optional headers to include in the request + * @return String + * @throws ApiException if fails to make API call + */ + public String testQueryStyleFormExplodeTrueObject(@javax.annotation.Nullable Pet queryObject, Map headers) throws ApiException { + ApiResponse localVarResponse = testQueryStyleFormExplodeTrueObjectWithHttpInfo(queryObject, headers); return localVarResponse.getData(); } @@ -929,7 +1135,19 @@ public String testQueryStyleFormExplodeTrueObject(@javax.annotation.Nullable Pet * @throws ApiException if fails to make API call */ public ApiResponse testQueryStyleFormExplodeTrueObjectWithHttpInfo(@javax.annotation.Nullable Pet queryObject) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = testQueryStyleFormExplodeTrueObjectRequestBuilder(queryObject); + return testQueryStyleFormExplodeTrueObjectWithHttpInfo(queryObject, null); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param queryObject (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<String> + * @throws ApiException if fails to make API call + */ + public ApiResponse testQueryStyleFormExplodeTrueObjectWithHttpInfo(@javax.annotation.Nullable Pet queryObject, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = testQueryStyleFormExplodeTrueObjectRequestBuilder(queryObject, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -965,7 +1183,7 @@ public ApiResponse testQueryStyleFormExplodeTrueObjectWithHttpInfo(@java } } - private HttpRequest.Builder testQueryStyleFormExplodeTrueObjectRequestBuilder(@javax.annotation.Nullable Pet queryObject) throws ApiException { + private HttpRequest.Builder testQueryStyleFormExplodeTrueObjectRequestBuilder(@javax.annotation.Nullable Pet queryObject, Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -999,9 +1217,11 @@ private HttpRequest.Builder testQueryStyleFormExplodeTrueObjectRequestBuilder(@j if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -1017,7 +1237,19 @@ private HttpRequest.Builder testQueryStyleFormExplodeTrueObjectRequestBuilder(@j * @throws ApiException if fails to make API call */ public String testQueryStyleFormExplodeTrueObjectAllOf(@javax.annotation.Nullable DataQuery queryObject) throws ApiException { - ApiResponse localVarResponse = testQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo(queryObject); + return testQueryStyleFormExplodeTrueObjectAllOf(queryObject, null); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param queryObject (optional) + * @param headers Optional headers to include in the request + * @return String + * @throws ApiException if fails to make API call + */ + public String testQueryStyleFormExplodeTrueObjectAllOf(@javax.annotation.Nullable DataQuery queryObject, Map headers) throws ApiException { + ApiResponse localVarResponse = testQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo(queryObject, headers); return localVarResponse.getData(); } @@ -1029,7 +1261,19 @@ public String testQueryStyleFormExplodeTrueObjectAllOf(@javax.annotation.Nullabl * @throws ApiException if fails to make API call */ public ApiResponse testQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo(@javax.annotation.Nullable DataQuery queryObject) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = testQueryStyleFormExplodeTrueObjectAllOfRequestBuilder(queryObject); + return testQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo(queryObject, null); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param queryObject (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<String> + * @throws ApiException if fails to make API call + */ + public ApiResponse testQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo(@javax.annotation.Nullable DataQuery queryObject, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = testQueryStyleFormExplodeTrueObjectAllOfRequestBuilder(queryObject, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -1065,7 +1309,7 @@ public ApiResponse testQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo( } } - private HttpRequest.Builder testQueryStyleFormExplodeTrueObjectAllOfRequestBuilder(@javax.annotation.Nullable DataQuery queryObject) throws ApiException { + private HttpRequest.Builder testQueryStyleFormExplodeTrueObjectAllOfRequestBuilder(@javax.annotation.Nullable DataQuery queryObject, Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -1094,9 +1338,11 @@ private HttpRequest.Builder testQueryStyleFormExplodeTrueObjectAllOfRequestBuild if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/AnotherFakeApi.java index 32c9e06780d5..ca763e49e1a6 100644 --- a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/AnotherFakeApi.java +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -57,9 +57,6 @@ public class AnotherFakeApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; - // Custom headers to be sent with every request from this API client - private final Map extraHeaders = new java.util.HashMap<>(); - public AnotherFakeApi() { this(Configuration.getDefaultApiClient()); } @@ -74,27 +71,6 @@ public AnotherFakeApi(ApiClient apiClient) { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } - /** - * Add a custom header to be sent with every request from this API client. - * @param name Header name - * @param value Header value - * @return this - */ - public AnotherFakeApi addHeader(String name, String value) { - this.extraHeaders.put(name, value); - return this; - } - - /** - * Remove a custom header. - * @param name Header name - * @return this - */ - public AnotherFakeApi removeHeader(String name) { - this.extraHeaders.remove(name); - return this; - } - private ApiException getApiException(String operationId, HttpResponse response) { String message = formatExceptionMessage(operationId, response.statusCode(), response.body()); @@ -116,8 +92,20 @@ private String formatExceptionMessage(String operationId, int statusCode, String * @throws ApiException if fails to make API call */ public CompletableFuture call123testSpecialTags(@javax.annotation.Nonnull Client client) throws ApiException { + return call123testSpecialTags(client, null); + } + + /** + * To test special tags + * To test special tags and operation ID starting with number + * @param client client model (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<Client> + * @throws ApiException if fails to make API call + */ + public CompletableFuture call123testSpecialTags(@javax.annotation.Nonnull Client client, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = call123testSpecialTagsRequestBuilder(client); + HttpRequest.Builder localVarRequestBuilder = call123testSpecialTagsRequestBuilder(client, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -147,8 +135,20 @@ public CompletableFuture call123testSpecialTags(@javax.annotation.Nonnul * @throws ApiException if fails to make API call */ public CompletableFuture> call123testSpecialTagsWithHttpInfo(@javax.annotation.Nonnull Client client) throws ApiException { + return call123testSpecialTagsWithHttpInfo(client, null); + } + + /** + * To test special tags + * To test special tags and operation ID starting with number + * @param client client model (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Client>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> call123testSpecialTagsWithHttpInfo(@javax.annotation.Nonnull Client client, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = call123testSpecialTagsRequestBuilder(client); + HttpRequest.Builder localVarRequestBuilder = call123testSpecialTagsRequestBuilder(client, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -177,7 +177,7 @@ public CompletableFuture> call123testSpecialTagsWithHttpInfo } } - private HttpRequest.Builder call123testSpecialTagsRequestBuilder(@javax.annotation.Nonnull Client client) throws ApiException { + private HttpRequest.Builder call123testSpecialTagsRequestBuilder(@javax.annotation.Nonnull Client client, Map headers) throws ApiException { // verify the required parameter 'client' is set if (client == null) { throw new ApiException(400, "Missing the required parameter 'client' when calling call123testSpecialTags"); @@ -201,9 +201,11 @@ private HttpRequest.Builder call123testSpecialTagsRequestBuilder(@javax.annotati if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/DefaultApi.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/DefaultApi.java index 8728718237bf..294544f24be8 100644 --- a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/DefaultApi.java +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/DefaultApi.java @@ -57,9 +57,6 @@ public class DefaultApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; - // Custom headers to be sent with every request from this API client - private final Map extraHeaders = new java.util.HashMap<>(); - public DefaultApi() { this(Configuration.getDefaultApiClient()); } @@ -74,27 +71,6 @@ public DefaultApi(ApiClient apiClient) { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } - /** - * Add a custom header to be sent with every request from this API client. - * @param name Header name - * @param value Header value - * @return this - */ - public DefaultApi addHeader(String name, String value) { - this.extraHeaders.put(name, value); - return this; - } - - /** - * Remove a custom header. - * @param name Header name - * @return this - */ - public DefaultApi removeHeader(String name) { - this.extraHeaders.remove(name); - return this; - } - private ApiException getApiException(String operationId, HttpResponse response) { String message = formatExceptionMessage(operationId, response.statusCode(), response.body()); @@ -115,8 +91,19 @@ private String formatExceptionMessage(String operationId, int statusCode, String * @throws ApiException if fails to make API call */ public CompletableFuture fooGet() throws ApiException { + return fooGet(null); + } + + /** + * + * + * @param headers Optional headers to include in the request + * @return CompletableFuture<FooGetDefaultResponse> + * @throws ApiException if fails to make API call + */ + public CompletableFuture fooGet(Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = fooGetRequestBuilder(); + HttpRequest.Builder localVarRequestBuilder = fooGetRequestBuilder(headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -145,8 +132,19 @@ public CompletableFuture fooGet() throws ApiException { * @throws ApiException if fails to make API call */ public CompletableFuture> fooGetWithHttpInfo() throws ApiException { + return fooGetWithHttpInfo(null); + } + + /** + * + * + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<FooGetDefaultResponse>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> fooGetWithHttpInfo(Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = fooGetRequestBuilder(); + HttpRequest.Builder localVarRequestBuilder = fooGetRequestBuilder(headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -175,7 +173,7 @@ public CompletableFuture> fooGetWithHttpInfo( } } - private HttpRequest.Builder fooGetRequestBuilder() throws ApiException { + private HttpRequest.Builder fooGetRequestBuilder(Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -189,9 +187,11 @@ private HttpRequest.Builder fooGetRequestBuilder() throws ApiException { if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeApi.java index c96d7cceac7a..51ef28f219cf 100644 --- a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeApi.java @@ -74,9 +74,6 @@ public class FakeApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; - // Custom headers to be sent with every request from this API client - private final Map extraHeaders = new java.util.HashMap<>(); - public FakeApi() { this(Configuration.getDefaultApiClient()); } @@ -91,27 +88,6 @@ public FakeApi(ApiClient apiClient) { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } - /** - * Add a custom header to be sent with every request from this API client. - * @param name Header name - * @param value Header value - * @return this - */ - public FakeApi addHeader(String name, String value) { - this.extraHeaders.put(name, value); - return this; - } - - /** - * Remove a custom header. - * @param name Header name - * @return this - */ - public FakeApi removeHeader(String name) { - this.extraHeaders.remove(name); - return this; - } - private ApiException getApiException(String operationId, HttpResponse response) { String message = formatExceptionMessage(operationId, response.statusCode(), response.body()); @@ -132,8 +108,19 @@ private String formatExceptionMessage(String operationId, int statusCode, String * @throws ApiException if fails to make API call */ public CompletableFuture fakeBigDecimalMap() throws ApiException { + return fakeBigDecimalMap(null); + } + + /** + * + * for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + * @param headers Optional headers to include in the request + * @return CompletableFuture<FakeBigDecimalMap200Response> + * @throws ApiException if fails to make API call + */ + public CompletableFuture fakeBigDecimalMap(Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = fakeBigDecimalMapRequestBuilder(); + HttpRequest.Builder localVarRequestBuilder = fakeBigDecimalMapRequestBuilder(headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -162,8 +149,19 @@ public CompletableFuture fakeBigDecimalMap() throw * @throws ApiException if fails to make API call */ public CompletableFuture> fakeBigDecimalMapWithHttpInfo() throws ApiException { + return fakeBigDecimalMapWithHttpInfo(null); + } + + /** + * + * for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<FakeBigDecimalMap200Response>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> fakeBigDecimalMapWithHttpInfo(Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = fakeBigDecimalMapRequestBuilder(); + HttpRequest.Builder localVarRequestBuilder = fakeBigDecimalMapRequestBuilder(headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -192,7 +190,7 @@ public CompletableFuture> fakeBigDecim } } - private HttpRequest.Builder fakeBigDecimalMapRequestBuilder() throws ApiException { + private HttpRequest.Builder fakeBigDecimalMapRequestBuilder(Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -206,9 +204,11 @@ private HttpRequest.Builder fakeBigDecimalMapRequestBuilder() throws ApiExceptio if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -223,8 +223,19 @@ private HttpRequest.Builder fakeBigDecimalMapRequestBuilder() throws ApiExceptio * @throws ApiException if fails to make API call */ public CompletableFuture fakeHealthGet() throws ApiException { + return fakeHealthGet(null); + } + + /** + * Health check endpoint + * + * @param headers Optional headers to include in the request + * @return CompletableFuture<HealthCheckResult> + * @throws ApiException if fails to make API call + */ + public CompletableFuture fakeHealthGet(Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = fakeHealthGetRequestBuilder(); + HttpRequest.Builder localVarRequestBuilder = fakeHealthGetRequestBuilder(headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -253,8 +264,19 @@ public CompletableFuture fakeHealthGet() throws ApiException * @throws ApiException if fails to make API call */ public CompletableFuture> fakeHealthGetWithHttpInfo() throws ApiException { + return fakeHealthGetWithHttpInfo(null); + } + + /** + * Health check endpoint + * + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<HealthCheckResult>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> fakeHealthGetWithHttpInfo(Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = fakeHealthGetRequestBuilder(); + HttpRequest.Builder localVarRequestBuilder = fakeHealthGetRequestBuilder(headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -283,7 +305,7 @@ public CompletableFuture> fakeHealthGetWithHttpIn } } - private HttpRequest.Builder fakeHealthGetRequestBuilder() throws ApiException { + private HttpRequest.Builder fakeHealthGetRequestBuilder(Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -297,9 +319,11 @@ private HttpRequest.Builder fakeHealthGetRequestBuilder() throws ApiException { if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -315,8 +339,20 @@ private HttpRequest.Builder fakeHealthGetRequestBuilder() throws ApiException { * @throws ApiException if fails to make API call */ public CompletableFuture fakeOuterBooleanSerialize(@javax.annotation.Nullable Boolean body) throws ApiException { + return fakeOuterBooleanSerialize(body, null); + } + + /** + * + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @param headers Optional headers to include in the request + * @return CompletableFuture<Boolean> + * @throws ApiException if fails to make API call + */ + public CompletableFuture fakeOuterBooleanSerialize(@javax.annotation.Nullable Boolean body, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = fakeOuterBooleanSerializeRequestBuilder(body); + HttpRequest.Builder localVarRequestBuilder = fakeOuterBooleanSerializeRequestBuilder(body, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -346,8 +382,20 @@ public CompletableFuture fakeOuterBooleanSerialize(@javax.annotation.Nu * @throws ApiException if fails to make API call */ public CompletableFuture> fakeOuterBooleanSerializeWithHttpInfo(@javax.annotation.Nullable Boolean body) throws ApiException { + return fakeOuterBooleanSerializeWithHttpInfo(body, null); + } + + /** + * + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Boolean>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> fakeOuterBooleanSerializeWithHttpInfo(@javax.annotation.Nullable Boolean body, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = fakeOuterBooleanSerializeRequestBuilder(body); + HttpRequest.Builder localVarRequestBuilder = fakeOuterBooleanSerializeRequestBuilder(body, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -376,7 +424,7 @@ public CompletableFuture> fakeOuterBooleanSerializeWithHttp } } - private HttpRequest.Builder fakeOuterBooleanSerializeRequestBuilder(@javax.annotation.Nullable Boolean body) throws ApiException { + private HttpRequest.Builder fakeOuterBooleanSerializeRequestBuilder(@javax.annotation.Nullable Boolean body, Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -396,9 +444,11 @@ private HttpRequest.Builder fakeOuterBooleanSerializeRequestBuilder(@javax.annot if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -414,8 +464,20 @@ private HttpRequest.Builder fakeOuterBooleanSerializeRequestBuilder(@javax.annot * @throws ApiException if fails to make API call */ public CompletableFuture fakeOuterCompositeSerialize(@javax.annotation.Nullable OuterComposite outerComposite) throws ApiException { + return fakeOuterCompositeSerialize(outerComposite, null); + } + + /** + * + * Test serialization of object with outer number type + * @param outerComposite Input composite as post body (optional) + * @param headers Optional headers to include in the request + * @return CompletableFuture<OuterComposite> + * @throws ApiException if fails to make API call + */ + public CompletableFuture fakeOuterCompositeSerialize(@javax.annotation.Nullable OuterComposite outerComposite, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = fakeOuterCompositeSerializeRequestBuilder(outerComposite); + HttpRequest.Builder localVarRequestBuilder = fakeOuterCompositeSerializeRequestBuilder(outerComposite, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -445,8 +507,20 @@ public CompletableFuture fakeOuterCompositeSerialize(@javax.anno * @throws ApiException if fails to make API call */ public CompletableFuture> fakeOuterCompositeSerializeWithHttpInfo(@javax.annotation.Nullable OuterComposite outerComposite) throws ApiException { + return fakeOuterCompositeSerializeWithHttpInfo(outerComposite, null); + } + + /** + * + * Test serialization of object with outer number type + * @param outerComposite Input composite as post body (optional) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<OuterComposite>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> fakeOuterCompositeSerializeWithHttpInfo(@javax.annotation.Nullable OuterComposite outerComposite, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = fakeOuterCompositeSerializeRequestBuilder(outerComposite); + HttpRequest.Builder localVarRequestBuilder = fakeOuterCompositeSerializeRequestBuilder(outerComposite, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -475,7 +549,7 @@ public CompletableFuture> fakeOuterCompositeSerializ } } - private HttpRequest.Builder fakeOuterCompositeSerializeRequestBuilder(@javax.annotation.Nullable OuterComposite outerComposite) throws ApiException { + private HttpRequest.Builder fakeOuterCompositeSerializeRequestBuilder(@javax.annotation.Nullable OuterComposite outerComposite, Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -495,9 +569,11 @@ private HttpRequest.Builder fakeOuterCompositeSerializeRequestBuilder(@javax.ann if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -513,8 +589,20 @@ private HttpRequest.Builder fakeOuterCompositeSerializeRequestBuilder(@javax.ann * @throws ApiException if fails to make API call */ public CompletableFuture fakeOuterNumberSerialize(@javax.annotation.Nullable BigDecimal body) throws ApiException { + return fakeOuterNumberSerialize(body, null); + } + + /** + * + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @param headers Optional headers to include in the request + * @return CompletableFuture<BigDecimal> + * @throws ApiException if fails to make API call + */ + public CompletableFuture fakeOuterNumberSerialize(@javax.annotation.Nullable BigDecimal body, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = fakeOuterNumberSerializeRequestBuilder(body); + HttpRequest.Builder localVarRequestBuilder = fakeOuterNumberSerializeRequestBuilder(body, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -544,8 +632,20 @@ public CompletableFuture fakeOuterNumberSerialize(@javax.annotation. * @throws ApiException if fails to make API call */ public CompletableFuture> fakeOuterNumberSerializeWithHttpInfo(@javax.annotation.Nullable BigDecimal body) throws ApiException { + return fakeOuterNumberSerializeWithHttpInfo(body, null); + } + + /** + * + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<BigDecimal>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> fakeOuterNumberSerializeWithHttpInfo(@javax.annotation.Nullable BigDecimal body, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = fakeOuterNumberSerializeRequestBuilder(body); + HttpRequest.Builder localVarRequestBuilder = fakeOuterNumberSerializeRequestBuilder(body, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -574,7 +674,7 @@ public CompletableFuture> fakeOuterNumberSerializeWithHt } } - private HttpRequest.Builder fakeOuterNumberSerializeRequestBuilder(@javax.annotation.Nullable BigDecimal body) throws ApiException { + private HttpRequest.Builder fakeOuterNumberSerializeRequestBuilder(@javax.annotation.Nullable BigDecimal body, Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -594,9 +694,11 @@ private HttpRequest.Builder fakeOuterNumberSerializeRequestBuilder(@javax.annota if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -612,8 +714,20 @@ private HttpRequest.Builder fakeOuterNumberSerializeRequestBuilder(@javax.annota * @throws ApiException if fails to make API call */ public CompletableFuture fakeOuterStringSerialize(@javax.annotation.Nullable String body) throws ApiException { + return fakeOuterStringSerialize(body, null); + } + + /** + * + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @param headers Optional headers to include in the request + * @return CompletableFuture<String> + * @throws ApiException if fails to make API call + */ + public CompletableFuture fakeOuterStringSerialize(@javax.annotation.Nullable String body, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = fakeOuterStringSerializeRequestBuilder(body); + HttpRequest.Builder localVarRequestBuilder = fakeOuterStringSerializeRequestBuilder(body, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -643,8 +757,20 @@ public CompletableFuture fakeOuterStringSerialize(@javax.annotation.Null * @throws ApiException if fails to make API call */ public CompletableFuture> fakeOuterStringSerializeWithHttpInfo(@javax.annotation.Nullable String body) throws ApiException { + return fakeOuterStringSerializeWithHttpInfo(body, null); + } + + /** + * + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<String>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> fakeOuterStringSerializeWithHttpInfo(@javax.annotation.Nullable String body, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = fakeOuterStringSerializeRequestBuilder(body); + HttpRequest.Builder localVarRequestBuilder = fakeOuterStringSerializeRequestBuilder(body, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -673,7 +799,7 @@ public CompletableFuture> fakeOuterStringSerializeWithHttpIn } } - private HttpRequest.Builder fakeOuterStringSerializeRequestBuilder(@javax.annotation.Nullable String body) throws ApiException { + private HttpRequest.Builder fakeOuterStringSerializeRequestBuilder(@javax.annotation.Nullable String body, Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -688,9 +814,11 @@ private HttpRequest.Builder fakeOuterStringSerializeRequestBuilder(@javax.annota if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -705,8 +833,19 @@ private HttpRequest.Builder fakeOuterStringSerializeRequestBuilder(@javax.annota * @throws ApiException if fails to make API call */ public CompletableFuture> getApplicationJsonUtf8() throws ApiException { + return getApplicationJsonUtf8(null); + } + + /** + * application/json UTF8 + * + * @param headers Optional headers to include in the request + * @return CompletableFuture<List<OuterEnum>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> getApplicationJsonUtf8(Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = getApplicationJsonUtf8RequestBuilder(); + HttpRequest.Builder localVarRequestBuilder = getApplicationJsonUtf8RequestBuilder(headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -735,8 +874,19 @@ public CompletableFuture> getApplicationJsonUtf8() throws ApiExc * @throws ApiException if fails to make API call */ public CompletableFuture>> getApplicationJsonUtf8WithHttpInfo() throws ApiException { + return getApplicationJsonUtf8WithHttpInfo(null); + } + + /** + * application/json UTF8 + * + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<List<OuterEnum>>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture>> getApplicationJsonUtf8WithHttpInfo(Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = getApplicationJsonUtf8RequestBuilder(); + HttpRequest.Builder localVarRequestBuilder = getApplicationJsonUtf8RequestBuilder(headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -765,7 +915,7 @@ public CompletableFuture>> getApplicationJsonUtf8Wit } } - private HttpRequest.Builder getApplicationJsonUtf8RequestBuilder() throws ApiException { + private HttpRequest.Builder getApplicationJsonUtf8RequestBuilder(Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -779,9 +929,11 @@ private HttpRequest.Builder getApplicationJsonUtf8RequestBuilder() throws ApiExc if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -796,8 +948,19 @@ private HttpRequest.Builder getApplicationJsonUtf8RequestBuilder() throws ApiExc * @throws ApiException if fails to make API call */ public CompletableFuture> getArrayOfEnums() throws ApiException { + return getArrayOfEnums(null); + } + + /** + * Array of Enums + * + * @param headers Optional headers to include in the request + * @return CompletableFuture<List<OuterEnum>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> getArrayOfEnums(Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = getArrayOfEnumsRequestBuilder(); + HttpRequest.Builder localVarRequestBuilder = getArrayOfEnumsRequestBuilder(headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -826,8 +989,19 @@ public CompletableFuture> getArrayOfEnums() throws ApiException * @throws ApiException if fails to make API call */ public CompletableFuture>> getArrayOfEnumsWithHttpInfo() throws ApiException { + return getArrayOfEnumsWithHttpInfo(null); + } + + /** + * Array of Enums + * + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<List<OuterEnum>>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture>> getArrayOfEnumsWithHttpInfo(Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = getArrayOfEnumsRequestBuilder(); + HttpRequest.Builder localVarRequestBuilder = getArrayOfEnumsRequestBuilder(headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -856,7 +1030,7 @@ public CompletableFuture>> getArrayOfEnumsWithHttpIn } } - private HttpRequest.Builder getArrayOfEnumsRequestBuilder() throws ApiException { + private HttpRequest.Builder getArrayOfEnumsRequestBuilder(Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -870,9 +1044,11 @@ private HttpRequest.Builder getArrayOfEnumsRequestBuilder() throws ApiException if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -888,8 +1064,20 @@ private HttpRequest.Builder getArrayOfEnumsRequestBuilder() throws ApiException * @throws ApiException if fails to make API call */ public CompletableFuture testAdditionalPropertiesReference(@javax.annotation.Nonnull Map requestBody) throws ApiException { + return testAdditionalPropertiesReference(requestBody, null); + } + + /** + * test referenced additionalProperties + * + * @param requestBody request body (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<Void> + * @throws ApiException if fails to make API call + */ + public CompletableFuture testAdditionalPropertiesReference(@javax.annotation.Nonnull Map requestBody, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = testAdditionalPropertiesReferenceRequestBuilder(requestBody); + HttpRequest.Builder localVarRequestBuilder = testAdditionalPropertiesReferenceRequestBuilder(requestBody, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -912,8 +1100,20 @@ public CompletableFuture testAdditionalPropertiesReference(@javax.annotati * @throws ApiException if fails to make API call */ public CompletableFuture> testAdditionalPropertiesReferenceWithHttpInfo(@javax.annotation.Nonnull Map requestBody) throws ApiException { + return testAdditionalPropertiesReferenceWithHttpInfo(requestBody, null); + } + + /** + * test referenced additionalProperties + * + * @param requestBody request body (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Void>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> testAdditionalPropertiesReferenceWithHttpInfo(@javax.annotation.Nonnull Map requestBody, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = testAdditionalPropertiesReferenceRequestBuilder(requestBody); + HttpRequest.Builder localVarRequestBuilder = testAdditionalPropertiesReferenceRequestBuilder(requestBody, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -934,7 +1134,7 @@ public CompletableFuture> testAdditionalPropertiesReferenceWit } } - private HttpRequest.Builder testAdditionalPropertiesReferenceRequestBuilder(@javax.annotation.Nonnull Map requestBody) throws ApiException { + private HttpRequest.Builder testAdditionalPropertiesReferenceRequestBuilder(@javax.annotation.Nonnull Map requestBody, Map headers) throws ApiException { // verify the required parameter 'requestBody' is set if (requestBody == null) { throw new ApiException(400, "Missing the required parameter 'requestBody' when calling testAdditionalPropertiesReference"); @@ -958,9 +1158,11 @@ private HttpRequest.Builder testAdditionalPropertiesReferenceRequestBuilder(@jav if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -976,8 +1178,20 @@ private HttpRequest.Builder testAdditionalPropertiesReferenceRequestBuilder(@jav * @throws ApiException if fails to make API call */ public CompletableFuture testBodyWithFileSchema(@javax.annotation.Nonnull FileSchemaTestClass fileSchemaTestClass) throws ApiException { + return testBodyWithFileSchema(fileSchemaTestClass, null); + } + + /** + * + * For this test, the body for this request much reference a schema named `File`. + * @param fileSchemaTestClass (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<Void> + * @throws ApiException if fails to make API call + */ + public CompletableFuture testBodyWithFileSchema(@javax.annotation.Nonnull FileSchemaTestClass fileSchemaTestClass, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = testBodyWithFileSchemaRequestBuilder(fileSchemaTestClass); + HttpRequest.Builder localVarRequestBuilder = testBodyWithFileSchemaRequestBuilder(fileSchemaTestClass, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -1000,8 +1214,20 @@ public CompletableFuture testBodyWithFileSchema(@javax.annotation.Nonnull * @throws ApiException if fails to make API call */ public CompletableFuture> testBodyWithFileSchemaWithHttpInfo(@javax.annotation.Nonnull FileSchemaTestClass fileSchemaTestClass) throws ApiException { + return testBodyWithFileSchemaWithHttpInfo(fileSchemaTestClass, null); + } + + /** + * + * For this test, the body for this request much reference a schema named `File`. + * @param fileSchemaTestClass (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Void>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> testBodyWithFileSchemaWithHttpInfo(@javax.annotation.Nonnull FileSchemaTestClass fileSchemaTestClass, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = testBodyWithFileSchemaRequestBuilder(fileSchemaTestClass); + HttpRequest.Builder localVarRequestBuilder = testBodyWithFileSchemaRequestBuilder(fileSchemaTestClass, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -1022,7 +1248,7 @@ public CompletableFuture> testBodyWithFileSchemaWithHttpInfo(@ } } - private HttpRequest.Builder testBodyWithFileSchemaRequestBuilder(@javax.annotation.Nonnull FileSchemaTestClass fileSchemaTestClass) throws ApiException { + private HttpRequest.Builder testBodyWithFileSchemaRequestBuilder(@javax.annotation.Nonnull FileSchemaTestClass fileSchemaTestClass, Map headers) throws ApiException { // verify the required parameter 'fileSchemaTestClass' is set if (fileSchemaTestClass == null) { throw new ApiException(400, "Missing the required parameter 'fileSchemaTestClass' when calling testBodyWithFileSchema"); @@ -1046,9 +1272,11 @@ private HttpRequest.Builder testBodyWithFileSchemaRequestBuilder(@javax.annotati if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -1065,8 +1293,21 @@ private HttpRequest.Builder testBodyWithFileSchemaRequestBuilder(@javax.annotati * @throws ApiException if fails to make API call */ public CompletableFuture testBodyWithQueryParams(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull User user) throws ApiException { + return testBodyWithQueryParams(query, user, null); + } + + /** + * + * + * @param query (required) + * @param user (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<Void> + * @throws ApiException if fails to make API call + */ + public CompletableFuture testBodyWithQueryParams(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull User user, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = testBodyWithQueryParamsRequestBuilder(query, user); + HttpRequest.Builder localVarRequestBuilder = testBodyWithQueryParamsRequestBuilder(query, user, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -1090,8 +1331,21 @@ public CompletableFuture testBodyWithQueryParams(@javax.annotation.Nonnull * @throws ApiException if fails to make API call */ public CompletableFuture> testBodyWithQueryParamsWithHttpInfo(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull User user) throws ApiException { + return testBodyWithQueryParamsWithHttpInfo(query, user, null); + } + + /** + * + * + * @param query (required) + * @param user (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Void>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> testBodyWithQueryParamsWithHttpInfo(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull User user, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = testBodyWithQueryParamsRequestBuilder(query, user); + HttpRequest.Builder localVarRequestBuilder = testBodyWithQueryParamsRequestBuilder(query, user, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -1112,7 +1366,7 @@ public CompletableFuture> testBodyWithQueryParamsWithHttpInfo( } } - private HttpRequest.Builder testBodyWithQueryParamsRequestBuilder(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull User user) throws ApiException { + private HttpRequest.Builder testBodyWithQueryParamsRequestBuilder(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull User user, Map headers) throws ApiException { // verify the required parameter 'query' is set if (query == null) { throw new ApiException(400, "Missing the required parameter 'query' when calling testBodyWithQueryParams"); @@ -1155,9 +1409,11 @@ private HttpRequest.Builder testBodyWithQueryParamsRequestBuilder(@javax.annotat if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -1173,8 +1429,20 @@ private HttpRequest.Builder testBodyWithQueryParamsRequestBuilder(@javax.annotat * @throws ApiException if fails to make API call */ public CompletableFuture testClientModel(@javax.annotation.Nonnull Client client) throws ApiException { + return testClientModel(client, null); + } + + /** + * To test \"client\" model + * To test \"client\" model + * @param client client model (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<Client> + * @throws ApiException if fails to make API call + */ + public CompletableFuture testClientModel(@javax.annotation.Nonnull Client client, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = testClientModelRequestBuilder(client); + HttpRequest.Builder localVarRequestBuilder = testClientModelRequestBuilder(client, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -1204,8 +1472,20 @@ public CompletableFuture testClientModel(@javax.annotation.Nonnull Clien * @throws ApiException if fails to make API call */ public CompletableFuture> testClientModelWithHttpInfo(@javax.annotation.Nonnull Client client) throws ApiException { + return testClientModelWithHttpInfo(client, null); + } + + /** + * To test \"client\" model + * To test \"client\" model + * @param client client model (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Client>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> testClientModelWithHttpInfo(@javax.annotation.Nonnull Client client, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = testClientModelRequestBuilder(client); + HttpRequest.Builder localVarRequestBuilder = testClientModelRequestBuilder(client, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -1234,7 +1514,7 @@ public CompletableFuture> testClientModelWithHttpInfo(@javax } } - private HttpRequest.Builder testClientModelRequestBuilder(@javax.annotation.Nonnull Client client) throws ApiException { + private HttpRequest.Builder testClientModelRequestBuilder(@javax.annotation.Nonnull Client client, Map headers) throws ApiException { // verify the required parameter 'client' is set if (client == null) { throw new ApiException(400, "Missing the required parameter 'client' when calling testClientModel"); @@ -1258,9 +1538,11 @@ private HttpRequest.Builder testClientModelRequestBuilder(@javax.annotation.Nonn if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -1289,8 +1571,33 @@ private HttpRequest.Builder testClientModelRequestBuilder(@javax.annotation.Nonn * @throws ApiException if fails to make API call */ public CompletableFuture testEndpointParameters(@javax.annotation.Nonnull BigDecimal number, @javax.annotation.Nonnull Double _double, @javax.annotation.Nonnull String patternWithoutDelimiter, @javax.annotation.Nonnull byte[] _byte, @javax.annotation.Nullable Integer integer, @javax.annotation.Nullable Integer int32, @javax.annotation.Nullable Long int64, @javax.annotation.Nullable Float _float, @javax.annotation.Nullable String string, @javax.annotation.Nullable File binary, @javax.annotation.Nullable LocalDate date, @javax.annotation.Nullable OffsetDateTime dateTime, @javax.annotation.Nullable String password, @javax.annotation.Nullable String paramCallback) throws ApiException { + return testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, null); + } + + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * @param number None (required) + * @param _double None (required) + * @param patternWithoutDelimiter None (required) + * @param _byte None (required) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param string None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional, default to 2010-02-01T10:20:10.111110+01:00) + * @param password None (optional) + * @param paramCallback None (optional) + * @param headers Optional headers to include in the request + * @return CompletableFuture<Void> + * @throws ApiException if fails to make API call + */ + public CompletableFuture testEndpointParameters(@javax.annotation.Nonnull BigDecimal number, @javax.annotation.Nonnull Double _double, @javax.annotation.Nonnull String patternWithoutDelimiter, @javax.annotation.Nonnull byte[] _byte, @javax.annotation.Nullable Integer integer, @javax.annotation.Nullable Integer int32, @javax.annotation.Nullable Long int64, @javax.annotation.Nullable Float _float, @javax.annotation.Nullable String string, @javax.annotation.Nullable File binary, @javax.annotation.Nullable LocalDate date, @javax.annotation.Nullable OffsetDateTime dateTime, @javax.annotation.Nullable String password, @javax.annotation.Nullable String paramCallback, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = testEndpointParametersRequestBuilder(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); + HttpRequest.Builder localVarRequestBuilder = testEndpointParametersRequestBuilder(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -1326,8 +1633,33 @@ public CompletableFuture testEndpointParameters(@javax.annotation.Nonnull * @throws ApiException if fails to make API call */ public CompletableFuture> testEndpointParametersWithHttpInfo(@javax.annotation.Nonnull BigDecimal number, @javax.annotation.Nonnull Double _double, @javax.annotation.Nonnull String patternWithoutDelimiter, @javax.annotation.Nonnull byte[] _byte, @javax.annotation.Nullable Integer integer, @javax.annotation.Nullable Integer int32, @javax.annotation.Nullable Long int64, @javax.annotation.Nullable Float _float, @javax.annotation.Nullable String string, @javax.annotation.Nullable File binary, @javax.annotation.Nullable LocalDate date, @javax.annotation.Nullable OffsetDateTime dateTime, @javax.annotation.Nullable String password, @javax.annotation.Nullable String paramCallback) throws ApiException { + return testEndpointParametersWithHttpInfo(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, null); + } + + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * @param number None (required) + * @param _double None (required) + * @param patternWithoutDelimiter None (required) + * @param _byte None (required) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param string None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional, default to 2010-02-01T10:20:10.111110+01:00) + * @param password None (optional) + * @param paramCallback None (optional) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Void>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> testEndpointParametersWithHttpInfo(@javax.annotation.Nonnull BigDecimal number, @javax.annotation.Nonnull Double _double, @javax.annotation.Nonnull String patternWithoutDelimiter, @javax.annotation.Nonnull byte[] _byte, @javax.annotation.Nullable Integer integer, @javax.annotation.Nullable Integer int32, @javax.annotation.Nullable Long int64, @javax.annotation.Nullable Float _float, @javax.annotation.Nullable String string, @javax.annotation.Nullable File binary, @javax.annotation.Nullable LocalDate date, @javax.annotation.Nullable OffsetDateTime dateTime, @javax.annotation.Nullable String password, @javax.annotation.Nullable String paramCallback, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = testEndpointParametersRequestBuilder(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); + HttpRequest.Builder localVarRequestBuilder = testEndpointParametersRequestBuilder(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -1348,7 +1680,7 @@ public CompletableFuture> testEndpointParametersWithHttpInfo(@ } } - private HttpRequest.Builder testEndpointParametersRequestBuilder(@javax.annotation.Nonnull BigDecimal number, @javax.annotation.Nonnull Double _double, @javax.annotation.Nonnull String patternWithoutDelimiter, @javax.annotation.Nonnull byte[] _byte, @javax.annotation.Nullable Integer integer, @javax.annotation.Nullable Integer int32, @javax.annotation.Nullable Long int64, @javax.annotation.Nullable Float _float, @javax.annotation.Nullable String string, @javax.annotation.Nullable File binary, @javax.annotation.Nullable LocalDate date, @javax.annotation.Nullable OffsetDateTime dateTime, @javax.annotation.Nullable String password, @javax.annotation.Nullable String paramCallback) throws ApiException { + private HttpRequest.Builder testEndpointParametersRequestBuilder(@javax.annotation.Nonnull BigDecimal number, @javax.annotation.Nonnull Double _double, @javax.annotation.Nonnull String patternWithoutDelimiter, @javax.annotation.Nonnull byte[] _byte, @javax.annotation.Nullable Integer integer, @javax.annotation.Nullable Integer int32, @javax.annotation.Nullable Long int64, @javax.annotation.Nullable Float _float, @javax.annotation.Nullable String string, @javax.annotation.Nullable File binary, @javax.annotation.Nullable LocalDate date, @javax.annotation.Nullable OffsetDateTime dateTime, @javax.annotation.Nullable String password, @javax.annotation.Nullable String paramCallback, Map headers) throws ApiException { // verify the required parameter 'number' is set if (number == null) { throw new ApiException(400, "Missing the required parameter 'number' when calling testEndpointParameters"); @@ -1431,9 +1763,11 @@ private HttpRequest.Builder testEndpointParametersRequestBuilder(@javax.annotati if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -1456,8 +1790,27 @@ private HttpRequest.Builder testEndpointParametersRequestBuilder(@javax.annotati * @throws ApiException if fails to make API call */ public CompletableFuture testEnumParameters(@javax.annotation.Nullable List enumHeaderStringArray, @javax.annotation.Nullable String enumHeaderString, @javax.annotation.Nullable List enumQueryStringArray, @javax.annotation.Nullable String enumQueryString, @javax.annotation.Nullable Integer enumQueryInteger, @javax.annotation.Nullable Double enumQueryDouble, @javax.annotation.Nullable List enumFormStringArray, @javax.annotation.Nullable String enumFormString) throws ApiException { + return testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, null); + } + + /** + * To test enum parameters + * To test enum parameters + * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional) + * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) + * @param enumQueryInteger Query parameter enum test (double) (optional) + * @param enumQueryDouble Query parameter enum test (double) (optional) + * @param enumFormStringArray Form parameter enum test (string array) (optional) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @param headers Optional headers to include in the request + * @return CompletableFuture<Void> + * @throws ApiException if fails to make API call + */ + public CompletableFuture testEnumParameters(@javax.annotation.Nullable List enumHeaderStringArray, @javax.annotation.Nullable String enumHeaderString, @javax.annotation.Nullable List enumQueryStringArray, @javax.annotation.Nullable String enumQueryString, @javax.annotation.Nullable Integer enumQueryInteger, @javax.annotation.Nullable Double enumQueryDouble, @javax.annotation.Nullable List enumFormStringArray, @javax.annotation.Nullable String enumFormString, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = testEnumParametersRequestBuilder(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + HttpRequest.Builder localVarRequestBuilder = testEnumParametersRequestBuilder(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -1487,8 +1840,27 @@ public CompletableFuture testEnumParameters(@javax.annotation.Nullable Lis * @throws ApiException if fails to make API call */ public CompletableFuture> testEnumParametersWithHttpInfo(@javax.annotation.Nullable List enumHeaderStringArray, @javax.annotation.Nullable String enumHeaderString, @javax.annotation.Nullable List enumQueryStringArray, @javax.annotation.Nullable String enumQueryString, @javax.annotation.Nullable Integer enumQueryInteger, @javax.annotation.Nullable Double enumQueryDouble, @javax.annotation.Nullable List enumFormStringArray, @javax.annotation.Nullable String enumFormString) throws ApiException { + return testEnumParametersWithHttpInfo(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, null); + } + + /** + * To test enum parameters + * To test enum parameters + * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional) + * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) + * @param enumQueryInteger Query parameter enum test (double) (optional) + * @param enumQueryDouble Query parameter enum test (double) (optional) + * @param enumFormStringArray Form parameter enum test (string array) (optional) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Void>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> testEnumParametersWithHttpInfo(@javax.annotation.Nullable List enumHeaderStringArray, @javax.annotation.Nullable String enumHeaderString, @javax.annotation.Nullable List enumQueryStringArray, @javax.annotation.Nullable String enumQueryString, @javax.annotation.Nullable Integer enumQueryInteger, @javax.annotation.Nullable Double enumQueryDouble, @javax.annotation.Nullable List enumFormStringArray, @javax.annotation.Nullable String enumFormString, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = testEnumParametersRequestBuilder(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + HttpRequest.Builder localVarRequestBuilder = testEnumParametersRequestBuilder(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -1509,7 +1881,7 @@ public CompletableFuture> testEnumParametersWithHttpInfo(@java } } - private HttpRequest.Builder testEnumParametersRequestBuilder(@javax.annotation.Nullable List enumHeaderStringArray, @javax.annotation.Nullable String enumHeaderString, @javax.annotation.Nullable List enumQueryStringArray, @javax.annotation.Nullable String enumQueryString, @javax.annotation.Nullable Integer enumQueryInteger, @javax.annotation.Nullable Double enumQueryDouble, @javax.annotation.Nullable List enumFormStringArray, @javax.annotation.Nullable String enumFormString) throws ApiException { + private HttpRequest.Builder testEnumParametersRequestBuilder(@javax.annotation.Nullable List enumHeaderStringArray, @javax.annotation.Nullable String enumHeaderString, @javax.annotation.Nullable List enumQueryStringArray, @javax.annotation.Nullable String enumQueryString, @javax.annotation.Nullable Integer enumQueryInteger, @javax.annotation.Nullable Double enumQueryDouble, @javax.annotation.Nullable List enumFormStringArray, @javax.annotation.Nullable String enumFormString, Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -1569,9 +1941,11 @@ private HttpRequest.Builder testEnumParametersRequestBuilder(@javax.annotation.N if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -1587,6 +1961,18 @@ private HttpRequest.Builder testEnumParametersRequestBuilder(@javax.annotation.N * @throws ApiException if fails to make API call */ public CompletableFuture testGroupParameters(APITestGroupParametersRequest apiRequest) throws ApiException { + return testGroupParameters(apiRequest, null); + } + + /** + * Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * @param apiRequest {@link APITestGroupParametersRequest} + * @param headers Optional headers to include in the request + * @return CompletableFuture<Void> + * @throws ApiException if fails to make API call + */ + public CompletableFuture testGroupParameters(APITestGroupParametersRequest apiRequest, Map headers) throws ApiException { @javax.annotation.Nonnull Integer requiredStringGroup = apiRequest.requiredStringGroup(); @javax.annotation.Nonnull @@ -1599,7 +1985,7 @@ public CompletableFuture testGroupParameters(APITestGroupParametersRequest Boolean booleanGroup = apiRequest.booleanGroup(); @javax.annotation.Nullable Long int64Group = apiRequest.int64Group(); - return testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + return testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, headers); } /** @@ -1610,13 +1996,25 @@ public CompletableFuture testGroupParameters(APITestGroupParametersRequest * @throws ApiException if fails to make API call */ public CompletableFuture> testGroupParametersWithHttpInfo(APITestGroupParametersRequest apiRequest) throws ApiException { + return testGroupParametersWithHttpInfo(apiRequest, null); + } + + /** + * Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * @param apiRequest {@link APITestGroupParametersRequest} + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Void>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> testGroupParametersWithHttpInfo(APITestGroupParametersRequest apiRequest, Map headers) throws ApiException { Integer requiredStringGroup = apiRequest.requiredStringGroup(); Boolean requiredBooleanGroup = apiRequest.requiredBooleanGroup(); Long requiredInt64Group = apiRequest.requiredInt64Group(); Integer stringGroup = apiRequest.stringGroup(); Boolean booleanGroup = apiRequest.booleanGroup(); Long int64Group = apiRequest.int64Group(); - return testGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + return testGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, headers); } /** @@ -1632,8 +2030,25 @@ public CompletableFuture> testGroupParametersWithHttpInfo(APIT * @throws ApiException if fails to make API call */ public CompletableFuture testGroupParameters(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group, @javax.annotation.Nullable Integer stringGroup, @javax.annotation.Nullable Boolean booleanGroup, @javax.annotation.Nullable Long int64Group) throws ApiException { + return testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, null); + } + + /** + * Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * @param requiredStringGroup Required String in group parameters (required) + * @param requiredBooleanGroup Required Boolean in group parameters (required) + * @param requiredInt64Group Required Integer in group parameters (required) + * @param stringGroup String in group parameters (optional) + * @param booleanGroup Boolean in group parameters (optional) + * @param int64Group Integer in group parameters (optional) + * @param headers Optional headers to include in the request + * @return CompletableFuture<Void> + * @throws ApiException if fails to make API call + */ + public CompletableFuture testGroupParameters(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group, @javax.annotation.Nullable Integer stringGroup, @javax.annotation.Nullable Boolean booleanGroup, @javax.annotation.Nullable Long int64Group, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = testGroupParametersRequestBuilder(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + HttpRequest.Builder localVarRequestBuilder = testGroupParametersRequestBuilder(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -1661,8 +2076,25 @@ public CompletableFuture testGroupParameters(@javax.annotation.Nonnull Int * @throws ApiException if fails to make API call */ public CompletableFuture> testGroupParametersWithHttpInfo(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group, @javax.annotation.Nullable Integer stringGroup, @javax.annotation.Nullable Boolean booleanGroup, @javax.annotation.Nullable Long int64Group) throws ApiException { + return testGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, null); + } + + /** + * Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * @param requiredStringGroup Required String in group parameters (required) + * @param requiredBooleanGroup Required Boolean in group parameters (required) + * @param requiredInt64Group Required Integer in group parameters (required) + * @param stringGroup String in group parameters (optional) + * @param booleanGroup Boolean in group parameters (optional) + * @param int64Group Integer in group parameters (optional) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Void>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> testGroupParametersWithHttpInfo(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group, @javax.annotation.Nullable Integer stringGroup, @javax.annotation.Nullable Boolean booleanGroup, @javax.annotation.Nullable Long int64Group, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = testGroupParametersRequestBuilder(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + HttpRequest.Builder localVarRequestBuilder = testGroupParametersRequestBuilder(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -1683,7 +2115,7 @@ public CompletableFuture> testGroupParametersWithHttpInfo(@jav } } - private HttpRequest.Builder testGroupParametersRequestBuilder(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group, @javax.annotation.Nullable Integer stringGroup, @javax.annotation.Nullable Boolean booleanGroup, @javax.annotation.Nullable Long int64Group) throws ApiException { + private HttpRequest.Builder testGroupParametersRequestBuilder(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group, @javax.annotation.Nullable Integer stringGroup, @javax.annotation.Nullable Boolean booleanGroup, @javax.annotation.Nullable Long int64Group, Map headers) throws ApiException { // verify the required parameter 'requiredStringGroup' is set if (requiredStringGroup == null) { throw new ApiException(400, "Missing the required parameter 'requiredStringGroup' when calling testGroupParameters"); @@ -1736,9 +2168,11 @@ private HttpRequest.Builder testGroupParametersRequestBuilder(@javax.annotation. if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -1843,8 +2277,20 @@ public APITestGroupParametersRequest build() { * @throws ApiException if fails to make API call */ public CompletableFuture testInlineAdditionalProperties(@javax.annotation.Nonnull Map requestBody) throws ApiException { + return testInlineAdditionalProperties(requestBody, null); + } + + /** + * test inline additionalProperties + * + * @param requestBody request body (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<Void> + * @throws ApiException if fails to make API call + */ + public CompletableFuture testInlineAdditionalProperties(@javax.annotation.Nonnull Map requestBody, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = testInlineAdditionalPropertiesRequestBuilder(requestBody); + HttpRequest.Builder localVarRequestBuilder = testInlineAdditionalPropertiesRequestBuilder(requestBody, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -1867,8 +2313,20 @@ public CompletableFuture testInlineAdditionalProperties(@javax.annotation. * @throws ApiException if fails to make API call */ public CompletableFuture> testInlineAdditionalPropertiesWithHttpInfo(@javax.annotation.Nonnull Map requestBody) throws ApiException { + return testInlineAdditionalPropertiesWithHttpInfo(requestBody, null); + } + + /** + * test inline additionalProperties + * + * @param requestBody request body (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Void>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> testInlineAdditionalPropertiesWithHttpInfo(@javax.annotation.Nonnull Map requestBody, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = testInlineAdditionalPropertiesRequestBuilder(requestBody); + HttpRequest.Builder localVarRequestBuilder = testInlineAdditionalPropertiesRequestBuilder(requestBody, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -1889,7 +2347,7 @@ public CompletableFuture> testInlineAdditionalPropertiesWithHt } } - private HttpRequest.Builder testInlineAdditionalPropertiesRequestBuilder(@javax.annotation.Nonnull Map requestBody) throws ApiException { + private HttpRequest.Builder testInlineAdditionalPropertiesRequestBuilder(@javax.annotation.Nonnull Map requestBody, Map headers) throws ApiException { // verify the required parameter 'requestBody' is set if (requestBody == null) { throw new ApiException(400, "Missing the required parameter 'requestBody' when calling testInlineAdditionalProperties"); @@ -1913,9 +2371,11 @@ private HttpRequest.Builder testInlineAdditionalPropertiesRequestBuilder(@javax. if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -1931,8 +2391,20 @@ private HttpRequest.Builder testInlineAdditionalPropertiesRequestBuilder(@javax. * @throws ApiException if fails to make API call */ public CompletableFuture testInlineFreeformAdditionalProperties(@javax.annotation.Nonnull TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest) throws ApiException { + return testInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest, null); + } + + /** + * test inline free-form additionalProperties + * + * @param testInlineFreeformAdditionalPropertiesRequest request body (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<Void> + * @throws ApiException if fails to make API call + */ + public CompletableFuture testInlineFreeformAdditionalProperties(@javax.annotation.Nonnull TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = testInlineFreeformAdditionalPropertiesRequestBuilder(testInlineFreeformAdditionalPropertiesRequest); + HttpRequest.Builder localVarRequestBuilder = testInlineFreeformAdditionalPropertiesRequestBuilder(testInlineFreeformAdditionalPropertiesRequest, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -1955,8 +2427,20 @@ public CompletableFuture testInlineFreeformAdditionalProperties(@javax.ann * @throws ApiException if fails to make API call */ public CompletableFuture> testInlineFreeformAdditionalPropertiesWithHttpInfo(@javax.annotation.Nonnull TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest) throws ApiException { + return testInlineFreeformAdditionalPropertiesWithHttpInfo(testInlineFreeformAdditionalPropertiesRequest, null); + } + + /** + * test inline free-form additionalProperties + * + * @param testInlineFreeformAdditionalPropertiesRequest request body (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Void>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> testInlineFreeformAdditionalPropertiesWithHttpInfo(@javax.annotation.Nonnull TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = testInlineFreeformAdditionalPropertiesRequestBuilder(testInlineFreeformAdditionalPropertiesRequest); + HttpRequest.Builder localVarRequestBuilder = testInlineFreeformAdditionalPropertiesRequestBuilder(testInlineFreeformAdditionalPropertiesRequest, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -1977,7 +2461,7 @@ public CompletableFuture> testInlineFreeformAdditionalProperti } } - private HttpRequest.Builder testInlineFreeformAdditionalPropertiesRequestBuilder(@javax.annotation.Nonnull TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest) throws ApiException { + private HttpRequest.Builder testInlineFreeformAdditionalPropertiesRequestBuilder(@javax.annotation.Nonnull TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, Map headers) throws ApiException { // verify the required parameter 'testInlineFreeformAdditionalPropertiesRequest' is set if (testInlineFreeformAdditionalPropertiesRequest == null) { throw new ApiException(400, "Missing the required parameter 'testInlineFreeformAdditionalPropertiesRequest' when calling testInlineFreeformAdditionalProperties"); @@ -2001,9 +2485,11 @@ private HttpRequest.Builder testInlineFreeformAdditionalPropertiesRequestBuilder if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -2020,8 +2506,21 @@ private HttpRequest.Builder testInlineFreeformAdditionalPropertiesRequestBuilder * @throws ApiException if fails to make API call */ public CompletableFuture testJsonFormData(@javax.annotation.Nonnull String param, @javax.annotation.Nonnull String param2) throws ApiException { + return testJsonFormData(param, param2, null); + } + + /** + * test json serialization of form data + * + * @param param field1 (required) + * @param param2 field2 (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<Void> + * @throws ApiException if fails to make API call + */ + public CompletableFuture testJsonFormData(@javax.annotation.Nonnull String param, @javax.annotation.Nonnull String param2, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = testJsonFormDataRequestBuilder(param, param2); + HttpRequest.Builder localVarRequestBuilder = testJsonFormDataRequestBuilder(param, param2, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -2045,8 +2544,21 @@ public CompletableFuture testJsonFormData(@javax.annotation.Nonnull String * @throws ApiException if fails to make API call */ public CompletableFuture> testJsonFormDataWithHttpInfo(@javax.annotation.Nonnull String param, @javax.annotation.Nonnull String param2) throws ApiException { + return testJsonFormDataWithHttpInfo(param, param2, null); + } + + /** + * test json serialization of form data + * + * @param param field1 (required) + * @param param2 field2 (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Void>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> testJsonFormDataWithHttpInfo(@javax.annotation.Nonnull String param, @javax.annotation.Nonnull String param2, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = testJsonFormDataRequestBuilder(param, param2); + HttpRequest.Builder localVarRequestBuilder = testJsonFormDataRequestBuilder(param, param2, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -2067,7 +2579,7 @@ public CompletableFuture> testJsonFormDataWithHttpInfo(@javax. } } - private HttpRequest.Builder testJsonFormDataRequestBuilder(@javax.annotation.Nonnull String param, @javax.annotation.Nonnull String param2) throws ApiException { + private HttpRequest.Builder testJsonFormDataRequestBuilder(@javax.annotation.Nonnull String param, @javax.annotation.Nonnull String param2, Map headers) throws ApiException { // verify the required parameter 'param' is set if (param == null) { throw new ApiException(400, "Missing the required parameter 'param' when calling testJsonFormData"); @@ -2106,9 +2618,11 @@ private HttpRequest.Builder testJsonFormDataRequestBuilder(@javax.annotation.Non if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -2128,8 +2642,24 @@ private HttpRequest.Builder testJsonFormDataRequestBuilder(@javax.annotation.Non * @throws ApiException if fails to make API call */ public CompletableFuture testQueryParameterCollectionFormat(@javax.annotation.Nonnull List pipe, @javax.annotation.Nonnull List ioutil, @javax.annotation.Nonnull List http, @javax.annotation.Nonnull List url, @javax.annotation.Nonnull List context) throws ApiException { + return testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, null); + } + + /** + * + * To test the collection format in query parameters + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<Void> + * @throws ApiException if fails to make API call + */ + public CompletableFuture testQueryParameterCollectionFormat(@javax.annotation.Nonnull List pipe, @javax.annotation.Nonnull List ioutil, @javax.annotation.Nonnull List http, @javax.annotation.Nonnull List url, @javax.annotation.Nonnull List context, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = testQueryParameterCollectionFormatRequestBuilder(pipe, ioutil, http, url, context); + HttpRequest.Builder localVarRequestBuilder = testQueryParameterCollectionFormatRequestBuilder(pipe, ioutil, http, url, context, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -2156,8 +2686,24 @@ public CompletableFuture testQueryParameterCollectionFormat(@javax.annotat * @throws ApiException if fails to make API call */ public CompletableFuture> testQueryParameterCollectionFormatWithHttpInfo(@javax.annotation.Nonnull List pipe, @javax.annotation.Nonnull List ioutil, @javax.annotation.Nonnull List http, @javax.annotation.Nonnull List url, @javax.annotation.Nonnull List context) throws ApiException { + return testQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context, null); + } + + /** + * + * To test the collection format in query parameters + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Void>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> testQueryParameterCollectionFormatWithHttpInfo(@javax.annotation.Nonnull List pipe, @javax.annotation.Nonnull List ioutil, @javax.annotation.Nonnull List http, @javax.annotation.Nonnull List url, @javax.annotation.Nonnull List context, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = testQueryParameterCollectionFormatRequestBuilder(pipe, ioutil, http, url, context); + HttpRequest.Builder localVarRequestBuilder = testQueryParameterCollectionFormatRequestBuilder(pipe, ioutil, http, url, context, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -2178,7 +2724,7 @@ public CompletableFuture> testQueryParameterCollectionFormatWi } } - private HttpRequest.Builder testQueryParameterCollectionFormatRequestBuilder(@javax.annotation.Nonnull List pipe, @javax.annotation.Nonnull List ioutil, @javax.annotation.Nonnull List http, @javax.annotation.Nonnull List url, @javax.annotation.Nonnull List context) throws ApiException { + private HttpRequest.Builder testQueryParameterCollectionFormatRequestBuilder(@javax.annotation.Nonnull List pipe, @javax.annotation.Nonnull List ioutil, @javax.annotation.Nonnull List http, @javax.annotation.Nonnull List url, @javax.annotation.Nonnull List context, Map headers) throws ApiException { // verify the required parameter 'pipe' is set if (pipe == null) { throw new ApiException(400, "Missing the required parameter 'pipe' when calling testQueryParameterCollectionFormat"); @@ -2235,9 +2781,11 @@ private HttpRequest.Builder testQueryParameterCollectionFormatRequestBuilder(@ja if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -2253,8 +2801,20 @@ private HttpRequest.Builder testQueryParameterCollectionFormatRequestBuilder(@ja * @throws ApiException if fails to make API call */ public CompletableFuture testStringMapReference(@javax.annotation.Nonnull Map requestBody) throws ApiException { + return testStringMapReference(requestBody, null); + } + + /** + * test referenced string map + * + * @param requestBody request body (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<Void> + * @throws ApiException if fails to make API call + */ + public CompletableFuture testStringMapReference(@javax.annotation.Nonnull Map requestBody, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = testStringMapReferenceRequestBuilder(requestBody); + HttpRequest.Builder localVarRequestBuilder = testStringMapReferenceRequestBuilder(requestBody, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -2277,8 +2837,20 @@ public CompletableFuture testStringMapReference(@javax.annotation.Nonnull * @throws ApiException if fails to make API call */ public CompletableFuture> testStringMapReferenceWithHttpInfo(@javax.annotation.Nonnull Map requestBody) throws ApiException { + return testStringMapReferenceWithHttpInfo(requestBody, null); + } + + /** + * test referenced string map + * + * @param requestBody request body (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Void>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> testStringMapReferenceWithHttpInfo(@javax.annotation.Nonnull Map requestBody, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = testStringMapReferenceRequestBuilder(requestBody); + HttpRequest.Builder localVarRequestBuilder = testStringMapReferenceRequestBuilder(requestBody, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -2299,7 +2871,7 @@ public CompletableFuture> testStringMapReferenceWithHttpInfo(@ } } - private HttpRequest.Builder testStringMapReferenceRequestBuilder(@javax.annotation.Nonnull Map requestBody) throws ApiException { + private HttpRequest.Builder testStringMapReferenceRequestBuilder(@javax.annotation.Nonnull Map requestBody, Map headers) throws ApiException { // verify the required parameter 'requestBody' is set if (requestBody == null) { throw new ApiException(400, "Missing the required parameter 'requestBody' when calling testStringMapReference"); @@ -2323,9 +2895,11 @@ private HttpRequest.Builder testStringMapReferenceRequestBuilder(@javax.annotati if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java index 316a985c7fa5..30b50325620d 100644 --- a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -63,9 +63,6 @@ public class FakeClassnameTags123Api { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; - // Custom headers to be sent with every request from this API client - private final Map extraHeaders = new java.util.HashMap<>(); - public FakeClassnameTags123Api() { this(Configuration.getDefaultApiClient()); } @@ -80,27 +77,6 @@ public FakeClassnameTags123Api(ApiClient apiClient) { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } - /** - * Add a custom header to be sent with every request from this API client. - * @param name Header name - * @param value Header value - * @return this - */ - public FakeClassnameTags123Api addHeader(String name, String value) { - this.extraHeaders.put(name, value); - return this; - } - - /** - * Remove a custom header. - * @param name Header name - * @return this - */ - public FakeClassnameTags123Api removeHeader(String name) { - this.extraHeaders.remove(name); - return this; - } - private ApiException getApiException(String operationId, HttpResponse response) { String message = formatExceptionMessage(operationId, response.statusCode(), response.body()); @@ -122,8 +98,20 @@ private String formatExceptionMessage(String operationId, int statusCode, String * @throws ApiException if fails to make API call */ public CompletableFuture testClassname(@javax.annotation.Nonnull Client client) throws ApiException { + return testClassname(client, null); + } + + /** + * To test class name in snake case + * To test class name in snake case + * @param client client model (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<Client> + * @throws ApiException if fails to make API call + */ + public CompletableFuture testClassname(@javax.annotation.Nonnull Client client, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = testClassnameRequestBuilder(client); + HttpRequest.Builder localVarRequestBuilder = testClassnameRequestBuilder(client, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -153,8 +141,20 @@ public CompletableFuture testClassname(@javax.annotation.Nonnull Client * @throws ApiException if fails to make API call */ public CompletableFuture> testClassnameWithHttpInfo(@javax.annotation.Nonnull Client client) throws ApiException { + return testClassnameWithHttpInfo(client, null); + } + + /** + * To test class name in snake case + * To test class name in snake case + * @param client client model (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Client>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> testClassnameWithHttpInfo(@javax.annotation.Nonnull Client client, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = testClassnameRequestBuilder(client); + HttpRequest.Builder localVarRequestBuilder = testClassnameRequestBuilder(client, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -183,7 +183,7 @@ public CompletableFuture> testClassnameWithHttpInfo(@javax.a } } - private HttpRequest.Builder testClassnameRequestBuilder(@javax.annotation.Nonnull Client client) throws ApiException { + private HttpRequest.Builder testClassnameRequestBuilder(@javax.annotation.Nonnull Client client, Map headers) throws ApiException { // verify the required parameter 'client' is set if (client == null) { throw new ApiException(400, "Missing the required parameter 'client' when calling testClassname"); @@ -207,9 +207,11 @@ private HttpRequest.Builder testClassnameRequestBuilder(@javax.annotation.Nonnul if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/PetApi.java index e27c4e7798cf..617d6d2d060b 100644 --- a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/PetApi.java @@ -65,9 +65,6 @@ public class PetApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; - // Custom headers to be sent with every request from this API client - private final Map extraHeaders = new java.util.HashMap<>(); - public PetApi() { this(Configuration.getDefaultApiClient()); } @@ -82,27 +79,6 @@ public PetApi(ApiClient apiClient) { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } - /** - * Add a custom header to be sent with every request from this API client. - * @param name Header name - * @param value Header value - * @return this - */ - public PetApi addHeader(String name, String value) { - this.extraHeaders.put(name, value); - return this; - } - - /** - * Remove a custom header. - * @param name Header name - * @return this - */ - public PetApi removeHeader(String name) { - this.extraHeaders.remove(name); - return this; - } - private ApiException getApiException(String operationId, HttpResponse response) { String message = formatExceptionMessage(operationId, response.statusCode(), response.body()); @@ -124,8 +100,20 @@ private String formatExceptionMessage(String operationId, int statusCode, String * @throws ApiException if fails to make API call */ public CompletableFuture addPet(@javax.annotation.Nonnull Pet pet) throws ApiException { + return addPet(pet, null); + } + + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<Void> + * @throws ApiException if fails to make API call + */ + public CompletableFuture addPet(@javax.annotation.Nonnull Pet pet, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = addPetRequestBuilder(pet); + HttpRequest.Builder localVarRequestBuilder = addPetRequestBuilder(pet, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -148,8 +136,20 @@ public CompletableFuture addPet(@javax.annotation.Nonnull Pet pet) throws * @throws ApiException if fails to make API call */ public CompletableFuture> addPetWithHttpInfo(@javax.annotation.Nonnull Pet pet) throws ApiException { + return addPetWithHttpInfo(pet, null); + } + + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Void>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> addPetWithHttpInfo(@javax.annotation.Nonnull Pet pet, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = addPetRequestBuilder(pet); + HttpRequest.Builder localVarRequestBuilder = addPetRequestBuilder(pet, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -170,7 +170,7 @@ public CompletableFuture> addPetWithHttpInfo(@javax.annotation } } - private HttpRequest.Builder addPetRequestBuilder(@javax.annotation.Nonnull Pet pet) throws ApiException { + private HttpRequest.Builder addPetRequestBuilder(@javax.annotation.Nonnull Pet pet, Map headers) throws ApiException { // verify the required parameter 'pet' is set if (pet == null) { throw new ApiException(400, "Missing the required parameter 'pet' when calling addPet"); @@ -194,9 +194,11 @@ private HttpRequest.Builder addPetRequestBuilder(@javax.annotation.Nonnull Pet p if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -213,8 +215,21 @@ private HttpRequest.Builder addPetRequestBuilder(@javax.annotation.Nonnull Pet p * @throws ApiException if fails to make API call */ public CompletableFuture deletePet(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey) throws ApiException { + return deletePet(petId, apiKey, null); + } + + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @param headers Optional headers to include in the request + * @return CompletableFuture<Void> + * @throws ApiException if fails to make API call + */ + public CompletableFuture deletePet(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = deletePetRequestBuilder(petId, apiKey); + HttpRequest.Builder localVarRequestBuilder = deletePetRequestBuilder(petId, apiKey, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -238,8 +253,21 @@ public CompletableFuture deletePet(@javax.annotation.Nonnull Long petId, @ * @throws ApiException if fails to make API call */ public CompletableFuture> deletePetWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey) throws ApiException { + return deletePetWithHttpInfo(petId, apiKey, null); + } + + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Void>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> deletePetWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = deletePetRequestBuilder(petId, apiKey); + HttpRequest.Builder localVarRequestBuilder = deletePetRequestBuilder(petId, apiKey, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -260,7 +288,7 @@ public CompletableFuture> deletePetWithHttpInfo(@javax.annotat } } - private HttpRequest.Builder deletePetRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey) throws ApiException { + private HttpRequest.Builder deletePetRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, Map headers) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { throw new ApiException(400, "Missing the required parameter 'petId' when calling deletePet"); @@ -282,9 +310,11 @@ private HttpRequest.Builder deletePetRequestBuilder(@javax.annotation.Nonnull Lo if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -300,8 +330,20 @@ private HttpRequest.Builder deletePetRequestBuilder(@javax.annotation.Nonnull Lo * @throws ApiException if fails to make API call */ public CompletableFuture> findPetsByStatus(@javax.annotation.Nonnull List status) throws ApiException { + return findPetsByStatus(status, null); + } + + /** + * Finds Pets by status + * Multiple status values can be provided with comma separated strings + * @param status Status values that need to be considered for filter (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<List<Pet>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> findPetsByStatus(@javax.annotation.Nonnull List status, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = findPetsByStatusRequestBuilder(status); + HttpRequest.Builder localVarRequestBuilder = findPetsByStatusRequestBuilder(status, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -331,8 +373,20 @@ public CompletableFuture> findPetsByStatus(@javax.annotation.Nonnull L * @throws ApiException if fails to make API call */ public CompletableFuture>> findPetsByStatusWithHttpInfo(@javax.annotation.Nonnull List status) throws ApiException { + return findPetsByStatusWithHttpInfo(status, null); + } + + /** + * Finds Pets by status + * Multiple status values can be provided with comma separated strings + * @param status Status values that need to be considered for filter (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<List<Pet>>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture>> findPetsByStatusWithHttpInfo(@javax.annotation.Nonnull List status, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = findPetsByStatusRequestBuilder(status); + HttpRequest.Builder localVarRequestBuilder = findPetsByStatusRequestBuilder(status, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -361,7 +415,7 @@ public CompletableFuture>> findPetsByStatusWithHttpInfo(@j } } - private HttpRequest.Builder findPetsByStatusRequestBuilder(@javax.annotation.Nonnull List status) throws ApiException { + private HttpRequest.Builder findPetsByStatusRequestBuilder(@javax.annotation.Nonnull List status, Map headers) throws ApiException { // verify the required parameter 'status' is set if (status == null) { throw new ApiException(400, "Missing the required parameter 'status' when calling findPetsByStatus"); @@ -394,9 +448,11 @@ private HttpRequest.Builder findPetsByStatusRequestBuilder(@javax.annotation.Non if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -414,8 +470,22 @@ private HttpRequest.Builder findPetsByStatusRequestBuilder(@javax.annotation.Non */ @Deprecated public CompletableFuture> findPetsByTags(@javax.annotation.Nonnull List tags) throws ApiException { + return findPetsByTags(tags, null); + } + + /** + * Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<List<Pet>> + * @throws ApiException if fails to make API call + * @deprecated + */ + @Deprecated + public CompletableFuture> findPetsByTags(@javax.annotation.Nonnull List tags, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = findPetsByTagsRequestBuilder(tags); + HttpRequest.Builder localVarRequestBuilder = findPetsByTagsRequestBuilder(tags, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -447,8 +517,22 @@ public CompletableFuture> findPetsByTags(@javax.annotation.Nonnull Lis */ @Deprecated public CompletableFuture>> findPetsByTagsWithHttpInfo(@javax.annotation.Nonnull List tags) throws ApiException { + return findPetsByTagsWithHttpInfo(tags, null); + } + + /** + * Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<List<Pet>>> + * @throws ApiException if fails to make API call + * @deprecated + */ + @Deprecated + public CompletableFuture>> findPetsByTagsWithHttpInfo(@javax.annotation.Nonnull List tags, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = findPetsByTagsRequestBuilder(tags); + HttpRequest.Builder localVarRequestBuilder = findPetsByTagsRequestBuilder(tags, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -477,7 +561,7 @@ public CompletableFuture>> findPetsByTagsWithHttpInfo(@jav } } - private HttpRequest.Builder findPetsByTagsRequestBuilder(@javax.annotation.Nonnull List tags) throws ApiException { + private HttpRequest.Builder findPetsByTagsRequestBuilder(@javax.annotation.Nonnull List tags, Map headers) throws ApiException { // verify the required parameter 'tags' is set if (tags == null) { throw new ApiException(400, "Missing the required parameter 'tags' when calling findPetsByTags"); @@ -510,9 +594,11 @@ private HttpRequest.Builder findPetsByTagsRequestBuilder(@javax.annotation.Nonnu if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -528,8 +614,20 @@ private HttpRequest.Builder findPetsByTagsRequestBuilder(@javax.annotation.Nonnu * @throws ApiException if fails to make API call */ public CompletableFuture getPetById(@javax.annotation.Nonnull Long petId) throws ApiException { + return getPetById(petId, null); + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<Pet> + * @throws ApiException if fails to make API call + */ + public CompletableFuture getPetById(@javax.annotation.Nonnull Long petId, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = getPetByIdRequestBuilder(petId); + HttpRequest.Builder localVarRequestBuilder = getPetByIdRequestBuilder(petId, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -559,8 +657,20 @@ public CompletableFuture getPetById(@javax.annotation.Nonnull Long petId) t * @throws ApiException if fails to make API call */ public CompletableFuture> getPetByIdWithHttpInfo(@javax.annotation.Nonnull Long petId) throws ApiException { + return getPetByIdWithHttpInfo(petId, null); + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Pet>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> getPetByIdWithHttpInfo(@javax.annotation.Nonnull Long petId, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = getPetByIdRequestBuilder(petId); + HttpRequest.Builder localVarRequestBuilder = getPetByIdRequestBuilder(petId, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -589,7 +699,7 @@ public CompletableFuture> getPetByIdWithHttpInfo(@javax.annotat } } - private HttpRequest.Builder getPetByIdRequestBuilder(@javax.annotation.Nonnull Long petId) throws ApiException { + private HttpRequest.Builder getPetByIdRequestBuilder(@javax.annotation.Nonnull Long petId, Map headers) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetById"); @@ -608,9 +718,11 @@ private HttpRequest.Builder getPetByIdRequestBuilder(@javax.annotation.Nonnull L if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -626,8 +738,20 @@ private HttpRequest.Builder getPetByIdRequestBuilder(@javax.annotation.Nonnull L * @throws ApiException if fails to make API call */ public CompletableFuture updatePet(@javax.annotation.Nonnull Pet pet) throws ApiException { + return updatePet(pet, null); + } + + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<Void> + * @throws ApiException if fails to make API call + */ + public CompletableFuture updatePet(@javax.annotation.Nonnull Pet pet, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = updatePetRequestBuilder(pet); + HttpRequest.Builder localVarRequestBuilder = updatePetRequestBuilder(pet, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -650,8 +774,20 @@ public CompletableFuture updatePet(@javax.annotation.Nonnull Pet pet) thro * @throws ApiException if fails to make API call */ public CompletableFuture> updatePetWithHttpInfo(@javax.annotation.Nonnull Pet pet) throws ApiException { + return updatePetWithHttpInfo(pet, null); + } + + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Void>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> updatePetWithHttpInfo(@javax.annotation.Nonnull Pet pet, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = updatePetRequestBuilder(pet); + HttpRequest.Builder localVarRequestBuilder = updatePetRequestBuilder(pet, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -672,7 +808,7 @@ public CompletableFuture> updatePetWithHttpInfo(@javax.annotat } } - private HttpRequest.Builder updatePetRequestBuilder(@javax.annotation.Nonnull Pet pet) throws ApiException { + private HttpRequest.Builder updatePetRequestBuilder(@javax.annotation.Nonnull Pet pet, Map headers) throws ApiException { // verify the required parameter 'pet' is set if (pet == null) { throw new ApiException(400, "Missing the required parameter 'pet' when calling updatePet"); @@ -696,9 +832,11 @@ private HttpRequest.Builder updatePetRequestBuilder(@javax.annotation.Nonnull Pe if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -716,8 +854,22 @@ private HttpRequest.Builder updatePetRequestBuilder(@javax.annotation.Nonnull Pe * @throws ApiException if fails to make API call */ public CompletableFuture updatePetWithForm(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status) throws ApiException { + return updatePetWithForm(petId, name, status, null); + } + + /** + * Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @param headers Optional headers to include in the request + * @return CompletableFuture<Void> + * @throws ApiException if fails to make API call + */ + public CompletableFuture updatePetWithForm(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = updatePetWithFormRequestBuilder(petId, name, status); + HttpRequest.Builder localVarRequestBuilder = updatePetWithFormRequestBuilder(petId, name, status, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -742,8 +894,22 @@ public CompletableFuture updatePetWithForm(@javax.annotation.Nonnull Long * @throws ApiException if fails to make API call */ public CompletableFuture> updatePetWithFormWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status) throws ApiException { + return updatePetWithFormWithHttpInfo(petId, name, status, null); + } + + /** + * Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Void>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> updatePetWithFormWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = updatePetWithFormRequestBuilder(petId, name, status); + HttpRequest.Builder localVarRequestBuilder = updatePetWithFormRequestBuilder(petId, name, status, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -764,7 +930,7 @@ public CompletableFuture> updatePetWithFormWithHttpInfo(@javax } } - private HttpRequest.Builder updatePetWithFormRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status) throws ApiException { + private HttpRequest.Builder updatePetWithFormRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, Map headers) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { throw new ApiException(400, "Missing the required parameter 'petId' when calling updatePetWithForm"); @@ -800,9 +966,11 @@ private HttpRequest.Builder updatePetWithFormRequestBuilder(@javax.annotation.No if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -820,8 +988,22 @@ private HttpRequest.Builder updatePetWithFormRequestBuilder(@javax.annotation.No * @throws ApiException if fails to make API call */ public CompletableFuture uploadFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { + return uploadFile(petId, additionalMetadata, _file, null); + } + + /** + * uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ModelApiResponse> + * @throws ApiException if fails to make API call + */ + public CompletableFuture uploadFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = uploadFileRequestBuilder(petId, additionalMetadata, _file); + HttpRequest.Builder localVarRequestBuilder = uploadFileRequestBuilder(petId, additionalMetadata, _file, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -853,8 +1035,22 @@ public CompletableFuture uploadFile(@javax.annotation.Nonnull * @throws ApiException if fails to make API call */ public CompletableFuture> uploadFileWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { + return uploadFileWithHttpInfo(petId, additionalMetadata, _file, null); + } + + /** + * uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<ModelApiResponse>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> uploadFileWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = uploadFileRequestBuilder(petId, additionalMetadata, _file); + HttpRequest.Builder localVarRequestBuilder = uploadFileRequestBuilder(petId, additionalMetadata, _file, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -883,7 +1079,7 @@ public CompletableFuture> uploadFileWithHttpInfo(@ } } - private HttpRequest.Builder uploadFileRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { + private HttpRequest.Builder uploadFileRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, Map headers) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFile"); @@ -938,9 +1134,11 @@ private HttpRequest.Builder uploadFileRequestBuilder(@javax.annotation.Nonnull L if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -958,8 +1156,22 @@ private HttpRequest.Builder uploadFileRequestBuilder(@javax.annotation.Nonnull L * @throws ApiException if fails to make API call */ public CompletableFuture uploadFileWithRequiredFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata) throws ApiException { + return uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata, null); + } + + /** + * uploads an image (required) + * + * @param petId ID of pet to update (required) + * @param requiredFile file to upload (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ModelApiResponse> + * @throws ApiException if fails to make API call + */ + public CompletableFuture uploadFileWithRequiredFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = uploadFileWithRequiredFileRequestBuilder(petId, requiredFile, additionalMetadata); + HttpRequest.Builder localVarRequestBuilder = uploadFileWithRequiredFileRequestBuilder(petId, requiredFile, additionalMetadata, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -991,8 +1203,22 @@ public CompletableFuture uploadFileWithRequiredFile(@javax.ann * @throws ApiException if fails to make API call */ public CompletableFuture> uploadFileWithRequiredFileWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata) throws ApiException { + return uploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata, null); + } + + /** + * uploads an image (required) + * + * @param petId ID of pet to update (required) + * @param requiredFile file to upload (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<ModelApiResponse>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> uploadFileWithRequiredFileWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = uploadFileWithRequiredFileRequestBuilder(petId, requiredFile, additionalMetadata); + HttpRequest.Builder localVarRequestBuilder = uploadFileWithRequiredFileRequestBuilder(petId, requiredFile, additionalMetadata, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -1021,7 +1247,7 @@ public CompletableFuture> uploadFileWithRequiredFi } } - private HttpRequest.Builder uploadFileWithRequiredFileRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata) throws ApiException { + private HttpRequest.Builder uploadFileWithRequiredFileRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata, Map headers) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFileWithRequiredFile"); @@ -1080,9 +1306,11 @@ private HttpRequest.Builder uploadFileWithRequiredFileRequestBuilder(@javax.anno if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/StoreApi.java index e407ae2a9889..629fc865607c 100644 --- a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/StoreApi.java @@ -63,9 +63,6 @@ public class StoreApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; - // Custom headers to be sent with every request from this API client - private final Map extraHeaders = new java.util.HashMap<>(); - public StoreApi() { this(Configuration.getDefaultApiClient()); } @@ -80,27 +77,6 @@ public StoreApi(ApiClient apiClient) { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } - /** - * Add a custom header to be sent with every request from this API client. - * @param name Header name - * @param value Header value - * @return this - */ - public StoreApi addHeader(String name, String value) { - this.extraHeaders.put(name, value); - return this; - } - - /** - * Remove a custom header. - * @param name Header name - * @return this - */ - public StoreApi removeHeader(String name) { - this.extraHeaders.remove(name); - return this; - } - private ApiException getApiException(String operationId, HttpResponse response) { String message = formatExceptionMessage(operationId, response.statusCode(), response.body()); @@ -122,8 +98,20 @@ private String formatExceptionMessage(String operationId, int statusCode, String * @throws ApiException if fails to make API call */ public CompletableFuture deleteOrder(@javax.annotation.Nonnull String orderId) throws ApiException { + return deleteOrder(orderId, null); + } + + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<Void> + * @throws ApiException if fails to make API call + */ + public CompletableFuture deleteOrder(@javax.annotation.Nonnull String orderId, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = deleteOrderRequestBuilder(orderId); + HttpRequest.Builder localVarRequestBuilder = deleteOrderRequestBuilder(orderId, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -146,8 +134,20 @@ public CompletableFuture deleteOrder(@javax.annotation.Nonnull String orde * @throws ApiException if fails to make API call */ public CompletableFuture> deleteOrderWithHttpInfo(@javax.annotation.Nonnull String orderId) throws ApiException { + return deleteOrderWithHttpInfo(orderId, null); + } + + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Void>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> deleteOrderWithHttpInfo(@javax.annotation.Nonnull String orderId, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = deleteOrderRequestBuilder(orderId); + HttpRequest.Builder localVarRequestBuilder = deleteOrderRequestBuilder(orderId, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -168,7 +168,7 @@ public CompletableFuture> deleteOrderWithHttpInfo(@javax.annot } } - private HttpRequest.Builder deleteOrderRequestBuilder(@javax.annotation.Nonnull String orderId) throws ApiException { + private HttpRequest.Builder deleteOrderRequestBuilder(@javax.annotation.Nonnull String orderId, Map headers) throws ApiException { // verify the required parameter 'orderId' is set if (orderId == null) { throw new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder"); @@ -187,9 +187,11 @@ private HttpRequest.Builder deleteOrderRequestBuilder(@javax.annotation.Nonnull if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -204,8 +206,19 @@ private HttpRequest.Builder deleteOrderRequestBuilder(@javax.annotation.Nonnull * @throws ApiException if fails to make API call */ public CompletableFuture> getInventory() throws ApiException { + return getInventory(null); + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @param headers Optional headers to include in the request + * @return CompletableFuture<Map<String, Integer>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> getInventory(Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = getInventoryRequestBuilder(); + HttpRequest.Builder localVarRequestBuilder = getInventoryRequestBuilder(headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -234,8 +247,19 @@ public CompletableFuture> getInventory() throws ApiExceptio * @throws ApiException if fails to make API call */ public CompletableFuture>> getInventoryWithHttpInfo() throws ApiException { + return getInventoryWithHttpInfo(null); + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Map<String, Integer>>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture>> getInventoryWithHttpInfo(Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = getInventoryRequestBuilder(); + HttpRequest.Builder localVarRequestBuilder = getInventoryRequestBuilder(headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -264,7 +288,7 @@ public CompletableFuture>> getInventoryWithHttp } } - private HttpRequest.Builder getInventoryRequestBuilder() throws ApiException { + private HttpRequest.Builder getInventoryRequestBuilder(Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -278,9 +302,11 @@ private HttpRequest.Builder getInventoryRequestBuilder() throws ApiException { if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -296,8 +322,20 @@ private HttpRequest.Builder getInventoryRequestBuilder() throws ApiException { * @throws ApiException if fails to make API call */ public CompletableFuture getOrderById(@javax.annotation.Nonnull Long orderId) throws ApiException { + return getOrderById(orderId, null); + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<Order> + * @throws ApiException if fails to make API call + */ + public CompletableFuture getOrderById(@javax.annotation.Nonnull Long orderId, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = getOrderByIdRequestBuilder(orderId); + HttpRequest.Builder localVarRequestBuilder = getOrderByIdRequestBuilder(orderId, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -327,8 +365,20 @@ public CompletableFuture getOrderById(@javax.annotation.Nonnull Long orde * @throws ApiException if fails to make API call */ public CompletableFuture> getOrderByIdWithHttpInfo(@javax.annotation.Nonnull Long orderId) throws ApiException { + return getOrderByIdWithHttpInfo(orderId, null); + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Order>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> getOrderByIdWithHttpInfo(@javax.annotation.Nonnull Long orderId, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = getOrderByIdRequestBuilder(orderId); + HttpRequest.Builder localVarRequestBuilder = getOrderByIdRequestBuilder(orderId, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -357,7 +407,7 @@ public CompletableFuture> getOrderByIdWithHttpInfo(@javax.ann } } - private HttpRequest.Builder getOrderByIdRequestBuilder(@javax.annotation.Nonnull Long orderId) throws ApiException { + private HttpRequest.Builder getOrderByIdRequestBuilder(@javax.annotation.Nonnull Long orderId, Map headers) throws ApiException { // verify the required parameter 'orderId' is set if (orderId == null) { throw new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById"); @@ -376,9 +426,11 @@ private HttpRequest.Builder getOrderByIdRequestBuilder(@javax.annotation.Nonnull if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -394,8 +446,20 @@ private HttpRequest.Builder getOrderByIdRequestBuilder(@javax.annotation.Nonnull * @throws ApiException if fails to make API call */ public CompletableFuture placeOrder(@javax.annotation.Nonnull Order order) throws ApiException { + return placeOrder(order, null); + } + + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<Order> + * @throws ApiException if fails to make API call + */ + public CompletableFuture placeOrder(@javax.annotation.Nonnull Order order, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = placeOrderRequestBuilder(order); + HttpRequest.Builder localVarRequestBuilder = placeOrderRequestBuilder(order, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -425,8 +489,20 @@ public CompletableFuture placeOrder(@javax.annotation.Nonnull Order order * @throws ApiException if fails to make API call */ public CompletableFuture> placeOrderWithHttpInfo(@javax.annotation.Nonnull Order order) throws ApiException { + return placeOrderWithHttpInfo(order, null); + } + + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Order>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> placeOrderWithHttpInfo(@javax.annotation.Nonnull Order order, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = placeOrderRequestBuilder(order); + HttpRequest.Builder localVarRequestBuilder = placeOrderRequestBuilder(order, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -455,7 +531,7 @@ public CompletableFuture> placeOrderWithHttpInfo(@javax.annot } } - private HttpRequest.Builder placeOrderRequestBuilder(@javax.annotation.Nonnull Order order) throws ApiException { + private HttpRequest.Builder placeOrderRequestBuilder(@javax.annotation.Nonnull Order order, Map headers) throws ApiException { // verify the required parameter 'order' is set if (order == null) { throw new ApiException(400, "Missing the required parameter 'order' when calling placeOrder"); @@ -479,9 +555,11 @@ private HttpRequest.Builder placeOrderRequestBuilder(@javax.annotation.Nonnull O if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/UserApi.java index 29329fb99225..143e6ecc4a26 100644 --- a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/UserApi.java @@ -64,9 +64,6 @@ public class UserApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; - // Custom headers to be sent with every request from this API client - private final Map extraHeaders = new java.util.HashMap<>(); - public UserApi() { this(Configuration.getDefaultApiClient()); } @@ -81,27 +78,6 @@ public UserApi(ApiClient apiClient) { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } - /** - * Add a custom header to be sent with every request from this API client. - * @param name Header name - * @param value Header value - * @return this - */ - public UserApi addHeader(String name, String value) { - this.extraHeaders.put(name, value); - return this; - } - - /** - * Remove a custom header. - * @param name Header name - * @return this - */ - public UserApi removeHeader(String name) { - this.extraHeaders.remove(name); - return this; - } - private ApiException getApiException(String operationId, HttpResponse response) { String message = formatExceptionMessage(operationId, response.statusCode(), response.body()); @@ -123,8 +99,20 @@ private String formatExceptionMessage(String operationId, int statusCode, String * @throws ApiException if fails to make API call */ public CompletableFuture createUser(@javax.annotation.Nonnull User user) throws ApiException { + return createUser(user, null); + } + + /** + * Create user + * This can only be done by the logged in user. + * @param user Created user object (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<Void> + * @throws ApiException if fails to make API call + */ + public CompletableFuture createUser(@javax.annotation.Nonnull User user, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = createUserRequestBuilder(user); + HttpRequest.Builder localVarRequestBuilder = createUserRequestBuilder(user, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -147,8 +135,20 @@ public CompletableFuture createUser(@javax.annotation.Nonnull User user) t * @throws ApiException if fails to make API call */ public CompletableFuture> createUserWithHttpInfo(@javax.annotation.Nonnull User user) throws ApiException { + return createUserWithHttpInfo(user, null); + } + + /** + * Create user + * This can only be done by the logged in user. + * @param user Created user object (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Void>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> createUserWithHttpInfo(@javax.annotation.Nonnull User user, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = createUserRequestBuilder(user); + HttpRequest.Builder localVarRequestBuilder = createUserRequestBuilder(user, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -169,7 +169,7 @@ public CompletableFuture> createUserWithHttpInfo(@javax.annota } } - private HttpRequest.Builder createUserRequestBuilder(@javax.annotation.Nonnull User user) throws ApiException { + private HttpRequest.Builder createUserRequestBuilder(@javax.annotation.Nonnull User user, Map headers) throws ApiException { // verify the required parameter 'user' is set if (user == null) { throw new ApiException(400, "Missing the required parameter 'user' when calling createUser"); @@ -193,9 +193,11 @@ private HttpRequest.Builder createUserRequestBuilder(@javax.annotation.Nonnull U if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -211,8 +213,20 @@ private HttpRequest.Builder createUserRequestBuilder(@javax.annotation.Nonnull U * @throws ApiException if fails to make API call */ public CompletableFuture createUsersWithArrayInput(@javax.annotation.Nonnull List user) throws ApiException { + return createUsersWithArrayInput(user, null); + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<Void> + * @throws ApiException if fails to make API call + */ + public CompletableFuture createUsersWithArrayInput(@javax.annotation.Nonnull List user, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = createUsersWithArrayInputRequestBuilder(user); + HttpRequest.Builder localVarRequestBuilder = createUsersWithArrayInputRequestBuilder(user, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -235,8 +249,20 @@ public CompletableFuture createUsersWithArrayInput(@javax.annotation.Nonnu * @throws ApiException if fails to make API call */ public CompletableFuture> createUsersWithArrayInputWithHttpInfo(@javax.annotation.Nonnull List user) throws ApiException { + return createUsersWithArrayInputWithHttpInfo(user, null); + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Void>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> createUsersWithArrayInputWithHttpInfo(@javax.annotation.Nonnull List user, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = createUsersWithArrayInputRequestBuilder(user); + HttpRequest.Builder localVarRequestBuilder = createUsersWithArrayInputRequestBuilder(user, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -257,7 +283,7 @@ public CompletableFuture> createUsersWithArrayInputWithHttpInf } } - private HttpRequest.Builder createUsersWithArrayInputRequestBuilder(@javax.annotation.Nonnull List user) throws ApiException { + private HttpRequest.Builder createUsersWithArrayInputRequestBuilder(@javax.annotation.Nonnull List user, Map headers) throws ApiException { // verify the required parameter 'user' is set if (user == null) { throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithArrayInput"); @@ -281,9 +307,11 @@ private HttpRequest.Builder createUsersWithArrayInputRequestBuilder(@javax.annot if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -299,8 +327,20 @@ private HttpRequest.Builder createUsersWithArrayInputRequestBuilder(@javax.annot * @throws ApiException if fails to make API call */ public CompletableFuture createUsersWithListInput(@javax.annotation.Nonnull List user) throws ApiException { + return createUsersWithListInput(user, null); + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<Void> + * @throws ApiException if fails to make API call + */ + public CompletableFuture createUsersWithListInput(@javax.annotation.Nonnull List user, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = createUsersWithListInputRequestBuilder(user); + HttpRequest.Builder localVarRequestBuilder = createUsersWithListInputRequestBuilder(user, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -323,8 +363,20 @@ public CompletableFuture createUsersWithListInput(@javax.annotation.Nonnul * @throws ApiException if fails to make API call */ public CompletableFuture> createUsersWithListInputWithHttpInfo(@javax.annotation.Nonnull List user) throws ApiException { + return createUsersWithListInputWithHttpInfo(user, null); + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Void>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> createUsersWithListInputWithHttpInfo(@javax.annotation.Nonnull List user, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = createUsersWithListInputRequestBuilder(user); + HttpRequest.Builder localVarRequestBuilder = createUsersWithListInputRequestBuilder(user, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -345,7 +397,7 @@ public CompletableFuture> createUsersWithListInputWithHttpInfo } } - private HttpRequest.Builder createUsersWithListInputRequestBuilder(@javax.annotation.Nonnull List user) throws ApiException { + private HttpRequest.Builder createUsersWithListInputRequestBuilder(@javax.annotation.Nonnull List user, Map headers) throws ApiException { // verify the required parameter 'user' is set if (user == null) { throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithListInput"); @@ -369,9 +421,11 @@ private HttpRequest.Builder createUsersWithListInputRequestBuilder(@javax.annota if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -387,8 +441,20 @@ private HttpRequest.Builder createUsersWithListInputRequestBuilder(@javax.annota * @throws ApiException if fails to make API call */ public CompletableFuture deleteUser(@javax.annotation.Nonnull String username) throws ApiException { + return deleteUser(username, null); + } + + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<Void> + * @throws ApiException if fails to make API call + */ + public CompletableFuture deleteUser(@javax.annotation.Nonnull String username, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = deleteUserRequestBuilder(username); + HttpRequest.Builder localVarRequestBuilder = deleteUserRequestBuilder(username, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -411,8 +477,20 @@ public CompletableFuture deleteUser(@javax.annotation.Nonnull String usern * @throws ApiException if fails to make API call */ public CompletableFuture> deleteUserWithHttpInfo(@javax.annotation.Nonnull String username) throws ApiException { + return deleteUserWithHttpInfo(username, null); + } + + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Void>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> deleteUserWithHttpInfo(@javax.annotation.Nonnull String username, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = deleteUserRequestBuilder(username); + HttpRequest.Builder localVarRequestBuilder = deleteUserRequestBuilder(username, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -433,7 +511,7 @@ public CompletableFuture> deleteUserWithHttpInfo(@javax.annota } } - private HttpRequest.Builder deleteUserRequestBuilder(@javax.annotation.Nonnull String username) throws ApiException { + private HttpRequest.Builder deleteUserRequestBuilder(@javax.annotation.Nonnull String username, Map headers) throws ApiException { // verify the required parameter 'username' is set if (username == null) { throw new ApiException(400, "Missing the required parameter 'username' when calling deleteUser"); @@ -452,9 +530,11 @@ private HttpRequest.Builder deleteUserRequestBuilder(@javax.annotation.Nonnull S if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -470,8 +550,20 @@ private HttpRequest.Builder deleteUserRequestBuilder(@javax.annotation.Nonnull S * @throws ApiException if fails to make API call */ public CompletableFuture getUserByName(@javax.annotation.Nonnull String username) throws ApiException { + return getUserByName(username, null); + } + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<User> + * @throws ApiException if fails to make API call + */ + public CompletableFuture getUserByName(@javax.annotation.Nonnull String username, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = getUserByNameRequestBuilder(username); + HttpRequest.Builder localVarRequestBuilder = getUserByNameRequestBuilder(username, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -501,8 +593,20 @@ public CompletableFuture getUserByName(@javax.annotation.Nonnull String us * @throws ApiException if fails to make API call */ public CompletableFuture> getUserByNameWithHttpInfo(@javax.annotation.Nonnull String username) throws ApiException { + return getUserByNameWithHttpInfo(username, null); + } + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<User>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> getUserByNameWithHttpInfo(@javax.annotation.Nonnull String username, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = getUserByNameRequestBuilder(username); + HttpRequest.Builder localVarRequestBuilder = getUserByNameRequestBuilder(username, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -531,7 +635,7 @@ public CompletableFuture> getUserByNameWithHttpInfo(@javax.ann } } - private HttpRequest.Builder getUserByNameRequestBuilder(@javax.annotation.Nonnull String username) throws ApiException { + private HttpRequest.Builder getUserByNameRequestBuilder(@javax.annotation.Nonnull String username, Map headers) throws ApiException { // verify the required parameter 'username' is set if (username == null) { throw new ApiException(400, "Missing the required parameter 'username' when calling getUserByName"); @@ -550,9 +654,11 @@ private HttpRequest.Builder getUserByNameRequestBuilder(@javax.annotation.Nonnul if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -569,8 +675,21 @@ private HttpRequest.Builder getUserByNameRequestBuilder(@javax.annotation.Nonnul * @throws ApiException if fails to make API call */ public CompletableFuture loginUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException { + return loginUser(username, password, null); + } + + /** + * Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<String> + * @throws ApiException if fails to make API call + */ + public CompletableFuture loginUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = loginUserRequestBuilder(username, password); + HttpRequest.Builder localVarRequestBuilder = loginUserRequestBuilder(username, password, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -601,8 +720,21 @@ public CompletableFuture loginUser(@javax.annotation.Nonnull String user * @throws ApiException if fails to make API call */ public CompletableFuture> loginUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException { + return loginUserWithHttpInfo(username, password, null); + } + + /** + * Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<String>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> loginUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = loginUserRequestBuilder(username, password); + HttpRequest.Builder localVarRequestBuilder = loginUserRequestBuilder(username, password, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -631,7 +763,7 @@ public CompletableFuture> loginUserWithHttpInfo(@javax.annot } } - private HttpRequest.Builder loginUserRequestBuilder(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException { + private HttpRequest.Builder loginUserRequestBuilder(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, Map headers) throws ApiException { // verify the required parameter 'username' is set if (username == null) { throw new ApiException(400, "Missing the required parameter 'username' when calling loginUser"); @@ -670,9 +802,11 @@ private HttpRequest.Builder loginUserRequestBuilder(@javax.annotation.Nonnull St if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -687,8 +821,19 @@ private HttpRequest.Builder loginUserRequestBuilder(@javax.annotation.Nonnull St * @throws ApiException if fails to make API call */ public CompletableFuture logoutUser() throws ApiException { + return logoutUser(null); + } + + /** + * Logs out current logged in user session + * + * @param headers Optional headers to include in the request + * @return CompletableFuture<Void> + * @throws ApiException if fails to make API call + */ + public CompletableFuture logoutUser(Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = logoutUserRequestBuilder(); + HttpRequest.Builder localVarRequestBuilder = logoutUserRequestBuilder(headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -710,8 +855,19 @@ public CompletableFuture logoutUser() throws ApiException { * @throws ApiException if fails to make API call */ public CompletableFuture> logoutUserWithHttpInfo() throws ApiException { + return logoutUserWithHttpInfo(null); + } + + /** + * Logs out current logged in user session + * + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Void>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> logoutUserWithHttpInfo(Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = logoutUserRequestBuilder(); + HttpRequest.Builder localVarRequestBuilder = logoutUserRequestBuilder(headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -732,7 +888,7 @@ public CompletableFuture> logoutUserWithHttpInfo() throws ApiE } } - private HttpRequest.Builder logoutUserRequestBuilder() throws ApiException { + private HttpRequest.Builder logoutUserRequestBuilder(Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -746,9 +902,11 @@ private HttpRequest.Builder logoutUserRequestBuilder() throws ApiException { if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -765,8 +923,21 @@ private HttpRequest.Builder logoutUserRequestBuilder() throws ApiException { * @throws ApiException if fails to make API call */ public CompletableFuture updateUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user) throws ApiException { + return updateUser(username, user, null); + } + + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param user Updated user object (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<Void> + * @throws ApiException if fails to make API call + */ + public CompletableFuture updateUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = updateUserRequestBuilder(username, user); + HttpRequest.Builder localVarRequestBuilder = updateUserRequestBuilder(username, user, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -790,8 +961,21 @@ public CompletableFuture updateUser(@javax.annotation.Nonnull String usern * @throws ApiException if fails to make API call */ public CompletableFuture> updateUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user) throws ApiException { + return updateUserWithHttpInfo(username, user, null); + } + + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param user Updated user object (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Void>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> updateUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, Map headers) throws ApiException { try { - HttpRequest.Builder localVarRequestBuilder = updateUserRequestBuilder(username, user); + HttpRequest.Builder localVarRequestBuilder = updateUserRequestBuilder(username, user, headers); return memberVarHttpClient.sendAsync( localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { @@ -812,7 +996,7 @@ public CompletableFuture> updateUserWithHttpInfo(@javax.annota } } - private HttpRequest.Builder updateUserRequestBuilder(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user) throws ApiException { + private HttpRequest.Builder updateUserRequestBuilder(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, Map headers) throws ApiException { // verify the required parameter 'username' is set if (username == null) { throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser"); @@ -841,9 +1025,11 @@ private HttpRequest.Builder updateUserRequestBuilder(@javax.annotation.Nonnull S if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); diff --git a/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/PetApi.java index 0b7e8e0328a6..422ee1b164b6 100644 --- a/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/PetApi.java @@ -63,9 +63,6 @@ public class PetApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; - // Custom headers to be sent with every request from this API client - private final Map extraHeaders = new java.util.HashMap<>(); - public PetApi() { this(Configuration.getDefaultApiClient()); } @@ -80,27 +77,6 @@ public PetApi(ApiClient apiClient) { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } - /** - * Add a custom header to be sent with every request from this API client. - * @param name Header name - * @param value Header value - * @return this - */ - public PetApi addHeader(String name, String value) { - this.extraHeaders.put(name, value); - return this; - } - - /** - * Remove a custom header. - * @param name Header name - * @return this - */ - public PetApi removeHeader(String name) { - this.extraHeaders.remove(name); - return this; - } - protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { String body = response.body() == null ? null : new String(response.body().readAllBytes()); @@ -123,7 +99,19 @@ private String formatExceptionMessage(String operationId, int statusCode, String * @throws ApiException if fails to make API call */ public Pet addPet(@jakarta.annotation.Nonnull Pet pet) throws ApiException { - ApiResponse localVarResponse = addPetWithHttpInfo(pet); + return addPet(pet, null); + } + + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store (required) + * @param headers Optional headers to include in the request + * @return Pet + * @throws ApiException if fails to make API call + */ + public Pet addPet(@jakarta.annotation.Nonnull Pet pet, Map headers) throws ApiException { + ApiResponse localVarResponse = addPetWithHttpInfo(pet, headers); return localVarResponse.getData(); } @@ -135,7 +123,19 @@ public Pet addPet(@jakarta.annotation.Nonnull Pet pet) throws ApiException { * @throws ApiException if fails to make API call */ public ApiResponse addPetWithHttpInfo(@jakarta.annotation.Nonnull Pet pet) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = addPetRequestBuilder(pet); + return addPetWithHttpInfo(pet, null); + } + + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Pet> + * @throws ApiException if fails to make API call + */ + public ApiResponse addPetWithHttpInfo(@jakarta.annotation.Nonnull Pet pet, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = addPetRequestBuilder(pet, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -174,7 +174,7 @@ public ApiResponse addPetWithHttpInfo(@jakarta.annotation.Nonnull Pet pet) } } - private HttpRequest.Builder addPetRequestBuilder(@jakarta.annotation.Nonnull Pet pet) throws ApiException { + private HttpRequest.Builder addPetRequestBuilder(@jakarta.annotation.Nonnull Pet pet, Map headers) throws ApiException { // verify the required parameter 'pet' is set if (pet == null) { throw new ApiException(400, "Missing the required parameter 'pet' when calling addPet"); @@ -198,9 +198,11 @@ private HttpRequest.Builder addPetRequestBuilder(@jakarta.annotation.Nonnull Pet if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -216,7 +218,19 @@ private HttpRequest.Builder addPetRequestBuilder(@jakarta.annotation.Nonnull Pet * @throws ApiException if fails to make API call */ public void deletePet(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String apiKey) throws ApiException { - deletePetWithHttpInfo(petId, apiKey); + deletePet(petId, apiKey, null); + } + + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void deletePet(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String apiKey, Map headers) throws ApiException { + deletePetWithHttpInfo(petId, apiKey, headers); } /** @@ -228,7 +242,20 @@ public void deletePet(@jakarta.annotation.Nonnull Long petId, @jakarta.annotatio * @throws ApiException if fails to make API call */ public ApiResponse deletePetWithHttpInfo(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String apiKey) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = deletePetRequestBuilder(petId, apiKey); + return deletePetWithHttpInfo(petId, apiKey, null); + } + + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse deletePetWithHttpInfo(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String apiKey, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = deletePetRequestBuilder(petId, apiKey, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -261,7 +288,7 @@ public ApiResponse deletePetWithHttpInfo(@jakarta.annotation.Nonnull Long } } - private HttpRequest.Builder deletePetRequestBuilder(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String apiKey) throws ApiException { + private HttpRequest.Builder deletePetRequestBuilder(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String apiKey, Map headers) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { throw new ApiException(400, "Missing the required parameter 'petId' when calling deletePet"); @@ -283,9 +310,11 @@ private HttpRequest.Builder deletePetRequestBuilder(@jakarta.annotation.Nonnull if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -301,7 +330,19 @@ private HttpRequest.Builder deletePetRequestBuilder(@jakarta.annotation.Nonnull * @throws ApiException if fails to make API call */ public List findPetsByStatus(@jakarta.annotation.Nonnull List status) throws ApiException { - ApiResponse> localVarResponse = findPetsByStatusWithHttpInfo(status); + return findPetsByStatus(status, null); + } + + /** + * Finds Pets by status + * Multiple status values can be provided with comma separated strings + * @param status Status values that need to be considered for filter (required) + * @param headers Optional headers to include in the request + * @return List<Pet> + * @throws ApiException if fails to make API call + */ + public List findPetsByStatus(@jakarta.annotation.Nonnull List status, Map headers) throws ApiException { + ApiResponse> localVarResponse = findPetsByStatusWithHttpInfo(status, headers); return localVarResponse.getData(); } @@ -313,7 +354,19 @@ public List findPetsByStatus(@jakarta.annotation.Nonnull List statu * @throws ApiException if fails to make API call */ public ApiResponse> findPetsByStatusWithHttpInfo(@jakarta.annotation.Nonnull List status) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = findPetsByStatusRequestBuilder(status); + return findPetsByStatusWithHttpInfo(status, null); + } + + /** + * Finds Pets by status + * Multiple status values can be provided with comma separated strings + * @param status Status values that need to be considered for filter (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<List<Pet>> + * @throws ApiException if fails to make API call + */ + public ApiResponse> findPetsByStatusWithHttpInfo(@jakarta.annotation.Nonnull List status, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = findPetsByStatusRequestBuilder(status, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -352,7 +405,7 @@ public ApiResponse> findPetsByStatusWithHttpInfo(@jakarta.annotation.N } } - private HttpRequest.Builder findPetsByStatusRequestBuilder(@jakarta.annotation.Nonnull List status) throws ApiException { + private HttpRequest.Builder findPetsByStatusRequestBuilder(@jakarta.annotation.Nonnull List status, Map headers) throws ApiException { // verify the required parameter 'status' is set if (status == null) { throw new ApiException(400, "Missing the required parameter 'status' when calling findPetsByStatus"); @@ -385,9 +438,11 @@ private HttpRequest.Builder findPetsByStatusRequestBuilder(@jakarta.annotation.N if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -405,7 +460,21 @@ private HttpRequest.Builder findPetsByStatusRequestBuilder(@jakarta.annotation.N */ @Deprecated public List findPetsByTags(@jakarta.annotation.Nonnull List tags) throws ApiException { - ApiResponse> localVarResponse = findPetsByTagsWithHttpInfo(tags); + return findPetsByTags(tags, null); + } + + /** + * Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) + * @param headers Optional headers to include in the request + * @return List<Pet> + * @throws ApiException if fails to make API call + * @deprecated + */ + @Deprecated + public List findPetsByTags(@jakarta.annotation.Nonnull List tags, Map headers) throws ApiException { + ApiResponse> localVarResponse = findPetsByTagsWithHttpInfo(tags, headers); return localVarResponse.getData(); } @@ -419,7 +488,21 @@ public List findPetsByTags(@jakarta.annotation.Nonnull List tags) t */ @Deprecated public ApiResponse> findPetsByTagsWithHttpInfo(@jakarta.annotation.Nonnull List tags) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = findPetsByTagsRequestBuilder(tags); + return findPetsByTagsWithHttpInfo(tags, null); + } + + /** + * Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<List<Pet>> + * @throws ApiException if fails to make API call + * @deprecated + */ + @Deprecated + public ApiResponse> findPetsByTagsWithHttpInfo(@jakarta.annotation.Nonnull List tags, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = findPetsByTagsRequestBuilder(tags, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -458,7 +541,7 @@ public ApiResponse> findPetsByTagsWithHttpInfo(@jakarta.annotation.Non } } - private HttpRequest.Builder findPetsByTagsRequestBuilder(@jakarta.annotation.Nonnull List tags) throws ApiException { + private HttpRequest.Builder findPetsByTagsRequestBuilder(@jakarta.annotation.Nonnull List tags, Map headers) throws ApiException { // verify the required parameter 'tags' is set if (tags == null) { throw new ApiException(400, "Missing the required parameter 'tags' when calling findPetsByTags"); @@ -491,9 +574,11 @@ private HttpRequest.Builder findPetsByTagsRequestBuilder(@jakarta.annotation.Non if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -509,7 +594,19 @@ private HttpRequest.Builder findPetsByTagsRequestBuilder(@jakarta.annotation.Non * @throws ApiException if fails to make API call */ public Pet getPetById(@jakarta.annotation.Nonnull Long petId) throws ApiException { - ApiResponse localVarResponse = getPetByIdWithHttpInfo(petId); + return getPetById(petId, null); + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @param headers Optional headers to include in the request + * @return Pet + * @throws ApiException if fails to make API call + */ + public Pet getPetById(@jakarta.annotation.Nonnull Long petId, Map headers) throws ApiException { + ApiResponse localVarResponse = getPetByIdWithHttpInfo(petId, headers); return localVarResponse.getData(); } @@ -521,7 +618,19 @@ public Pet getPetById(@jakarta.annotation.Nonnull Long petId) throws ApiExceptio * @throws ApiException if fails to make API call */ public ApiResponse getPetByIdWithHttpInfo(@jakarta.annotation.Nonnull Long petId) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = getPetByIdRequestBuilder(petId); + return getPetByIdWithHttpInfo(petId, null); + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Pet> + * @throws ApiException if fails to make API call + */ + public ApiResponse getPetByIdWithHttpInfo(@jakarta.annotation.Nonnull Long petId, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = getPetByIdRequestBuilder(petId, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -560,7 +669,7 @@ public ApiResponse getPetByIdWithHttpInfo(@jakarta.annotation.Nonnull Long } } - private HttpRequest.Builder getPetByIdRequestBuilder(@jakarta.annotation.Nonnull Long petId) throws ApiException { + private HttpRequest.Builder getPetByIdRequestBuilder(@jakarta.annotation.Nonnull Long petId, Map headers) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetById"); @@ -579,9 +688,11 @@ private HttpRequest.Builder getPetByIdRequestBuilder(@jakarta.annotation.Nonnull if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -599,7 +710,21 @@ private HttpRequest.Builder getPetByIdRequestBuilder(@jakarta.annotation.Nonnull * @see Update an existing pet Documentation */ public Pet updatePet(@jakarta.annotation.Nonnull Pet pet) throws ApiException { - ApiResponse localVarResponse = updatePetWithHttpInfo(pet); + return updatePet(pet, null); + } + + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store (required) + * @param headers Optional headers to include in the request + * @return Pet + * @throws ApiException if fails to make API call + * API documentation for the updatePet operation + * @see Update an existing pet Documentation + */ + public Pet updatePet(@jakarta.annotation.Nonnull Pet pet, Map headers) throws ApiException { + ApiResponse localVarResponse = updatePetWithHttpInfo(pet, headers); return localVarResponse.getData(); } @@ -613,7 +738,21 @@ public Pet updatePet(@jakarta.annotation.Nonnull Pet pet) throws ApiException { * @see Update an existing pet Documentation */ public ApiResponse updatePetWithHttpInfo(@jakarta.annotation.Nonnull Pet pet) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = updatePetRequestBuilder(pet); + return updatePetWithHttpInfo(pet, null); + } + + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Pet> + * @throws ApiException if fails to make API call + * API documentation for the updatePet operation + * @see Update an existing pet Documentation + */ + public ApiResponse updatePetWithHttpInfo(@jakarta.annotation.Nonnull Pet pet, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = updatePetRequestBuilder(pet, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -652,7 +791,7 @@ public ApiResponse updatePetWithHttpInfo(@jakarta.annotation.Nonnull Pet pe } } - private HttpRequest.Builder updatePetRequestBuilder(@jakarta.annotation.Nonnull Pet pet) throws ApiException { + private HttpRequest.Builder updatePetRequestBuilder(@jakarta.annotation.Nonnull Pet pet, Map headers) throws ApiException { // verify the required parameter 'pet' is set if (pet == null) { throw new ApiException(400, "Missing the required parameter 'pet' when calling updatePet"); @@ -676,9 +815,11 @@ private HttpRequest.Builder updatePetRequestBuilder(@jakarta.annotation.Nonnull if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -695,7 +836,20 @@ private HttpRequest.Builder updatePetRequestBuilder(@jakarta.annotation.Nonnull * @throws ApiException if fails to make API call */ public void updatePetWithForm(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String name, @jakarta.annotation.Nullable String status) throws ApiException { - updatePetWithFormWithHttpInfo(petId, name, status); + updatePetWithForm(petId, name, status, null); + } + + /** + * Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void updatePetWithForm(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String name, @jakarta.annotation.Nullable String status, Map headers) throws ApiException { + updatePetWithFormWithHttpInfo(petId, name, status, headers); } /** @@ -708,7 +862,21 @@ public void updatePetWithForm(@jakarta.annotation.Nonnull Long petId, @jakarta.a * @throws ApiException if fails to make API call */ public ApiResponse updatePetWithFormWithHttpInfo(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String name, @jakarta.annotation.Nullable String status) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = updatePetWithFormRequestBuilder(petId, name, status); + return updatePetWithFormWithHttpInfo(petId, name, status, null); + } + + /** + * Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse updatePetWithFormWithHttpInfo(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String name, @jakarta.annotation.Nullable String status, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = updatePetWithFormRequestBuilder(petId, name, status, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -741,7 +909,7 @@ public ApiResponse updatePetWithFormWithHttpInfo(@jakarta.annotation.Nonnu } } - private HttpRequest.Builder updatePetWithFormRequestBuilder(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String name, @jakarta.annotation.Nullable String status) throws ApiException { + private HttpRequest.Builder updatePetWithFormRequestBuilder(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String name, @jakarta.annotation.Nullable String status, Map headers) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { throw new ApiException(400, "Missing the required parameter 'petId' when calling updatePetWithForm"); @@ -777,9 +945,11 @@ private HttpRequest.Builder updatePetWithFormRequestBuilder(@jakarta.annotation. if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -797,7 +967,21 @@ private HttpRequest.Builder updatePetWithFormRequestBuilder(@jakarta.annotation. * @throws ApiException if fails to make API call */ public ModelApiResponse uploadFile(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String additionalMetadata, @jakarta.annotation.Nullable File _file) throws ApiException { - ApiResponse localVarResponse = uploadFileWithHttpInfo(petId, additionalMetadata, _file); + return uploadFile(petId, additionalMetadata, _file, null); + } + + /** + * uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @param headers Optional headers to include in the request + * @return ModelApiResponse + * @throws ApiException if fails to make API call + */ + public ModelApiResponse uploadFile(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String additionalMetadata, @jakarta.annotation.Nullable File _file, Map headers) throws ApiException { + ApiResponse localVarResponse = uploadFileWithHttpInfo(petId, additionalMetadata, _file, headers); return localVarResponse.getData(); } @@ -811,7 +995,21 @@ public ModelApiResponse uploadFile(@jakarta.annotation.Nonnull Long petId, @jaka * @throws ApiException if fails to make API call */ public ApiResponse uploadFileWithHttpInfo(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String additionalMetadata, @jakarta.annotation.Nullable File _file) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = uploadFileRequestBuilder(petId, additionalMetadata, _file); + return uploadFileWithHttpInfo(petId, additionalMetadata, _file, null); + } + + /** + * uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<ModelApiResponse> + * @throws ApiException if fails to make API call + */ + public ApiResponse uploadFileWithHttpInfo(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String additionalMetadata, @jakarta.annotation.Nullable File _file, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = uploadFileRequestBuilder(petId, additionalMetadata, _file, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -850,7 +1048,7 @@ public ApiResponse uploadFileWithHttpInfo(@jakarta.annotation. } } - private HttpRequest.Builder uploadFileRequestBuilder(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String additionalMetadata, @jakarta.annotation.Nullable File _file) throws ApiException { + private HttpRequest.Builder uploadFileRequestBuilder(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String additionalMetadata, @jakarta.annotation.Nullable File _file, Map headers) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFile"); @@ -905,9 +1103,11 @@ private HttpRequest.Builder uploadFileRequestBuilder(@jakarta.annotation.Nonnull if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); diff --git a/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/StoreApi.java index 39e63a2bfd55..7a050448bd8c 100644 --- a/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/StoreApi.java @@ -61,9 +61,6 @@ public class StoreApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; - // Custom headers to be sent with every request from this API client - private final Map extraHeaders = new java.util.HashMap<>(); - public StoreApi() { this(Configuration.getDefaultApiClient()); } @@ -78,27 +75,6 @@ public StoreApi(ApiClient apiClient) { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } - /** - * Add a custom header to be sent with every request from this API client. - * @param name Header name - * @param value Header value - * @return this - */ - public StoreApi addHeader(String name, String value) { - this.extraHeaders.put(name, value); - return this; - } - - /** - * Remove a custom header. - * @param name Header name - * @return this - */ - public StoreApi removeHeader(String name) { - this.extraHeaders.remove(name); - return this; - } - protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { String body = response.body() == null ? null : new String(response.body().readAllBytes()); @@ -120,7 +96,18 @@ private String formatExceptionMessage(String operationId, int statusCode, String * @throws ApiException if fails to make API call */ public void deleteOrder(@jakarta.annotation.Nonnull String orderId) throws ApiException { - deleteOrderWithHttpInfo(orderId); + deleteOrder(orderId, null); + } + + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted (required) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void deleteOrder(@jakarta.annotation.Nonnull String orderId, Map headers) throws ApiException { + deleteOrderWithHttpInfo(orderId, headers); } /** @@ -131,7 +118,19 @@ public void deleteOrder(@jakarta.annotation.Nonnull String orderId) throws ApiEx * @throws ApiException if fails to make API call */ public ApiResponse deleteOrderWithHttpInfo(@jakarta.annotation.Nonnull String orderId) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = deleteOrderRequestBuilder(orderId); + return deleteOrderWithHttpInfo(orderId, null); + } + + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse deleteOrderWithHttpInfo(@jakarta.annotation.Nonnull String orderId, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = deleteOrderRequestBuilder(orderId, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -164,7 +163,7 @@ public ApiResponse deleteOrderWithHttpInfo(@jakarta.annotation.Nonnull Str } } - private HttpRequest.Builder deleteOrderRequestBuilder(@jakarta.annotation.Nonnull String orderId) throws ApiException { + private HttpRequest.Builder deleteOrderRequestBuilder(@jakarta.annotation.Nonnull String orderId, Map headers) throws ApiException { // verify the required parameter 'orderId' is set if (orderId == null) { throw new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder"); @@ -183,9 +182,11 @@ private HttpRequest.Builder deleteOrderRequestBuilder(@jakarta.annotation.Nonnul if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -200,7 +201,18 @@ private HttpRequest.Builder deleteOrderRequestBuilder(@jakarta.annotation.Nonnul * @throws ApiException if fails to make API call */ public Map getInventory() throws ApiException { - ApiResponse> localVarResponse = getInventoryWithHttpInfo(); + return getInventory(null); + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @param headers Optional headers to include in the request + * @return Map<String, Integer> + * @throws ApiException if fails to make API call + */ + public Map getInventory(Map headers) throws ApiException { + ApiResponse> localVarResponse = getInventoryWithHttpInfo(headers); return localVarResponse.getData(); } @@ -211,7 +223,18 @@ public Map getInventory() throws ApiException { * @throws ApiException if fails to make API call */ public ApiResponse> getInventoryWithHttpInfo() throws ApiException { - HttpRequest.Builder localVarRequestBuilder = getInventoryRequestBuilder(); + return getInventoryWithHttpInfo(null); + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @param headers Optional headers to include in the request + * @return ApiResponse<Map<String, Integer>> + * @throws ApiException if fails to make API call + */ + public ApiResponse> getInventoryWithHttpInfo(Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = getInventoryRequestBuilder(headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -250,7 +273,7 @@ public ApiResponse> getInventoryWithHttpInfo() throws ApiEx } } - private HttpRequest.Builder getInventoryRequestBuilder() throws ApiException { + private HttpRequest.Builder getInventoryRequestBuilder(Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -264,9 +287,11 @@ private HttpRequest.Builder getInventoryRequestBuilder() throws ApiException { if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -282,7 +307,19 @@ private HttpRequest.Builder getInventoryRequestBuilder() throws ApiException { * @throws ApiException if fails to make API call */ public Order getOrderById(@jakarta.annotation.Nonnull Long orderId) throws ApiException { - ApiResponse localVarResponse = getOrderByIdWithHttpInfo(orderId); + return getOrderById(orderId, null); + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @param headers Optional headers to include in the request + * @return Order + * @throws ApiException if fails to make API call + */ + public Order getOrderById(@jakarta.annotation.Nonnull Long orderId, Map headers) throws ApiException { + ApiResponse localVarResponse = getOrderByIdWithHttpInfo(orderId, headers); return localVarResponse.getData(); } @@ -294,7 +331,19 @@ public Order getOrderById(@jakarta.annotation.Nonnull Long orderId) throws ApiEx * @throws ApiException if fails to make API call */ public ApiResponse getOrderByIdWithHttpInfo(@jakarta.annotation.Nonnull Long orderId) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = getOrderByIdRequestBuilder(orderId); + return getOrderByIdWithHttpInfo(orderId, null); + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Order> + * @throws ApiException if fails to make API call + */ + public ApiResponse getOrderByIdWithHttpInfo(@jakarta.annotation.Nonnull Long orderId, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = getOrderByIdRequestBuilder(orderId, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -333,7 +382,7 @@ public ApiResponse getOrderByIdWithHttpInfo(@jakarta.annotation.Nonnull L } } - private HttpRequest.Builder getOrderByIdRequestBuilder(@jakarta.annotation.Nonnull Long orderId) throws ApiException { + private HttpRequest.Builder getOrderByIdRequestBuilder(@jakarta.annotation.Nonnull Long orderId, Map headers) throws ApiException { // verify the required parameter 'orderId' is set if (orderId == null) { throw new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById"); @@ -352,9 +401,11 @@ private HttpRequest.Builder getOrderByIdRequestBuilder(@jakarta.annotation.Nonnu if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -370,7 +421,19 @@ private HttpRequest.Builder getOrderByIdRequestBuilder(@jakarta.annotation.Nonnu * @throws ApiException if fails to make API call */ public Order placeOrder(@jakarta.annotation.Nonnull Order order) throws ApiException { - ApiResponse localVarResponse = placeOrderWithHttpInfo(order); + return placeOrder(order, null); + } + + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @param headers Optional headers to include in the request + * @return Order + * @throws ApiException if fails to make API call + */ + public Order placeOrder(@jakarta.annotation.Nonnull Order order, Map headers) throws ApiException { + ApiResponse localVarResponse = placeOrderWithHttpInfo(order, headers); return localVarResponse.getData(); } @@ -382,7 +445,19 @@ public Order placeOrder(@jakarta.annotation.Nonnull Order order) throws ApiExcep * @throws ApiException if fails to make API call */ public ApiResponse placeOrderWithHttpInfo(@jakarta.annotation.Nonnull Order order) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = placeOrderRequestBuilder(order); + return placeOrderWithHttpInfo(order, null); + } + + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Order> + * @throws ApiException if fails to make API call + */ + public ApiResponse placeOrderWithHttpInfo(@jakarta.annotation.Nonnull Order order, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = placeOrderRequestBuilder(order, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -421,7 +496,7 @@ public ApiResponse placeOrderWithHttpInfo(@jakarta.annotation.Nonnull Ord } } - private HttpRequest.Builder placeOrderRequestBuilder(@jakarta.annotation.Nonnull Order order) throws ApiException { + private HttpRequest.Builder placeOrderRequestBuilder(@jakarta.annotation.Nonnull Order order, Map headers) throws ApiException { // verify the required parameter 'order' is set if (order == null) { throw new ApiException(400, "Missing the required parameter 'order' when calling placeOrder"); @@ -445,9 +520,11 @@ private HttpRequest.Builder placeOrderRequestBuilder(@jakarta.annotation.Nonnull if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); diff --git a/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/UserApi.java index a2ddf7ab8727..519f01df4cd9 100644 --- a/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/UserApi.java @@ -62,9 +62,6 @@ public class UserApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; - // Custom headers to be sent with every request from this API client - private final Map extraHeaders = new java.util.HashMap<>(); - public UserApi() { this(Configuration.getDefaultApiClient()); } @@ -79,27 +76,6 @@ public UserApi(ApiClient apiClient) { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } - /** - * Add a custom header to be sent with every request from this API client. - * @param name Header name - * @param value Header value - * @return this - */ - public UserApi addHeader(String name, String value) { - this.extraHeaders.put(name, value); - return this; - } - - /** - * Remove a custom header. - * @param name Header name - * @return this - */ - public UserApi removeHeader(String name) { - this.extraHeaders.remove(name); - return this; - } - protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { String body = response.body() == null ? null : new String(response.body().readAllBytes()); @@ -121,7 +97,18 @@ private String formatExceptionMessage(String operationId, int statusCode, String * @throws ApiException if fails to make API call */ public void createUser(@jakarta.annotation.Nonnull User user) throws ApiException { - createUserWithHttpInfo(user); + createUser(user, null); + } + + /** + * Create user + * This can only be done by the logged in user. + * @param user Created user object (required) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void createUser(@jakarta.annotation.Nonnull User user, Map headers) throws ApiException { + createUserWithHttpInfo(user, headers); } /** @@ -132,7 +119,19 @@ public void createUser(@jakarta.annotation.Nonnull User user) throws ApiExceptio * @throws ApiException if fails to make API call */ public ApiResponse createUserWithHttpInfo(@jakarta.annotation.Nonnull User user) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = createUserRequestBuilder(user); + return createUserWithHttpInfo(user, null); + } + + /** + * Create user + * This can only be done by the logged in user. + * @param user Created user object (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse createUserWithHttpInfo(@jakarta.annotation.Nonnull User user, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = createUserRequestBuilder(user, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -165,7 +164,7 @@ public ApiResponse createUserWithHttpInfo(@jakarta.annotation.Nonnull User } } - private HttpRequest.Builder createUserRequestBuilder(@jakarta.annotation.Nonnull User user) throws ApiException { + private HttpRequest.Builder createUserRequestBuilder(@jakarta.annotation.Nonnull User user, Map headers) throws ApiException { // verify the required parameter 'user' is set if (user == null) { throw new ApiException(400, "Missing the required parameter 'user' when calling createUser"); @@ -189,9 +188,11 @@ private HttpRequest.Builder createUserRequestBuilder(@jakarta.annotation.Nonnull if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -206,7 +207,18 @@ private HttpRequest.Builder createUserRequestBuilder(@jakarta.annotation.Nonnull * @throws ApiException if fails to make API call */ public void createUsersWithArrayInput(@jakarta.annotation.Nonnull List user) throws ApiException { - createUsersWithArrayInputWithHttpInfo(user); + createUsersWithArrayInput(user, null); + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void createUsersWithArrayInput(@jakarta.annotation.Nonnull List user, Map headers) throws ApiException { + createUsersWithArrayInputWithHttpInfo(user, headers); } /** @@ -217,7 +229,19 @@ public void createUsersWithArrayInput(@jakarta.annotation.Nonnull List use * @throws ApiException if fails to make API call */ public ApiResponse createUsersWithArrayInputWithHttpInfo(@jakarta.annotation.Nonnull List user) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = createUsersWithArrayInputRequestBuilder(user); + return createUsersWithArrayInputWithHttpInfo(user, null); + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse createUsersWithArrayInputWithHttpInfo(@jakarta.annotation.Nonnull List user, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = createUsersWithArrayInputRequestBuilder(user, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -250,7 +274,7 @@ public ApiResponse createUsersWithArrayInputWithHttpInfo(@jakarta.annotati } } - private HttpRequest.Builder createUsersWithArrayInputRequestBuilder(@jakarta.annotation.Nonnull List user) throws ApiException { + private HttpRequest.Builder createUsersWithArrayInputRequestBuilder(@jakarta.annotation.Nonnull List user, Map headers) throws ApiException { // verify the required parameter 'user' is set if (user == null) { throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithArrayInput"); @@ -274,9 +298,11 @@ private HttpRequest.Builder createUsersWithArrayInputRequestBuilder(@jakarta.ann if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -291,7 +317,18 @@ private HttpRequest.Builder createUsersWithArrayInputRequestBuilder(@jakarta.ann * @throws ApiException if fails to make API call */ public void createUsersWithListInput(@jakarta.annotation.Nonnull List user) throws ApiException { - createUsersWithListInputWithHttpInfo(user); + createUsersWithListInput(user, null); + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void createUsersWithListInput(@jakarta.annotation.Nonnull List user, Map headers) throws ApiException { + createUsersWithListInputWithHttpInfo(user, headers); } /** @@ -302,7 +339,19 @@ public void createUsersWithListInput(@jakarta.annotation.Nonnull List user * @throws ApiException if fails to make API call */ public ApiResponse createUsersWithListInputWithHttpInfo(@jakarta.annotation.Nonnull List user) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = createUsersWithListInputRequestBuilder(user); + return createUsersWithListInputWithHttpInfo(user, null); + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse createUsersWithListInputWithHttpInfo(@jakarta.annotation.Nonnull List user, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = createUsersWithListInputRequestBuilder(user, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -335,7 +384,7 @@ public ApiResponse createUsersWithListInputWithHttpInfo(@jakarta.annotatio } } - private HttpRequest.Builder createUsersWithListInputRequestBuilder(@jakarta.annotation.Nonnull List user) throws ApiException { + private HttpRequest.Builder createUsersWithListInputRequestBuilder(@jakarta.annotation.Nonnull List user, Map headers) throws ApiException { // verify the required parameter 'user' is set if (user == null) { throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithListInput"); @@ -359,9 +408,11 @@ private HttpRequest.Builder createUsersWithListInputRequestBuilder(@jakarta.anno if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -376,7 +427,18 @@ private HttpRequest.Builder createUsersWithListInputRequestBuilder(@jakarta.anno * @throws ApiException if fails to make API call */ public void deleteUser(@jakarta.annotation.Nonnull String username) throws ApiException { - deleteUserWithHttpInfo(username); + deleteUser(username, null); + } + + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void deleteUser(@jakarta.annotation.Nonnull String username, Map headers) throws ApiException { + deleteUserWithHttpInfo(username, headers); } /** @@ -387,7 +449,19 @@ public void deleteUser(@jakarta.annotation.Nonnull String username) throws ApiEx * @throws ApiException if fails to make API call */ public ApiResponse deleteUserWithHttpInfo(@jakarta.annotation.Nonnull String username) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = deleteUserRequestBuilder(username); + return deleteUserWithHttpInfo(username, null); + } + + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse deleteUserWithHttpInfo(@jakarta.annotation.Nonnull String username, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = deleteUserRequestBuilder(username, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -420,7 +494,7 @@ public ApiResponse deleteUserWithHttpInfo(@jakarta.annotation.Nonnull Stri } } - private HttpRequest.Builder deleteUserRequestBuilder(@jakarta.annotation.Nonnull String username) throws ApiException { + private HttpRequest.Builder deleteUserRequestBuilder(@jakarta.annotation.Nonnull String username, Map headers) throws ApiException { // verify the required parameter 'username' is set if (username == null) { throw new ApiException(400, "Missing the required parameter 'username' when calling deleteUser"); @@ -439,9 +513,11 @@ private HttpRequest.Builder deleteUserRequestBuilder(@jakarta.annotation.Nonnull if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -457,7 +533,19 @@ private HttpRequest.Builder deleteUserRequestBuilder(@jakarta.annotation.Nonnull * @throws ApiException if fails to make API call */ public User getUserByName(@jakarta.annotation.Nonnull String username) throws ApiException { - ApiResponse localVarResponse = getUserByNameWithHttpInfo(username); + return getUserByName(username, null); + } + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @param headers Optional headers to include in the request + * @return User + * @throws ApiException if fails to make API call + */ + public User getUserByName(@jakarta.annotation.Nonnull String username, Map headers) throws ApiException { + ApiResponse localVarResponse = getUserByNameWithHttpInfo(username, headers); return localVarResponse.getData(); } @@ -469,7 +557,19 @@ public User getUserByName(@jakarta.annotation.Nonnull String username) throws Ap * @throws ApiException if fails to make API call */ public ApiResponse getUserByNameWithHttpInfo(@jakarta.annotation.Nonnull String username) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = getUserByNameRequestBuilder(username); + return getUserByNameWithHttpInfo(username, null); + } + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<User> + * @throws ApiException if fails to make API call + */ + public ApiResponse getUserByNameWithHttpInfo(@jakarta.annotation.Nonnull String username, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = getUserByNameRequestBuilder(username, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -508,7 +608,7 @@ public ApiResponse getUserByNameWithHttpInfo(@jakarta.annotation.Nonnull S } } - private HttpRequest.Builder getUserByNameRequestBuilder(@jakarta.annotation.Nonnull String username) throws ApiException { + private HttpRequest.Builder getUserByNameRequestBuilder(@jakarta.annotation.Nonnull String username, Map headers) throws ApiException { // verify the required parameter 'username' is set if (username == null) { throw new ApiException(400, "Missing the required parameter 'username' when calling getUserByName"); @@ -527,9 +627,11 @@ private HttpRequest.Builder getUserByNameRequestBuilder(@jakarta.annotation.Nonn if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -546,7 +648,20 @@ private HttpRequest.Builder getUserByNameRequestBuilder(@jakarta.annotation.Nonn * @throws ApiException if fails to make API call */ public String loginUser(@jakarta.annotation.Nonnull String username, @jakarta.annotation.Nonnull String password) throws ApiException { - ApiResponse localVarResponse = loginUserWithHttpInfo(username, password); + return loginUser(username, password, null); + } + + /** + * Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @param headers Optional headers to include in the request + * @return String + * @throws ApiException if fails to make API call + */ + public String loginUser(@jakarta.annotation.Nonnull String username, @jakarta.annotation.Nonnull String password, Map headers) throws ApiException { + ApiResponse localVarResponse = loginUserWithHttpInfo(username, password, headers); return localVarResponse.getData(); } @@ -559,7 +674,20 @@ public String loginUser(@jakarta.annotation.Nonnull String username, @jakarta.an * @throws ApiException if fails to make API call */ public ApiResponse loginUserWithHttpInfo(@jakarta.annotation.Nonnull String username, @jakarta.annotation.Nonnull String password) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = loginUserRequestBuilder(username, password); + return loginUserWithHttpInfo(username, password, null); + } + + /** + * Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<String> + * @throws ApiException if fails to make API call + */ + public ApiResponse loginUserWithHttpInfo(@jakarta.annotation.Nonnull String username, @jakarta.annotation.Nonnull String password, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = loginUserRequestBuilder(username, password, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -598,7 +726,7 @@ public ApiResponse loginUserWithHttpInfo(@jakarta.annotation.Nonnull Str } } - private HttpRequest.Builder loginUserRequestBuilder(@jakarta.annotation.Nonnull String username, @jakarta.annotation.Nonnull String password) throws ApiException { + private HttpRequest.Builder loginUserRequestBuilder(@jakarta.annotation.Nonnull String username, @jakarta.annotation.Nonnull String password, Map headers) throws ApiException { // verify the required parameter 'username' is set if (username == null) { throw new ApiException(400, "Missing the required parameter 'username' when calling loginUser"); @@ -637,9 +765,11 @@ private HttpRequest.Builder loginUserRequestBuilder(@jakarta.annotation.Nonnull if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -653,7 +783,17 @@ private HttpRequest.Builder loginUserRequestBuilder(@jakarta.annotation.Nonnull * @throws ApiException if fails to make API call */ public void logoutUser() throws ApiException { - logoutUserWithHttpInfo(); + logoutUser(null); + } + + /** + * Logs out current logged in user session + * + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void logoutUser(Map headers) throws ApiException { + logoutUserWithHttpInfo(headers); } /** @@ -663,7 +803,18 @@ public void logoutUser() throws ApiException { * @throws ApiException if fails to make API call */ public ApiResponse logoutUserWithHttpInfo() throws ApiException { - HttpRequest.Builder localVarRequestBuilder = logoutUserRequestBuilder(); + return logoutUserWithHttpInfo(null); + } + + /** + * Logs out current logged in user session + * + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse logoutUserWithHttpInfo(Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = logoutUserRequestBuilder(headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -696,7 +847,7 @@ public ApiResponse logoutUserWithHttpInfo() throws ApiException { } } - private HttpRequest.Builder logoutUserRequestBuilder() throws ApiException { + private HttpRequest.Builder logoutUserRequestBuilder(Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -710,9 +861,11 @@ private HttpRequest.Builder logoutUserRequestBuilder() throws ApiException { if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -728,7 +881,19 @@ private HttpRequest.Builder logoutUserRequestBuilder() throws ApiException { * @throws ApiException if fails to make API call */ public void updateUser(@jakarta.annotation.Nonnull String username, @jakarta.annotation.Nonnull User user) throws ApiException { - updateUserWithHttpInfo(username, user); + updateUser(username, user, null); + } + + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param user Updated user object (required) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void updateUser(@jakarta.annotation.Nonnull String username, @jakarta.annotation.Nonnull User user, Map headers) throws ApiException { + updateUserWithHttpInfo(username, user, headers); } /** @@ -740,7 +905,20 @@ public void updateUser(@jakarta.annotation.Nonnull String username, @jakarta.ann * @throws ApiException if fails to make API call */ public ApiResponse updateUserWithHttpInfo(@jakarta.annotation.Nonnull String username, @jakarta.annotation.Nonnull User user) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = updateUserRequestBuilder(username, user); + return updateUserWithHttpInfo(username, user, null); + } + + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param user Updated user object (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse updateUserWithHttpInfo(@jakarta.annotation.Nonnull String username, @jakarta.annotation.Nonnull User user, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = updateUserRequestBuilder(username, user, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -773,7 +951,7 @@ public ApiResponse updateUserWithHttpInfo(@jakarta.annotation.Nonnull Stri } } - private HttpRequest.Builder updateUserRequestBuilder(@jakarta.annotation.Nonnull String username, @jakarta.annotation.Nonnull User user) throws ApiException { + private HttpRequest.Builder updateUserRequestBuilder(@jakarta.annotation.Nonnull String username, @jakarta.annotation.Nonnull User user, Map headers) throws ApiException { // verify the required parameter 'username' is set if (username == null) { throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser"); @@ -802,9 +980,11 @@ private HttpRequest.Builder updateUserRequestBuilder(@jakarta.annotation.Nonnull if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/AnotherFakeApi.java index 6693c39e4b3e..ff2da74a5a5a 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/AnotherFakeApi.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -55,9 +55,6 @@ public class AnotherFakeApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; - // Custom headers to be sent with every request from this API client - private final Map extraHeaders = new java.util.HashMap<>(); - public AnotherFakeApi() { this(Configuration.getDefaultApiClient()); } @@ -72,27 +69,6 @@ public AnotherFakeApi(ApiClient apiClient) { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } - /** - * Add a custom header to be sent with every request from this API client. - * @param name Header name - * @param value Header value - * @return this - */ - public AnotherFakeApi addHeader(String name, String value) { - this.extraHeaders.put(name, value); - return this; - } - - /** - * Remove a custom header. - * @param name Header name - * @return this - */ - public AnotherFakeApi removeHeader(String name) { - this.extraHeaders.remove(name); - return this; - } - protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { String body = response.body() == null ? null : new String(response.body().readAllBytes()); @@ -115,7 +91,19 @@ private String formatExceptionMessage(String operationId, int statusCode, String * @throws ApiException if fails to make API call */ public Client call123testSpecialTags(@javax.annotation.Nonnull Client client) throws ApiException { - ApiResponse localVarResponse = call123testSpecialTagsWithHttpInfo(client); + return call123testSpecialTags(client, null); + } + + /** + * To test special tags + * To test special tags and operation ID starting with number + * @param client client model (required) + * @param headers Optional headers to include in the request + * @return Client + * @throws ApiException if fails to make API call + */ + public Client call123testSpecialTags(@javax.annotation.Nonnull Client client, Map headers) throws ApiException { + ApiResponse localVarResponse = call123testSpecialTagsWithHttpInfo(client, headers); return localVarResponse.getData(); } @@ -127,7 +115,19 @@ public Client call123testSpecialTags(@javax.annotation.Nonnull Client client) th * @throws ApiException if fails to make API call */ public ApiResponse call123testSpecialTagsWithHttpInfo(@javax.annotation.Nonnull Client client) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = call123testSpecialTagsRequestBuilder(client); + return call123testSpecialTagsWithHttpInfo(client, null); + } + + /** + * To test special tags + * To test special tags and operation ID starting with number + * @param client client model (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Client> + * @throws ApiException if fails to make API call + */ + public ApiResponse call123testSpecialTagsWithHttpInfo(@javax.annotation.Nonnull Client client, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = call123testSpecialTagsRequestBuilder(client, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -166,7 +166,7 @@ public ApiResponse call123testSpecialTagsWithHttpInfo(@javax.annotation. } } - private HttpRequest.Builder call123testSpecialTagsRequestBuilder(@javax.annotation.Nonnull Client client) throws ApiException { + private HttpRequest.Builder call123testSpecialTagsRequestBuilder(@javax.annotation.Nonnull Client client, Map headers) throws ApiException { // verify the required parameter 'client' is set if (client == null) { throw new ApiException(400, "Missing the required parameter 'client' when calling call123testSpecialTags"); @@ -190,9 +190,11 @@ private HttpRequest.Builder call123testSpecialTagsRequestBuilder(@javax.annotati if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/DefaultApi.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/DefaultApi.java index 6abf340a6872..4b72f2ad1639 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/DefaultApi.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/DefaultApi.java @@ -55,9 +55,6 @@ public class DefaultApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; - // Custom headers to be sent with every request from this API client - private final Map extraHeaders = new java.util.HashMap<>(); - public DefaultApi() { this(Configuration.getDefaultApiClient()); } @@ -72,27 +69,6 @@ public DefaultApi(ApiClient apiClient) { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } - /** - * Add a custom header to be sent with every request from this API client. - * @param name Header name - * @param value Header value - * @return this - */ - public DefaultApi addHeader(String name, String value) { - this.extraHeaders.put(name, value); - return this; - } - - /** - * Remove a custom header. - * @param name Header name - * @return this - */ - public DefaultApi removeHeader(String name) { - this.extraHeaders.remove(name); - return this; - } - protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { String body = response.body() == null ? null : new String(response.body().readAllBytes()); @@ -114,7 +90,18 @@ private String formatExceptionMessage(String operationId, int statusCode, String * @throws ApiException if fails to make API call */ public FooGetDefaultResponse fooGet() throws ApiException { - ApiResponse localVarResponse = fooGetWithHttpInfo(); + return fooGet(null); + } + + /** + * + * + * @param headers Optional headers to include in the request + * @return FooGetDefaultResponse + * @throws ApiException if fails to make API call + */ + public FooGetDefaultResponse fooGet(Map headers) throws ApiException { + ApiResponse localVarResponse = fooGetWithHttpInfo(headers); return localVarResponse.getData(); } @@ -125,7 +112,18 @@ public FooGetDefaultResponse fooGet() throws ApiException { * @throws ApiException if fails to make API call */ public ApiResponse fooGetWithHttpInfo() throws ApiException { - HttpRequest.Builder localVarRequestBuilder = fooGetRequestBuilder(); + return fooGetWithHttpInfo(null); + } + + /** + * + * + * @param headers Optional headers to include in the request + * @return ApiResponse<FooGetDefaultResponse> + * @throws ApiException if fails to make API call + */ + public ApiResponse fooGetWithHttpInfo(Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = fooGetRequestBuilder(headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -164,7 +162,7 @@ public ApiResponse fooGetWithHttpInfo() throws ApiExcepti } } - private HttpRequest.Builder fooGetRequestBuilder() throws ApiException { + private HttpRequest.Builder fooGetRequestBuilder(Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -178,9 +176,11 @@ private HttpRequest.Builder fooGetRequestBuilder() throws ApiException { if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeApi.java index ddc79c79929d..dca421cef972 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeApi.java @@ -72,9 +72,6 @@ public class FakeApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; - // Custom headers to be sent with every request from this API client - private final Map extraHeaders = new java.util.HashMap<>(); - public FakeApi() { this(Configuration.getDefaultApiClient()); } @@ -89,27 +86,6 @@ public FakeApi(ApiClient apiClient) { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } - /** - * Add a custom header to be sent with every request from this API client. - * @param name Header name - * @param value Header value - * @return this - */ - public FakeApi addHeader(String name, String value) { - this.extraHeaders.put(name, value); - return this; - } - - /** - * Remove a custom header. - * @param name Header name - * @return this - */ - public FakeApi removeHeader(String name) { - this.extraHeaders.remove(name); - return this; - } - protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { String body = response.body() == null ? null : new String(response.body().readAllBytes()); @@ -131,7 +107,18 @@ private String formatExceptionMessage(String operationId, int statusCode, String * @throws ApiException if fails to make API call */ public FakeBigDecimalMap200Response fakeBigDecimalMap() throws ApiException { - ApiResponse localVarResponse = fakeBigDecimalMapWithHttpInfo(); + return fakeBigDecimalMap(null); + } + + /** + * + * for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + * @param headers Optional headers to include in the request + * @return FakeBigDecimalMap200Response + * @throws ApiException if fails to make API call + */ + public FakeBigDecimalMap200Response fakeBigDecimalMap(Map headers) throws ApiException { + ApiResponse localVarResponse = fakeBigDecimalMapWithHttpInfo(headers); return localVarResponse.getData(); } @@ -142,7 +129,18 @@ public FakeBigDecimalMap200Response fakeBigDecimalMap() throws ApiException { * @throws ApiException if fails to make API call */ public ApiResponse fakeBigDecimalMapWithHttpInfo() throws ApiException { - HttpRequest.Builder localVarRequestBuilder = fakeBigDecimalMapRequestBuilder(); + return fakeBigDecimalMapWithHttpInfo(null); + } + + /** + * + * for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + * @param headers Optional headers to include in the request + * @return ApiResponse<FakeBigDecimalMap200Response> + * @throws ApiException if fails to make API call + */ + public ApiResponse fakeBigDecimalMapWithHttpInfo(Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = fakeBigDecimalMapRequestBuilder(headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -181,7 +179,7 @@ public ApiResponse fakeBigDecimalMapWithHttpInfo() } } - private HttpRequest.Builder fakeBigDecimalMapRequestBuilder() throws ApiException { + private HttpRequest.Builder fakeBigDecimalMapRequestBuilder(Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -195,9 +193,11 @@ private HttpRequest.Builder fakeBigDecimalMapRequestBuilder() throws ApiExceptio if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -212,7 +212,18 @@ private HttpRequest.Builder fakeBigDecimalMapRequestBuilder() throws ApiExceptio * @throws ApiException if fails to make API call */ public HealthCheckResult fakeHealthGet() throws ApiException { - ApiResponse localVarResponse = fakeHealthGetWithHttpInfo(); + return fakeHealthGet(null); + } + + /** + * Health check endpoint + * + * @param headers Optional headers to include in the request + * @return HealthCheckResult + * @throws ApiException if fails to make API call + */ + public HealthCheckResult fakeHealthGet(Map headers) throws ApiException { + ApiResponse localVarResponse = fakeHealthGetWithHttpInfo(headers); return localVarResponse.getData(); } @@ -223,7 +234,18 @@ public HealthCheckResult fakeHealthGet() throws ApiException { * @throws ApiException if fails to make API call */ public ApiResponse fakeHealthGetWithHttpInfo() throws ApiException { - HttpRequest.Builder localVarRequestBuilder = fakeHealthGetRequestBuilder(); + return fakeHealthGetWithHttpInfo(null); + } + + /** + * Health check endpoint + * + * @param headers Optional headers to include in the request + * @return ApiResponse<HealthCheckResult> + * @throws ApiException if fails to make API call + */ + public ApiResponse fakeHealthGetWithHttpInfo(Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = fakeHealthGetRequestBuilder(headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -262,7 +284,7 @@ public ApiResponse fakeHealthGetWithHttpInfo() throws ApiExce } } - private HttpRequest.Builder fakeHealthGetRequestBuilder() throws ApiException { + private HttpRequest.Builder fakeHealthGetRequestBuilder(Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -276,9 +298,11 @@ private HttpRequest.Builder fakeHealthGetRequestBuilder() throws ApiException { if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -294,7 +318,19 @@ private HttpRequest.Builder fakeHealthGetRequestBuilder() throws ApiException { * @throws ApiException if fails to make API call */ public Boolean fakeOuterBooleanSerialize(@javax.annotation.Nullable Boolean body) throws ApiException { - ApiResponse localVarResponse = fakeOuterBooleanSerializeWithHttpInfo(body); + return fakeOuterBooleanSerialize(body, null); + } + + /** + * + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @param headers Optional headers to include in the request + * @return Boolean + * @throws ApiException if fails to make API call + */ + public Boolean fakeOuterBooleanSerialize(@javax.annotation.Nullable Boolean body, Map headers) throws ApiException { + ApiResponse localVarResponse = fakeOuterBooleanSerializeWithHttpInfo(body, headers); return localVarResponse.getData(); } @@ -306,7 +342,19 @@ public Boolean fakeOuterBooleanSerialize(@javax.annotation.Nullable Boolean body * @throws ApiException if fails to make API call */ public ApiResponse fakeOuterBooleanSerializeWithHttpInfo(@javax.annotation.Nullable Boolean body) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = fakeOuterBooleanSerializeRequestBuilder(body); + return fakeOuterBooleanSerializeWithHttpInfo(body, null); + } + + /** + * + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<Boolean> + * @throws ApiException if fails to make API call + */ + public ApiResponse fakeOuterBooleanSerializeWithHttpInfo(@javax.annotation.Nullable Boolean body, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = fakeOuterBooleanSerializeRequestBuilder(body, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -345,7 +393,7 @@ public ApiResponse fakeOuterBooleanSerializeWithHttpInfo(@javax.annotat } } - private HttpRequest.Builder fakeOuterBooleanSerializeRequestBuilder(@javax.annotation.Nullable Boolean body) throws ApiException { + private HttpRequest.Builder fakeOuterBooleanSerializeRequestBuilder(@javax.annotation.Nullable Boolean body, Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -365,9 +413,11 @@ private HttpRequest.Builder fakeOuterBooleanSerializeRequestBuilder(@javax.annot if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -383,7 +433,19 @@ private HttpRequest.Builder fakeOuterBooleanSerializeRequestBuilder(@javax.annot * @throws ApiException if fails to make API call */ public OuterComposite fakeOuterCompositeSerialize(@javax.annotation.Nullable OuterComposite outerComposite) throws ApiException { - ApiResponse localVarResponse = fakeOuterCompositeSerializeWithHttpInfo(outerComposite); + return fakeOuterCompositeSerialize(outerComposite, null); + } + + /** + * + * Test serialization of object with outer number type + * @param outerComposite Input composite as post body (optional) + * @param headers Optional headers to include in the request + * @return OuterComposite + * @throws ApiException if fails to make API call + */ + public OuterComposite fakeOuterCompositeSerialize(@javax.annotation.Nullable OuterComposite outerComposite, Map headers) throws ApiException { + ApiResponse localVarResponse = fakeOuterCompositeSerializeWithHttpInfo(outerComposite, headers); return localVarResponse.getData(); } @@ -395,7 +457,19 @@ public OuterComposite fakeOuterCompositeSerialize(@javax.annotation.Nullable Out * @throws ApiException if fails to make API call */ public ApiResponse fakeOuterCompositeSerializeWithHttpInfo(@javax.annotation.Nullable OuterComposite outerComposite) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = fakeOuterCompositeSerializeRequestBuilder(outerComposite); + return fakeOuterCompositeSerializeWithHttpInfo(outerComposite, null); + } + + /** + * + * Test serialization of object with outer number type + * @param outerComposite Input composite as post body (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<OuterComposite> + * @throws ApiException if fails to make API call + */ + public ApiResponse fakeOuterCompositeSerializeWithHttpInfo(@javax.annotation.Nullable OuterComposite outerComposite, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = fakeOuterCompositeSerializeRequestBuilder(outerComposite, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -434,7 +508,7 @@ public ApiResponse fakeOuterCompositeSerializeWithHttpInfo(@java } } - private HttpRequest.Builder fakeOuterCompositeSerializeRequestBuilder(@javax.annotation.Nullable OuterComposite outerComposite) throws ApiException { + private HttpRequest.Builder fakeOuterCompositeSerializeRequestBuilder(@javax.annotation.Nullable OuterComposite outerComposite, Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -454,9 +528,11 @@ private HttpRequest.Builder fakeOuterCompositeSerializeRequestBuilder(@javax.ann if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -472,7 +548,19 @@ private HttpRequest.Builder fakeOuterCompositeSerializeRequestBuilder(@javax.ann * @throws ApiException if fails to make API call */ public BigDecimal fakeOuterNumberSerialize(@javax.annotation.Nullable BigDecimal body) throws ApiException { - ApiResponse localVarResponse = fakeOuterNumberSerializeWithHttpInfo(body); + return fakeOuterNumberSerialize(body, null); + } + + /** + * + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @param headers Optional headers to include in the request + * @return BigDecimal + * @throws ApiException if fails to make API call + */ + public BigDecimal fakeOuterNumberSerialize(@javax.annotation.Nullable BigDecimal body, Map headers) throws ApiException { + ApiResponse localVarResponse = fakeOuterNumberSerializeWithHttpInfo(body, headers); return localVarResponse.getData(); } @@ -484,7 +572,19 @@ public BigDecimal fakeOuterNumberSerialize(@javax.annotation.Nullable BigDecimal * @throws ApiException if fails to make API call */ public ApiResponse fakeOuterNumberSerializeWithHttpInfo(@javax.annotation.Nullable BigDecimal body) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = fakeOuterNumberSerializeRequestBuilder(body); + return fakeOuterNumberSerializeWithHttpInfo(body, null); + } + + /** + * + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<BigDecimal> + * @throws ApiException if fails to make API call + */ + public ApiResponse fakeOuterNumberSerializeWithHttpInfo(@javax.annotation.Nullable BigDecimal body, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = fakeOuterNumberSerializeRequestBuilder(body, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -523,7 +623,7 @@ public ApiResponse fakeOuterNumberSerializeWithHttpInfo(@javax.annot } } - private HttpRequest.Builder fakeOuterNumberSerializeRequestBuilder(@javax.annotation.Nullable BigDecimal body) throws ApiException { + private HttpRequest.Builder fakeOuterNumberSerializeRequestBuilder(@javax.annotation.Nullable BigDecimal body, Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -543,9 +643,11 @@ private HttpRequest.Builder fakeOuterNumberSerializeRequestBuilder(@javax.annota if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -561,7 +663,19 @@ private HttpRequest.Builder fakeOuterNumberSerializeRequestBuilder(@javax.annota * @throws ApiException if fails to make API call */ public String fakeOuterStringSerialize(@javax.annotation.Nullable String body) throws ApiException { - ApiResponse localVarResponse = fakeOuterStringSerializeWithHttpInfo(body); + return fakeOuterStringSerialize(body, null); + } + + /** + * + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @param headers Optional headers to include in the request + * @return String + * @throws ApiException if fails to make API call + */ + public String fakeOuterStringSerialize(@javax.annotation.Nullable String body, Map headers) throws ApiException { + ApiResponse localVarResponse = fakeOuterStringSerializeWithHttpInfo(body, headers); return localVarResponse.getData(); } @@ -573,7 +687,19 @@ public String fakeOuterStringSerialize(@javax.annotation.Nullable String body) t * @throws ApiException if fails to make API call */ public ApiResponse fakeOuterStringSerializeWithHttpInfo(@javax.annotation.Nullable String body) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = fakeOuterStringSerializeRequestBuilder(body); + return fakeOuterStringSerializeWithHttpInfo(body, null); + } + + /** + * + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<String> + * @throws ApiException if fails to make API call + */ + public ApiResponse fakeOuterStringSerializeWithHttpInfo(@javax.annotation.Nullable String body, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = fakeOuterStringSerializeRequestBuilder(body, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -612,7 +738,7 @@ public ApiResponse fakeOuterStringSerializeWithHttpInfo(@javax.annotatio } } - private HttpRequest.Builder fakeOuterStringSerializeRequestBuilder(@javax.annotation.Nullable String body) throws ApiException { + private HttpRequest.Builder fakeOuterStringSerializeRequestBuilder(@javax.annotation.Nullable String body, Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -627,9 +753,11 @@ private HttpRequest.Builder fakeOuterStringSerializeRequestBuilder(@javax.annota if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -644,7 +772,18 @@ private HttpRequest.Builder fakeOuterStringSerializeRequestBuilder(@javax.annota * @throws ApiException if fails to make API call */ public List getApplicationJsonUtf8() throws ApiException { - ApiResponse> localVarResponse = getApplicationJsonUtf8WithHttpInfo(); + return getApplicationJsonUtf8(null); + } + + /** + * application/json UTF8 + * + * @param headers Optional headers to include in the request + * @return List<OuterEnum> + * @throws ApiException if fails to make API call + */ + public List getApplicationJsonUtf8(Map headers) throws ApiException { + ApiResponse> localVarResponse = getApplicationJsonUtf8WithHttpInfo(headers); return localVarResponse.getData(); } @@ -655,7 +794,18 @@ public List getApplicationJsonUtf8() throws ApiException { * @throws ApiException if fails to make API call */ public ApiResponse> getApplicationJsonUtf8WithHttpInfo() throws ApiException { - HttpRequest.Builder localVarRequestBuilder = getApplicationJsonUtf8RequestBuilder(); + return getApplicationJsonUtf8WithHttpInfo(null); + } + + /** + * application/json UTF8 + * + * @param headers Optional headers to include in the request + * @return ApiResponse<List<OuterEnum>> + * @throws ApiException if fails to make API call + */ + public ApiResponse> getApplicationJsonUtf8WithHttpInfo(Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = getApplicationJsonUtf8RequestBuilder(headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -694,7 +844,7 @@ public ApiResponse> getApplicationJsonUtf8WithHttpInfo() throws } } - private HttpRequest.Builder getApplicationJsonUtf8RequestBuilder() throws ApiException { + private HttpRequest.Builder getApplicationJsonUtf8RequestBuilder(Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -708,9 +858,11 @@ private HttpRequest.Builder getApplicationJsonUtf8RequestBuilder() throws ApiExc if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -725,7 +877,18 @@ private HttpRequest.Builder getApplicationJsonUtf8RequestBuilder() throws ApiExc * @throws ApiException if fails to make API call */ public List getArrayOfEnums() throws ApiException { - ApiResponse> localVarResponse = getArrayOfEnumsWithHttpInfo(); + return getArrayOfEnums(null); + } + + /** + * Array of Enums + * + * @param headers Optional headers to include in the request + * @return List<OuterEnum> + * @throws ApiException if fails to make API call + */ + public List getArrayOfEnums(Map headers) throws ApiException { + ApiResponse> localVarResponse = getArrayOfEnumsWithHttpInfo(headers); return localVarResponse.getData(); } @@ -736,7 +899,18 @@ public List getArrayOfEnums() throws ApiException { * @throws ApiException if fails to make API call */ public ApiResponse> getArrayOfEnumsWithHttpInfo() throws ApiException { - HttpRequest.Builder localVarRequestBuilder = getArrayOfEnumsRequestBuilder(); + return getArrayOfEnumsWithHttpInfo(null); + } + + /** + * Array of Enums + * + * @param headers Optional headers to include in the request + * @return ApiResponse<List<OuterEnum>> + * @throws ApiException if fails to make API call + */ + public ApiResponse> getArrayOfEnumsWithHttpInfo(Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = getArrayOfEnumsRequestBuilder(headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -775,7 +949,7 @@ public ApiResponse> getArrayOfEnumsWithHttpInfo() throws ApiExce } } - private HttpRequest.Builder getArrayOfEnumsRequestBuilder() throws ApiException { + private HttpRequest.Builder getArrayOfEnumsRequestBuilder(Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -789,9 +963,11 @@ private HttpRequest.Builder getArrayOfEnumsRequestBuilder() throws ApiException if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -806,7 +982,18 @@ private HttpRequest.Builder getArrayOfEnumsRequestBuilder() throws ApiException * @throws ApiException if fails to make API call */ public void testAdditionalPropertiesReference(@javax.annotation.Nonnull Map requestBody) throws ApiException { - testAdditionalPropertiesReferenceWithHttpInfo(requestBody); + testAdditionalPropertiesReference(requestBody, null); + } + + /** + * test referenced additionalProperties + * + * @param requestBody request body (required) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void testAdditionalPropertiesReference(@javax.annotation.Nonnull Map requestBody, Map headers) throws ApiException { + testAdditionalPropertiesReferenceWithHttpInfo(requestBody, headers); } /** @@ -817,7 +1004,19 @@ public void testAdditionalPropertiesReference(@javax.annotation.Nonnull Map testAdditionalPropertiesReferenceWithHttpInfo(@javax.annotation.Nonnull Map requestBody) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = testAdditionalPropertiesReferenceRequestBuilder(requestBody); + return testAdditionalPropertiesReferenceWithHttpInfo(requestBody, null); + } + + /** + * test referenced additionalProperties + * + * @param requestBody request body (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse testAdditionalPropertiesReferenceWithHttpInfo(@javax.annotation.Nonnull Map requestBody, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = testAdditionalPropertiesReferenceRequestBuilder(requestBody, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -850,7 +1049,7 @@ public ApiResponse testAdditionalPropertiesReferenceWithHttpInfo(@javax.an } } - private HttpRequest.Builder testAdditionalPropertiesReferenceRequestBuilder(@javax.annotation.Nonnull Map requestBody) throws ApiException { + private HttpRequest.Builder testAdditionalPropertiesReferenceRequestBuilder(@javax.annotation.Nonnull Map requestBody, Map headers) throws ApiException { // verify the required parameter 'requestBody' is set if (requestBody == null) { throw new ApiException(400, "Missing the required parameter 'requestBody' when calling testAdditionalPropertiesReference"); @@ -874,9 +1073,11 @@ private HttpRequest.Builder testAdditionalPropertiesReferenceRequestBuilder(@jav if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -891,7 +1092,18 @@ private HttpRequest.Builder testAdditionalPropertiesReferenceRequestBuilder(@jav * @throws ApiException if fails to make API call */ public void testBodyWithFileSchema(@javax.annotation.Nonnull FileSchemaTestClass fileSchemaTestClass) throws ApiException { - testBodyWithFileSchemaWithHttpInfo(fileSchemaTestClass); + testBodyWithFileSchema(fileSchemaTestClass, null); + } + + /** + * + * For this test, the body for this request much reference a schema named `File`. + * @param fileSchemaTestClass (required) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void testBodyWithFileSchema(@javax.annotation.Nonnull FileSchemaTestClass fileSchemaTestClass, Map headers) throws ApiException { + testBodyWithFileSchemaWithHttpInfo(fileSchemaTestClass, headers); } /** @@ -902,7 +1114,19 @@ public void testBodyWithFileSchema(@javax.annotation.Nonnull FileSchemaTestClass * @throws ApiException if fails to make API call */ public ApiResponse testBodyWithFileSchemaWithHttpInfo(@javax.annotation.Nonnull FileSchemaTestClass fileSchemaTestClass) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = testBodyWithFileSchemaRequestBuilder(fileSchemaTestClass); + return testBodyWithFileSchemaWithHttpInfo(fileSchemaTestClass, null); + } + + /** + * + * For this test, the body for this request much reference a schema named `File`. + * @param fileSchemaTestClass (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse testBodyWithFileSchemaWithHttpInfo(@javax.annotation.Nonnull FileSchemaTestClass fileSchemaTestClass, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = testBodyWithFileSchemaRequestBuilder(fileSchemaTestClass, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -935,7 +1159,7 @@ public ApiResponse testBodyWithFileSchemaWithHttpInfo(@javax.annotation.No } } - private HttpRequest.Builder testBodyWithFileSchemaRequestBuilder(@javax.annotation.Nonnull FileSchemaTestClass fileSchemaTestClass) throws ApiException { + private HttpRequest.Builder testBodyWithFileSchemaRequestBuilder(@javax.annotation.Nonnull FileSchemaTestClass fileSchemaTestClass, Map headers) throws ApiException { // verify the required parameter 'fileSchemaTestClass' is set if (fileSchemaTestClass == null) { throw new ApiException(400, "Missing the required parameter 'fileSchemaTestClass' when calling testBodyWithFileSchema"); @@ -959,9 +1183,11 @@ private HttpRequest.Builder testBodyWithFileSchemaRequestBuilder(@javax.annotati if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -977,7 +1203,19 @@ private HttpRequest.Builder testBodyWithFileSchemaRequestBuilder(@javax.annotati * @throws ApiException if fails to make API call */ public void testBodyWithQueryParams(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull User user) throws ApiException { - testBodyWithQueryParamsWithHttpInfo(query, user); + testBodyWithQueryParams(query, user, null); + } + + /** + * + * + * @param query (required) + * @param user (required) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void testBodyWithQueryParams(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull User user, Map headers) throws ApiException { + testBodyWithQueryParamsWithHttpInfo(query, user, headers); } /** @@ -989,7 +1227,20 @@ public void testBodyWithQueryParams(@javax.annotation.Nonnull String query, @jav * @throws ApiException if fails to make API call */ public ApiResponse testBodyWithQueryParamsWithHttpInfo(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull User user) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = testBodyWithQueryParamsRequestBuilder(query, user); + return testBodyWithQueryParamsWithHttpInfo(query, user, null); + } + + /** + * + * + * @param query (required) + * @param user (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse testBodyWithQueryParamsWithHttpInfo(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull User user, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = testBodyWithQueryParamsRequestBuilder(query, user, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -1022,7 +1273,7 @@ public ApiResponse testBodyWithQueryParamsWithHttpInfo(@javax.annotation.N } } - private HttpRequest.Builder testBodyWithQueryParamsRequestBuilder(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull User user) throws ApiException { + private HttpRequest.Builder testBodyWithQueryParamsRequestBuilder(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull User user, Map headers) throws ApiException { // verify the required parameter 'query' is set if (query == null) { throw new ApiException(400, "Missing the required parameter 'query' when calling testBodyWithQueryParams"); @@ -1065,9 +1316,11 @@ private HttpRequest.Builder testBodyWithQueryParamsRequestBuilder(@javax.annotat if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -1083,7 +1336,19 @@ private HttpRequest.Builder testBodyWithQueryParamsRequestBuilder(@javax.annotat * @throws ApiException if fails to make API call */ public Client testClientModel(@javax.annotation.Nonnull Client client) throws ApiException { - ApiResponse localVarResponse = testClientModelWithHttpInfo(client); + return testClientModel(client, null); + } + + /** + * To test \"client\" model + * To test \"client\" model + * @param client client model (required) + * @param headers Optional headers to include in the request + * @return Client + * @throws ApiException if fails to make API call + */ + public Client testClientModel(@javax.annotation.Nonnull Client client, Map headers) throws ApiException { + ApiResponse localVarResponse = testClientModelWithHttpInfo(client, headers); return localVarResponse.getData(); } @@ -1095,7 +1360,19 @@ public Client testClientModel(@javax.annotation.Nonnull Client client) throws Ap * @throws ApiException if fails to make API call */ public ApiResponse testClientModelWithHttpInfo(@javax.annotation.Nonnull Client client) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = testClientModelRequestBuilder(client); + return testClientModelWithHttpInfo(client, null); + } + + /** + * To test \"client\" model + * To test \"client\" model + * @param client client model (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Client> + * @throws ApiException if fails to make API call + */ + public ApiResponse testClientModelWithHttpInfo(@javax.annotation.Nonnull Client client, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = testClientModelRequestBuilder(client, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -1134,7 +1411,7 @@ public ApiResponse testClientModelWithHttpInfo(@javax.annotation.Nonnull } } - private HttpRequest.Builder testClientModelRequestBuilder(@javax.annotation.Nonnull Client client) throws ApiException { + private HttpRequest.Builder testClientModelRequestBuilder(@javax.annotation.Nonnull Client client, Map headers) throws ApiException { // verify the required parameter 'client' is set if (client == null) { throw new ApiException(400, "Missing the required parameter 'client' when calling testClientModel"); @@ -1158,9 +1435,11 @@ private HttpRequest.Builder testClientModelRequestBuilder(@javax.annotation.Nonn if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -1188,7 +1467,31 @@ private HttpRequest.Builder testClientModelRequestBuilder(@javax.annotation.Nonn * @throws ApiException if fails to make API call */ public void testEndpointParameters(@javax.annotation.Nonnull BigDecimal number, @javax.annotation.Nonnull Double _double, @javax.annotation.Nonnull String patternWithoutDelimiter, @javax.annotation.Nonnull byte[] _byte, @javax.annotation.Nullable Integer integer, @javax.annotation.Nullable Integer int32, @javax.annotation.Nullable Long int64, @javax.annotation.Nullable Float _float, @javax.annotation.Nullable String string, @javax.annotation.Nullable File binary, @javax.annotation.Nullable LocalDate date, @javax.annotation.Nullable OffsetDateTime dateTime, @javax.annotation.Nullable String password, @javax.annotation.Nullable String paramCallback) throws ApiException { - testEndpointParametersWithHttpInfo(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); + testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, null); + } + + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * @param number None (required) + * @param _double None (required) + * @param patternWithoutDelimiter None (required) + * @param _byte None (required) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param string None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional, default to 2010-02-01T10:20:10.111110+01:00) + * @param password None (optional) + * @param paramCallback None (optional) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void testEndpointParameters(@javax.annotation.Nonnull BigDecimal number, @javax.annotation.Nonnull Double _double, @javax.annotation.Nonnull String patternWithoutDelimiter, @javax.annotation.Nonnull byte[] _byte, @javax.annotation.Nullable Integer integer, @javax.annotation.Nullable Integer int32, @javax.annotation.Nullable Long int64, @javax.annotation.Nullable Float _float, @javax.annotation.Nullable String string, @javax.annotation.Nullable File binary, @javax.annotation.Nullable LocalDate date, @javax.annotation.Nullable OffsetDateTime dateTime, @javax.annotation.Nullable String password, @javax.annotation.Nullable String paramCallback, Map headers) throws ApiException { + testEndpointParametersWithHttpInfo(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, headers); } /** @@ -1212,7 +1515,32 @@ public void testEndpointParameters(@javax.annotation.Nonnull BigDecimal number, * @throws ApiException if fails to make API call */ public ApiResponse testEndpointParametersWithHttpInfo(@javax.annotation.Nonnull BigDecimal number, @javax.annotation.Nonnull Double _double, @javax.annotation.Nonnull String patternWithoutDelimiter, @javax.annotation.Nonnull byte[] _byte, @javax.annotation.Nullable Integer integer, @javax.annotation.Nullable Integer int32, @javax.annotation.Nullable Long int64, @javax.annotation.Nullable Float _float, @javax.annotation.Nullable String string, @javax.annotation.Nullable File binary, @javax.annotation.Nullable LocalDate date, @javax.annotation.Nullable OffsetDateTime dateTime, @javax.annotation.Nullable String password, @javax.annotation.Nullable String paramCallback) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = testEndpointParametersRequestBuilder(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); + return testEndpointParametersWithHttpInfo(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, null); + } + + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * @param number None (required) + * @param _double None (required) + * @param patternWithoutDelimiter None (required) + * @param _byte None (required) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param string None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional, default to 2010-02-01T10:20:10.111110+01:00) + * @param password None (optional) + * @param paramCallback None (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse testEndpointParametersWithHttpInfo(@javax.annotation.Nonnull BigDecimal number, @javax.annotation.Nonnull Double _double, @javax.annotation.Nonnull String patternWithoutDelimiter, @javax.annotation.Nonnull byte[] _byte, @javax.annotation.Nullable Integer integer, @javax.annotation.Nullable Integer int32, @javax.annotation.Nullable Long int64, @javax.annotation.Nullable Float _float, @javax.annotation.Nullable String string, @javax.annotation.Nullable File binary, @javax.annotation.Nullable LocalDate date, @javax.annotation.Nullable OffsetDateTime dateTime, @javax.annotation.Nullable String password, @javax.annotation.Nullable String paramCallback, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = testEndpointParametersRequestBuilder(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -1245,7 +1573,7 @@ public ApiResponse testEndpointParametersWithHttpInfo(@javax.annotation.No } } - private HttpRequest.Builder testEndpointParametersRequestBuilder(@javax.annotation.Nonnull BigDecimal number, @javax.annotation.Nonnull Double _double, @javax.annotation.Nonnull String patternWithoutDelimiter, @javax.annotation.Nonnull byte[] _byte, @javax.annotation.Nullable Integer integer, @javax.annotation.Nullable Integer int32, @javax.annotation.Nullable Long int64, @javax.annotation.Nullable Float _float, @javax.annotation.Nullable String string, @javax.annotation.Nullable File binary, @javax.annotation.Nullable LocalDate date, @javax.annotation.Nullable OffsetDateTime dateTime, @javax.annotation.Nullable String password, @javax.annotation.Nullable String paramCallback) throws ApiException { + private HttpRequest.Builder testEndpointParametersRequestBuilder(@javax.annotation.Nonnull BigDecimal number, @javax.annotation.Nonnull Double _double, @javax.annotation.Nonnull String patternWithoutDelimiter, @javax.annotation.Nonnull byte[] _byte, @javax.annotation.Nullable Integer integer, @javax.annotation.Nullable Integer int32, @javax.annotation.Nullable Long int64, @javax.annotation.Nullable Float _float, @javax.annotation.Nullable String string, @javax.annotation.Nullable File binary, @javax.annotation.Nullable LocalDate date, @javax.annotation.Nullable OffsetDateTime dateTime, @javax.annotation.Nullable String password, @javax.annotation.Nullable String paramCallback, Map headers) throws ApiException { // verify the required parameter 'number' is set if (number == null) { throw new ApiException(400, "Missing the required parameter 'number' when calling testEndpointParameters"); @@ -1328,9 +1656,11 @@ private HttpRequest.Builder testEndpointParametersRequestBuilder(@javax.annotati if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -1352,7 +1682,25 @@ private HttpRequest.Builder testEndpointParametersRequestBuilder(@javax.annotati * @throws ApiException if fails to make API call */ public void testEnumParameters(@javax.annotation.Nullable List enumHeaderStringArray, @javax.annotation.Nullable String enumHeaderString, @javax.annotation.Nullable List enumQueryStringArray, @javax.annotation.Nullable String enumQueryString, @javax.annotation.Nullable Integer enumQueryInteger, @javax.annotation.Nullable Double enumQueryDouble, @javax.annotation.Nullable List enumFormStringArray, @javax.annotation.Nullable String enumFormString) throws ApiException { - testEnumParametersWithHttpInfo(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, null); + } + + /** + * To test enum parameters + * To test enum parameters + * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional) + * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) + * @param enumQueryInteger Query parameter enum test (double) (optional) + * @param enumQueryDouble Query parameter enum test (double) (optional) + * @param enumFormStringArray Form parameter enum test (string array) (optional) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void testEnumParameters(@javax.annotation.Nullable List enumHeaderStringArray, @javax.annotation.Nullable String enumHeaderString, @javax.annotation.Nullable List enumQueryStringArray, @javax.annotation.Nullable String enumQueryString, @javax.annotation.Nullable Integer enumQueryInteger, @javax.annotation.Nullable Double enumQueryDouble, @javax.annotation.Nullable List enumFormStringArray, @javax.annotation.Nullable String enumFormString, Map headers) throws ApiException { + testEnumParametersWithHttpInfo(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, headers); } /** @@ -1370,7 +1718,26 @@ public void testEnumParameters(@javax.annotation.Nullable List enumHeade * @throws ApiException if fails to make API call */ public ApiResponse testEnumParametersWithHttpInfo(@javax.annotation.Nullable List enumHeaderStringArray, @javax.annotation.Nullable String enumHeaderString, @javax.annotation.Nullable List enumQueryStringArray, @javax.annotation.Nullable String enumQueryString, @javax.annotation.Nullable Integer enumQueryInteger, @javax.annotation.Nullable Double enumQueryDouble, @javax.annotation.Nullable List enumFormStringArray, @javax.annotation.Nullable String enumFormString) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = testEnumParametersRequestBuilder(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + return testEnumParametersWithHttpInfo(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, null); + } + + /** + * To test enum parameters + * To test enum parameters + * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional) + * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) + * @param enumQueryInteger Query parameter enum test (double) (optional) + * @param enumQueryDouble Query parameter enum test (double) (optional) + * @param enumFormStringArray Form parameter enum test (string array) (optional) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse testEnumParametersWithHttpInfo(@javax.annotation.Nullable List enumHeaderStringArray, @javax.annotation.Nullable String enumHeaderString, @javax.annotation.Nullable List enumQueryStringArray, @javax.annotation.Nullable String enumQueryString, @javax.annotation.Nullable Integer enumQueryInteger, @javax.annotation.Nullable Double enumQueryDouble, @javax.annotation.Nullable List enumFormStringArray, @javax.annotation.Nullable String enumFormString, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = testEnumParametersRequestBuilder(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -1403,7 +1770,7 @@ public ApiResponse testEnumParametersWithHttpInfo(@javax.annotation.Nullab } } - private HttpRequest.Builder testEnumParametersRequestBuilder(@javax.annotation.Nullable List enumHeaderStringArray, @javax.annotation.Nullable String enumHeaderString, @javax.annotation.Nullable List enumQueryStringArray, @javax.annotation.Nullable String enumQueryString, @javax.annotation.Nullable Integer enumQueryInteger, @javax.annotation.Nullable Double enumQueryDouble, @javax.annotation.Nullable List enumFormStringArray, @javax.annotation.Nullable String enumFormString) throws ApiException { + private HttpRequest.Builder testEnumParametersRequestBuilder(@javax.annotation.Nullable List enumHeaderStringArray, @javax.annotation.Nullable String enumHeaderString, @javax.annotation.Nullable List enumQueryStringArray, @javax.annotation.Nullable String enumQueryString, @javax.annotation.Nullable Integer enumQueryInteger, @javax.annotation.Nullable Double enumQueryDouble, @javax.annotation.Nullable List enumFormStringArray, @javax.annotation.Nullable String enumFormString, Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -1463,9 +1830,11 @@ private HttpRequest.Builder testEnumParametersRequestBuilder(@javax.annotation.N if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -1480,6 +1849,17 @@ private HttpRequest.Builder testEnumParametersRequestBuilder(@javax.annotation.N * @throws ApiException if fails to make API call */ public void testGroupParameters(APITestGroupParametersRequest apiRequest) throws ApiException { + testGroupParameters(apiRequest, null); + } + + /** + * Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * @param apiRequest {@link APITestGroupParametersRequest} + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void testGroupParameters(APITestGroupParametersRequest apiRequest, Map headers) throws ApiException { @javax.annotation.Nonnull Integer requiredStringGroup = apiRequest.requiredStringGroup(); @javax.annotation.Nonnull @@ -1492,7 +1872,7 @@ public void testGroupParameters(APITestGroupParametersRequest apiRequest) throws Boolean booleanGroup = apiRequest.booleanGroup(); @javax.annotation.Nullable Long int64Group = apiRequest.int64Group(); - testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, headers); } /** @@ -1503,13 +1883,25 @@ public void testGroupParameters(APITestGroupParametersRequest apiRequest) throws * @throws ApiException if fails to make API call */ public ApiResponse testGroupParametersWithHttpInfo(APITestGroupParametersRequest apiRequest) throws ApiException { + return testGroupParametersWithHttpInfo(apiRequest, null); + } + + /** + * Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * @param apiRequest {@link APITestGroupParametersRequest} + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse testGroupParametersWithHttpInfo(APITestGroupParametersRequest apiRequest, Map headers) throws ApiException { Integer requiredStringGroup = apiRequest.requiredStringGroup(); Boolean requiredBooleanGroup = apiRequest.requiredBooleanGroup(); Long requiredInt64Group = apiRequest.requiredInt64Group(); Integer stringGroup = apiRequest.stringGroup(); Boolean booleanGroup = apiRequest.booleanGroup(); Long int64Group = apiRequest.int64Group(); - return testGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + return testGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, headers); } /** @@ -1524,7 +1916,23 @@ public ApiResponse testGroupParametersWithHttpInfo(APITestGroupParametersR * @throws ApiException if fails to make API call */ public void testGroupParameters(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group, @javax.annotation.Nullable Integer stringGroup, @javax.annotation.Nullable Boolean booleanGroup, @javax.annotation.Nullable Long int64Group) throws ApiException { - testGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, null); + } + + /** + * Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * @param requiredStringGroup Required String in group parameters (required) + * @param requiredBooleanGroup Required Boolean in group parameters (required) + * @param requiredInt64Group Required Integer in group parameters (required) + * @param stringGroup String in group parameters (optional) + * @param booleanGroup Boolean in group parameters (optional) + * @param int64Group Integer in group parameters (optional) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void testGroupParameters(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group, @javax.annotation.Nullable Integer stringGroup, @javax.annotation.Nullable Boolean booleanGroup, @javax.annotation.Nullable Long int64Group, Map headers) throws ApiException { + testGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, headers); } /** @@ -1540,7 +1948,24 @@ public void testGroupParameters(@javax.annotation.Nonnull Integer requiredString * @throws ApiException if fails to make API call */ public ApiResponse testGroupParametersWithHttpInfo(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group, @javax.annotation.Nullable Integer stringGroup, @javax.annotation.Nullable Boolean booleanGroup, @javax.annotation.Nullable Long int64Group) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = testGroupParametersRequestBuilder(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + return testGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, null); + } + + /** + * Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * @param requiredStringGroup Required String in group parameters (required) + * @param requiredBooleanGroup Required Boolean in group parameters (required) + * @param requiredInt64Group Required Integer in group parameters (required) + * @param stringGroup String in group parameters (optional) + * @param booleanGroup Boolean in group parameters (optional) + * @param int64Group Integer in group parameters (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse testGroupParametersWithHttpInfo(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group, @javax.annotation.Nullable Integer stringGroup, @javax.annotation.Nullable Boolean booleanGroup, @javax.annotation.Nullable Long int64Group, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = testGroupParametersRequestBuilder(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -1573,7 +1998,7 @@ public ApiResponse testGroupParametersWithHttpInfo(@javax.annotation.Nonnu } } - private HttpRequest.Builder testGroupParametersRequestBuilder(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group, @javax.annotation.Nullable Integer stringGroup, @javax.annotation.Nullable Boolean booleanGroup, @javax.annotation.Nullable Long int64Group) throws ApiException { + private HttpRequest.Builder testGroupParametersRequestBuilder(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group, @javax.annotation.Nullable Integer stringGroup, @javax.annotation.Nullable Boolean booleanGroup, @javax.annotation.Nullable Long int64Group, Map headers) throws ApiException { // verify the required parameter 'requiredStringGroup' is set if (requiredStringGroup == null) { throw new ApiException(400, "Missing the required parameter 'requiredStringGroup' when calling testGroupParameters"); @@ -1626,9 +2051,11 @@ private HttpRequest.Builder testGroupParametersRequestBuilder(@javax.annotation. if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -1732,7 +2159,18 @@ public APITestGroupParametersRequest build() { * @throws ApiException if fails to make API call */ public void testInlineAdditionalProperties(@javax.annotation.Nonnull Map requestBody) throws ApiException { - testInlineAdditionalPropertiesWithHttpInfo(requestBody); + testInlineAdditionalProperties(requestBody, null); + } + + /** + * test inline additionalProperties + * + * @param requestBody request body (required) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void testInlineAdditionalProperties(@javax.annotation.Nonnull Map requestBody, Map headers) throws ApiException { + testInlineAdditionalPropertiesWithHttpInfo(requestBody, headers); } /** @@ -1743,7 +2181,19 @@ public void testInlineAdditionalProperties(@javax.annotation.Nonnull Map testInlineAdditionalPropertiesWithHttpInfo(@javax.annotation.Nonnull Map requestBody) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = testInlineAdditionalPropertiesRequestBuilder(requestBody); + return testInlineAdditionalPropertiesWithHttpInfo(requestBody, null); + } + + /** + * test inline additionalProperties + * + * @param requestBody request body (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse testInlineAdditionalPropertiesWithHttpInfo(@javax.annotation.Nonnull Map requestBody, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = testInlineAdditionalPropertiesRequestBuilder(requestBody, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -1776,7 +2226,7 @@ public ApiResponse testInlineAdditionalPropertiesWithHttpInfo(@javax.annot } } - private HttpRequest.Builder testInlineAdditionalPropertiesRequestBuilder(@javax.annotation.Nonnull Map requestBody) throws ApiException { + private HttpRequest.Builder testInlineAdditionalPropertiesRequestBuilder(@javax.annotation.Nonnull Map requestBody, Map headers) throws ApiException { // verify the required parameter 'requestBody' is set if (requestBody == null) { throw new ApiException(400, "Missing the required parameter 'requestBody' when calling testInlineAdditionalProperties"); @@ -1800,9 +2250,11 @@ private HttpRequest.Builder testInlineAdditionalPropertiesRequestBuilder(@javax. if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -1817,7 +2269,18 @@ private HttpRequest.Builder testInlineAdditionalPropertiesRequestBuilder(@javax. * @throws ApiException if fails to make API call */ public void testInlineFreeformAdditionalProperties(@javax.annotation.Nonnull TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest) throws ApiException { - testInlineFreeformAdditionalPropertiesWithHttpInfo(testInlineFreeformAdditionalPropertiesRequest); + testInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest, null); + } + + /** + * test inline free-form additionalProperties + * + * @param testInlineFreeformAdditionalPropertiesRequest request body (required) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void testInlineFreeformAdditionalProperties(@javax.annotation.Nonnull TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, Map headers) throws ApiException { + testInlineFreeformAdditionalPropertiesWithHttpInfo(testInlineFreeformAdditionalPropertiesRequest, headers); } /** @@ -1828,7 +2291,19 @@ public void testInlineFreeformAdditionalProperties(@javax.annotation.Nonnull Tes * @throws ApiException if fails to make API call */ public ApiResponse testInlineFreeformAdditionalPropertiesWithHttpInfo(@javax.annotation.Nonnull TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = testInlineFreeformAdditionalPropertiesRequestBuilder(testInlineFreeformAdditionalPropertiesRequest); + return testInlineFreeformAdditionalPropertiesWithHttpInfo(testInlineFreeformAdditionalPropertiesRequest, null); + } + + /** + * test inline free-form additionalProperties + * + * @param testInlineFreeformAdditionalPropertiesRequest request body (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse testInlineFreeformAdditionalPropertiesWithHttpInfo(@javax.annotation.Nonnull TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = testInlineFreeformAdditionalPropertiesRequestBuilder(testInlineFreeformAdditionalPropertiesRequest, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -1861,7 +2336,7 @@ public ApiResponse testInlineFreeformAdditionalPropertiesWithHttpInfo(@jav } } - private HttpRequest.Builder testInlineFreeformAdditionalPropertiesRequestBuilder(@javax.annotation.Nonnull TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest) throws ApiException { + private HttpRequest.Builder testInlineFreeformAdditionalPropertiesRequestBuilder(@javax.annotation.Nonnull TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, Map headers) throws ApiException { // verify the required parameter 'testInlineFreeformAdditionalPropertiesRequest' is set if (testInlineFreeformAdditionalPropertiesRequest == null) { throw new ApiException(400, "Missing the required parameter 'testInlineFreeformAdditionalPropertiesRequest' when calling testInlineFreeformAdditionalProperties"); @@ -1885,9 +2360,11 @@ private HttpRequest.Builder testInlineFreeformAdditionalPropertiesRequestBuilder if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -1903,7 +2380,19 @@ private HttpRequest.Builder testInlineFreeformAdditionalPropertiesRequestBuilder * @throws ApiException if fails to make API call */ public void testJsonFormData(@javax.annotation.Nonnull String param, @javax.annotation.Nonnull String param2) throws ApiException { - testJsonFormDataWithHttpInfo(param, param2); + testJsonFormData(param, param2, null); + } + + /** + * test json serialization of form data + * + * @param param field1 (required) + * @param param2 field2 (required) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void testJsonFormData(@javax.annotation.Nonnull String param, @javax.annotation.Nonnull String param2, Map headers) throws ApiException { + testJsonFormDataWithHttpInfo(param, param2, headers); } /** @@ -1915,7 +2404,20 @@ public void testJsonFormData(@javax.annotation.Nonnull String param, @javax.anno * @throws ApiException if fails to make API call */ public ApiResponse testJsonFormDataWithHttpInfo(@javax.annotation.Nonnull String param, @javax.annotation.Nonnull String param2) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = testJsonFormDataRequestBuilder(param, param2); + return testJsonFormDataWithHttpInfo(param, param2, null); + } + + /** + * test json serialization of form data + * + * @param param field1 (required) + * @param param2 field2 (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse testJsonFormDataWithHttpInfo(@javax.annotation.Nonnull String param, @javax.annotation.Nonnull String param2, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = testJsonFormDataRequestBuilder(param, param2, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -1948,7 +2450,7 @@ public ApiResponse testJsonFormDataWithHttpInfo(@javax.annotation.Nonnull } } - private HttpRequest.Builder testJsonFormDataRequestBuilder(@javax.annotation.Nonnull String param, @javax.annotation.Nonnull String param2) throws ApiException { + private HttpRequest.Builder testJsonFormDataRequestBuilder(@javax.annotation.Nonnull String param, @javax.annotation.Nonnull String param2, Map headers) throws ApiException { // verify the required parameter 'param' is set if (param == null) { throw new ApiException(400, "Missing the required parameter 'param' when calling testJsonFormData"); @@ -1987,9 +2489,11 @@ private HttpRequest.Builder testJsonFormDataRequestBuilder(@javax.annotation.Non if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -2008,7 +2512,22 @@ private HttpRequest.Builder testJsonFormDataRequestBuilder(@javax.annotation.Non * @throws ApiException if fails to make API call */ public void testQueryParameterCollectionFormat(@javax.annotation.Nonnull List pipe, @javax.annotation.Nonnull List ioutil, @javax.annotation.Nonnull List http, @javax.annotation.Nonnull List url, @javax.annotation.Nonnull List context) throws ApiException { - testQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context); + testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, null); + } + + /** + * + * To test the collection format in query parameters + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void testQueryParameterCollectionFormat(@javax.annotation.Nonnull List pipe, @javax.annotation.Nonnull List ioutil, @javax.annotation.Nonnull List http, @javax.annotation.Nonnull List url, @javax.annotation.Nonnull List context, Map headers) throws ApiException { + testQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context, headers); } /** @@ -2023,7 +2542,23 @@ public void testQueryParameterCollectionFormat(@javax.annotation.Nonnull List testQueryParameterCollectionFormatWithHttpInfo(@javax.annotation.Nonnull List pipe, @javax.annotation.Nonnull List ioutil, @javax.annotation.Nonnull List http, @javax.annotation.Nonnull List url, @javax.annotation.Nonnull List context) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = testQueryParameterCollectionFormatRequestBuilder(pipe, ioutil, http, url, context); + return testQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context, null); + } + + /** + * + * To test the collection format in query parameters + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse testQueryParameterCollectionFormatWithHttpInfo(@javax.annotation.Nonnull List pipe, @javax.annotation.Nonnull List ioutil, @javax.annotation.Nonnull List http, @javax.annotation.Nonnull List url, @javax.annotation.Nonnull List context, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = testQueryParameterCollectionFormatRequestBuilder(pipe, ioutil, http, url, context, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -2056,7 +2591,7 @@ public ApiResponse testQueryParameterCollectionFormatWithHttpInfo(@javax.a } } - private HttpRequest.Builder testQueryParameterCollectionFormatRequestBuilder(@javax.annotation.Nonnull List pipe, @javax.annotation.Nonnull List ioutil, @javax.annotation.Nonnull List http, @javax.annotation.Nonnull List url, @javax.annotation.Nonnull List context) throws ApiException { + private HttpRequest.Builder testQueryParameterCollectionFormatRequestBuilder(@javax.annotation.Nonnull List pipe, @javax.annotation.Nonnull List ioutil, @javax.annotation.Nonnull List http, @javax.annotation.Nonnull List url, @javax.annotation.Nonnull List context, Map headers) throws ApiException { // verify the required parameter 'pipe' is set if (pipe == null) { throw new ApiException(400, "Missing the required parameter 'pipe' when calling testQueryParameterCollectionFormat"); @@ -2113,9 +2648,11 @@ private HttpRequest.Builder testQueryParameterCollectionFormatRequestBuilder(@ja if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -2130,7 +2667,18 @@ private HttpRequest.Builder testQueryParameterCollectionFormatRequestBuilder(@ja * @throws ApiException if fails to make API call */ public void testStringMapReference(@javax.annotation.Nonnull Map requestBody) throws ApiException { - testStringMapReferenceWithHttpInfo(requestBody); + testStringMapReference(requestBody, null); + } + + /** + * test referenced string map + * + * @param requestBody request body (required) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void testStringMapReference(@javax.annotation.Nonnull Map requestBody, Map headers) throws ApiException { + testStringMapReferenceWithHttpInfo(requestBody, headers); } /** @@ -2141,7 +2689,19 @@ public void testStringMapReference(@javax.annotation.Nonnull Map * @throws ApiException if fails to make API call */ public ApiResponse testStringMapReferenceWithHttpInfo(@javax.annotation.Nonnull Map requestBody) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = testStringMapReferenceRequestBuilder(requestBody); + return testStringMapReferenceWithHttpInfo(requestBody, null); + } + + /** + * test referenced string map + * + * @param requestBody request body (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse testStringMapReferenceWithHttpInfo(@javax.annotation.Nonnull Map requestBody, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = testStringMapReferenceRequestBuilder(requestBody, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -2174,7 +2734,7 @@ public ApiResponse testStringMapReferenceWithHttpInfo(@javax.annotation.No } } - private HttpRequest.Builder testStringMapReferenceRequestBuilder(@javax.annotation.Nonnull Map requestBody) throws ApiException { + private HttpRequest.Builder testStringMapReferenceRequestBuilder(@javax.annotation.Nonnull Map requestBody, Map headers) throws ApiException { // verify the required parameter 'requestBody' is set if (requestBody == null) { throw new ApiException(400, "Missing the required parameter 'requestBody' when calling testStringMapReference"); @@ -2198,9 +2758,11 @@ private HttpRequest.Builder testStringMapReferenceRequestBuilder(@javax.annotati if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java index 8deff6965b77..db5f2a655ccf 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -61,9 +61,6 @@ public class FakeClassnameTags123Api { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; - // Custom headers to be sent with every request from this API client - private final Map extraHeaders = new java.util.HashMap<>(); - public FakeClassnameTags123Api() { this(Configuration.getDefaultApiClient()); } @@ -78,27 +75,6 @@ public FakeClassnameTags123Api(ApiClient apiClient) { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } - /** - * Add a custom header to be sent with every request from this API client. - * @param name Header name - * @param value Header value - * @return this - */ - public FakeClassnameTags123Api addHeader(String name, String value) { - this.extraHeaders.put(name, value); - return this; - } - - /** - * Remove a custom header. - * @param name Header name - * @return this - */ - public FakeClassnameTags123Api removeHeader(String name) { - this.extraHeaders.remove(name); - return this; - } - protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { String body = response.body() == null ? null : new String(response.body().readAllBytes()); @@ -121,7 +97,19 @@ private String formatExceptionMessage(String operationId, int statusCode, String * @throws ApiException if fails to make API call */ public Client testClassname(@javax.annotation.Nonnull Client client) throws ApiException { - ApiResponse localVarResponse = testClassnameWithHttpInfo(client); + return testClassname(client, null); + } + + /** + * To test class name in snake case + * To test class name in snake case + * @param client client model (required) + * @param headers Optional headers to include in the request + * @return Client + * @throws ApiException if fails to make API call + */ + public Client testClassname(@javax.annotation.Nonnull Client client, Map headers) throws ApiException { + ApiResponse localVarResponse = testClassnameWithHttpInfo(client, headers); return localVarResponse.getData(); } @@ -133,7 +121,19 @@ public Client testClassname(@javax.annotation.Nonnull Client client) throws ApiE * @throws ApiException if fails to make API call */ public ApiResponse testClassnameWithHttpInfo(@javax.annotation.Nonnull Client client) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = testClassnameRequestBuilder(client); + return testClassnameWithHttpInfo(client, null); + } + + /** + * To test class name in snake case + * To test class name in snake case + * @param client client model (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Client> + * @throws ApiException if fails to make API call + */ + public ApiResponse testClassnameWithHttpInfo(@javax.annotation.Nonnull Client client, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = testClassnameRequestBuilder(client, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -172,7 +172,7 @@ public ApiResponse testClassnameWithHttpInfo(@javax.annotation.Nonnull C } } - private HttpRequest.Builder testClassnameRequestBuilder(@javax.annotation.Nonnull Client client) throws ApiException { + private HttpRequest.Builder testClassnameRequestBuilder(@javax.annotation.Nonnull Client client, Map headers) throws ApiException { // verify the required parameter 'client' is set if (client == null) { throw new ApiException(400, "Missing the required parameter 'client' when calling testClassname"); @@ -196,9 +196,11 @@ private HttpRequest.Builder testClassnameRequestBuilder(@javax.annotation.Nonnul if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/PetApi.java index b3b111ff23c1..ebd93e058533 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/PetApi.java @@ -63,9 +63,6 @@ public class PetApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; - // Custom headers to be sent with every request from this API client - private final Map extraHeaders = new java.util.HashMap<>(); - public PetApi() { this(Configuration.getDefaultApiClient()); } @@ -80,27 +77,6 @@ public PetApi(ApiClient apiClient) { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } - /** - * Add a custom header to be sent with every request from this API client. - * @param name Header name - * @param value Header value - * @return this - */ - public PetApi addHeader(String name, String value) { - this.extraHeaders.put(name, value); - return this; - } - - /** - * Remove a custom header. - * @param name Header name - * @return this - */ - public PetApi removeHeader(String name) { - this.extraHeaders.remove(name); - return this; - } - protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { String body = response.body() == null ? null : new String(response.body().readAllBytes()); @@ -122,7 +98,18 @@ private String formatExceptionMessage(String operationId, int statusCode, String * @throws ApiException if fails to make API call */ public void addPet(@javax.annotation.Nonnull Pet pet) throws ApiException { - addPetWithHttpInfo(pet); + addPet(pet, null); + } + + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store (required) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void addPet(@javax.annotation.Nonnull Pet pet, Map headers) throws ApiException { + addPetWithHttpInfo(pet, headers); } /** @@ -133,7 +120,19 @@ public void addPet(@javax.annotation.Nonnull Pet pet) throws ApiException { * @throws ApiException if fails to make API call */ public ApiResponse addPetWithHttpInfo(@javax.annotation.Nonnull Pet pet) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = addPetRequestBuilder(pet); + return addPetWithHttpInfo(pet, null); + } + + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse addPetWithHttpInfo(@javax.annotation.Nonnull Pet pet, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = addPetRequestBuilder(pet, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -166,7 +165,7 @@ public ApiResponse addPetWithHttpInfo(@javax.annotation.Nonnull Pet pet) t } } - private HttpRequest.Builder addPetRequestBuilder(@javax.annotation.Nonnull Pet pet) throws ApiException { + private HttpRequest.Builder addPetRequestBuilder(@javax.annotation.Nonnull Pet pet, Map headers) throws ApiException { // verify the required parameter 'pet' is set if (pet == null) { throw new ApiException(400, "Missing the required parameter 'pet' when calling addPet"); @@ -190,9 +189,11 @@ private HttpRequest.Builder addPetRequestBuilder(@javax.annotation.Nonnull Pet p if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -208,7 +209,19 @@ private HttpRequest.Builder addPetRequestBuilder(@javax.annotation.Nonnull Pet p * @throws ApiException if fails to make API call */ public void deletePet(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey) throws ApiException { - deletePetWithHttpInfo(petId, apiKey); + deletePet(petId, apiKey, null); + } + + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void deletePet(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, Map headers) throws ApiException { + deletePetWithHttpInfo(petId, apiKey, headers); } /** @@ -220,7 +233,20 @@ public void deletePet(@javax.annotation.Nonnull Long petId, @javax.annotation.Nu * @throws ApiException if fails to make API call */ public ApiResponse deletePetWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = deletePetRequestBuilder(petId, apiKey); + return deletePetWithHttpInfo(petId, apiKey, null); + } + + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse deletePetWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = deletePetRequestBuilder(petId, apiKey, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -253,7 +279,7 @@ public ApiResponse deletePetWithHttpInfo(@javax.annotation.Nonnull Long pe } } - private HttpRequest.Builder deletePetRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey) throws ApiException { + private HttpRequest.Builder deletePetRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, Map headers) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { throw new ApiException(400, "Missing the required parameter 'petId' when calling deletePet"); @@ -275,9 +301,11 @@ private HttpRequest.Builder deletePetRequestBuilder(@javax.annotation.Nonnull Lo if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -293,7 +321,19 @@ private HttpRequest.Builder deletePetRequestBuilder(@javax.annotation.Nonnull Lo * @throws ApiException if fails to make API call */ public List findPetsByStatus(@javax.annotation.Nonnull List status) throws ApiException { - ApiResponse> localVarResponse = findPetsByStatusWithHttpInfo(status); + return findPetsByStatus(status, null); + } + + /** + * Finds Pets by status + * Multiple status values can be provided with comma separated strings + * @param status Status values that need to be considered for filter (required) + * @param headers Optional headers to include in the request + * @return List<Pet> + * @throws ApiException if fails to make API call + */ + public List findPetsByStatus(@javax.annotation.Nonnull List status, Map headers) throws ApiException { + ApiResponse> localVarResponse = findPetsByStatusWithHttpInfo(status, headers); return localVarResponse.getData(); } @@ -305,7 +345,19 @@ public List findPetsByStatus(@javax.annotation.Nonnull List status) * @throws ApiException if fails to make API call */ public ApiResponse> findPetsByStatusWithHttpInfo(@javax.annotation.Nonnull List status) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = findPetsByStatusRequestBuilder(status); + return findPetsByStatusWithHttpInfo(status, null); + } + + /** + * Finds Pets by status + * Multiple status values can be provided with comma separated strings + * @param status Status values that need to be considered for filter (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<List<Pet>> + * @throws ApiException if fails to make API call + */ + public ApiResponse> findPetsByStatusWithHttpInfo(@javax.annotation.Nonnull List status, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = findPetsByStatusRequestBuilder(status, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -344,7 +396,7 @@ public ApiResponse> findPetsByStatusWithHttpInfo(@javax.annotation.Non } } - private HttpRequest.Builder findPetsByStatusRequestBuilder(@javax.annotation.Nonnull List status) throws ApiException { + private HttpRequest.Builder findPetsByStatusRequestBuilder(@javax.annotation.Nonnull List status, Map headers) throws ApiException { // verify the required parameter 'status' is set if (status == null) { throw new ApiException(400, "Missing the required parameter 'status' when calling findPetsByStatus"); @@ -377,9 +429,11 @@ private HttpRequest.Builder findPetsByStatusRequestBuilder(@javax.annotation.Non if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -397,7 +451,21 @@ private HttpRequest.Builder findPetsByStatusRequestBuilder(@javax.annotation.Non */ @Deprecated public List findPetsByTags(@javax.annotation.Nonnull List tags) throws ApiException { - ApiResponse> localVarResponse = findPetsByTagsWithHttpInfo(tags); + return findPetsByTags(tags, null); + } + + /** + * Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) + * @param headers Optional headers to include in the request + * @return List<Pet> + * @throws ApiException if fails to make API call + * @deprecated + */ + @Deprecated + public List findPetsByTags(@javax.annotation.Nonnull List tags, Map headers) throws ApiException { + ApiResponse> localVarResponse = findPetsByTagsWithHttpInfo(tags, headers); return localVarResponse.getData(); } @@ -411,7 +479,21 @@ public List findPetsByTags(@javax.annotation.Nonnull List tags) thr */ @Deprecated public ApiResponse> findPetsByTagsWithHttpInfo(@javax.annotation.Nonnull List tags) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = findPetsByTagsRequestBuilder(tags); + return findPetsByTagsWithHttpInfo(tags, null); + } + + /** + * Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<List<Pet>> + * @throws ApiException if fails to make API call + * @deprecated + */ + @Deprecated + public ApiResponse> findPetsByTagsWithHttpInfo(@javax.annotation.Nonnull List tags, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = findPetsByTagsRequestBuilder(tags, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -450,7 +532,7 @@ public ApiResponse> findPetsByTagsWithHttpInfo(@javax.annotation.Nonnu } } - private HttpRequest.Builder findPetsByTagsRequestBuilder(@javax.annotation.Nonnull List tags) throws ApiException { + private HttpRequest.Builder findPetsByTagsRequestBuilder(@javax.annotation.Nonnull List tags, Map headers) throws ApiException { // verify the required parameter 'tags' is set if (tags == null) { throw new ApiException(400, "Missing the required parameter 'tags' when calling findPetsByTags"); @@ -483,9 +565,11 @@ private HttpRequest.Builder findPetsByTagsRequestBuilder(@javax.annotation.Nonnu if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -501,7 +585,19 @@ private HttpRequest.Builder findPetsByTagsRequestBuilder(@javax.annotation.Nonnu * @throws ApiException if fails to make API call */ public Pet getPetById(@javax.annotation.Nonnull Long petId) throws ApiException { - ApiResponse localVarResponse = getPetByIdWithHttpInfo(petId); + return getPetById(petId, null); + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @param headers Optional headers to include in the request + * @return Pet + * @throws ApiException if fails to make API call + */ + public Pet getPetById(@javax.annotation.Nonnull Long petId, Map headers) throws ApiException { + ApiResponse localVarResponse = getPetByIdWithHttpInfo(petId, headers); return localVarResponse.getData(); } @@ -513,7 +609,19 @@ public Pet getPetById(@javax.annotation.Nonnull Long petId) throws ApiException * @throws ApiException if fails to make API call */ public ApiResponse getPetByIdWithHttpInfo(@javax.annotation.Nonnull Long petId) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = getPetByIdRequestBuilder(petId); + return getPetByIdWithHttpInfo(petId, null); + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Pet> + * @throws ApiException if fails to make API call + */ + public ApiResponse getPetByIdWithHttpInfo(@javax.annotation.Nonnull Long petId, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = getPetByIdRequestBuilder(petId, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -552,7 +660,7 @@ public ApiResponse getPetByIdWithHttpInfo(@javax.annotation.Nonnull Long pe } } - private HttpRequest.Builder getPetByIdRequestBuilder(@javax.annotation.Nonnull Long petId) throws ApiException { + private HttpRequest.Builder getPetByIdRequestBuilder(@javax.annotation.Nonnull Long petId, Map headers) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetById"); @@ -571,9 +679,11 @@ private HttpRequest.Builder getPetByIdRequestBuilder(@javax.annotation.Nonnull L if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -588,7 +698,18 @@ private HttpRequest.Builder getPetByIdRequestBuilder(@javax.annotation.Nonnull L * @throws ApiException if fails to make API call */ public void updatePet(@javax.annotation.Nonnull Pet pet) throws ApiException { - updatePetWithHttpInfo(pet); + updatePet(pet, null); + } + + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store (required) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void updatePet(@javax.annotation.Nonnull Pet pet, Map headers) throws ApiException { + updatePetWithHttpInfo(pet, headers); } /** @@ -599,7 +720,19 @@ public void updatePet(@javax.annotation.Nonnull Pet pet) throws ApiException { * @throws ApiException if fails to make API call */ public ApiResponse updatePetWithHttpInfo(@javax.annotation.Nonnull Pet pet) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = updatePetRequestBuilder(pet); + return updatePetWithHttpInfo(pet, null); + } + + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse updatePetWithHttpInfo(@javax.annotation.Nonnull Pet pet, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = updatePetRequestBuilder(pet, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -632,7 +765,7 @@ public ApiResponse updatePetWithHttpInfo(@javax.annotation.Nonnull Pet pet } } - private HttpRequest.Builder updatePetRequestBuilder(@javax.annotation.Nonnull Pet pet) throws ApiException { + private HttpRequest.Builder updatePetRequestBuilder(@javax.annotation.Nonnull Pet pet, Map headers) throws ApiException { // verify the required parameter 'pet' is set if (pet == null) { throw new ApiException(400, "Missing the required parameter 'pet' when calling updatePet"); @@ -656,9 +789,11 @@ private HttpRequest.Builder updatePetRequestBuilder(@javax.annotation.Nonnull Pe if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -675,7 +810,20 @@ private HttpRequest.Builder updatePetRequestBuilder(@javax.annotation.Nonnull Pe * @throws ApiException if fails to make API call */ public void updatePetWithForm(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status) throws ApiException { - updatePetWithFormWithHttpInfo(petId, name, status); + updatePetWithForm(petId, name, status, null); + } + + /** + * Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void updatePetWithForm(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, Map headers) throws ApiException { + updatePetWithFormWithHttpInfo(petId, name, status, headers); } /** @@ -688,7 +836,21 @@ public void updatePetWithForm(@javax.annotation.Nonnull Long petId, @javax.annot * @throws ApiException if fails to make API call */ public ApiResponse updatePetWithFormWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = updatePetWithFormRequestBuilder(petId, name, status); + return updatePetWithFormWithHttpInfo(petId, name, status, null); + } + + /** + * Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse updatePetWithFormWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = updatePetWithFormRequestBuilder(petId, name, status, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -721,7 +883,7 @@ public ApiResponse updatePetWithFormWithHttpInfo(@javax.annotation.Nonnull } } - private HttpRequest.Builder updatePetWithFormRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status) throws ApiException { + private HttpRequest.Builder updatePetWithFormRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, Map headers) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { throw new ApiException(400, "Missing the required parameter 'petId' when calling updatePetWithForm"); @@ -757,9 +919,11 @@ private HttpRequest.Builder updatePetWithFormRequestBuilder(@javax.annotation.No if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -777,7 +941,21 @@ private HttpRequest.Builder updatePetWithFormRequestBuilder(@javax.annotation.No * @throws ApiException if fails to make API call */ public ModelApiResponse uploadFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { - ApiResponse localVarResponse = uploadFileWithHttpInfo(petId, additionalMetadata, _file); + return uploadFile(petId, additionalMetadata, _file, null); + } + + /** + * uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @param headers Optional headers to include in the request + * @return ModelApiResponse + * @throws ApiException if fails to make API call + */ + public ModelApiResponse uploadFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, Map headers) throws ApiException { + ApiResponse localVarResponse = uploadFileWithHttpInfo(petId, additionalMetadata, _file, headers); return localVarResponse.getData(); } @@ -791,7 +969,21 @@ public ModelApiResponse uploadFile(@javax.annotation.Nonnull Long petId, @javax. * @throws ApiException if fails to make API call */ public ApiResponse uploadFileWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = uploadFileRequestBuilder(petId, additionalMetadata, _file); + return uploadFileWithHttpInfo(petId, additionalMetadata, _file, null); + } + + /** + * uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<ModelApiResponse> + * @throws ApiException if fails to make API call + */ + public ApiResponse uploadFileWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = uploadFileRequestBuilder(petId, additionalMetadata, _file, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -830,7 +1022,7 @@ public ApiResponse uploadFileWithHttpInfo(@javax.annotation.No } } - private HttpRequest.Builder uploadFileRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { + private HttpRequest.Builder uploadFileRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, Map headers) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFile"); @@ -885,9 +1077,11 @@ private HttpRequest.Builder uploadFileRequestBuilder(@javax.annotation.Nonnull L if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -905,7 +1099,21 @@ private HttpRequest.Builder uploadFileRequestBuilder(@javax.annotation.Nonnull L * @throws ApiException if fails to make API call */ public ModelApiResponse uploadFileWithRequiredFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata) throws ApiException { - ApiResponse localVarResponse = uploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata); + return uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata, null); + } + + /** + * uploads an image (required) + * + * @param petId ID of pet to update (required) + * @param requiredFile file to upload (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param headers Optional headers to include in the request + * @return ModelApiResponse + * @throws ApiException if fails to make API call + */ + public ModelApiResponse uploadFileWithRequiredFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata, Map headers) throws ApiException { + ApiResponse localVarResponse = uploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata, headers); return localVarResponse.getData(); } @@ -919,7 +1127,21 @@ public ModelApiResponse uploadFileWithRequiredFile(@javax.annotation.Nonnull Lon * @throws ApiException if fails to make API call */ public ApiResponse uploadFileWithRequiredFileWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = uploadFileWithRequiredFileRequestBuilder(petId, requiredFile, additionalMetadata); + return uploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata, null); + } + + /** + * uploads an image (required) + * + * @param petId ID of pet to update (required) + * @param requiredFile file to upload (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<ModelApiResponse> + * @throws ApiException if fails to make API call + */ + public ApiResponse uploadFileWithRequiredFileWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = uploadFileWithRequiredFileRequestBuilder(petId, requiredFile, additionalMetadata, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -958,7 +1180,7 @@ public ApiResponse uploadFileWithRequiredFileWithHttpInfo(@jav } } - private HttpRequest.Builder uploadFileWithRequiredFileRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata) throws ApiException { + private HttpRequest.Builder uploadFileWithRequiredFileRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata, Map headers) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFileWithRequiredFile"); @@ -1017,9 +1239,11 @@ private HttpRequest.Builder uploadFileWithRequiredFileRequestBuilder(@javax.anno if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/StoreApi.java index 6f2b83415dc6..a18b18a4aa3d 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/StoreApi.java @@ -61,9 +61,6 @@ public class StoreApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; - // Custom headers to be sent with every request from this API client - private final Map extraHeaders = new java.util.HashMap<>(); - public StoreApi() { this(Configuration.getDefaultApiClient()); } @@ -78,27 +75,6 @@ public StoreApi(ApiClient apiClient) { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } - /** - * Add a custom header to be sent with every request from this API client. - * @param name Header name - * @param value Header value - * @return this - */ - public StoreApi addHeader(String name, String value) { - this.extraHeaders.put(name, value); - return this; - } - - /** - * Remove a custom header. - * @param name Header name - * @return this - */ - public StoreApi removeHeader(String name) { - this.extraHeaders.remove(name); - return this; - } - protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { String body = response.body() == null ? null : new String(response.body().readAllBytes()); @@ -120,7 +96,18 @@ private String formatExceptionMessage(String operationId, int statusCode, String * @throws ApiException if fails to make API call */ public void deleteOrder(@javax.annotation.Nonnull String orderId) throws ApiException { - deleteOrderWithHttpInfo(orderId); + deleteOrder(orderId, null); + } + + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted (required) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void deleteOrder(@javax.annotation.Nonnull String orderId, Map headers) throws ApiException { + deleteOrderWithHttpInfo(orderId, headers); } /** @@ -131,7 +118,19 @@ public void deleteOrder(@javax.annotation.Nonnull String orderId) throws ApiExce * @throws ApiException if fails to make API call */ public ApiResponse deleteOrderWithHttpInfo(@javax.annotation.Nonnull String orderId) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = deleteOrderRequestBuilder(orderId); + return deleteOrderWithHttpInfo(orderId, null); + } + + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse deleteOrderWithHttpInfo(@javax.annotation.Nonnull String orderId, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = deleteOrderRequestBuilder(orderId, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -164,7 +163,7 @@ public ApiResponse deleteOrderWithHttpInfo(@javax.annotation.Nonnull Strin } } - private HttpRequest.Builder deleteOrderRequestBuilder(@javax.annotation.Nonnull String orderId) throws ApiException { + private HttpRequest.Builder deleteOrderRequestBuilder(@javax.annotation.Nonnull String orderId, Map headers) throws ApiException { // verify the required parameter 'orderId' is set if (orderId == null) { throw new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder"); @@ -183,9 +182,11 @@ private HttpRequest.Builder deleteOrderRequestBuilder(@javax.annotation.Nonnull if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -200,7 +201,18 @@ private HttpRequest.Builder deleteOrderRequestBuilder(@javax.annotation.Nonnull * @throws ApiException if fails to make API call */ public Map getInventory() throws ApiException { - ApiResponse> localVarResponse = getInventoryWithHttpInfo(); + return getInventory(null); + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @param headers Optional headers to include in the request + * @return Map<String, Integer> + * @throws ApiException if fails to make API call + */ + public Map getInventory(Map headers) throws ApiException { + ApiResponse> localVarResponse = getInventoryWithHttpInfo(headers); return localVarResponse.getData(); } @@ -211,7 +223,18 @@ public Map getInventory() throws ApiException { * @throws ApiException if fails to make API call */ public ApiResponse> getInventoryWithHttpInfo() throws ApiException { - HttpRequest.Builder localVarRequestBuilder = getInventoryRequestBuilder(); + return getInventoryWithHttpInfo(null); + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @param headers Optional headers to include in the request + * @return ApiResponse<Map<String, Integer>> + * @throws ApiException if fails to make API call + */ + public ApiResponse> getInventoryWithHttpInfo(Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = getInventoryRequestBuilder(headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -250,7 +273,7 @@ public ApiResponse> getInventoryWithHttpInfo() throws ApiEx } } - private HttpRequest.Builder getInventoryRequestBuilder() throws ApiException { + private HttpRequest.Builder getInventoryRequestBuilder(Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -264,9 +287,11 @@ private HttpRequest.Builder getInventoryRequestBuilder() throws ApiException { if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -282,7 +307,19 @@ private HttpRequest.Builder getInventoryRequestBuilder() throws ApiException { * @throws ApiException if fails to make API call */ public Order getOrderById(@javax.annotation.Nonnull Long orderId) throws ApiException { - ApiResponse localVarResponse = getOrderByIdWithHttpInfo(orderId); + return getOrderById(orderId, null); + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @param headers Optional headers to include in the request + * @return Order + * @throws ApiException if fails to make API call + */ + public Order getOrderById(@javax.annotation.Nonnull Long orderId, Map headers) throws ApiException { + ApiResponse localVarResponse = getOrderByIdWithHttpInfo(orderId, headers); return localVarResponse.getData(); } @@ -294,7 +331,19 @@ public Order getOrderById(@javax.annotation.Nonnull Long orderId) throws ApiExce * @throws ApiException if fails to make API call */ public ApiResponse getOrderByIdWithHttpInfo(@javax.annotation.Nonnull Long orderId) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = getOrderByIdRequestBuilder(orderId); + return getOrderByIdWithHttpInfo(orderId, null); + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Order> + * @throws ApiException if fails to make API call + */ + public ApiResponse getOrderByIdWithHttpInfo(@javax.annotation.Nonnull Long orderId, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = getOrderByIdRequestBuilder(orderId, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -333,7 +382,7 @@ public ApiResponse getOrderByIdWithHttpInfo(@javax.annotation.Nonnull Lon } } - private HttpRequest.Builder getOrderByIdRequestBuilder(@javax.annotation.Nonnull Long orderId) throws ApiException { + private HttpRequest.Builder getOrderByIdRequestBuilder(@javax.annotation.Nonnull Long orderId, Map headers) throws ApiException { // verify the required parameter 'orderId' is set if (orderId == null) { throw new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById"); @@ -352,9 +401,11 @@ private HttpRequest.Builder getOrderByIdRequestBuilder(@javax.annotation.Nonnull if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -370,7 +421,19 @@ private HttpRequest.Builder getOrderByIdRequestBuilder(@javax.annotation.Nonnull * @throws ApiException if fails to make API call */ public Order placeOrder(@javax.annotation.Nonnull Order order) throws ApiException { - ApiResponse localVarResponse = placeOrderWithHttpInfo(order); + return placeOrder(order, null); + } + + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @param headers Optional headers to include in the request + * @return Order + * @throws ApiException if fails to make API call + */ + public Order placeOrder(@javax.annotation.Nonnull Order order, Map headers) throws ApiException { + ApiResponse localVarResponse = placeOrderWithHttpInfo(order, headers); return localVarResponse.getData(); } @@ -382,7 +445,19 @@ public Order placeOrder(@javax.annotation.Nonnull Order order) throws ApiExcepti * @throws ApiException if fails to make API call */ public ApiResponse placeOrderWithHttpInfo(@javax.annotation.Nonnull Order order) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = placeOrderRequestBuilder(order); + return placeOrderWithHttpInfo(order, null); + } + + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Order> + * @throws ApiException if fails to make API call + */ + public ApiResponse placeOrderWithHttpInfo(@javax.annotation.Nonnull Order order, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = placeOrderRequestBuilder(order, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -421,7 +496,7 @@ public ApiResponse placeOrderWithHttpInfo(@javax.annotation.Nonnull Order } } - private HttpRequest.Builder placeOrderRequestBuilder(@javax.annotation.Nonnull Order order) throws ApiException { + private HttpRequest.Builder placeOrderRequestBuilder(@javax.annotation.Nonnull Order order, Map headers) throws ApiException { // verify the required parameter 'order' is set if (order == null) { throw new ApiException(400, "Missing the required parameter 'order' when calling placeOrder"); @@ -445,9 +520,11 @@ private HttpRequest.Builder placeOrderRequestBuilder(@javax.annotation.Nonnull O if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/UserApi.java index 95029e09153a..1b5fdef81caf 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/UserApi.java @@ -62,9 +62,6 @@ public class UserApi { private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; - // Custom headers to be sent with every request from this API client - private final Map extraHeaders = new java.util.HashMap<>(); - public UserApi() { this(Configuration.getDefaultApiClient()); } @@ -79,27 +76,6 @@ public UserApi(ApiClient apiClient) { memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); } - /** - * Add a custom header to be sent with every request from this API client. - * @param name Header name - * @param value Header value - * @return this - */ - public UserApi addHeader(String name, String value) { - this.extraHeaders.put(name, value); - return this; - } - - /** - * Remove a custom header. - * @param name Header name - * @return this - */ - public UserApi removeHeader(String name) { - this.extraHeaders.remove(name); - return this; - } - protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { String body = response.body() == null ? null : new String(response.body().readAllBytes()); @@ -121,7 +97,18 @@ private String formatExceptionMessage(String operationId, int statusCode, String * @throws ApiException if fails to make API call */ public void createUser(@javax.annotation.Nonnull User user) throws ApiException { - createUserWithHttpInfo(user); + createUser(user, null); + } + + /** + * Create user + * This can only be done by the logged in user. + * @param user Created user object (required) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void createUser(@javax.annotation.Nonnull User user, Map headers) throws ApiException { + createUserWithHttpInfo(user, headers); } /** @@ -132,7 +119,19 @@ public void createUser(@javax.annotation.Nonnull User user) throws ApiException * @throws ApiException if fails to make API call */ public ApiResponse createUserWithHttpInfo(@javax.annotation.Nonnull User user) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = createUserRequestBuilder(user); + return createUserWithHttpInfo(user, null); + } + + /** + * Create user + * This can only be done by the logged in user. + * @param user Created user object (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse createUserWithHttpInfo(@javax.annotation.Nonnull User user, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = createUserRequestBuilder(user, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -165,7 +164,7 @@ public ApiResponse createUserWithHttpInfo(@javax.annotation.Nonnull User u } } - private HttpRequest.Builder createUserRequestBuilder(@javax.annotation.Nonnull User user) throws ApiException { + private HttpRequest.Builder createUserRequestBuilder(@javax.annotation.Nonnull User user, Map headers) throws ApiException { // verify the required parameter 'user' is set if (user == null) { throw new ApiException(400, "Missing the required parameter 'user' when calling createUser"); @@ -189,9 +188,11 @@ private HttpRequest.Builder createUserRequestBuilder(@javax.annotation.Nonnull U if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -206,7 +207,18 @@ private HttpRequest.Builder createUserRequestBuilder(@javax.annotation.Nonnull U * @throws ApiException if fails to make API call */ public void createUsersWithArrayInput(@javax.annotation.Nonnull List user) throws ApiException { - createUsersWithArrayInputWithHttpInfo(user); + createUsersWithArrayInput(user, null); + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void createUsersWithArrayInput(@javax.annotation.Nonnull List user, Map headers) throws ApiException { + createUsersWithArrayInputWithHttpInfo(user, headers); } /** @@ -217,7 +229,19 @@ public void createUsersWithArrayInput(@javax.annotation.Nonnull List user) * @throws ApiException if fails to make API call */ public ApiResponse createUsersWithArrayInputWithHttpInfo(@javax.annotation.Nonnull List user) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = createUsersWithArrayInputRequestBuilder(user); + return createUsersWithArrayInputWithHttpInfo(user, null); + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse createUsersWithArrayInputWithHttpInfo(@javax.annotation.Nonnull List user, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = createUsersWithArrayInputRequestBuilder(user, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -250,7 +274,7 @@ public ApiResponse createUsersWithArrayInputWithHttpInfo(@javax.annotation } } - private HttpRequest.Builder createUsersWithArrayInputRequestBuilder(@javax.annotation.Nonnull List user) throws ApiException { + private HttpRequest.Builder createUsersWithArrayInputRequestBuilder(@javax.annotation.Nonnull List user, Map headers) throws ApiException { // verify the required parameter 'user' is set if (user == null) { throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithArrayInput"); @@ -274,9 +298,11 @@ private HttpRequest.Builder createUsersWithArrayInputRequestBuilder(@javax.annot if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -291,7 +317,18 @@ private HttpRequest.Builder createUsersWithArrayInputRequestBuilder(@javax.annot * @throws ApiException if fails to make API call */ public void createUsersWithListInput(@javax.annotation.Nonnull List user) throws ApiException { - createUsersWithListInputWithHttpInfo(user); + createUsersWithListInput(user, null); + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void createUsersWithListInput(@javax.annotation.Nonnull List user, Map headers) throws ApiException { + createUsersWithListInputWithHttpInfo(user, headers); } /** @@ -302,7 +339,19 @@ public void createUsersWithListInput(@javax.annotation.Nonnull List user) * @throws ApiException if fails to make API call */ public ApiResponse createUsersWithListInputWithHttpInfo(@javax.annotation.Nonnull List user) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = createUsersWithListInputRequestBuilder(user); + return createUsersWithListInputWithHttpInfo(user, null); + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse createUsersWithListInputWithHttpInfo(@javax.annotation.Nonnull List user, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = createUsersWithListInputRequestBuilder(user, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -335,7 +384,7 @@ public ApiResponse createUsersWithListInputWithHttpInfo(@javax.annotation. } } - private HttpRequest.Builder createUsersWithListInputRequestBuilder(@javax.annotation.Nonnull List user) throws ApiException { + private HttpRequest.Builder createUsersWithListInputRequestBuilder(@javax.annotation.Nonnull List user, Map headers) throws ApiException { // verify the required parameter 'user' is set if (user == null) { throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithListInput"); @@ -359,9 +408,11 @@ private HttpRequest.Builder createUsersWithListInputRequestBuilder(@javax.annota if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -376,7 +427,18 @@ private HttpRequest.Builder createUsersWithListInputRequestBuilder(@javax.annota * @throws ApiException if fails to make API call */ public void deleteUser(@javax.annotation.Nonnull String username) throws ApiException { - deleteUserWithHttpInfo(username); + deleteUser(username, null); + } + + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void deleteUser(@javax.annotation.Nonnull String username, Map headers) throws ApiException { + deleteUserWithHttpInfo(username, headers); } /** @@ -387,7 +449,19 @@ public void deleteUser(@javax.annotation.Nonnull String username) throws ApiExce * @throws ApiException if fails to make API call */ public ApiResponse deleteUserWithHttpInfo(@javax.annotation.Nonnull String username) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = deleteUserRequestBuilder(username); + return deleteUserWithHttpInfo(username, null); + } + + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse deleteUserWithHttpInfo(@javax.annotation.Nonnull String username, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = deleteUserRequestBuilder(username, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -420,7 +494,7 @@ public ApiResponse deleteUserWithHttpInfo(@javax.annotation.Nonnull String } } - private HttpRequest.Builder deleteUserRequestBuilder(@javax.annotation.Nonnull String username) throws ApiException { + private HttpRequest.Builder deleteUserRequestBuilder(@javax.annotation.Nonnull String username, Map headers) throws ApiException { // verify the required parameter 'username' is set if (username == null) { throw new ApiException(400, "Missing the required parameter 'username' when calling deleteUser"); @@ -439,9 +513,11 @@ private HttpRequest.Builder deleteUserRequestBuilder(@javax.annotation.Nonnull S if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -457,7 +533,19 @@ private HttpRequest.Builder deleteUserRequestBuilder(@javax.annotation.Nonnull S * @throws ApiException if fails to make API call */ public User getUserByName(@javax.annotation.Nonnull String username) throws ApiException { - ApiResponse localVarResponse = getUserByNameWithHttpInfo(username); + return getUserByName(username, null); + } + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @param headers Optional headers to include in the request + * @return User + * @throws ApiException if fails to make API call + */ + public User getUserByName(@javax.annotation.Nonnull String username, Map headers) throws ApiException { + ApiResponse localVarResponse = getUserByNameWithHttpInfo(username, headers); return localVarResponse.getData(); } @@ -469,7 +557,19 @@ public User getUserByName(@javax.annotation.Nonnull String username) throws ApiE * @throws ApiException if fails to make API call */ public ApiResponse getUserByNameWithHttpInfo(@javax.annotation.Nonnull String username) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = getUserByNameRequestBuilder(username); + return getUserByNameWithHttpInfo(username, null); + } + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<User> + * @throws ApiException if fails to make API call + */ + public ApiResponse getUserByNameWithHttpInfo(@javax.annotation.Nonnull String username, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = getUserByNameRequestBuilder(username, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -508,7 +608,7 @@ public ApiResponse getUserByNameWithHttpInfo(@javax.annotation.Nonnull Str } } - private HttpRequest.Builder getUserByNameRequestBuilder(@javax.annotation.Nonnull String username) throws ApiException { + private HttpRequest.Builder getUserByNameRequestBuilder(@javax.annotation.Nonnull String username, Map headers) throws ApiException { // verify the required parameter 'username' is set if (username == null) { throw new ApiException(400, "Missing the required parameter 'username' when calling getUserByName"); @@ -527,9 +627,11 @@ private HttpRequest.Builder getUserByNameRequestBuilder(@javax.annotation.Nonnul if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -546,7 +648,20 @@ private HttpRequest.Builder getUserByNameRequestBuilder(@javax.annotation.Nonnul * @throws ApiException if fails to make API call */ public String loginUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException { - ApiResponse localVarResponse = loginUserWithHttpInfo(username, password); + return loginUser(username, password, null); + } + + /** + * Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @param headers Optional headers to include in the request + * @return String + * @throws ApiException if fails to make API call + */ + public String loginUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, Map headers) throws ApiException { + ApiResponse localVarResponse = loginUserWithHttpInfo(username, password, headers); return localVarResponse.getData(); } @@ -559,7 +674,20 @@ public String loginUser(@javax.annotation.Nonnull String username, @javax.annota * @throws ApiException if fails to make API call */ public ApiResponse loginUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = loginUserRequestBuilder(username, password); + return loginUserWithHttpInfo(username, password, null); + } + + /** + * Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<String> + * @throws ApiException if fails to make API call + */ + public ApiResponse loginUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = loginUserRequestBuilder(username, password, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -598,7 +726,7 @@ public ApiResponse loginUserWithHttpInfo(@javax.annotation.Nonnull Strin } } - private HttpRequest.Builder loginUserRequestBuilder(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException { + private HttpRequest.Builder loginUserRequestBuilder(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, Map headers) throws ApiException { // verify the required parameter 'username' is set if (username == null) { throw new ApiException(400, "Missing the required parameter 'username' when calling loginUser"); @@ -637,9 +765,11 @@ private HttpRequest.Builder loginUserRequestBuilder(@javax.annotation.Nonnull St if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -653,7 +783,17 @@ private HttpRequest.Builder loginUserRequestBuilder(@javax.annotation.Nonnull St * @throws ApiException if fails to make API call */ public void logoutUser() throws ApiException { - logoutUserWithHttpInfo(); + logoutUser(null); + } + + /** + * Logs out current logged in user session + * + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void logoutUser(Map headers) throws ApiException { + logoutUserWithHttpInfo(headers); } /** @@ -663,7 +803,18 @@ public void logoutUser() throws ApiException { * @throws ApiException if fails to make API call */ public ApiResponse logoutUserWithHttpInfo() throws ApiException { - HttpRequest.Builder localVarRequestBuilder = logoutUserRequestBuilder(); + return logoutUserWithHttpInfo(null); + } + + /** + * Logs out current logged in user session + * + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse logoutUserWithHttpInfo(Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = logoutUserRequestBuilder(headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -696,7 +847,7 @@ public ApiResponse logoutUserWithHttpInfo() throws ApiException { } } - private HttpRequest.Builder logoutUserRequestBuilder() throws ApiException { + private HttpRequest.Builder logoutUserRequestBuilder(Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -710,9 +861,11 @@ private HttpRequest.Builder logoutUserRequestBuilder() throws ApiException { if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); @@ -728,7 +881,19 @@ private HttpRequest.Builder logoutUserRequestBuilder() throws ApiException { * @throws ApiException if fails to make API call */ public void updateUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user) throws ApiException { - updateUserWithHttpInfo(username, user); + updateUser(username, user, null); + } + + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param user Updated user object (required) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void updateUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, Map headers) throws ApiException { + updateUserWithHttpInfo(username, user, headers); } /** @@ -740,7 +905,20 @@ public void updateUser(@javax.annotation.Nonnull String username, @javax.annotat * @throws ApiException if fails to make API call */ public ApiResponse updateUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = updateUserRequestBuilder(username, user); + return updateUserWithHttpInfo(username, user, null); + } + + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param user Updated user object (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse updateUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = updateUserRequestBuilder(username, user, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -773,7 +951,7 @@ public ApiResponse updateUserWithHttpInfo(@javax.annotation.Nonnull String } } - private HttpRequest.Builder updateUserRequestBuilder(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user) throws ApiException { + private HttpRequest.Builder updateUserRequestBuilder(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, Map headers) throws ApiException { // verify the required parameter 'username' is set if (username == null) { throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser"); @@ -802,9 +980,11 @@ private HttpRequest.Builder updateUserRequestBuilder(@javax.annotation.Nonnull S if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); } - // Add custom headers - for (Map.Entry entry : extraHeaders.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } } if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/.github/workflows/maven.yml b/samples/client/petstore/java/native/test-regenerated-fixed/.github/workflows/maven.yml new file mode 100644 index 000000000000..460f78bfd1b2 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/.github/workflows/maven.yml @@ -0,0 +1,30 @@ +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven +# +# This file is auto-generated by OpenAPI Generator (https://openapi-generator.tech) + +name: Java CI with Maven + +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] + +jobs: + build: + name: Build OpenAPI Petstore + runs-on: ubuntu-latest + strategy: + matrix: + java: [ 17, 21 ] + steps: + - uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.java }} + distribution: 'temurin' + cache: maven + - name: Build with Maven + run: mvn -B package --no-transfer-progress --file pom.xml diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/.gitignore b/samples/client/petstore/java/native/test-regenerated-fixed/.gitignore new file mode 100644 index 000000000000..a530464afa1b --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/.gitignore @@ -0,0 +1,21 @@ +*.class + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.ear + +# exclude jar for gradle wrapper +!gradle/wrapper/*.jar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +# build files +**/target +target +.gradle +build diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/.openapi-generator-ignore b/samples/client/petstore/java/native/test-regenerated-fixed/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/.openapi-generator/FILES b/samples/client/petstore/java/native/test-regenerated-fixed/.openapi-generator/FILES new file mode 100644 index 000000000000..57d506c4c50b --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/.openapi-generator/FILES @@ -0,0 +1,56 @@ +.github/workflows/maven.yml +.gitignore +.openapi-generator-ignore +.travis.yml +README.md +api/openapi.yaml +build.gradle +build.sbt +docs/Category.md +docs/ModelApiResponse.md +docs/Order.md +docs/Pet.md +docs/PetApi.md +docs/StoreApi.md +docs/Tag.md +docs/User.md +docs/UserApi.md +git_push.sh +gradle.properties +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat +pom.xml +settings.gradle +src/main/AndroidManifest.xml +src/main/java/org/openapitools/client/ApiClient.java +src/main/java/org/openapitools/client/ApiException.java +src/main/java/org/openapitools/client/ApiResponse.java +src/main/java/org/openapitools/client/Configuration.java +src/main/java/org/openapitools/client/JSON.java +src/main/java/org/openapitools/client/Pair.java +src/main/java/org/openapitools/client/RFC3339DateFormat.java +src/main/java/org/openapitools/client/RFC3339InstantDeserializer.java +src/main/java/org/openapitools/client/RFC3339JavaTimeModule.java +src/main/java/org/openapitools/client/ServerConfiguration.java +src/main/java/org/openapitools/client/ServerVariable.java +src/main/java/org/openapitools/client/api/PetApi.java +src/main/java/org/openapitools/client/api/StoreApi.java +src/main/java/org/openapitools/client/api/UserApi.java +src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +src/main/java/org/openapitools/client/model/Category.java +src/main/java/org/openapitools/client/model/ModelApiResponse.java +src/main/java/org/openapitools/client/model/Order.java +src/main/java/org/openapitools/client/model/Pet.java +src/main/java/org/openapitools/client/model/Tag.java +src/main/java/org/openapitools/client/model/User.java +src/test/java/org/openapitools/client/api/PetApiTest.java +src/test/java/org/openapitools/client/api/StoreApiTest.java +src/test/java/org/openapitools/client/api/UserApiTest.java +src/test/java/org/openapitools/client/model/CategoryTest.java +src/test/java/org/openapitools/client/model/ModelApiResponseTest.java +src/test/java/org/openapitools/client/model/OrderTest.java +src/test/java/org/openapitools/client/model/PetTest.java +src/test/java/org/openapitools/client/model/TagTest.java +src/test/java/org/openapitools/client/model/UserTest.java diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/.openapi-generator/VERSION b/samples/client/petstore/java/native/test-regenerated-fixed/.openapi-generator/VERSION new file mode 100644 index 000000000000..fc74d6ceba8e --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.15.0-SNAPSHOT diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/.travis.yml b/samples/client/petstore/java/native/test-regenerated-fixed/.travis.yml new file mode 100644 index 000000000000..c94647479234 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/.travis.yml @@ -0,0 +1,16 @@ +# +# Generated by: https://openapi-generator.tech +# +language: java +jdk: + - oraclejdk11 +before_install: + # ensure gradlew has proper permission + - chmod a+x ./gradlew +script: + # test using maven + - mvn test + # uncomment below to test using gradle + # - gradle test + # uncomment below to test using sbt + # - sbt test diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/README.md b/samples/client/petstore/java/native/test-regenerated-fixed/README.md new file mode 100644 index 000000000000..182c442842d3 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/README.md @@ -0,0 +1,197 @@ +# openapi-java-client + +OpenAPI Petstore + +- API version: 1.0.0 + +- Build date: 2025-07-08T21:07:41.448223+07:00[Asia/Bangkok] + +- Generator version: 7.15.0-SNAPSHOT + +This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + + +*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* + +## Requirements + +Building the API client library requires: + +1. Java 11+ +2. Maven/Gradle + +## Installation + +To install the API client library to your local Maven repository, simply execute: + +```shell +mvn clean install +``` + +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: + +```shell +mvn clean deploy +``` + +Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. + +### Maven users + +Add this dependency to your project's POM: + +```xml + + org.openapitools + openapi-java-client + 1.0.0 + compile + +``` + +### Gradle users + +Add this dependency to your project's build file: + +```groovy +compile "org.openapitools:openapi-java-client:1.0.0" +``` + +### Others + +At first generate the JAR by executing: + +```shell +mvn clean package +``` + +Then manually install the following JARs: + +- `target/openapi-java-client-1.0.0.jar` +- `target/lib/*.jar` + +## Getting Started + +Please follow the [installation](#installation) instruction and execute the following Java code: + +```java + +import org.openapitools.client.*; +import org.openapitools.client.model.*; +import org.openapitools.client.api.PetApi; + +public class PetApiExample { + + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + // Configure clients using the `defaultClient` object, such as + // overriding the host and port, timeout, etc. + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + Pet result = apiInstance.addPet(pet); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store +*PetApi* | [**addPetWithHttpInfo**](docs/PetApi.md#addPetWithHttpInfo) | **POST** /pet | Add a new pet to the store +*PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**deletePetWithHttpInfo**](docs/PetApi.md#deletePetWithHttpInfo) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status +*PetApi* | [**findPetsByStatusWithHttpInfo**](docs/PetApi.md#findPetsByStatusWithHttpInfo) | **GET** /pet/findByStatus | Finds Pets by status +*PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags +*PetApi* | [**findPetsByTagsWithHttpInfo**](docs/PetApi.md#findPetsByTagsWithHttpInfo) | **GET** /pet/findByTags | Finds Pets by tags +*PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**getPetByIdWithHttpInfo**](docs/PetApi.md#getPetByIdWithHttpInfo) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**updatePet**](docs/PetApi.md#updatePet) | **PUT** /pet | Update an existing pet +*PetApi* | [**updatePetWithHttpInfo**](docs/PetApi.md#updatePetWithHttpInfo) | **PUT** /pet | Update an existing pet +*PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data +*PetApi* | [**updatePetWithFormWithHttpInfo**](docs/PetApi.md#updatePetWithFormWithHttpInfo) | **POST** /pet/{petId} | Updates a pet in the store with form data +*PetApi* | [**uploadFile**](docs/PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image +*PetApi* | [**uploadFileWithHttpInfo**](docs/PetApi.md#uploadFileWithHttpInfo) | **POST** /pet/{petId}/uploadImage | uploads an image +*StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID +*StoreApi* | [**deleteOrderWithHttpInfo**](docs/StoreApi.md#deleteOrderWithHttpInfo) | **DELETE** /store/order/{orderId} | Delete purchase order by ID +*StoreApi* | [**getInventory**](docs/StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status +*StoreApi* | [**getInventoryWithHttpInfo**](docs/StoreApi.md#getInventoryWithHttpInfo) | **GET** /store/inventory | Returns pet inventories by status +*StoreApi* | [**getOrderById**](docs/StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID +*StoreApi* | [**getOrderByIdWithHttpInfo**](docs/StoreApi.md#getOrderByIdWithHttpInfo) | **GET** /store/order/{orderId} | Find purchase order by ID +*StoreApi* | [**placeOrder**](docs/StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet +*StoreApi* | [**placeOrderWithHttpInfo**](docs/StoreApi.md#placeOrderWithHttpInfo) | **POST** /store/order | Place an order for a pet +*UserApi* | [**createUser**](docs/UserApi.md#createUser) | **POST** /user | Create user +*UserApi* | [**createUserWithHttpInfo**](docs/UserApi.md#createUserWithHttpInfo) | **POST** /user | Create user +*UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**createUsersWithArrayInputWithHttpInfo**](docs/UserApi.md#createUsersWithArrayInputWithHttpInfo) | **POST** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**createUsersWithListInput**](docs/UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array +*UserApi* | [**createUsersWithListInputWithHttpInfo**](docs/UserApi.md#createUsersWithListInputWithHttpInfo) | **POST** /user/createWithList | Creates list of users with given input array +*UserApi* | [**deleteUser**](docs/UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user +*UserApi* | [**deleteUserWithHttpInfo**](docs/UserApi.md#deleteUserWithHttpInfo) | **DELETE** /user/{username} | Delete user +*UserApi* | [**getUserByName**](docs/UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name +*UserApi* | [**getUserByNameWithHttpInfo**](docs/UserApi.md#getUserByNameWithHttpInfo) | **GET** /user/{username} | Get user by user name +*UserApi* | [**loginUser**](docs/UserApi.md#loginUser) | **GET** /user/login | Logs user into the system +*UserApi* | [**loginUserWithHttpInfo**](docs/UserApi.md#loginUserWithHttpInfo) | **GET** /user/login | Logs user into the system +*UserApi* | [**logoutUser**](docs/UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session +*UserApi* | [**logoutUserWithHttpInfo**](docs/UserApi.md#logoutUserWithHttpInfo) | **GET** /user/logout | Logs out current logged in user session +*UserApi* | [**updateUser**](docs/UserApi.md#updateUser) | **PUT** /user/{username} | Updated user +*UserApi* | [**updateUserWithHttpInfo**](docs/UserApi.md#updateUserWithHttpInfo) | **PUT** /user/{username} | Updated user + + +## Documentation for Models + + - [Category](docs/Category.md) + - [ModelApiResponse](docs/ModelApiResponse.md) + - [Order](docs/Order.md) + - [Pet](docs/Pet.md) + - [Tag](docs/Tag.md) + - [User](docs/User.md) + + + +## Documentation for Authorization + + +Authentication schemes defined for the API: + +### petstore_auth + + +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - write:pets: modify pets in your account + - read:pets: read your pets + + +### api_key + + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + + +## Recommendation + +It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. +However, the instances of the api clients created from the `ApiClient` are thread-safe and can be re-used. + +## Author + + + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/api/openapi.yaml b/samples/client/petstore/java/native/test-regenerated-fixed/api/openapi.yaml new file mode 100644 index 000000000000..9b1b54b9454b --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/api/openapi.yaml @@ -0,0 +1,865 @@ +openapi: 3.0.0 +info: + description: "This is a sample server Petstore server. For this sample, you can\ + \ use the api key `special-key` to test the authorization filters." + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user +paths: + /pet: + post: + description: "" + operationId: addPet + requestBody: + $ref: "#/components/requestBodies/Pet" + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Pet" + application/json: + schema: + $ref: "#/components/schemas/Pet" + description: successful operation + "405": + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + x-content-type: application/json + x-accepts: + - application/json + - application/xml + put: + description: "" + operationId: updatePet + requestBody: + $ref: "#/components/requestBodies/Pet" + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Pet" + application/json: + schema: + $ref: "#/components/schemas/Pet" + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Pet not found + "405": + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + x-content-type: application/json + x-accepts: + - application/json + - application/xml + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + "200": + content: + application/xml: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + application/json: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + description: successful operation + "400": + description: Invalid status value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by status + tags: + - pet + x-accepts: + - application/json + - application/xml + /pet/findByTags: + get: + deprecated: true + description: "Multiple tags can be provided with comma separated strings. Use\ + \ tag1, tag2, tag3 for testing." + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + "200": + content: + application/xml: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + application/json: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + description: successful operation + "400": + description: Invalid tag value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by tags + tags: + - pet + x-accepts: + - application/json + - application/xml + /pet/{petId}: + delete: + description: "" + operationId: deletePet + parameters: + - explode: false + in: header + name: api_key + required: false + schema: + type: string + style: simple + - description: Pet id to delete + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "400": + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + x-accepts: + - application/json + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Pet" + application/json: + schema: + $ref: "#/components/schemas/Pet" + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + x-accepts: + - application/json + - application/xml + post: + description: "" + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/updatePetWithForm_request" + responses: + "405": + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + /pet/{petId}/uploadImage: + post: + description: "" + operationId: uploadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/uploadFile_request" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/ApiResponse" + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + x-content-type: multipart/form-data + x-accepts: + - application/json + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + "200": + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + x-accepts: + - application/json + /store/order: + post: + description: "" + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Order" + description: order placed for purchasing the pet + required: true + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Order" + application/json: + schema: + $ref: "#/components/schemas/Order" + description: successful operation + "400": + description: Invalid Order + summary: Place an order for a pet + tags: + - store + x-content-type: application/json + x-accepts: + - application/json + - application/xml + /store/order/{orderId}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + explode: false + in: path + name: orderId + required: true + schema: + type: string + style: simple + responses: + "400": + description: Invalid ID supplied + "404": + description: Order not found + summary: Delete purchase order by ID + tags: + - store + x-accepts: + - application/json + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + explode: false + in: path + name: orderId + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Order" + application/json: + schema: + $ref: "#/components/schemas/Order" + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Order not found + summary: Find purchase order by ID + tags: + - store + x-accepts: + - application/json + - application/xml + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/User" + description: Created user object + required: true + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Create user + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + /user/createWithArray: + post: + description: "" + operationId: createUsersWithArrayInput + requestBody: + $ref: "#/components/requestBodies/UserArray" + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + /user/createWithList: + post: + description: "" + operationId: createUsersWithListInput + requestBody: + $ref: "#/components/requestBodies/UserArray" + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + /user/login: + get: + description: "" + operationId: loginUser + parameters: + - description: The user name for login + explode: true + in: query + name: username + required: true + schema: + pattern: "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$" + type: string + style: form + - description: The password for login in clear text + explode: true + in: query + name: password + required: true + schema: + type: string + style: form + responses: + "200": + content: + application/xml: + schema: + type: string + application/json: + schema: + type: string + description: successful operation + headers: + Set-Cookie: + description: Cookie authentication key for use with the `api_key` apiKey + authentication. + explode: false + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + style: simple + X-Rate-Limit: + description: calls per hour allowed by the user + explode: false + schema: + format: int32 + type: integer + style: simple + X-Expires-After: + description: date in UTC when token expires + explode: false + schema: + format: date-time + type: string + style: simple + "400": + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + x-accepts: + - application/json + - application/xml + /user/logout: + get: + description: "" + operationId: logoutUser + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Logs out current logged in user session + tags: + - user + x-accepts: + - application/json + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + "400": + description: Invalid username supplied + "404": + description: User not found + security: + - api_key: [] + summary: Delete user + tags: + - user + x-accepts: + - application/json + get: + description: "" + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/User" + application/json: + schema: + $ref: "#/components/schemas/User" + description: successful operation + "400": + description: Invalid username supplied + "404": + description: User not found + summary: Get user by user name + tags: + - user + x-accepts: + - application/json + - application/xml + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/User" + description: Updated user object + required: true + responses: + "400": + description: Invalid user supplied + "404": + description: User not found + security: + - api_key: [] + summary: Updated user + tags: + - user + x-content-type: application/json + x-accepts: + - application/json +components: + requestBodies: + UserArray: + content: + application/json: + schema: + items: + $ref: "#/components/schemas/User" + type: array + description: List of user object + required: true + Pet: + content: + application/json: + schema: + $ref: "#/components/schemas/Pet" + application/xml: + schema: + $ref: "#/components/schemas/Pet" + description: Pet object that needs to be added to the store + required: true + schemas: + ApiResponse: + description: Describes the result of uploading an image resource + example: + code: 0 + type: type + message: message + properties: + code: + format: int32 + type: integer + type: + type: string + message: + type: string + title: An uploaded response + type: object + Pet: + description: A pet for sale in the pet store + example: + photoUrls: + - photoUrls + - photoUrls + name: doggie + id: 0 + category: + name: name + id: 6 + tags: + - name: name + id: 1 + - name: name + id: 1 + status: available + properties: + id: + format: int64 + type: integer + category: + $ref: "#/components/schemas/Category" + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + tags: + items: + $ref: "#/components/schemas/Tag" + type: array + xml: + name: tag + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + Order: + description: An order for a pets from the pet store + example: + petId: 6 + quantity: 1 + id: 0 + shipDate: 2000-01-23T04:56:07.000+00:00 + complete: false + status: placed + properties: + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + complete: + default: false + type: boolean + title: Pet Order + type: object + xml: + name: Order + User: + description: A User who is purchasing from the pet store + example: + firstName: firstName + lastName: lastName + password: password + userStatus: 6 + phone: phone + id: 0 + email: email + username: username + properties: + id: + format: int64 + type: integer + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + title: a User + type: object + xml: + name: User + Category: + description: A category for a pet + example: + name: name + id: 6 + properties: + id: + format: int64 + type: integer + name: + pattern: "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$" + type: string + title: Pet category + type: object + xml: + name: Category + Tag: + description: A tag for a pet + example: + name: name + id: 1 + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + updatePetWithForm_request: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + uploadFile_request: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + securitySchemes: + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 + api_key: + in: header + name: api_key + type: apiKey + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/build.gradle b/samples/client/petstore/java/native/test-regenerated-fixed/build.gradle new file mode 100644 index 000000000000..56fa470fb767 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/build.gradle @@ -0,0 +1,109 @@ +apply plugin: 'idea' +apply plugin: 'eclipse' +apply plugin: 'com.diffplug.spotless' + +group = 'org.openapitools' +version = '1.0.0' + +buildscript { + repositories { + mavenCentral() + } + dependencies { + classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.11.0' + } +} + +repositories { + mavenCentral() +} + +apply plugin: 'java' +apply plugin: 'maven-publish' + +sourceCompatibility = JavaVersion.VERSION_11 +targetCompatibility = JavaVersion.VERSION_11 + +// Some text from the schema is copy pasted into the source files as UTF-8 +// but the default still seems to be to use platform encoding +tasks.withType(JavaCompile) { + configure(options) { + options.encoding = 'UTF-8' + } +} +javadoc { + options.encoding = 'UTF-8' +} + +publishing { + publications { + maven(MavenPublication) { + artifactId = 'openapi-java-client' + from components.java + } + } +} + +task execute(type:JavaExec) { + main = System.getProperty('mainClass') + classpath = sourceSets.main.runtimeClasspath +} + +task sourcesJar(type: Jar, dependsOn: classes) { + archiveClassifier = 'sources' + from sourceSets.main.allSource +} + +task javadocJar(type: Jar, dependsOn: javadoc) { + archiveClassifier = 'javadoc' + from javadoc.destinationDir +} + +artifacts { + archives sourcesJar + archives javadocJar +} + + +ext { + jackson_version = "2.17.1" + jakarta_annotation_version = "1.3.5" + beanvalidation_version = "2.0.2" + junit_version = "5.10.2" + httpmime_version = "4.5.13" +} + +dependencies { + implementation "com.google.code.findbugs:jsr305:3.0.2" + implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version" + implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" + implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_version" + implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" + implementation "org.openapitools:jackson-databind-nullable:0.2.1" + implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" + implementation "org.apache.httpcomponents:httpmime:$httpmime_version" + testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version" +} + +// Use spotless plugin to automatically format code, remove unused import, etc +// To apply changes directly to the file, run `gradlew spotlessApply` +// Ref: https://github.com/diffplug/spotless/tree/main/plugin-gradle +spotless { + // comment out below to run spotless as part of the `check` task + enforceCheck false + format 'misc', { + // define the files (e.g. '*.gradle', '*.md') to apply `misc` to + target '.gitignore' + // define the steps to apply to those files + trimTrailingWhitespace() + indentWithSpaces() // Takes an integer argument if you don't like 4 + endWithNewline() + } + java { + // don't need to set target, it is inferred from java + // apply a specific flavor of google-java-format + googleJavaFormat('1.8').aosp().reflowLongStrings() + removeUnusedImports() + importOrder() + } +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/build.sbt b/samples/client/petstore/java/native/test-regenerated-fixed/build.sbt new file mode 100644 index 000000000000..464090415c47 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/build.sbt @@ -0,0 +1 @@ +# TODO diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/docs/Category.md b/samples/client/petstore/java/native/test-regenerated-fixed/docs/Category.md new file mode 100644 index 000000000000..a7fc939d252e --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/docs/Category.md @@ -0,0 +1,15 @@ + + +# Category + +A category for a pet + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/docs/ModelApiResponse.md b/samples/client/petstore/java/native/test-regenerated-fixed/docs/ModelApiResponse.md new file mode 100644 index 000000000000..cd7e3c400be6 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/docs/ModelApiResponse.md @@ -0,0 +1,16 @@ + + +# ModelApiResponse + +Describes the result of uploading an image resource + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**code** | **Integer** | | [optional] | +|**type** | **String** | | [optional] | +|**message** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/docs/Order.md b/samples/client/petstore/java/native/test-regenerated-fixed/docs/Order.md new file mode 100644 index 000000000000..0c33059b8b6a --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/docs/Order.md @@ -0,0 +1,29 @@ + + +# Order + +An order for a pets from the pet store + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**petId** | **Long** | | [optional] | +|**quantity** | **Integer** | | [optional] | +|**shipDate** | **OffsetDateTime** | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional] | +|**complete** | **Boolean** | | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| PLACED | "placed" | +| APPROVED | "approved" | +| DELIVERED | "delivered" | + + + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/docs/Pet.md b/samples/client/petstore/java/native/test-regenerated-fixed/docs/Pet.md new file mode 100644 index 000000000000..8bb363301232 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/docs/Pet.md @@ -0,0 +1,29 @@ + + +# Pet + +A pet for sale in the pet store + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**category** | [**Category**](Category.md) | | [optional] | +|**name** | **String** | | | +|**photoUrls** | **List<String>** | | | +|**tags** | [**List<Tag>**](Tag.md) | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| AVAILABLE | "available" | +| PENDING | "pending" | +| SOLD | "sold" | + + + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/docs/PetApi.md b/samples/client/petstore/java/native/test-regenerated-fixed/docs/PetApi.md new file mode 100644 index 000000000000..51f089e85389 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/docs/PetApi.md @@ -0,0 +1,1212 @@ +# PetApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | +| [**addPetWithHttpInfo**](PetApi.md#addPetWithHttpInfo) | **POST** /pet | Add a new pet to the store | +| [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | +| [**deletePetWithHttpInfo**](PetApi.md#deletePetWithHttpInfo) | **DELETE** /pet/{petId} | Deletes a pet | +| [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | +| [**findPetsByStatusWithHttpInfo**](PetApi.md#findPetsByStatusWithHttpInfo) | **GET** /pet/findByStatus | Finds Pets by status | +| [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | +| [**findPetsByTagsWithHttpInfo**](PetApi.md#findPetsByTagsWithHttpInfo) | **GET** /pet/findByTags | Finds Pets by tags | +| [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | +| [**getPetByIdWithHttpInfo**](PetApi.md#getPetByIdWithHttpInfo) | **GET** /pet/{petId} | Find pet by ID | +| [**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet | +| [**updatePetWithHttpInfo**](PetApi.md#updatePetWithHttpInfo) | **PUT** /pet | Update an existing pet | +| [**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data | +| [**updatePetWithFormWithHttpInfo**](PetApi.md#updatePetWithFormWithHttpInfo) | **POST** /pet/{petId} | Updates a pet in the store with form data | +| [**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image | +| [**uploadFileWithHttpInfo**](PetApi.md#uploadFileWithHttpInfo) | **POST** /pet/{petId}/uploadImage | uploads an image | + + + +## addPet + +> Pet addPet(pet) + +Add a new pet to the store + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + Pet result = apiInstance.addPet(pet); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | + +### Return type + +[**Pet**](Pet.md) + + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: application/json, application/xml +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **405** | Invalid input | - | + +## addPetWithHttpInfo + +> ApiResponse addPet addPetWithHttpInfo(pet) + +Add a new pet to the store + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + ApiResponse response = apiInstance.addPetWithHttpInfo(pet); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | + +### Return type + +ApiResponse<[**Pet**](Pet.md)> + + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: application/json, application/xml +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **405** | Invalid input | - | + + +## deletePet + +> void deletePet(petId, apiKey) + +Deletes a pet + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | Pet id to delete + String apiKey = "apiKey_example"; // String | + try { + apiInstance.deletePet(petId, apiKey); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#deletePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| Pet id to delete | | +| **apiKey** | **String**| | [optional] | + +### Return type + + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid pet value | - | + +## deletePetWithHttpInfo + +> ApiResponse deletePet deletePetWithHttpInfo(petId, apiKey) + +Deletes a pet + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | Pet id to delete + String apiKey = "apiKey_example"; // String | + try { + ApiResponse response = apiInstance.deletePetWithHttpInfo(petId, apiKey); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#deletePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| Pet id to delete | | +| **apiKey** | **String**| | [optional] | + +### Return type + + +ApiResponse + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid pet value | - | + + +## findPetsByStatus + +> List findPetsByStatus(status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + List status = Arrays.asList("available"); // List | Status values that need to be considered for filter + try { + List result = apiInstance.findPetsByStatus(status); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByStatus"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [enum: available, pending, sold] | + +### Return type + +[**List<Pet>**](Pet.md) + + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid status value | - | + +## findPetsByStatusWithHttpInfo + +> ApiResponse> findPetsByStatus findPetsByStatusWithHttpInfo(status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + List status = Arrays.asList("available"); // List | Status values that need to be considered for filter + try { + ApiResponse> response = apiInstance.findPetsByStatusWithHttpInfo(status); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByStatus"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [enum: available, pending, sold] | + +### Return type + +ApiResponse<[**List<Pet>**](Pet.md)> + + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid status value | - | + + +## findPetsByTags + +> List findPetsByTags(tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + List tags = Arrays.asList(); // List | Tags to filter by + try { + List result = apiInstance.findPetsByTags(tags); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **tags** | [**List<String>**](String.md)| Tags to filter by | | + +### Return type + +[**List<Pet>**](Pet.md) + + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid tag value | - | + +## findPetsByTagsWithHttpInfo + +> ApiResponse> findPetsByTags findPetsByTagsWithHttpInfo(tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + List tags = Arrays.asList(); // List | Tags to filter by + try { + ApiResponse> response = apiInstance.findPetsByTagsWithHttpInfo(tags); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **tags** | [**List<String>**](String.md)| Tags to filter by | | + +### Return type + +ApiResponse<[**List<Pet>**](Pet.md)> + + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid tag value | - | + + +## getPetById + +> Pet getPetById(petId) + +Find pet by ID + +Returns a single pet + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to return + try { + Pet result = apiInstance.getPetById(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#getPetById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to return | | + +### Return type + +[**Pet**](Pet.md) + + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | + +## getPetByIdWithHttpInfo + +> ApiResponse getPetById getPetByIdWithHttpInfo(petId) + +Find pet by ID + +Returns a single pet + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to return + try { + ApiResponse response = apiInstance.getPetByIdWithHttpInfo(petId); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#getPetById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to return | | + +### Return type + +ApiResponse<[**Pet**](Pet.md)> + + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | + + +## updatePet + +> Pet updatePet(pet) + +Update an existing pet + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + Pet result = apiInstance.updatePet(pet); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | + +### Return type + +[**Pet**](Pet.md) + + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: application/json, application/xml +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | +| **405** | Validation exception | - | + +## updatePetWithHttpInfo + +> ApiResponse updatePet updatePetWithHttpInfo(pet) + +Update an existing pet + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + ApiResponse response = apiInstance.updatePetWithHttpInfo(pet); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | + +### Return type + +ApiResponse<[**Pet**](Pet.md)> + + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: application/json, application/xml +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | +| **405** | Validation exception | - | + + +## updatePetWithForm + +> void updatePetWithForm(petId, name, status) + +Updates a pet in the store with form data + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet that needs to be updated + String name = "name_example"; // String | Updated name of the pet + String status = "status_example"; // String | Updated status of the pet + try { + apiInstance.updatePetWithForm(petId, name, status); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePetWithForm"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet that needs to be updated | | +| **name** | **String**| Updated name of the pet | [optional] | +| **status** | **String**| Updated status of the pet | [optional] | + +### Return type + + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + +## updatePetWithFormWithHttpInfo + +> ApiResponse updatePetWithForm updatePetWithFormWithHttpInfo(petId, name, status) + +Updates a pet in the store with form data + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet that needs to be updated + String name = "name_example"; // String | Updated name of the pet + String status = "status_example"; // String | Updated status of the pet + try { + ApiResponse response = apiInstance.updatePetWithFormWithHttpInfo(petId, name, status); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePetWithForm"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet that needs to be updated | | +| **name** | **String**| Updated name of the pet | [optional] | +| **status** | **String**| Updated status of the pet | [optional] | + +### Return type + + +ApiResponse + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + + +## uploadFile + +> ModelApiResponse uploadFile(petId, additionalMetadata, _file) + +uploads an image + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + File _file = new File("/path/to/file"); // File | file to upload + try { + ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, _file); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | +| **additionalMetadata** | **String**| Additional data to pass to server | [optional] | +| **_file** | **File**| file to upload | [optional] | + +### Return type + +[**ModelApiResponse**](ModelApiResponse.md) + + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: multipart/form-data +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + +## uploadFileWithHttpInfo + +> ApiResponse uploadFile uploadFileWithHttpInfo(petId, additionalMetadata, _file) + +uploads an image + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + File _file = new File("/path/to/file"); // File | file to upload + try { + ApiResponse response = apiInstance.uploadFileWithHttpInfo(petId, additionalMetadata, _file); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | +| **additionalMetadata** | **String**| Additional data to pass to server | [optional] | +| **_file** | **File**| file to upload | [optional] | + +### Return type + +ApiResponse<[**ModelApiResponse**](ModelApiResponse.md)> + + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: multipart/form-data +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/docs/StoreApi.md b/samples/client/petstore/java/native/test-regenerated-fixed/docs/StoreApi.md new file mode 100644 index 000000000000..7dfbbe315c11 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/docs/StoreApi.md @@ -0,0 +1,564 @@ +# StoreApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID | +| [**deleteOrderWithHttpInfo**](StoreApi.md#deleteOrderWithHttpInfo) | **DELETE** /store/order/{orderId} | Delete purchase order by ID | +| [**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status | +| [**getInventoryWithHttpInfo**](StoreApi.md#getInventoryWithHttpInfo) | **GET** /store/inventory | Returns pet inventories by status | +| [**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID | +| [**getOrderByIdWithHttpInfo**](StoreApi.md#getOrderByIdWithHttpInfo) | **GET** /store/order/{orderId} | Find purchase order by ID | +| [**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet | +| [**placeOrderWithHttpInfo**](StoreApi.md#placeOrderWithHttpInfo) | **POST** /store/order | Place an order for a pet | + + + +## deleteOrder + +> void deleteOrder(orderId) + +Delete purchase order by ID + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + String orderId = "orderId_example"; // String | ID of the order that needs to be deleted + try { + apiInstance.deleteOrder(orderId); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#deleteOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **orderId** | **String**| ID of the order that needs to be deleted | | + +### Return type + + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + +## deleteOrderWithHttpInfo + +> ApiResponse deleteOrder deleteOrderWithHttpInfo(orderId) + +Delete purchase order by ID + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + String orderId = "orderId_example"; // String | ID of the order that needs to be deleted + try { + ApiResponse response = apiInstance.deleteOrderWithHttpInfo(orderId); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#deleteOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **orderId** | **String**| ID of the order that needs to be deleted | | + +### Return type + + +ApiResponse + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + + +## getInventory + +> Map getInventory() + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + StoreApi apiInstance = new StoreApi(defaultClient); + try { + Map result = apiInstance.getInventory(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getInventory"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +**Map<String, Integer>** + + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + +## getInventoryWithHttpInfo + +> ApiResponse> getInventory getInventoryWithHttpInfo() + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + StoreApi apiInstance = new StoreApi(defaultClient); + try { + ApiResponse> response = apiInstance.getInventoryWithHttpInfo(); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getInventory"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +ApiResponse<**Map<String, Integer>**> + + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +## getOrderById + +> Order getOrderById(orderId) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + Long orderId = 56L; // Long | ID of pet that needs to be fetched + try { + Order result = apiInstance.getOrderById(orderId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getOrderById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **orderId** | **Long**| ID of pet that needs to be fetched | | + +### Return type + +[**Order**](Order.md) + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + +## getOrderByIdWithHttpInfo + +> ApiResponse getOrderById getOrderByIdWithHttpInfo(orderId) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + Long orderId = 56L; // Long | ID of pet that needs to be fetched + try { + ApiResponse response = apiInstance.getOrderByIdWithHttpInfo(orderId); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getOrderById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **orderId** | **Long**| ID of pet that needs to be fetched | | + +### Return type + +ApiResponse<[**Order**](Order.md)> + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + + +## placeOrder + +> Order placeOrder(order) + +Place an order for a pet + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + Order order = new Order(); // Order | order placed for purchasing the pet + try { + Order result = apiInstance.placeOrder(order); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#placeOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **order** | [**Order**](Order.md)| order placed for purchasing the pet | | + +### Return type + +[**Order**](Order.md) + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid Order | - | + +## placeOrderWithHttpInfo + +> ApiResponse placeOrder placeOrderWithHttpInfo(order) + +Place an order for a pet + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + Order order = new Order(); // Order | order placed for purchasing the pet + try { + ApiResponse response = apiInstance.placeOrderWithHttpInfo(order); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#placeOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **order** | [**Order**](Order.md)| order placed for purchasing the pet | | + +### Return type + +ApiResponse<[**Order**](Order.md)> + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid Order | - | + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/docs/Tag.md b/samples/client/petstore/java/native/test-regenerated-fixed/docs/Tag.md new file mode 100644 index 000000000000..abfde4afb501 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/docs/Tag.md @@ -0,0 +1,15 @@ + + +# Tag + +A tag for a pet + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/docs/User.md b/samples/client/petstore/java/native/test-regenerated-fixed/docs/User.md new file mode 100644 index 000000000000..426845227bd3 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/docs/User.md @@ -0,0 +1,21 @@ + + +# User + +A User who is purchasing from the pet store + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**username** | **String** | | [optional] | +|**firstName** | **String** | | [optional] | +|**lastName** | **String** | | [optional] | +|**email** | **String** | | [optional] | +|**password** | **String** | | [optional] | +|**phone** | **String** | | [optional] | +|**userStatus** | **Integer** | User Status | [optional] | + + + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/docs/UserApi.md b/samples/client/petstore/java/native/test-regenerated-fixed/docs/UserApi.md new file mode 100644 index 000000000000..da72405c908b --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/docs/UserApi.md @@ -0,0 +1,1178 @@ +# UserApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**createUser**](UserApi.md#createUser) | **POST** /user | Create user | +| [**createUserWithHttpInfo**](UserApi.md#createUserWithHttpInfo) | **POST** /user | Create user | +| [**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array | +| [**createUsersWithArrayInputWithHttpInfo**](UserApi.md#createUsersWithArrayInputWithHttpInfo) | **POST** /user/createWithArray | Creates list of users with given input array | +| [**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array | +| [**createUsersWithListInputWithHttpInfo**](UserApi.md#createUsersWithListInputWithHttpInfo) | **POST** /user/createWithList | Creates list of users with given input array | +| [**deleteUser**](UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user | +| [**deleteUserWithHttpInfo**](UserApi.md#deleteUserWithHttpInfo) | **DELETE** /user/{username} | Delete user | +| [**getUserByName**](UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name | +| [**getUserByNameWithHttpInfo**](UserApi.md#getUserByNameWithHttpInfo) | **GET** /user/{username} | Get user by user name | +| [**loginUser**](UserApi.md#loginUser) | **GET** /user/login | Logs user into the system | +| [**loginUserWithHttpInfo**](UserApi.md#loginUserWithHttpInfo) | **GET** /user/login | Logs user into the system | +| [**logoutUser**](UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session | +| [**logoutUserWithHttpInfo**](UserApi.md#logoutUserWithHttpInfo) | **GET** /user/logout | Logs out current logged in user session | +| [**updateUser**](UserApi.md#updateUser) | **PUT** /user/{username} | Updated user | +| [**updateUserWithHttpInfo**](UserApi.md#updateUserWithHttpInfo) | **PUT** /user/{username} | Updated user | + + + +## createUser + +> void createUser(user) + +Create user + +This can only be done by the logged in user. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + User user = new User(); // User | Created user object + try { + apiInstance.createUser(user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**User**](User.md)| Created user object | | + +### Return type + + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + +## createUserWithHttpInfo + +> ApiResponse createUser createUserWithHttpInfo(user) + +Create user + +This can only be done by the logged in user. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + User user = new User(); // User | Created user object + try { + ApiResponse response = apiInstance.createUserWithHttpInfo(user); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**User**](User.md)| Created user object | | + +### Return type + + +ApiResponse + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +## createUsersWithArrayInput + +> void createUsersWithArrayInput(user) + +Creates list of users with given input array + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + List user = Arrays.asList(); // List | List of user object + try { + apiInstance.createUsersWithArrayInput(user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**List<User>**](User.md)| List of user object | | + +### Return type + + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + +## createUsersWithArrayInputWithHttpInfo + +> ApiResponse createUsersWithArrayInput createUsersWithArrayInputWithHttpInfo(user) + +Creates list of users with given input array + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + List user = Arrays.asList(); // List | List of user object + try { + ApiResponse response = apiInstance.createUsersWithArrayInputWithHttpInfo(user); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**List<User>**](User.md)| List of user object | | + +### Return type + + +ApiResponse + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +## createUsersWithListInput + +> void createUsersWithListInput(user) + +Creates list of users with given input array + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + List user = Arrays.asList(); // List | List of user object + try { + apiInstance.createUsersWithListInput(user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithListInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**List<User>**](User.md)| List of user object | | + +### Return type + + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + +## createUsersWithListInputWithHttpInfo + +> ApiResponse createUsersWithListInput createUsersWithListInputWithHttpInfo(user) + +Creates list of users with given input array + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + List user = Arrays.asList(); // List | List of user object + try { + ApiResponse response = apiInstance.createUsersWithListInputWithHttpInfo(user); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithListInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**List<User>**](User.md)| List of user object | | + +### Return type + + +ApiResponse + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +## deleteUser + +> void deleteUser(username) + +Delete user + +This can only be done by the logged in user. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be deleted + try { + apiInstance.deleteUser(username); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#deleteUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The name that needs to be deleted | | + +### Return type + + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + +## deleteUserWithHttpInfo + +> ApiResponse deleteUser deleteUserWithHttpInfo(username) + +Delete user + +This can only be done by the logged in user. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be deleted + try { + ApiResponse response = apiInstance.deleteUserWithHttpInfo(username); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#deleteUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The name that needs to be deleted | | + +### Return type + + +ApiResponse + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + + +## getUserByName + +> User getUserByName(username) + +Get user by user name + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. + try { + User result = apiInstance.getUserByName(username); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#getUserByName"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The name that needs to be fetched. Use user1 for testing. | | + +### Return type + +[**User**](User.md) + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + +## getUserByNameWithHttpInfo + +> ApiResponse getUserByName getUserByNameWithHttpInfo(username) + +Get user by user name + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. + try { + ApiResponse response = apiInstance.getUserByNameWithHttpInfo(username); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#getUserByName"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The name that needs to be fetched. Use user1 for testing. | | + +### Return type + +ApiResponse<[**User**](User.md)> + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + + +## loginUser + +> String loginUser(username, password) + +Logs user into the system + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The user name for login + String password = "password_example"; // String | The password for login in clear text + try { + String result = apiInstance.loginUser(username, password); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#loginUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The user name for login | | +| **password** | **String**| The password for login in clear text | | + +### Return type + +**String** + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +| **400** | Invalid username/password supplied | - | + +## loginUserWithHttpInfo + +> ApiResponse loginUser loginUserWithHttpInfo(username, password) + +Logs user into the system + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The user name for login + String password = "password_example"; // String | The password for login in clear text + try { + ApiResponse response = apiInstance.loginUserWithHttpInfo(username, password); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#loginUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The user name for login | | +| **password** | **String**| The password for login in clear text | | + +### Return type + +ApiResponse<**String**> + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +| **400** | Invalid username/password supplied | - | + + +## logoutUser + +> void logoutUser() + +Logs out current logged in user session + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + try { + apiInstance.logoutUser(); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#logoutUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + +## logoutUserWithHttpInfo + +> ApiResponse logoutUser logoutUserWithHttpInfo() + +Logs out current logged in user session + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + try { + ApiResponse response = apiInstance.logoutUserWithHttpInfo(); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#logoutUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + + +ApiResponse + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +## updateUser + +> void updateUser(username, user) + +Updated user + +This can only be done by the logged in user. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | name that need to be deleted + User user = new User(); // User | Updated user object + try { + apiInstance.updateUser(username, user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#updateUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| name that need to be deleted | | +| **user** | [**User**](User.md)| Updated user object | | + +### Return type + + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid user supplied | - | +| **404** | User not found | - | + +## updateUserWithHttpInfo + +> ApiResponse updateUser updateUserWithHttpInfo(username, user) + +Updated user + +This can only be done by the logged in user. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | name that need to be deleted + User user = new User(); // User | Updated user object + try { + ApiResponse response = apiInstance.updateUserWithHttpInfo(username, user); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#updateUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| name that need to be deleted | | +| **user** | [**User**](User.md)| Updated user object | | + +### Return type + + +ApiResponse + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid user supplied | - | +| **404** | User not found | - | + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/git_push.sh b/samples/client/petstore/java/native/test-regenerated-fixed/git_push.sh new file mode 100644 index 000000000000..f53a75d4fabe --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/git_push.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=$(git remote) +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/gradle.properties b/samples/client/petstore/java/native/test-regenerated-fixed/gradle.properties new file mode 100644 index 000000000000..a3408578278a --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/gradle.properties @@ -0,0 +1,6 @@ +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/native/test-regenerated-fixed/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..e6441136f3d4ba8a0da8d277868979cfbc8ad796 GIT binary patch literal 43453 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 yu?e%!_ptzGB|8GrCfu%p?(_ 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
NnX)EH+Nua)3Y(c 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 '} +case $link in #( +/*) app_path=$link ;; #( +*) app_path=$APP_HOME$link ;; +esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { +echo "$*" +} >&2 + +die () { +echo +echo "$*" +echo +exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( +CYGWIN* ) cygwin=true ;; #( +Darwin* ) darwin=true ;; #( +MSYS* | MINGW* ) msys=true ;; #( +NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then +if [ -x "$JAVA_HOME/jre/sh/java" ] ; then +# IBM's JDK on AIX uses strange locations for the executables +JAVACMD=$JAVA_HOME/jre/sh/java +else +JAVACMD=$JAVA_HOME/bin/java +fi +if [ ! -x "$JAVACMD" ] ; then +die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +else +JAVACMD=java +if ! command -v java >/dev/null 2>&1 +then +die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then +case $MAX_FD in #( +max*) +# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +MAX_FD=$( ulimit -H -n ) || +warn "Could not query maximum file descriptor limit" +esac +case $MAX_FD in #( +'' | soft) :;; #( +*) +# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +ulimit -n "$MAX_FD" || +warn "Could not set maximum file descriptor limit to $MAX_FD" +esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then +APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) +CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + +JAVACMD=$( cygpath --unix "$JAVACMD" ) + +# Now convert the arguments - kludge to limit ourselves to /bin/sh +for arg do +if +case $arg in #( +-*) false ;; # don't mess with options #( +/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath +[ -e "$t" ] ;; #( +*) false ;; +esac +then +arg=$( cygpath --path --ignore --mixed "$arg" ) +fi +# Roll the args list around exactly as many times as the number of +# args, so each arg winds up back in the position where it started, but +# possibly modified. +# +# NB: a `for` loop captures its iteration list before it begins, so +# changing the positional parameters here affects neither the number of +# iterations, nor the values presented in `arg`. +shift # remove old arg +set -- "$@" "$arg" # push replacement arg +done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ +"-Dorg.gradle.appname=$APP_BASE_NAME" \ +-classpath "$CLASSPATH" \ +org.gradle.wrapper.GradleWrapperMain \ +"$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then +die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( +printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | +xargs -n1 | +sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | +tr '\n' ' ' +)" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/gradlew.bat b/samples/client/petstore/java/native/test-regenerated-fixed/gradlew.bat new file mode 100644 index 000000000000..25da30dbdeee --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/pom.xml b/samples/client/petstore/java/native/test-regenerated-fixed/pom.xml new file mode 100644 index 000000000000..10a3beca26fb --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/pom.xml @@ -0,0 +1,264 @@ + + 4.0.0 + org.openapitools + openapi-java-client + jar + openapi-java-client + 1.0.0 + https://github.com/openapitools/openapi-generator + OpenAPI Java + + scm:git:git@github.com:openapitools/openapi-generator.git + scm:git:git@github.com:openapitools/openapi-generator.git + https://github.com/openapitools/openapi-generator + + + + + Unlicense + https://www.apache.org/licenses/LICENSE-2.0.html + repo + + + + + + OpenAPI-Generator Contributors + team@openapitools.org + OpenAPITools.org + http://openapitools.org + + + + + + + maven-enforcer-plugin + 3.1.0 + + + enforce-maven + + enforce + + + + + 3 + + + 11 + + + + + + + + maven-surefire-plugin + 3.2.5 + + + conf/log4j.properties + + -Xms512m -Xmx1500m + methods + 10 + + + + maven-dependency-plugin + 3.3.0 + + + package + + copy-dependencies + + + ${project.build.directory}/lib + + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.3.0 + + + + test-jar + + + + + + + + maven-compiler-plugin + 3.10.1 + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.4.1 + + + attach-javadocs + + jar + + + + + + maven-source-plugin + 3.2.1 + + + attach-sources + + jar-no-fork + + + + + + + com.diffplug.spotless + spotless-maven-plugin + ${spotless.version} + + + + + + + .gitignore + + + + + + true + 4 + + + + + + + + + + 1.8 + + true + + + + + + + + + + + + sign-artifacts + + + + maven-gpg-plugin + 3.0.1 + + + sign-artifacts + verify + + sign + + + + + + + + + + + + + + com.fasterxml.jackson.core + jackson-core + ${jackson-version} + + + com.fasterxml.jackson.core + jackson-annotations + ${jackson-version} + + + com.fasterxml.jackson.core + jackson-databind + ${jackson-version} + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson-version} + + + org.openapitools + jackson-databind-nullable + ${jackson-databind-nullable-version} + + + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + jakarta.annotation + jakarta.annotation-api + ${jakarta-annotation-version} + provided + + + org.apache.httpcomponents + httpmime + ${httpmime-version} + + + + + org.junit.jupiter + junit-jupiter-api + ${junit-version} + test + + + + + UTF-8 + 11 + 11 + 2.17.1 + 0.2.6 + 1.3.5 + 2.0.2 + 4.5.14 + 5.10.2 + 2.27.2 + + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/settings.gradle b/samples/client/petstore/java/native/test-regenerated-fixed/settings.gradle new file mode 100644 index 000000000000..369ba54a9e06 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/settings.gradle @@ -0,0 +1 @@ +rootProject.name = "openapi-java-client" \ No newline at end of file diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/src/main/AndroidManifest.xml b/samples/client/petstore/java/native/test-regenerated-fixed/src/main/AndroidManifest.xml new file mode 100644 index 000000000000..54fbcb3da1e8 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/src/main/AndroidManifest.xml @@ -0,0 +1,3 @@ + + + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/ApiClient.java new file mode 100644 index 000000000000..9afcc9608abd --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/ApiClient.java @@ -0,0 +1,457 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import org.openapitools.jackson.nullable.JsonNullableModule; + +import java.io.InputStream; +import java.net.URI; +import java.net.URLEncoder; +import java.net.http.HttpClient; +import java.net.http.HttpConnectTimeoutException; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.StringJoiner; +import java.util.function.Consumer; +import java.util.stream.Collectors; + +import static java.nio.charset.StandardCharsets.UTF_8; + +/** + * Configuration and utility class for API clients. + * + *

This class can be constructed and modified, then used to instantiate the + * various API classes. The API classes use the settings in this class to + * configure themselves, but otherwise do not store a link to this class.

+ * + *

This class is mutable and not synchronized, so it is not thread-safe. + * The API classes generated from this are immutable and thread-safe.

+ * + *

The setter methods of this class return the current object to facilitate + * a fluent style of configuration.

+ */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:07:41.448223+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class ApiClient { + + protected HttpClient.Builder builder; + protected ObjectMapper mapper; + protected String scheme; + protected String host; + protected int port; + protected String basePath; + protected Consumer interceptor; + protected Consumer> responseInterceptor; + protected Consumer> asyncResponseInterceptor; + protected Duration readTimeout; + protected Duration connectTimeout; + + public static String valueToString(Object value) { + if (value == null) { + return ""; + } + if (value instanceof OffsetDateTime) { + return ((OffsetDateTime) value).format(DateTimeFormatter.ISO_OFFSET_DATE_TIME); + } + return value.toString(); + } + + /** + * URL encode a string in the UTF-8 encoding. + * + * @param s String to encode. + * @return URL-encoded representation of the input string. + */ + public static String urlEncode(String s) { + return URLEncoder.encode(s, UTF_8).replaceAll("\\+", "%20"); + } + + /** + * Convert a URL query name/value parameter to a list of encoded {@link Pair} + * objects. + * + *

The value can be null, in which case an empty list is returned.

+ * + * @param name The query name parameter. + * @param value The query value, which may not be a collection but may be + * null. + * @return A singleton list of the {@link Pair} objects representing the input + * parameters, which is encoded for use in a URL. If the value is null, an + * empty list is returned. + */ + public static List parameterToPairs(String name, Object value) { + if (name == null || name.isEmpty() || value == null) { + return Collections.emptyList(); + } + return Collections.singletonList(new Pair(urlEncode(name), urlEncode(valueToString(value)))); + } + + /** + * Convert a URL query name/collection parameter to a list of encoded + * {@link Pair} objects. + * + * @param collectionFormat The swagger collectionFormat string (csv, tsv, etc). + * @param name The query name parameter. + * @param values A collection of values for the given query name, which may be + * null. + * @return A list of {@link Pair} objects representing the input parameters, + * which is encoded for use in a URL. If the values collection is null, an + * empty list is returned. + */ + public static List parameterToPairs( + String collectionFormat, String name, Collection values) { + if (name == null || name.isEmpty() || values == null || values.isEmpty()) { + return Collections.emptyList(); + } + + // get the collection format (default: csv) + String format = collectionFormat == null || collectionFormat.isEmpty() ? "csv" : collectionFormat; + + // create the params based on the collection format + if ("multi".equals(format)) { + return values.stream() + .map(value -> new Pair(urlEncode(name), urlEncode(valueToString(value)))) + .collect(Collectors.toList()); + } + + String delimiter; + switch(format) { + case "csv": + delimiter = urlEncode(","); + break; + case "ssv": + delimiter = urlEncode(" "); + break; + case "tsv": + delimiter = urlEncode("\t"); + break; + case "pipes": + delimiter = urlEncode("|"); + break; + default: + throw new IllegalArgumentException("Illegal collection format: " + collectionFormat); + } + + StringJoiner joiner = new StringJoiner(delimiter); + for (Object value : values) { + joiner.add(urlEncode(valueToString(value))); + } + + return Collections.singletonList(new Pair(urlEncode(name), joiner.toString())); + } + + /** + * Create an instance of ApiClient. + */ + public ApiClient() { + this.builder = createDefaultHttpClientBuilder(); + this.mapper = createDefaultObjectMapper(); + updateBaseUri(getDefaultBaseUri()); + interceptor = null; + readTimeout = null; + connectTimeout = null; + responseInterceptor = null; + asyncResponseInterceptor = null; + } + + /** + * Create an instance of ApiClient. + * + * @param builder Http client builder. + * @param mapper Object mapper. + * @param baseUri Base URI + */ + public ApiClient(HttpClient.Builder builder, ObjectMapper mapper, String baseUri) { + this.builder = builder; + this.mapper = mapper; + updateBaseUri(baseUri != null ? baseUri : getDefaultBaseUri()); + interceptor = null; + readTimeout = null; + connectTimeout = null; + responseInterceptor = null; + asyncResponseInterceptor = null; + } + + public static ObjectMapper createDefaultObjectMapper() { + ObjectMapper mapper = new ObjectMapper(); + mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, false); + mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); + mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); + mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); + mapper.disable(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE); + mapper.registerModule(new JavaTimeModule()); + mapper.registerModule(new JsonNullableModule()); + mapper.registerModule(new RFC3339JavaTimeModule()); + return mapper; + } + + protected String getDefaultBaseUri() { + return "http://petstore.swagger.io/v2"; + } + + public static HttpClient.Builder createDefaultHttpClientBuilder() { + return HttpClient.newBuilder(); + } + + public final void updateBaseUri(String baseUri) { + URI uri = URI.create(baseUri); + scheme = uri.getScheme(); + host = uri.getHost(); + port = uri.getPort(); + basePath = uri.getRawPath(); + } + + /** + * Set a custom {@link HttpClient.Builder} object to use when creating the + * {@link HttpClient} that is used by the API client. + * + * @param builder Custom client builder. + * @return This object. + */ + public ApiClient setHttpClientBuilder(HttpClient.Builder builder) { + this.builder = builder; + return this; + } + + /** + * Get an {@link HttpClient} based on the current {@link HttpClient.Builder}. + * + *

The returned object is immutable and thread-safe.

+ * + * @return The HTTP client. + */ + public HttpClient getHttpClient() { + return builder.build(); + } + + /** + * Set a custom {@link ObjectMapper} to serialize and deserialize the request + * and response bodies. + * + * @param mapper Custom object mapper. + * @return This object. + */ + public ApiClient setObjectMapper(ObjectMapper mapper) { + this.mapper = mapper; + return this; + } + + /** + * Get a copy of the current {@link ObjectMapper}. + * + * @return A copy of the current object mapper. + */ + public ObjectMapper getObjectMapper() { + return mapper.copy(); + } + + /** + * Set a custom host name for the target service. + * + * @param host The host name of the target service. + * @return This object. + */ + public ApiClient setHost(String host) { + this.host = host; + return this; + } + + /** + * Set a custom port number for the target service. + * + * @param port The port of the target service. Set this to -1 to reset the + * value to the default for the scheme. + * @return This object. + */ + public ApiClient setPort(int port) { + this.port = port; + return this; + } + + /** + * Set a custom base path for the target service, for example '/v2'. + * + * @param basePath The base path against which the rest of the path is + * resolved. + * @return This object. + */ + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + return this; + } + + /** + * Get the base URI to resolve the endpoint paths against. + * + * @return The complete base URI that the rest of the API parameters are + * resolved against. + */ + public String getBaseUri() { + return scheme + "://" + host + (port == -1 ? "" : ":" + port) + basePath; + } + + /** + * Set a custom scheme for the target service, for example 'https'. + * + * @param scheme The scheme of the target service + * @return This object. + */ + public ApiClient setScheme(String scheme){ + this.scheme = scheme; + return this; + } + + /** + * Set a custom request interceptor. + * + *

A request interceptor is a mechanism for altering each request before it + * is sent. After the request has been fully configured but not yet built, the + * request builder is passed into this function for further modification, + * after which it is sent out.

+ * + *

This is useful for altering the requests in a custom manner, such as + * adding headers. It could also be used for logging and monitoring.

+ * + * @param interceptor A function invoked before creating each request. A value + * of null resets the interceptor to a no-op. + * @return This object. + */ + public ApiClient setRequestInterceptor(Consumer interceptor) { + this.interceptor = interceptor; + return this; + } + + /** + * Get the custom interceptor. + * + * @return The custom interceptor that was set, or null if there isn't any. + */ + public Consumer getRequestInterceptor() { + return interceptor; + } + + /** + * Set a custom response interceptor. + * + *

This is useful for logging, monitoring or extraction of header variables

+ * + * @param interceptor A function invoked before creating each request. A value + * of null resets the interceptor to a no-op. + * @return This object. + */ + public ApiClient setResponseInterceptor(Consumer> interceptor) { + this.responseInterceptor = interceptor; + return this; + } + + /** + * Get the custom response interceptor. + * + * @return The custom interceptor that was set, or null if there isn't any. + */ + public Consumer> getResponseInterceptor() { + return responseInterceptor; + } + + /** + * Set a custom async response interceptor. Use this interceptor when asyncNative is set to 'true'. + * + *

This is useful for logging, monitoring or extraction of header variables

+ * + * @param interceptor A function invoked before creating each request. A value + * of null resets the interceptor to a no-op. + * @return This object. + */ + public ApiClient setAsyncResponseInterceptor(Consumer> interceptor) { + this.asyncResponseInterceptor = interceptor; + return this; + } + + /** + * Get the custom async response interceptor. Use this interceptor when asyncNative is set to 'true'. + * + * @return The custom interceptor that was set, or null if there isn't any. + */ + public Consumer> getAsyncResponseInterceptor() { + return asyncResponseInterceptor; + } + + /** + * Set the read timeout for the http client. + * + *

This is the value used by default for each request, though it can be + * overridden on a per-request basis with a request interceptor.

+ * + * @param readTimeout The read timeout used by default by the http client. + * Setting this value to null resets the timeout to an + * effectively infinite value. + * @return This object. + */ + public ApiClient setReadTimeout(Duration readTimeout) { + this.readTimeout = readTimeout; + return this; + } + + /** + * Get the read timeout that was set. + * + * @return The read timeout, or null if no timeout was set. Null represents + * an infinite wait time. + */ + public Duration getReadTimeout() { + return readTimeout; + } + /** + * Sets the connect timeout (in milliseconds) for the http client. + * + *

In the case where a new connection needs to be established, if + * the connection cannot be established within the given {@code + * duration}, then {@link HttpClient#send(HttpRequest,BodyHandler) + * HttpClient::send} throws an {@link HttpConnectTimeoutException}, or + * {@link HttpClient#sendAsync(HttpRequest,BodyHandler) + * HttpClient::sendAsync} completes exceptionally with an + * {@code HttpConnectTimeoutException}. If a new connection does not + * need to be established, for example if a connection can be reused + * from a previous request, then this timeout duration has no effect. + * + * @param connectTimeout connection timeout in milliseconds + * + * @return This object. + */ + public ApiClient setConnectTimeout(Duration connectTimeout) { + this.connectTimeout = connectTimeout; + this.builder.connectTimeout(connectTimeout); + return this; + } + + /** + * Get connection timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public Duration getConnectTimeout() { + return connectTimeout; + } +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/ApiException.java new file mode 100644 index 000000000000..b2c796e41c45 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/ApiException.java @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +import java.net.http.HttpHeaders; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:07:41.448223+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class ApiException extends Exception { + private static final long serialVersionUID = 1L; + + private int code = 0; + private HttpHeaders responseHeaders = null; + private String responseBody = null; + + public ApiException() {} + + public ApiException(Throwable throwable) { + super(throwable); + } + + public ApiException(String message) { + super(message); + } + + public ApiException(String message, Throwable throwable, int code, HttpHeaders responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + public ApiException(String message, int code, HttpHeaders responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(String message, Throwable throwable, int code, HttpHeaders responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } + + public ApiException(int code, HttpHeaders responseHeaders, String responseBody) { + this((String) null, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + public ApiException(int code, String message, HttpHeaders responseHeaders, String responseBody) { + this(code, message); + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + /** + * Get the HTTP status code. + * + * @return HTTP status code + */ + public int getCode() { + return code; + } + + /** + * Get the HTTP response headers. + * + * @return Headers as an HttpHeaders object + */ + public HttpHeaders getResponseHeaders() { + return responseHeaders; + } + + /** + * Get the HTTP response body. + * + * @return Response body in the form of string + */ + public String getResponseBody() { + return responseBody; + } +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/ApiResponse.java b/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/ApiResponse.java new file mode 100644 index 000000000000..dfaf2fc37f49 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/ApiResponse.java @@ -0,0 +1,60 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +import java.util.List; +import java.util.Map; + +/** + * API response returned by API call. + * + * @param The type of data that is deserialized from response body + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:07:41.448223+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class ApiResponse { + final private int statusCode; + final private Map> headers; + final private T data; + + /** + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + */ + public ApiResponse(int statusCode, Map> headers) { + this(statusCode, headers, null); + } + + /** + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + * @param data The object deserialized from response bod + */ + public ApiResponse(int statusCode, Map> headers, T data) { + this.statusCode = statusCode; + this.headers = headers; + this.data = data; + } + + public int getStatusCode() { + return statusCode; + } + + public Map> getHeaders() { + return headers; + } + + public T getData() { + return data; + } +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/Configuration.java b/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/Configuration.java new file mode 100644 index 000000000000..b7a6ebfcde4d --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/Configuration.java @@ -0,0 +1,63 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +import java.util.Objects; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Supplier; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:07:41.448223+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class Configuration { + public static final String VERSION = "1.0.0"; + + private static final AtomicReference defaultApiClient = new AtomicReference<>(); + private static volatile Supplier apiClientFactory = ApiClient::new; + + /** + * Get the default API client, which would be used when creating API instances without providing an API client. + * + * @return Default API client + */ + public static ApiClient getDefaultApiClient() { + ApiClient client = defaultApiClient.get(); + if (client == null) { + client = defaultApiClient.updateAndGet(val -> { + if (val != null) { // changed by another thread + return val; + } + return apiClientFactory.get(); + }); + } + return client; + } + + /** + * Set the default API client, which would be used when creating API instances without providing an API client. + * + * @param apiClient API client + */ + public static void setDefaultApiClient(ApiClient apiClient) { + defaultApiClient.set(apiClient); + } + + /** + * set the callback used to create new ApiClient objects + */ + public static void setApiClientFactory(Supplier factory) { + apiClientFactory = Objects.requireNonNull(factory); + } + + private Configuration() { + } +} \ No newline at end of file diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/JSON.java new file mode 100644 index 000000000000..7f6a0317ebc1 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/JSON.java @@ -0,0 +1,264 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.*; +import com.fasterxml.jackson.databind.json.JsonMapper; +import org.openapitools.jackson.nullable.JsonNullableModule; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import org.openapitools.client.model.*; + +import java.text.DateFormat; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:07:41.448223+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class JSON { + private ObjectMapper mapper; + + public JSON() { + mapper = JsonMapper.builder() + .serializationInclusion(JsonInclude.Include.NON_NULL) + .disable(MapperFeature.ALLOW_COERCION_OF_SCALARS) + .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE) + .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) + .enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING) + .enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING) + .defaultDateFormat(new RFC3339DateFormat()) + .addModule(new JavaTimeModule()) + .build(); + JsonNullableModule jnm = new JsonNullableModule(); + mapper.registerModule(jnm); + } + + /** + * Set the date format for JSON (de)serialization with Date properties. + * + * @param dateFormat Date format + */ + public void setDateFormat(DateFormat dateFormat) { + mapper.setDateFormat(dateFormat); + } + + /** + * Get the object mapper + * + * @return object mapper + */ + public ObjectMapper getMapper() { return mapper; } + + /** + * Returns the target model class that should be used to deserialize the input data. + * The discriminator mappings are used to determine the target model class. + * + * @param node The input data. + * @param modelClass The class that contains the discriminator mappings. + * + * @return the target model class. + */ + public static Class getClassForElement(JsonNode node, Class modelClass) { + ClassDiscriminatorMapping cdm = modelDiscriminators.get(modelClass); + if (cdm != null) { + return cdm.getClassForElement(node, new HashSet>()); + } + return null; + } + + /** + * Helper class to register the discriminator mappings. + */ + @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:07:41.448223+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") + private static class ClassDiscriminatorMapping { + // The model class name. + Class modelClass; + // The name of the discriminator property. + String discriminatorName; + // The discriminator mappings for a model class. + Map> discriminatorMappings; + + // Constructs a new class discriminator. + ClassDiscriminatorMapping(Class cls, String propertyName, Map> mappings) { + modelClass = cls; + discriminatorName = propertyName; + discriminatorMappings = new HashMap>(); + if (mappings != null) { + discriminatorMappings.putAll(mappings); + } + } + + // Return the name of the discriminator property for this model class. + String getDiscriminatorPropertyName() { + return discriminatorName; + } + + // Return the discriminator value or null if the discriminator is not + // present in the payload. + String getDiscriminatorValue(JsonNode node) { + // Determine the value of the discriminator property in the input data. + if (discriminatorName != null) { + // Get the value of the discriminator property, if present in the input payload. + node = node.get(discriminatorName); + if (node != null && node.isValueNode()) { + String discrValue = node.asText(); + if (discrValue != null) { + return discrValue; + } + } + } + return null; + } + + /** + * Returns the target model class that should be used to deserialize the input data. + * This function can be invoked for anyOf/oneOf composed models with discriminator mappings. + * The discriminator mappings are used to determine the target model class. + * + * @param node The input data. + * @param visitedClasses The set of classes that have already been visited. + * + * @return the target model class. + */ + Class getClassForElement(JsonNode node, Set> visitedClasses) { + if (visitedClasses.contains(modelClass)) { + // Class has already been visited. + return null; + } + // Determine the value of the discriminator property in the input data. + String discrValue = getDiscriminatorValue(node); + if (discrValue == null) { + return null; + } + Class cls = discriminatorMappings.get(discrValue); + // It may not be sufficient to return this cls directly because that target class + // may itself be a composed schema, possibly with its own discriminator. + visitedClasses.add(modelClass); + for (Class childClass : discriminatorMappings.values()) { + ClassDiscriminatorMapping childCdm = modelDiscriminators.get(childClass); + if (childCdm == null) { + continue; + } + if (!discriminatorName.equals(childCdm.discriminatorName)) { + discrValue = getDiscriminatorValue(node); + if (discrValue == null) { + continue; + } + } + if (childCdm != null) { + // Recursively traverse the discriminator mappings. + Class childDiscr = childCdm.getClassForElement(node, visitedClasses); + if (childDiscr != null) { + return childDiscr; + } + } + } + return cls; + } + } + + /** + * Returns true if inst is an instance of modelClass in the OpenAPI model hierarchy. + * + * The Java class hierarchy is not implemented the same way as the OpenAPI model hierarchy, + * so it's not possible to use the instanceof keyword. + * + * @param modelClass A OpenAPI model class. + * @param inst The instance object. + * @param visitedClasses The set of classes that have already been visited. + * + * @return true if inst is an instance of modelClass in the OpenAPI model hierarchy. + */ + public static boolean isInstanceOf(Class modelClass, Object inst, Set> visitedClasses) { + if (modelClass.isInstance(inst)) { + // This handles the 'allOf' use case with single parent inheritance. + return true; + } + if (visitedClasses.contains(modelClass)) { + // This is to prevent infinite recursion when the composed schemas have + // a circular dependency. + return false; + } + visitedClasses.add(modelClass); + + // Traverse the oneOf/anyOf composed schemas. + Map> descendants = modelDescendants.get(modelClass); + if (descendants != null) { + for (Class childType : descendants.values()) { + if (isInstanceOf(childType, inst, visitedClasses)) { + return true; + } + } + } + return false; + } + + /** + * A map of discriminators for all model classes. + */ + private static Map, ClassDiscriminatorMapping> modelDiscriminators = new HashMap<>(); + + /** + * A map of oneOf/anyOf descendants for each model class. + */ + private static Map, Map>> modelDescendants = new HashMap<>(); + + /** + * Register a model class discriminator. + * + * @param modelClass the model class + * @param discriminatorPropertyName the name of the discriminator property + * @param mappings a map with the discriminator mappings. + */ + public static void registerDiscriminator(Class modelClass, String discriminatorPropertyName, Map> mappings) { + ClassDiscriminatorMapping m = new ClassDiscriminatorMapping(modelClass, discriminatorPropertyName, mappings); + modelDiscriminators.put(modelClass, m); + } + + /** + * Register the oneOf/anyOf descendants of the modelClass. + * + * @param modelClass the model class + * @param descendants a map of oneOf/anyOf descendants. + */ + public static void registerDescendants(Class modelClass, Map> descendants) { + modelDescendants.put(modelClass, descendants); + } + + private static JSON json; + + static { + json = new JSON(); + } + + /** + * Get the default JSON instance. + * + * @return the default JSON instance + */ + public static JSON getDefault() { + return json; + } + + /** + * Set the default JSON instance. + * + * @param json JSON instance to be used + */ + public static void setDefault(JSON json) { + JSON.json = json; + } +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/Pair.java new file mode 100644 index 000000000000..121faebe0766 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/Pair.java @@ -0,0 +1,37 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:07:41.448223+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class Pair { + private final String name; + private final String value; + + public Pair(String name, String value) { + this.name = isValidString(name) ? name : ""; + this.value = isValidString(value) ? value : ""; + } + + public String getName() { + return this.name; + } + + public String getValue() { + return this.value; + } + + private static boolean isValidString(String arg) { + return arg != null; + } +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/RFC3339DateFormat.java b/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/RFC3339DateFormat.java new file mode 100644 index 000000000000..791079ce6d83 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/RFC3339DateFormat.java @@ -0,0 +1,58 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client; + +import com.fasterxml.jackson.databind.util.StdDateFormat; + +import java.text.DateFormat; +import java.text.FieldPosition; +import java.text.ParsePosition; +import java.util.Date; +import java.text.DecimalFormat; +import java.util.GregorianCalendar; +import java.util.TimeZone; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:07:41.448223+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class RFC3339DateFormat extends DateFormat { + private static final long serialVersionUID = 1L; + private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + + public RFC3339DateFormat() { + this.calendar = new GregorianCalendar(); + this.numberFormat = new DecimalFormat(); + } + + @Override + public Date parse(String source) { + return parse(source, new ParsePosition(0)); + } + + @Override + public Date parse(String source, ParsePosition pos) { + return fmt.parse(source, pos); + } + + @Override + public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { + return fmt.format(date, toAppendTo, fieldPosition); + } + + @Override + public Object clone() { + return super.clone(); + } +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/RFC3339InstantDeserializer.java b/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/RFC3339InstantDeserializer.java new file mode 100644 index 000000000000..248ff1a011ca --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/RFC3339InstantDeserializer.java @@ -0,0 +1,100 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client; + +import java.io.IOException; +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneId; +import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; +import java.time.temporal.Temporal; +import java.time.temporal.TemporalAccessor; +import java.util.function.BiFunction; +import java.util.function.Function; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeFeature; +import com.fasterxml.jackson.datatype.jsr310.deser.InstantDeserializer; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:07:41.448223+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class RFC3339InstantDeserializer extends InstantDeserializer { + private static final long serialVersionUID = 1L; + private final static boolean DEFAULT_NORMALIZE_ZONE_ID = JavaTimeFeature.NORMALIZE_DESERIALIZED_ZONE_ID.enabledByDefault(); + private final static boolean DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS + = JavaTimeFeature.ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS.enabledByDefault(); + + public static final RFC3339InstantDeserializer INSTANT = new RFC3339InstantDeserializer<>( + Instant.class, DateTimeFormatter.ISO_INSTANT, + Instant::from, + a -> Instant.ofEpochMilli( a.value ), + a -> Instant.ofEpochSecond( a.integer, a.fraction ), + null, + true, // yes, replace zero offset with Z + DEFAULT_NORMALIZE_ZONE_ID, + DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS + ); + + public static final RFC3339InstantDeserializer OFFSET_DATE_TIME = new RFC3339InstantDeserializer<>( + OffsetDateTime.class, DateTimeFormatter.ISO_OFFSET_DATE_TIME, + OffsetDateTime::from, + a -> OffsetDateTime.ofInstant( Instant.ofEpochMilli( a.value ), a.zoneId ), + a -> OffsetDateTime.ofInstant( Instant.ofEpochSecond( a.integer, a.fraction ), a.zoneId ), + (d, z) -> ( d.isEqual( OffsetDateTime.MIN ) || d.isEqual( OffsetDateTime.MAX ) ? + d : + d.withOffsetSameInstant( z.getRules().getOffset( d.toLocalDateTime() ) ) ), + true, // yes, replace zero offset with Z + DEFAULT_NORMALIZE_ZONE_ID, + DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS + ); + + public static final RFC3339InstantDeserializer ZONED_DATE_TIME = new RFC3339InstantDeserializer<>( + ZonedDateTime.class, DateTimeFormatter.ISO_ZONED_DATE_TIME, + ZonedDateTime::from, + a -> ZonedDateTime.ofInstant( Instant.ofEpochMilli( a.value ), a.zoneId ), + a -> ZonedDateTime.ofInstant( Instant.ofEpochSecond( a.integer, a.fraction ), a.zoneId ), + ZonedDateTime::withZoneSameInstant, + false, // keep zero offset and Z separate since zones explicitly supported + DEFAULT_NORMALIZE_ZONE_ID, + DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS + ); + + protected RFC3339InstantDeserializer( + Class supportedType, + DateTimeFormatter formatter, + Function parsedToValue, + Function fromMilliseconds, + Function fromNanoseconds, + BiFunction adjust, + boolean replaceZeroOffsetAsZ, + boolean normalizeZoneId, + boolean readNumericStringsAsTimestamp) { + super( + supportedType, + formatter, + parsedToValue, + fromMilliseconds, + fromNanoseconds, + adjust, + replaceZeroOffsetAsZ, + normalizeZoneId, + readNumericStringsAsTimestamp + ); + } + + @Override + protected T _fromString(JsonParser p, DeserializationContext ctxt, String string0) throws IOException { + return super._fromString(p, ctxt, string0.replace( ' ', 'T' )); + } +} \ No newline at end of file diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/RFC3339JavaTimeModule.java b/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/RFC3339JavaTimeModule.java new file mode 100644 index 000000000000..53e5ca962811 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/RFC3339JavaTimeModule.java @@ -0,0 +1,32 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client; + +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZonedDateTime; + +import com.fasterxml.jackson.databind.module.SimpleModule; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:07:41.448223+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class RFC3339JavaTimeModule extends SimpleModule { + private static final long serialVersionUID = 1L; + + public RFC3339JavaTimeModule() { + super("RFC3339JavaTimeModule"); + + addDeserializer(Instant.class, RFC3339InstantDeserializer.INSTANT); + addDeserializer(OffsetDateTime.class, RFC3339InstantDeserializer.OFFSET_DATE_TIME); + addDeserializer(ZonedDateTime.class, RFC3339InstantDeserializer.ZONED_DATE_TIME); + } +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/ServerConfiguration.java new file mode 100644 index 000000000000..1f7afd0db9d9 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -0,0 +1,72 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +import java.util.Map; + +/** + * Representing a Server configuration. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:07:41.448223+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class ServerConfiguration { + public String URL; + public String description; + public Map variables; + + /** + * @param URL A URL to the target host. + * @param description A description of the host designated by the URL. + * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. + */ + public ServerConfiguration(String URL, String description, Map variables) { + this.URL = URL; + this.description = description; + this.variables = variables; + } + + /** + * Format URL template using given variables. + * + * @param variables A map between a variable name and its value. + * @return Formatted URL. + */ + public String URL(Map variables) { + String url = this.URL; + + // go through variables and replace placeholders + for (Map.Entry variable: this.variables.entrySet()) { + String name = variable.getKey(); + ServerVariable serverVariable = variable.getValue(); + String value = serverVariable.defaultValue; + + if (variables != null && variables.containsKey(name)) { + value = variables.get(name); + if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) { + throw new IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + "."); + } + } + url = url.replace("{" + name + "}", value); + } + return url; + } + + /** + * Format URL template using default server variables. + * + * @return Formatted URL. + */ + public String URL() { + return URL(null); + } +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/ServerVariable.java new file mode 100644 index 000000000000..dd7ada6e073e --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/ServerVariable.java @@ -0,0 +1,37 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +import java.util.HashSet; + +/** + * Representing a Server Variable for server URL template substitution. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:07:41.448223+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class ServerVariable { + public String description; + public String defaultValue; + public HashSet enumValues = null; + + /** + * @param description A description for the server variable. + * @param defaultValue The default value to use for substitution. + * @param enumValues An enumeration of string values to be used if the substitution options are from a limited set. + */ + public ServerVariable(String description, String defaultValue, HashSet enumValues) { + this.description = description; + this.defaultValue = defaultValue; + this.enumValues = enumValues; + } +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/api/PetApi.java new file mode 100644 index 000000000000..aa3c05111881 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/api/PetApi.java @@ -0,0 +1,1110 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client.api; + +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; + +import java.io.File; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.Pet; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; + +import org.apache.http.HttpEntity; +import org.apache.http.NameValuePair; +import org.apache.http.entity.mime.MultipartEntityBuilder; +import org.apache.http.message.BasicNameValuePair; +import org.apache.http.client.entity.UrlEncodedFormEntity; + +import java.io.InputStream; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.OutputStream; +import java.net.http.HttpRequest; +import java.nio.channels.Channels; +import java.nio.channels.Pipe; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.time.Duration; + +import java.util.ArrayList; +import java.util.StringJoiner; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.function.Consumer; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:07:41.448223+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class PetApi { + private final HttpClient memberVarHttpClient; + private final ObjectMapper memberVarObjectMapper; + private final String memberVarBaseUri; + private final Consumer memberVarInterceptor; + private final Duration memberVarReadTimeout; + private final Consumer> memberVarResponseInterceptor; + private final Consumer> memberVarAsyncResponseInterceptor; + + public PetApi() { + this(Configuration.getDefaultApiClient()); + } + + public PetApi(ApiClient apiClient) { + memberVarHttpClient = apiClient.getHttpClient(); + memberVarObjectMapper = apiClient.getObjectMapper(); + memberVarBaseUri = apiClient.getBaseUri(); + memberVarInterceptor = apiClient.getRequestInterceptor(); + memberVarReadTimeout = apiClient.getReadTimeout(); + memberVarResponseInterceptor = apiClient.getResponseInterceptor(); + memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); + } + + + protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { + String body = response.body() == null ? null : new String(response.body().readAllBytes()); + String message = formatExceptionMessage(operationId, response.statusCode(), body); + return new ApiException(response.statusCode(), message, response.headers(), body); + } + + private String formatExceptionMessage(String operationId, int statusCode, String body) { + if (body == null || body.isEmpty()) { + body = "[no body]"; + } + return operationId + " call failed with: " + statusCode + " - " + body; + } + + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store (required) + * @return Pet + * @throws ApiException if fails to make API call + */ + public Pet addPet(@javax.annotation.Nonnull Pet pet) throws ApiException { + return addPet(pet, null); + } + + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store (required) + * @param headers Optional headers to include in the request + * @return Pet + * @throws ApiException if fails to make API call + */ + public Pet addPet(@javax.annotation.Nonnull Pet pet, Map headers) throws ApiException { + ApiResponse localVarResponse = addPetWithHttpInfo(pet, headers); + return localVarResponse.getData(); + } + + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store (required) + * @return ApiResponse<Pet> + * @throws ApiException if fails to make API call + */ + public ApiResponse addPetWithHttpInfo(@javax.annotation.Nonnull Pet pet) throws ApiException { + return addPetWithHttpInfo(pet, null); + } + + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Pet> + * @throws ApiException if fails to make API call + */ + public ApiResponse addPetWithHttpInfo(@javax.annotation.Nonnull Pet pet, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = addPetRequestBuilder(pet, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("addPet", localVarResponse); + } + if (localVarResponse.body() == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + String responseBody = new String(localVarResponse.body().readAllBytes()); + localVarResponse.body().close(); + + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}) + ); + } finally { + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder addPetRequestBuilder(@javax.annotation.Nonnull Pet pet, Map headers) throws ApiException { + // verify the required parameter 'pet' is set + if (pet == null) { + throw new ApiException(400, "Missing the required parameter 'pet' when calling addPet"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/pet"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/xml, application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(pet); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @throws ApiException if fails to make API call + */ + public void deletePet(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey) throws ApiException { + return deletePet(petId, apiKey, null); + } + + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void deletePet(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, Map headers) throws ApiException { + deletePetWithHttpInfo(petId, apiKey, headers); + } + + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse deletePetWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey) throws ApiException { + return deletePetWithHttpInfo(petId, apiKey, null); + } + + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse deletePetWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = deletePetRequestBuilder(petId, apiKey, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("deletePet", localVarResponse); + } + return new ApiResponse<>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } finally { + // Drain the InputStream + while (localVarResponse.body().read() != -1) { + // Ignore + } + localVarResponse.body().close(); + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder deletePetRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, Map headers) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException(400, "Missing the required parameter 'petId' when calling deletePet"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/pet/{petId}" + .replace("{petId}", ApiClient.urlEncode(petId.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + if (apiKey != null) { + localVarRequestBuilder.header("api_key", apiKey.toString()); + } + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("DELETE", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Finds Pets by status + * Multiple status values can be provided with comma separated strings + * @param status Status values that need to be considered for filter (required) + * @return List<Pet> + * @throws ApiException if fails to make API call + */ + public List findPetsByStatus(@javax.annotation.Nonnull List status) throws ApiException { + return findPetsByStatus(status, null); + } + + /** + * Finds Pets by status + * Multiple status values can be provided with comma separated strings + * @param status Status values that need to be considered for filter (required) + * @param headers Optional headers to include in the request + * @return List<Pet> + * @throws ApiException if fails to make API call + */ + public List findPetsByStatus(@javax.annotation.Nonnull List status, Map headers) throws ApiException { + ApiResponse> localVarResponse = findPetsByStatusWithHttpInfo(status, headers); + return localVarResponse.getData(); + } + + /** + * Finds Pets by status + * Multiple status values can be provided with comma separated strings + * @param status Status values that need to be considered for filter (required) + * @return ApiResponse<List<Pet>> + * @throws ApiException if fails to make API call + */ + public ApiResponse> findPetsByStatusWithHttpInfo(@javax.annotation.Nonnull List status) throws ApiException { + return findPetsByStatusWithHttpInfo(status, null); + } + + /** + * Finds Pets by status + * Multiple status values can be provided with comma separated strings + * @param status Status values that need to be considered for filter (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<List<Pet>> + * @throws ApiException if fails to make API call + */ + public ApiResponse> findPetsByStatusWithHttpInfo(@javax.annotation.Nonnull List status, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = findPetsByStatusRequestBuilder(status, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("findPetsByStatus", localVarResponse); + } + if (localVarResponse.body() == null) { + return new ApiResponse>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + String responseBody = new String(localVarResponse.body().readAllBytes()); + localVarResponse.body().close(); + + return new ApiResponse>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference>() {}) + ); + } finally { + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder findPetsByStatusRequestBuilder(@javax.annotation.Nonnull List status, Map headers) throws ApiException { + // verify the required parameter 'status' is set + if (status == null) { + throw new ApiException(400, "Missing the required parameter 'status' when calling findPetsByStatus"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/pet/findByStatus"; + + List localVarQueryParams = new ArrayList<>(); + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + localVarQueryParameterBaseName = "status"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("csv", "status", status)); + + if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) { + StringJoiner queryJoiner = new StringJoiner("&"); + localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue())); + if (localVarQueryStringJoiner.length() != 0) { + queryJoiner.add(localVarQueryStringJoiner.toString()); + } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } + + localVarRequestBuilder.header("Accept", "application/xml, application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) + * @return List<Pet> + * @throws ApiException if fails to make API call + * @deprecated + */ + @Deprecated + public List findPetsByTags(@javax.annotation.Nonnull List tags) throws ApiException { + return findPetsByTags(tags, null); + } + + /** + * Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) + * @param headers Optional headers to include in the request + * @return List<Pet> + * @throws ApiException if fails to make API call + * @deprecated + */ + @Deprecated + public List findPetsByTags(@javax.annotation.Nonnull List tags, Map headers) throws ApiException { + ApiResponse> localVarResponse = findPetsByTagsWithHttpInfo(tags, headers); + return localVarResponse.getData(); + } + + /** + * Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) + * @return ApiResponse<List<Pet>> + * @throws ApiException if fails to make API call + * @deprecated + */ + @Deprecated + public ApiResponse> findPetsByTagsWithHttpInfo(@javax.annotation.Nonnull List tags) throws ApiException { + return findPetsByTagsWithHttpInfo(tags, null); + } + + /** + * Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<List<Pet>> + * @throws ApiException if fails to make API call + * @deprecated + */ + @Deprecated + public ApiResponse> findPetsByTagsWithHttpInfo(@javax.annotation.Nonnull List tags, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = findPetsByTagsRequestBuilder(tags, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("findPetsByTags", localVarResponse); + } + if (localVarResponse.body() == null) { + return new ApiResponse>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + String responseBody = new String(localVarResponse.body().readAllBytes()); + localVarResponse.body().close(); + + return new ApiResponse>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference>() {}) + ); + } finally { + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder findPetsByTagsRequestBuilder(@javax.annotation.Nonnull List tags, Map headers) throws ApiException { + // verify the required parameter 'tags' is set + if (tags == null) { + throw new ApiException(400, "Missing the required parameter 'tags' when calling findPetsByTags"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/pet/findByTags"; + + List localVarQueryParams = new ArrayList<>(); + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + localVarQueryParameterBaseName = "tags"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("csv", "tags", tags)); + + if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) { + StringJoiner queryJoiner = new StringJoiner("&"); + localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue())); + if (localVarQueryStringJoiner.length() != 0) { + queryJoiner.add(localVarQueryStringJoiner.toString()); + } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } + + localVarRequestBuilder.header("Accept", "application/xml, application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @return Pet + * @throws ApiException if fails to make API call + */ + public Pet getPetById(@javax.annotation.Nonnull Long petId) throws ApiException { + return getPetById(petId, null); + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @param headers Optional headers to include in the request + * @return Pet + * @throws ApiException if fails to make API call + */ + public Pet getPetById(@javax.annotation.Nonnull Long petId, Map headers) throws ApiException { + ApiResponse localVarResponse = getPetByIdWithHttpInfo(petId, headers); + return localVarResponse.getData(); + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @return ApiResponse<Pet> + * @throws ApiException if fails to make API call + */ + public ApiResponse getPetByIdWithHttpInfo(@javax.annotation.Nonnull Long petId) throws ApiException { + return getPetByIdWithHttpInfo(petId, null); + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Pet> + * @throws ApiException if fails to make API call + */ + public ApiResponse getPetByIdWithHttpInfo(@javax.annotation.Nonnull Long petId, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = getPetByIdRequestBuilder(petId, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("getPetById", localVarResponse); + } + if (localVarResponse.body() == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + String responseBody = new String(localVarResponse.body().readAllBytes()); + localVarResponse.body().close(); + + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}) + ); + } finally { + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder getPetByIdRequestBuilder(@javax.annotation.Nonnull Long petId, Map headers) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetById"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/pet/{petId}" + .replace("{petId}", ApiClient.urlEncode(petId.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/xml, application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store (required) + * @return Pet + * @throws ApiException if fails to make API call + */ + public Pet updatePet(@javax.annotation.Nonnull Pet pet) throws ApiException { + return updatePet(pet, null); + } + + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store (required) + * @param headers Optional headers to include in the request + * @return Pet + * @throws ApiException if fails to make API call + */ + public Pet updatePet(@javax.annotation.Nonnull Pet pet, Map headers) throws ApiException { + ApiResponse localVarResponse = updatePetWithHttpInfo(pet, headers); + return localVarResponse.getData(); + } + + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store (required) + * @return ApiResponse<Pet> + * @throws ApiException if fails to make API call + */ + public ApiResponse updatePetWithHttpInfo(@javax.annotation.Nonnull Pet pet) throws ApiException { + return updatePetWithHttpInfo(pet, null); + } + + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Pet> + * @throws ApiException if fails to make API call + */ + public ApiResponse updatePetWithHttpInfo(@javax.annotation.Nonnull Pet pet, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = updatePetRequestBuilder(pet, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("updatePet", localVarResponse); + } + if (localVarResponse.body() == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + String responseBody = new String(localVarResponse.body().readAllBytes()); + localVarResponse.body().close(); + + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}) + ); + } finally { + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder updatePetRequestBuilder(@javax.annotation.Nonnull Pet pet, Map headers) throws ApiException { + // verify the required parameter 'pet' is set + if (pet == null) { + throw new ApiException(400, "Missing the required parameter 'pet' when calling updatePet"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/pet"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/xml, application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(pet); + localVarRequestBuilder.method("PUT", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @throws ApiException if fails to make API call + */ + public void updatePetWithForm(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status) throws ApiException { + return updatePetWithForm(petId, name, status, null); + } + + /** + * Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void updatePetWithForm(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, Map headers) throws ApiException { + updatePetWithFormWithHttpInfo(petId, name, status, headers); + } + + /** + * Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse updatePetWithFormWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status) throws ApiException { + return updatePetWithFormWithHttpInfo(petId, name, status, null); + } + + /** + * Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse updatePetWithFormWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = updatePetWithFormRequestBuilder(petId, name, status, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("updatePetWithForm", localVarResponse); + } + return new ApiResponse<>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } finally { + // Drain the InputStream + while (localVarResponse.body().read() != -1) { + // Ignore + } + localVarResponse.body().close(); + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder updatePetWithFormRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, Map headers) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException(400, "Missing the required parameter 'petId' when calling updatePetWithForm"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/pet/{petId}" + .replace("{petId}", ApiClient.urlEncode(petId.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/json"); + + List formValues = new ArrayList<>(); + if (name != null) { + formValues.add(new BasicNameValuePair("name", name.toString())); + } + if (status != null) { + formValues.add(new BasicNameValuePair("status", status.toString())); + } + HttpEntity entity = new UrlEncodedFormEntity(formValues, java.nio.charset.StandardCharsets.UTF_8); + ByteArrayOutputStream formOutputStream = new ByteArrayOutputStream(); + try { + entity.writeTo(formOutputStream); + } catch (IOException e) { + throw new RuntimeException(e); + } + localVarRequestBuilder + .header("Content-Type", entity.getContentType().getValue()) + .method("POST", HttpRequest.BodyPublishers + .ofInputStream(() -> new ByteArrayInputStream(formOutputStream.toByteArray()))); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @return ModelApiResponse + * @throws ApiException if fails to make API call + */ + public ModelApiResponse uploadFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { + return uploadFile(petId, additionalMetadata, _file, null); + } + + /** + * uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @param headers Optional headers to include in the request + * @return ModelApiResponse + * @throws ApiException if fails to make API call + */ + public ModelApiResponse uploadFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, Map headers) throws ApiException { + ApiResponse localVarResponse = uploadFileWithHttpInfo(petId, additionalMetadata, _file, headers); + return localVarResponse.getData(); + } + + /** + * uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @return ApiResponse<ModelApiResponse> + * @throws ApiException if fails to make API call + */ + public ApiResponse uploadFileWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { + return uploadFileWithHttpInfo(petId, additionalMetadata, _file, null); + } + + /** + * uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<ModelApiResponse> + * @throws ApiException if fails to make API call + */ + public ApiResponse uploadFileWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = uploadFileRequestBuilder(petId, additionalMetadata, _file, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("uploadFile", localVarResponse); + } + if (localVarResponse.body() == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + String responseBody = new String(localVarResponse.body().readAllBytes()); + localVarResponse.body().close(); + + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}) + ); + } finally { + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder uploadFileRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, Map headers) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFile"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/pet/{petId}/uploadImage" + .replace("{petId}", ApiClient.urlEncode(petId.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/json"); + + MultipartEntityBuilder multiPartBuilder = MultipartEntityBuilder.create(); + boolean hasFiles = false; + if (additionalMetadata != null) { + multiPartBuilder.addTextBody("additionalMetadata", additionalMetadata.toString()); + } + multiPartBuilder.addBinaryBody("file", _file); + hasFiles = true; + HttpEntity entity = multiPartBuilder.build(); + HttpRequest.BodyPublisher formDataPublisher; + if (hasFiles) { + Pipe pipe; + try { + pipe = Pipe.open(); + } catch (IOException e) { + throw new RuntimeException(e); + } + new Thread(() -> { + try (OutputStream outputStream = Channels.newOutputStream(pipe.sink())) { + entity.writeTo(outputStream); + } catch (IOException e) { + e.printStackTrace(); + } + }).start(); + formDataPublisher = HttpRequest.BodyPublishers.ofInputStream(() -> Channels.newInputStream(pipe.source())); + } else { + ByteArrayOutputStream formOutputStream = new ByteArrayOutputStream(); + try { + entity.writeTo(formOutputStream); + } catch (IOException e) { + throw new RuntimeException(e); + } + formDataPublisher = HttpRequest.BodyPublishers + .ofInputStream(() -> new ByteArrayInputStream(formOutputStream.toByteArray())); + } + localVarRequestBuilder + .header("Content-Type", entity.getContentType().getValue()) + .method("POST", formDataPublisher); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/api/StoreApi.java new file mode 100644 index 000000000000..f45c23d159a4 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/api/StoreApi.java @@ -0,0 +1,535 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client.api; + +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; + +import org.openapitools.client.model.Order; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; + +import org.apache.http.HttpEntity; +import org.apache.http.NameValuePair; +import org.apache.http.entity.mime.MultipartEntityBuilder; +import org.apache.http.message.BasicNameValuePair; +import org.apache.http.client.entity.UrlEncodedFormEntity; + +import java.io.InputStream; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.OutputStream; +import java.net.http.HttpRequest; +import java.nio.channels.Channels; +import java.nio.channels.Pipe; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.time.Duration; + +import java.util.ArrayList; +import java.util.StringJoiner; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.function.Consumer; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:07:41.448223+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class StoreApi { + private final HttpClient memberVarHttpClient; + private final ObjectMapper memberVarObjectMapper; + private final String memberVarBaseUri; + private final Consumer memberVarInterceptor; + private final Duration memberVarReadTimeout; + private final Consumer> memberVarResponseInterceptor; + private final Consumer> memberVarAsyncResponseInterceptor; + + public StoreApi() { + this(Configuration.getDefaultApiClient()); + } + + public StoreApi(ApiClient apiClient) { + memberVarHttpClient = apiClient.getHttpClient(); + memberVarObjectMapper = apiClient.getObjectMapper(); + memberVarBaseUri = apiClient.getBaseUri(); + memberVarInterceptor = apiClient.getRequestInterceptor(); + memberVarReadTimeout = apiClient.getReadTimeout(); + memberVarResponseInterceptor = apiClient.getResponseInterceptor(); + memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); + } + + + protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { + String body = response.body() == null ? null : new String(response.body().readAllBytes()); + String message = formatExceptionMessage(operationId, response.statusCode(), body); + return new ApiException(response.statusCode(), message, response.headers(), body); + } + + private String formatExceptionMessage(String operationId, int statusCode, String body) { + if (body == null || body.isEmpty()) { + body = "[no body]"; + } + return operationId + " call failed with: " + statusCode + " - " + body; + } + + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted (required) + * @throws ApiException if fails to make API call + */ + public void deleteOrder(@javax.annotation.Nonnull String orderId) throws ApiException { + return deleteOrder(orderId, null); + } + + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted (required) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void deleteOrder(@javax.annotation.Nonnull String orderId, Map headers) throws ApiException { + deleteOrderWithHttpInfo(orderId, headers); + } + + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse deleteOrderWithHttpInfo(@javax.annotation.Nonnull String orderId) throws ApiException { + return deleteOrderWithHttpInfo(orderId, null); + } + + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse deleteOrderWithHttpInfo(@javax.annotation.Nonnull String orderId, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = deleteOrderRequestBuilder(orderId, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("deleteOrder", localVarResponse); + } + return new ApiResponse<>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } finally { + // Drain the InputStream + while (localVarResponse.body().read() != -1) { + // Ignore + } + localVarResponse.body().close(); + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder deleteOrderRequestBuilder(@javax.annotation.Nonnull String orderId, Map headers) throws ApiException { + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/store/order/{orderId}" + .replace("{orderId}", ApiClient.urlEncode(orderId.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("DELETE", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @return Map<String, Integer> + * @throws ApiException if fails to make API call + */ + public Map getInventory() throws ApiException { + return getInventory(, null); + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @param headers Optional headers to include in the request + * @return Map<String, Integer> + * @throws ApiException if fails to make API call + */ + public Map getInventory(Map headers) throws ApiException { + ApiResponse> localVarResponse = getInventoryWithHttpInfo(headers); + return localVarResponse.getData(); + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @return ApiResponse<Map<String, Integer>> + * @throws ApiException if fails to make API call + */ + public ApiResponse> getInventoryWithHttpInfo() throws ApiException { + return getInventoryWithHttpInfo(, null); + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @param headers Optional headers to include in the request + * @return ApiResponse<Map<String, Integer>> + * @throws ApiException if fails to make API call + */ + public ApiResponse> getInventoryWithHttpInfo(Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = getInventoryRequestBuilder(headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("getInventory", localVarResponse); + } + if (localVarResponse.body() == null) { + return new ApiResponse>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + String responseBody = new String(localVarResponse.body().readAllBytes()); + localVarResponse.body().close(); + + return new ApiResponse>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference>() {}) + ); + } finally { + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder getInventoryRequestBuilder(Map headers) throws ApiException { + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/store/inventory"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @return Order + * @throws ApiException if fails to make API call + */ + public Order getOrderById(@javax.annotation.Nonnull Long orderId) throws ApiException { + return getOrderById(orderId, null); + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @param headers Optional headers to include in the request + * @return Order + * @throws ApiException if fails to make API call + */ + public Order getOrderById(@javax.annotation.Nonnull Long orderId, Map headers) throws ApiException { + ApiResponse localVarResponse = getOrderByIdWithHttpInfo(orderId, headers); + return localVarResponse.getData(); + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @return ApiResponse<Order> + * @throws ApiException if fails to make API call + */ + public ApiResponse getOrderByIdWithHttpInfo(@javax.annotation.Nonnull Long orderId) throws ApiException { + return getOrderByIdWithHttpInfo(orderId, null); + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Order> + * @throws ApiException if fails to make API call + */ + public ApiResponse getOrderByIdWithHttpInfo(@javax.annotation.Nonnull Long orderId, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = getOrderByIdRequestBuilder(orderId, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("getOrderById", localVarResponse); + } + if (localVarResponse.body() == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + String responseBody = new String(localVarResponse.body().readAllBytes()); + localVarResponse.body().close(); + + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}) + ); + } finally { + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder getOrderByIdRequestBuilder(@javax.annotation.Nonnull Long orderId, Map headers) throws ApiException { + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/store/order/{orderId}" + .replace("{orderId}", ApiClient.urlEncode(orderId.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/xml, application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @return Order + * @throws ApiException if fails to make API call + */ + public Order placeOrder(@javax.annotation.Nonnull Order order) throws ApiException { + return placeOrder(order, null); + } + + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @param headers Optional headers to include in the request + * @return Order + * @throws ApiException if fails to make API call + */ + public Order placeOrder(@javax.annotation.Nonnull Order order, Map headers) throws ApiException { + ApiResponse localVarResponse = placeOrderWithHttpInfo(order, headers); + return localVarResponse.getData(); + } + + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @return ApiResponse<Order> + * @throws ApiException if fails to make API call + */ + public ApiResponse placeOrderWithHttpInfo(@javax.annotation.Nonnull Order order) throws ApiException { + return placeOrderWithHttpInfo(order, null); + } + + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Order> + * @throws ApiException if fails to make API call + */ + public ApiResponse placeOrderWithHttpInfo(@javax.annotation.Nonnull Order order, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = placeOrderRequestBuilder(order, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("placeOrder", localVarResponse); + } + if (localVarResponse.body() == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + String responseBody = new String(localVarResponse.body().readAllBytes()); + localVarResponse.body().close(); + + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}) + ); + } finally { + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder placeOrderRequestBuilder(@javax.annotation.Nonnull Order order, Map headers) throws ApiException { + // verify the required parameter 'order' is set + if (order == null) { + throw new ApiException(400, "Missing the required parameter 'order' when calling placeOrder"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/store/order"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/xml, application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(order); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/api/UserApi.java new file mode 100644 index 000000000000..ea659b72e460 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/api/UserApi.java @@ -0,0 +1,995 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client.api; + +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; + +import java.time.OffsetDateTime; +import org.openapitools.client.model.User; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; + +import org.apache.http.HttpEntity; +import org.apache.http.NameValuePair; +import org.apache.http.entity.mime.MultipartEntityBuilder; +import org.apache.http.message.BasicNameValuePair; +import org.apache.http.client.entity.UrlEncodedFormEntity; + +import java.io.InputStream; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.OutputStream; +import java.net.http.HttpRequest; +import java.nio.channels.Channels; +import java.nio.channels.Pipe; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.time.Duration; + +import java.util.ArrayList; +import java.util.StringJoiner; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.function.Consumer; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:07:41.448223+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class UserApi { + private final HttpClient memberVarHttpClient; + private final ObjectMapper memberVarObjectMapper; + private final String memberVarBaseUri; + private final Consumer memberVarInterceptor; + private final Duration memberVarReadTimeout; + private final Consumer> memberVarResponseInterceptor; + private final Consumer> memberVarAsyncResponseInterceptor; + + public UserApi() { + this(Configuration.getDefaultApiClient()); + } + + public UserApi(ApiClient apiClient) { + memberVarHttpClient = apiClient.getHttpClient(); + memberVarObjectMapper = apiClient.getObjectMapper(); + memberVarBaseUri = apiClient.getBaseUri(); + memberVarInterceptor = apiClient.getRequestInterceptor(); + memberVarReadTimeout = apiClient.getReadTimeout(); + memberVarResponseInterceptor = apiClient.getResponseInterceptor(); + memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); + } + + + protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { + String body = response.body() == null ? null : new String(response.body().readAllBytes()); + String message = formatExceptionMessage(operationId, response.statusCode(), body); + return new ApiException(response.statusCode(), message, response.headers(), body); + } + + private String formatExceptionMessage(String operationId, int statusCode, String body) { + if (body == null || body.isEmpty()) { + body = "[no body]"; + } + return operationId + " call failed with: " + statusCode + " - " + body; + } + + /** + * Create user + * This can only be done by the logged in user. + * @param user Created user object (required) + * @throws ApiException if fails to make API call + */ + public void createUser(@javax.annotation.Nonnull User user) throws ApiException { + return createUser(user, null); + } + + /** + * Create user + * This can only be done by the logged in user. + * @param user Created user object (required) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void createUser(@javax.annotation.Nonnull User user, Map headers) throws ApiException { + createUserWithHttpInfo(user, headers); + } + + /** + * Create user + * This can only be done by the logged in user. + * @param user Created user object (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse createUserWithHttpInfo(@javax.annotation.Nonnull User user) throws ApiException { + return createUserWithHttpInfo(user, null); + } + + /** + * Create user + * This can only be done by the logged in user. + * @param user Created user object (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse createUserWithHttpInfo(@javax.annotation.Nonnull User user, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = createUserRequestBuilder(user, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("createUser", localVarResponse); + } + return new ApiResponse<>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } finally { + // Drain the InputStream + while (localVarResponse.body().read() != -1) { + // Ignore + } + localVarResponse.body().close(); + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder createUserRequestBuilder(@javax.annotation.Nonnull User user, Map headers) throws ApiException { + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException(400, "Missing the required parameter 'user' when calling createUser"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/user"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(user); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @throws ApiException if fails to make API call + */ + public void createUsersWithArrayInput(@javax.annotation.Nonnull List user) throws ApiException { + return createUsersWithArrayInput(user, null); + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void createUsersWithArrayInput(@javax.annotation.Nonnull List user, Map headers) throws ApiException { + createUsersWithArrayInputWithHttpInfo(user, headers); + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse createUsersWithArrayInputWithHttpInfo(@javax.annotation.Nonnull List user) throws ApiException { + return createUsersWithArrayInputWithHttpInfo(user, null); + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse createUsersWithArrayInputWithHttpInfo(@javax.annotation.Nonnull List user, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = createUsersWithArrayInputRequestBuilder(user, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("createUsersWithArrayInput", localVarResponse); + } + return new ApiResponse<>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } finally { + // Drain the InputStream + while (localVarResponse.body().read() != -1) { + // Ignore + } + localVarResponse.body().close(); + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder createUsersWithArrayInputRequestBuilder(@javax.annotation.Nonnull List user, Map headers) throws ApiException { + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithArrayInput"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/user/createWithArray"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(user); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @throws ApiException if fails to make API call + */ + public void createUsersWithListInput(@javax.annotation.Nonnull List user) throws ApiException { + return createUsersWithListInput(user, null); + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void createUsersWithListInput(@javax.annotation.Nonnull List user, Map headers) throws ApiException { + createUsersWithListInputWithHttpInfo(user, headers); + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse createUsersWithListInputWithHttpInfo(@javax.annotation.Nonnull List user) throws ApiException { + return createUsersWithListInputWithHttpInfo(user, null); + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse createUsersWithListInputWithHttpInfo(@javax.annotation.Nonnull List user, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = createUsersWithListInputRequestBuilder(user, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("createUsersWithListInput", localVarResponse); + } + return new ApiResponse<>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } finally { + // Drain the InputStream + while (localVarResponse.body().read() != -1) { + // Ignore + } + localVarResponse.body().close(); + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder createUsersWithListInputRequestBuilder(@javax.annotation.Nonnull List user, Map headers) throws ApiException { + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithListInput"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/user/createWithList"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(user); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @throws ApiException if fails to make API call + */ + public void deleteUser(@javax.annotation.Nonnull String username) throws ApiException { + return deleteUser(username, null); + } + + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void deleteUser(@javax.annotation.Nonnull String username, Map headers) throws ApiException { + deleteUserWithHttpInfo(username, headers); + } + + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse deleteUserWithHttpInfo(@javax.annotation.Nonnull String username) throws ApiException { + return deleteUserWithHttpInfo(username, null); + } + + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse deleteUserWithHttpInfo(@javax.annotation.Nonnull String username, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = deleteUserRequestBuilder(username, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("deleteUser", localVarResponse); + } + return new ApiResponse<>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } finally { + // Drain the InputStream + while (localVarResponse.body().read() != -1) { + // Ignore + } + localVarResponse.body().close(); + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder deleteUserRequestBuilder(@javax.annotation.Nonnull String username, Map headers) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException(400, "Missing the required parameter 'username' when calling deleteUser"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/user/{username}" + .replace("{username}", ApiClient.urlEncode(username.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("DELETE", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return User + * @throws ApiException if fails to make API call + */ + public User getUserByName(@javax.annotation.Nonnull String username) throws ApiException { + return getUserByName(username, null); + } + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @param headers Optional headers to include in the request + * @return User + * @throws ApiException if fails to make API call + */ + public User getUserByName(@javax.annotation.Nonnull String username, Map headers) throws ApiException { + ApiResponse localVarResponse = getUserByNameWithHttpInfo(username, headers); + return localVarResponse.getData(); + } + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return ApiResponse<User> + * @throws ApiException if fails to make API call + */ + public ApiResponse getUserByNameWithHttpInfo(@javax.annotation.Nonnull String username) throws ApiException { + return getUserByNameWithHttpInfo(username, null); + } + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<User> + * @throws ApiException if fails to make API call + */ + public ApiResponse getUserByNameWithHttpInfo(@javax.annotation.Nonnull String username, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = getUserByNameRequestBuilder(username, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("getUserByName", localVarResponse); + } + if (localVarResponse.body() == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + String responseBody = new String(localVarResponse.body().readAllBytes()); + localVarResponse.body().close(); + + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}) + ); + } finally { + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder getUserByNameRequestBuilder(@javax.annotation.Nonnull String username, Map headers) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException(400, "Missing the required parameter 'username' when calling getUserByName"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/user/{username}" + .replace("{username}", ApiClient.urlEncode(username.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/xml, application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @return String + * @throws ApiException if fails to make API call + */ + public String loginUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException { + return loginUser(username, password, null); + } + + /** + * Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @param headers Optional headers to include in the request + * @return String + * @throws ApiException if fails to make API call + */ + public String loginUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, Map headers) throws ApiException { + ApiResponse localVarResponse = loginUserWithHttpInfo(username, password, headers); + return localVarResponse.getData(); + } + + /** + * Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @return ApiResponse<String> + * @throws ApiException if fails to make API call + */ + public ApiResponse loginUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException { + return loginUserWithHttpInfo(username, password, null); + } + + /** + * Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<String> + * @throws ApiException if fails to make API call + */ + public ApiResponse loginUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = loginUserRequestBuilder(username, password, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("loginUser", localVarResponse); + } + if (localVarResponse.body() == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + String responseBody = new String(localVarResponse.body().readAllBytes()); + localVarResponse.body().close(); + + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}) + ); + } finally { + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder loginUserRequestBuilder(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, Map headers) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException(400, "Missing the required parameter 'username' when calling loginUser"); + } + // verify the required parameter 'password' is set + if (password == null) { + throw new ApiException(400, "Missing the required parameter 'password' when calling loginUser"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/user/login"; + + List localVarQueryParams = new ArrayList<>(); + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + localVarQueryParameterBaseName = "username"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("username", username)); + localVarQueryParameterBaseName = "password"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("password", password)); + + if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) { + StringJoiner queryJoiner = new StringJoiner("&"); + localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue())); + if (localVarQueryStringJoiner.length() != 0) { + queryJoiner.add(localVarQueryStringJoiner.toString()); + } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } + + localVarRequestBuilder.header("Accept", "application/xml, application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Logs out current logged in user session + * + * @throws ApiException if fails to make API call + */ + public void logoutUser() throws ApiException { + return logoutUser(, null); + } + + /** + * Logs out current logged in user session + * + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void logoutUser(Map headers) throws ApiException { + logoutUserWithHttpInfo(headers); + } + + /** + * Logs out current logged in user session + * + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse logoutUserWithHttpInfo() throws ApiException { + return logoutUserWithHttpInfo(, null); + } + + /** + * Logs out current logged in user session + * + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse logoutUserWithHttpInfo(Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = logoutUserRequestBuilder(headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("logoutUser", localVarResponse); + } + return new ApiResponse<>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } finally { + // Drain the InputStream + while (localVarResponse.body().read() != -1) { + // Ignore + } + localVarResponse.body().close(); + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder logoutUserRequestBuilder(Map headers) throws ApiException { + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/user/logout"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param user Updated user object (required) + * @throws ApiException if fails to make API call + */ + public void updateUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user) throws ApiException { + return updateUser(username, user, null); + } + + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param user Updated user object (required) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void updateUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, Map headers) throws ApiException { + updateUserWithHttpInfo(username, user, headers); + } + + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param user Updated user object (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse updateUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user) throws ApiException { + return updateUserWithHttpInfo(username, user, null); + } + + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param user Updated user object (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse updateUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = updateUserRequestBuilder(username, user, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("updateUser", localVarResponse); + } + return new ApiResponse<>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } finally { + // Drain the InputStream + while (localVarResponse.body().read() != -1) { + // Ignore + } + localVarResponse.body().close(); + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder updateUserRequestBuilder(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, Map headers) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser"); + } + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException(400, "Missing the required parameter 'user' when calling updateUser"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/user/{username}" + .replace("{username}", ApiClient.urlEncode(username.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(user); + localVarRequestBuilder.method("PUT", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java new file mode 100644 index 000000000000..772e5e7c3c1b --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java @@ -0,0 +1,147 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.lang.reflect.Type; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:07:41.448223+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public abstract class AbstractOpenApiSchema { + + // store the actual instance of the schema/object + private Object instance; + + // is nullable + private Boolean isNullable; + + // schema type (e.g. oneOf, anyOf) + private final String schemaType; + + public AbstractOpenApiSchema(String schemaType, Boolean isNullable) { + this.schemaType = schemaType; + this.isNullable = isNullable; + } + + /** + * Get the list of oneOf/anyOf composed schemas allowed to be stored in this object + * + * @return an instance of the actual schema/object + */ + public abstract Map> getSchemas(); + + /** + * Get the actual instance + * + * @return an instance of the actual schema/object + */ + @JsonValue + public Object getActualInstance() {return instance;} + + /** + * Set the actual instance + * + * @param instance the actual instance of the schema/object + */ + public void setActualInstance(Object instance) {this.instance = instance;} + + /** + * Get the instant recursively when the schemas defined in oneOf/anyof happen to be oneOf/anyOf schema as well + * + * @return an instance of the actual schema/object + */ + public Object getActualInstanceRecursively() { + return getActualInstanceRecursively(this); + } + + private Object getActualInstanceRecursively(AbstractOpenApiSchema object) { + if (object.getActualInstance() == null) { + return null; + } else if (object.getActualInstance() instanceof AbstractOpenApiSchema) { + return getActualInstanceRecursively((AbstractOpenApiSchema)object.getActualInstance()); + } else { + return object.getActualInstance(); + } + } + + /** + * Get the schema type (e.g. anyOf, oneOf) + * + * @return the schema type + */ + public String getSchemaType() { + return schemaType; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ").append(getClass()).append(" {\n"); + sb.append(" instance: ").append(toIndentedString(instance)).append("\n"); + sb.append(" isNullable: ").append(toIndentedString(isNullable)).append("\n"); + sb.append(" schemaType: ").append(toIndentedString(schemaType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AbstractOpenApiSchema a = (AbstractOpenApiSchema) o; + return Objects.equals(this.instance, a.instance) && + Objects.equals(this.isNullable, a.isNullable) && + Objects.equals(this.schemaType, a.schemaType); + } + + @Override + public int hashCode() { + return Objects.hash(instance, isNullable, schemaType); + } + + /** + * Is nullable + * + * @return true if it's nullable + */ + public Boolean isNullable() { + if (Boolean.TRUE.equals(isNullable)) { + return Boolean.TRUE; + } else { + return Boolean.FALSE; + } + } + + + +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/model/Category.java new file mode 100644 index 000000000000..74d7fa10840a --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/model/Category.java @@ -0,0 +1,187 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import org.openapitools.client.ApiClient; +/** + * A category for a pet + */ +@JsonPropertyOrder({ + Category.JSON_PROPERTY_ID, + Category.JSON_PROPERTY_NAME +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:07:41.448223+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class Category { + public static final String JSON_PROPERTY_ID = "id"; + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_NAME = "name"; + @javax.annotation.Nullable + private String name; + + public Category() { + } + + public Category id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getId() { + return id; + } + + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Category name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getName() { + return name; + } + + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + /** + * Return true if this Category object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Category category = (Category) o; + return Objects.equals(this.id, category.id) && + Objects.equals(this.name, category.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Category {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `id` to the URL query string + if (getId() != null) { + joiner.add(String.format("%sid%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getId())))); + } + + // add `name` to the URL query string + if (getName() != null) { + joiner.add(String.format("%sname%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getName())))); + } + + return joiner.toString(); + } +} + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/model/ModelApiResponse.java new file mode 100644 index 000000000000..7b4850fa80af --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -0,0 +1,223 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import org.openapitools.client.ApiClient; +/** + * Describes the result of uploading an image resource + */ +@JsonPropertyOrder({ + ModelApiResponse.JSON_PROPERTY_CODE, + ModelApiResponse.JSON_PROPERTY_TYPE, + ModelApiResponse.JSON_PROPERTY_MESSAGE +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:07:41.448223+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class ModelApiResponse { + public static final String JSON_PROPERTY_CODE = "code"; + @javax.annotation.Nullable + private Integer code; + + public static final String JSON_PROPERTY_TYPE = "type"; + @javax.annotation.Nullable + private String type; + + public static final String JSON_PROPERTY_MESSAGE = "message"; + @javax.annotation.Nullable + private String message; + + public ModelApiResponse() { + } + + public ModelApiResponse code(@javax.annotation.Nullable Integer code) { + this.code = code; + return this; + } + + /** + * Get code + * @return code + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CODE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getCode() { + return code; + } + + + @JsonProperty(JSON_PROPERTY_CODE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCode(@javax.annotation.Nullable Integer code) { + this.code = code; + } + + + public ModelApiResponse type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getType() { + return type; + } + + + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public ModelApiResponse message(@javax.annotation.Nullable String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getMessage() { + return message; + } + + + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMessage(@javax.annotation.Nullable String message) { + this.message = message; + } + + + /** + * Return true if this ApiResponse object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelApiResponse _apiResponse = (ModelApiResponse) o; + return Objects.equals(this.code, _apiResponse.code) && + Objects.equals(this.type, _apiResponse.type) && + Objects.equals(this.message, _apiResponse.message); + } + + @Override + public int hashCode() { + return Objects.hash(code, type, message); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelApiResponse {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `code` to the URL query string + if (getCode() != null) { + joiner.add(String.format("%scode%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getCode())))); + } + + // add `type` to the URL query string + if (getType() != null) { + joiner.add(String.format("%stype%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getType())))); + } + + // add `message` to the URL query string + if (getMessage() != null) { + joiner.add(String.format("%smessage%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getMessage())))); + } + + return joiner.toString(); + } +} + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/model/Order.java new file mode 100644 index 000000000000..4c48e61a5211 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/model/Order.java @@ -0,0 +1,369 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.time.OffsetDateTime; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import org.openapitools.client.ApiClient; +/** + * An order for a pets from the pet store + */ +@JsonPropertyOrder({ + Order.JSON_PROPERTY_ID, + Order.JSON_PROPERTY_PET_ID, + Order.JSON_PROPERTY_QUANTITY, + Order.JSON_PROPERTY_SHIP_DATE, + Order.JSON_PROPERTY_STATUS, + Order.JSON_PROPERTY_COMPLETE +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:07:41.448223+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class Order { + public static final String JSON_PROPERTY_ID = "id"; + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_PET_ID = "petId"; + @javax.annotation.Nullable + private Long petId; + + public static final String JSON_PROPERTY_QUANTITY = "quantity"; + @javax.annotation.Nullable + private Integer quantity; + + public static final String JSON_PROPERTY_SHIP_DATE = "shipDate"; + @javax.annotation.Nullable + private OffsetDateTime shipDate; + + /** + * Order Status + */ + public enum StatusEnum { + PLACED(String.valueOf("placed")), + + APPROVED(String.valueOf("approved")), + + DELIVERED(String.valueOf("delivered")); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_STATUS = "status"; + @javax.annotation.Nullable + private StatusEnum status; + + public static final String JSON_PROPERTY_COMPLETE = "complete"; + @javax.annotation.Nullable + private Boolean complete = false; + + public Order() { + } + + public Order id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getId() { + return id; + } + + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Order petId(@javax.annotation.Nullable Long petId) { + this.petId = petId; + return this; + } + + /** + * Get petId + * @return petId + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PET_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getPetId() { + return petId; + } + + + @JsonProperty(JSON_PROPERTY_PET_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPetId(@javax.annotation.Nullable Long petId) { + this.petId = petId; + } + + + public Order quantity(@javax.annotation.Nullable Integer quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get quantity + * @return quantity + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_QUANTITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getQuantity() { + return quantity; + } + + + @JsonProperty(JSON_PROPERTY_QUANTITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setQuantity(@javax.annotation.Nullable Integer quantity) { + this.quantity = quantity; + } + + + public Order shipDate(@javax.annotation.Nullable OffsetDateTime shipDate) { + this.shipDate = shipDate; + return this; + } + + /** + * Get shipDate + * @return shipDate + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SHIP_DATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getShipDate() { + return shipDate; + } + + + @JsonProperty(JSON_PROPERTY_SHIP_DATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setShipDate(@javax.annotation.Nullable OffsetDateTime shipDate) { + this.shipDate = shipDate; + } + + + public Order status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * Order Status + * @return status + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public StatusEnum getStatus() { + return status; + } + + + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + + public Order complete(@javax.annotation.Nullable Boolean complete) { + this.complete = complete; + return this; + } + + /** + * Get complete + * @return complete + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_COMPLETE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getComplete() { + return complete; + } + + + @JsonProperty(JSON_PROPERTY_COMPLETE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setComplete(@javax.annotation.Nullable Boolean complete) { + this.complete = complete; + } + + + /** + * Return true if this Order object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Order order = (Order) o; + return Objects.equals(this.id, order.id) && + Objects.equals(this.petId, order.petId) && + Objects.equals(this.quantity, order.quantity) && + Objects.equals(this.shipDate, order.shipDate) && + Objects.equals(this.status, order.status) && + Objects.equals(this.complete, order.complete); + } + + @Override + public int hashCode() { + return Objects.hash(id, petId, quantity, shipDate, status, complete); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Order {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" petId: ").append(toIndentedString(petId)).append("\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append(" shipDate: ").append(toIndentedString(shipDate)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" complete: ").append(toIndentedString(complete)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `id` to the URL query string + if (getId() != null) { + joiner.add(String.format("%sid%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getId())))); + } + + // add `petId` to the URL query string + if (getPetId() != null) { + joiner.add(String.format("%spetId%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getPetId())))); + } + + // add `quantity` to the URL query string + if (getQuantity() != null) { + joiner.add(String.format("%squantity%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getQuantity())))); + } + + // add `shipDate` to the URL query string + if (getShipDate() != null) { + joiner.add(String.format("%sshipDate%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getShipDate())))); + } + + // add `status` to the URL query string + if (getStatus() != null) { + joiner.add(String.format("%sstatus%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getStatus())))); + } + + // add `complete` to the URL query string + if (getComplete() != null) { + joiner.add(String.format("%scomplete%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getComplete())))); + } + + return joiner.toString(); + } +} + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/model/Pet.java new file mode 100644 index 000000000000..cc394c7afcae --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/model/Pet.java @@ -0,0 +1,397 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import org.openapitools.client.ApiClient; +/** + * A pet for sale in the pet store + */ +@JsonPropertyOrder({ + Pet.JSON_PROPERTY_ID, + Pet.JSON_PROPERTY_CATEGORY, + Pet.JSON_PROPERTY_NAME, + Pet.JSON_PROPERTY_PHOTO_URLS, + Pet.JSON_PROPERTY_TAGS, + Pet.JSON_PROPERTY_STATUS +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:07:41.448223+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class Pet { + public static final String JSON_PROPERTY_ID = "id"; + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_CATEGORY = "category"; + @javax.annotation.Nullable + private Category category; + + public static final String JSON_PROPERTY_NAME = "name"; + @javax.annotation.Nonnull + private String name; + + public static final String JSON_PROPERTY_PHOTO_URLS = "photoUrls"; + @javax.annotation.Nonnull + private List photoUrls = new ArrayList<>(); + + public static final String JSON_PROPERTY_TAGS = "tags"; + @javax.annotation.Nullable + private List tags = new ArrayList<>(); + + /** + * pet status in the store + */ + public enum StatusEnum { + AVAILABLE(String.valueOf("available")), + + PENDING(String.valueOf("pending")), + + SOLD(String.valueOf("sold")); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_STATUS = "status"; + @javax.annotation.Nullable + private StatusEnum status; + + public Pet() { + } + + public Pet id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getId() { + return id; + } + + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Pet category(@javax.annotation.Nullable Category category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CATEGORY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Category getCategory() { + return category; + } + + + @JsonProperty(JSON_PROPERTY_CATEGORY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCategory(@javax.annotation.Nullable Category category) { + this.category = category; + } + + + public Pet name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public Pet photoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public Pet addPhotoUrlsItem(String photoUrlsItem) { + if (this.photoUrls == null) { + this.photoUrls = new ArrayList<>(); + } + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + */ + @javax.annotation.Nonnull + @JsonProperty(JSON_PROPERTY_PHOTO_URLS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getPhotoUrls() { + return photoUrls; + } + + + @JsonProperty(JSON_PROPERTY_PHOTO_URLS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setPhotoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + } + + + public Pet tags(@javax.annotation.Nullable List tags) { + this.tags = tags; + return this; + } + + public Pet addTagsItem(Tag tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Get tags + * @return tags + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TAGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getTags() { + return tags; + } + + + @JsonProperty(JSON_PROPERTY_TAGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTags(@javax.annotation.Nullable List tags) { + this.tags = tags; + } + + + public Pet status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public StatusEnum getStatus() { + return status; + } + + + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + + /** + * Return true if this Pet object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Pet pet = (Pet) o; + return Objects.equals(this.id, pet.id) && + Objects.equals(this.category, pet.category) && + Objects.equals(this.name, pet.name) && + Objects.equals(this.photoUrls, pet.photoUrls) && + Objects.equals(this.tags, pet.tags) && + Objects.equals(this.status, pet.status); + } + + @Override + public int hashCode() { + return Objects.hash(id, category, name, photoUrls, tags, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Pet {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `id` to the URL query string + if (getId() != null) { + joiner.add(String.format("%sid%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getId())))); + } + + // add `category` to the URL query string + if (getCategory() != null) { + joiner.add(getCategory().toUrlQueryString(prefix + "category" + suffix)); + } + + // add `name` to the URL query string + if (getName() != null) { + joiner.add(String.format("%sname%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getName())))); + } + + // add `photoUrls` to the URL query string + if (getPhotoUrls() != null) { + for (int i = 0; i < getPhotoUrls().size(); i++) { + joiner.add(String.format("%sphotoUrls%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix), + ApiClient.urlEncode(ApiClient.valueToString(getPhotoUrls().get(i))))); + } + } + + // add `tags` to the URL query string + if (getTags() != null) { + for (int i = 0; i < getTags().size(); i++) { + if (getTags().get(i) != null) { + joiner.add(getTags().get(i).toUrlQueryString(String.format("%stags%s%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix)))); + } + } + } + + // add `status` to the URL query string + if (getStatus() != null) { + joiner.add(String.format("%sstatus%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getStatus())))); + } + + return joiner.toString(); + } +} + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/model/Tag.java new file mode 100644 index 000000000000..be01bae3f7d2 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/model/Tag.java @@ -0,0 +1,187 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import org.openapitools.client.ApiClient; +/** + * A tag for a pet + */ +@JsonPropertyOrder({ + Tag.JSON_PROPERTY_ID, + Tag.JSON_PROPERTY_NAME +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:07:41.448223+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class Tag { + public static final String JSON_PROPERTY_ID = "id"; + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_NAME = "name"; + @javax.annotation.Nullable + private String name; + + public Tag() { + } + + public Tag id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getId() { + return id; + } + + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Tag name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getName() { + return name; + } + + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + /** + * Return true if this Tag object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Tag tag = (Tag) o; + return Objects.equals(this.id, tag.id) && + Objects.equals(this.name, tag.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Tag {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `id` to the URL query string + if (getId() != null) { + joiner.add(String.format("%sid%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getId())))); + } + + // add `name` to the URL query string + if (getName() != null) { + joiner.add(String.format("%sname%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getName())))); + } + + return joiner.toString(); + } +} + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/model/User.java new file mode 100644 index 000000000000..b2b2ab12cd05 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/src/main/java/org/openapitools/client/model/User.java @@ -0,0 +1,403 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import org.openapitools.client.ApiClient; +/** + * A User who is purchasing from the pet store + */ +@JsonPropertyOrder({ + User.JSON_PROPERTY_ID, + User.JSON_PROPERTY_USERNAME, + User.JSON_PROPERTY_FIRST_NAME, + User.JSON_PROPERTY_LAST_NAME, + User.JSON_PROPERTY_EMAIL, + User.JSON_PROPERTY_PASSWORD, + User.JSON_PROPERTY_PHONE, + User.JSON_PROPERTY_USER_STATUS +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:07:41.448223+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class User { + public static final String JSON_PROPERTY_ID = "id"; + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_USERNAME = "username"; + @javax.annotation.Nullable + private String username; + + public static final String JSON_PROPERTY_FIRST_NAME = "firstName"; + @javax.annotation.Nullable + private String firstName; + + public static final String JSON_PROPERTY_LAST_NAME = "lastName"; + @javax.annotation.Nullable + private String lastName; + + public static final String JSON_PROPERTY_EMAIL = "email"; + @javax.annotation.Nullable + private String email; + + public static final String JSON_PROPERTY_PASSWORD = "password"; + @javax.annotation.Nullable + private String password; + + public static final String JSON_PROPERTY_PHONE = "phone"; + @javax.annotation.Nullable + private String phone; + + public static final String JSON_PROPERTY_USER_STATUS = "userStatus"; + @javax.annotation.Nullable + private Integer userStatus; + + public User() { + } + + public User id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getId() { + return id; + } + + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public User username(@javax.annotation.Nullable String username) { + this.username = username; + return this; + } + + /** + * Get username + * @return username + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_USERNAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getUsername() { + return username; + } + + + @JsonProperty(JSON_PROPERTY_USERNAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setUsername(@javax.annotation.Nullable String username) { + this.username = username; + } + + + public User firstName(@javax.annotation.Nullable String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Get firstName + * @return firstName + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_FIRST_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getFirstName() { + return firstName; + } + + + @JsonProperty(JSON_PROPERTY_FIRST_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setFirstName(@javax.annotation.Nullable String firstName) { + this.firstName = firstName; + } + + + public User lastName(@javax.annotation.Nullable String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Get lastName + * @return lastName + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_LAST_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getLastName() { + return lastName; + } + + + @JsonProperty(JSON_PROPERTY_LAST_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setLastName(@javax.annotation.Nullable String lastName) { + this.lastName = lastName; + } + + + public User email(@javax.annotation.Nullable String email) { + this.email = email; + return this; + } + + /** + * Get email + * @return email + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_EMAIL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getEmail() { + return email; + } + + + @JsonProperty(JSON_PROPERTY_EMAIL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setEmail(@javax.annotation.Nullable String email) { + this.email = email; + } + + + public User password(@javax.annotation.Nullable String password) { + this.password = password; + return this; + } + + /** + * Get password + * @return password + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PASSWORD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getPassword() { + return password; + } + + + @JsonProperty(JSON_PROPERTY_PASSWORD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPassword(@javax.annotation.Nullable String password) { + this.password = password; + } + + + public User phone(@javax.annotation.Nullable String phone) { + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PHONE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getPhone() { + return phone; + } + + + @JsonProperty(JSON_PROPERTY_PHONE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPhone(@javax.annotation.Nullable String phone) { + this.phone = phone; + } + + + public User userStatus(@javax.annotation.Nullable Integer userStatus) { + this.userStatus = userStatus; + return this; + } + + /** + * User Status + * @return userStatus + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_USER_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getUserStatus() { + return userStatus; + } + + + @JsonProperty(JSON_PROPERTY_USER_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setUserStatus(@javax.annotation.Nullable Integer userStatus) { + this.userStatus = userStatus; + } + + + /** + * Return true if this User object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + User user = (User) o; + return Objects.equals(this.id, user.id) && + Objects.equals(this.username, user.username) && + Objects.equals(this.firstName, user.firstName) && + Objects.equals(this.lastName, user.lastName) && + Objects.equals(this.email, user.email) && + Objects.equals(this.password, user.password) && + Objects.equals(this.phone, user.phone) && + Objects.equals(this.userStatus, user.userStatus); + } + + @Override + public int hashCode() { + return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class User {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" username: ").append(toIndentedString(username)).append("\n"); + sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); + sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" userStatus: ").append(toIndentedString(userStatus)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `id` to the URL query string + if (getId() != null) { + joiner.add(String.format("%sid%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getId())))); + } + + // add `username` to the URL query string + if (getUsername() != null) { + joiner.add(String.format("%susername%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getUsername())))); + } + + // add `firstName` to the URL query string + if (getFirstName() != null) { + joiner.add(String.format("%sfirstName%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getFirstName())))); + } + + // add `lastName` to the URL query string + if (getLastName() != null) { + joiner.add(String.format("%slastName%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getLastName())))); + } + + // add `email` to the URL query string + if (getEmail() != null) { + joiner.add(String.format("%semail%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getEmail())))); + } + + // add `password` to the URL query string + if (getPassword() != null) { + joiner.add(String.format("%spassword%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getPassword())))); + } + + // add `phone` to the URL query string + if (getPhone() != null) { + joiner.add(String.format("%sphone%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getPhone())))); + } + + // add `userStatus` to the URL query string + if (getUserStatus() != null) { + joiner.add(String.format("%suserStatus%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getUserStatus())))); + } + + return joiner.toString(); + } +} + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/src/test/java/org/openapitools/client/api/PetApiTest.java b/samples/client/petstore/java/native/test-regenerated-fixed/src/test/java/org/openapitools/client/api/PetApiTest.java new file mode 100644 index 000000000000..f725ba246938 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/src/test/java/org/openapitools/client/api/PetApiTest.java @@ -0,0 +1,180 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import java.io.File; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.Pet; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + + +/** + * API tests for PetApi + */ +@Disabled +public class PetApiTest { + + private final PetApi api = new PetApi(); + + + /** + * Add a new pet to the store + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void addPetTest() throws ApiException { + Pet pet = null; + Pet response = + api.addPet(pet); + + // TODO: test validations + } + + /** + * Deletes a pet + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void deletePetTest() throws ApiException { + Long petId = null; + String apiKey = null; + + api.deletePet(petId, apiKey); + + // TODO: test validations + } + + /** + * Finds Pets by status + * + * Multiple status values can be provided with comma separated strings + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void findPetsByStatusTest() throws ApiException { + List status = null; + List response = + api.findPetsByStatus(status); + + // TODO: test validations + } + + /** + * Finds Pets by tags + * + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void findPetsByTagsTest() throws ApiException { + List tags = null; + List response = + api.findPetsByTags(tags); + + // TODO: test validations + } + + /** + * Find pet by ID + * + * Returns a single pet + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void getPetByIdTest() throws ApiException { + Long petId = null; + Pet response = + api.getPetById(petId); + + // TODO: test validations + } + + /** + * Update an existing pet + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void updatePetTest() throws ApiException { + Pet pet = null; + Pet response = + api.updatePet(pet); + + // TODO: test validations + } + + /** + * Updates a pet in the store with form data + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void updatePetWithFormTest() throws ApiException { + Long petId = null; + String name = null; + String status = null; + + api.updatePetWithForm(petId, name, status); + + // TODO: test validations + } + + /** + * uploads an image + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void uploadFileTest() throws ApiException { + Long petId = null; + String additionalMetadata = null; + File _file = null; + ModelApiResponse response = + api.uploadFile(petId, additionalMetadata, _file); + + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/src/test/java/org/openapitools/client/api/StoreApiTest.java b/samples/client/petstore/java/native/test-regenerated-fixed/src/test/java/org/openapitools/client/api/StoreApiTest.java new file mode 100644 index 000000000000..be318cab8b1e --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/src/test/java/org/openapitools/client/api/StoreApiTest.java @@ -0,0 +1,104 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.model.Order; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + + +/** + * API tests for StoreApi + */ +@Disabled +public class StoreApiTest { + + private final StoreApi api = new StoreApi(); + + + /** + * Delete purchase order by ID + * + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void deleteOrderTest() throws ApiException { + String orderId = null; + + api.deleteOrder(orderId); + + // TODO: test validations + } + + /** + * Returns pet inventories by status + * + * Returns a map of status codes to quantities + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void getInventoryTest() throws ApiException { + Map response = + api.getInventory(); + + // TODO: test validations + } + + /** + * Find purchase order by ID + * + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void getOrderByIdTest() throws ApiException { + Long orderId = null; + Order response = + api.getOrderById(orderId); + + // TODO: test validations + } + + /** + * Place an order for a pet + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void placeOrderTest() throws ApiException { + Order order = null; + Order response = + api.placeOrder(order); + + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/src/test/java/org/openapitools/client/api/UserApiTest.java b/samples/client/petstore/java/native/test-regenerated-fixed/src/test/java/org/openapitools/client/api/UserApiTest.java new file mode 100644 index 000000000000..2b2b7a60fd21 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/src/test/java/org/openapitools/client/api/UserApiTest.java @@ -0,0 +1,175 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import java.time.OffsetDateTime; +import org.openapitools.client.model.User; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + + +/** + * API tests for UserApi + */ +@Disabled +public class UserApiTest { + + private final UserApi api = new UserApi(); + + + /** + * Create user + * + * This can only be done by the logged in user. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void createUserTest() throws ApiException { + User user = null; + + api.createUser(user); + + // TODO: test validations + } + + /** + * Creates list of users with given input array + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void createUsersWithArrayInputTest() throws ApiException { + List user = null; + + api.createUsersWithArrayInput(user); + + // TODO: test validations + } + + /** + * Creates list of users with given input array + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void createUsersWithListInputTest() throws ApiException { + List user = null; + + api.createUsersWithListInput(user); + + // TODO: test validations + } + + /** + * Delete user + * + * This can only be done by the logged in user. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void deleteUserTest() throws ApiException { + String username = null; + + api.deleteUser(username); + + // TODO: test validations + } + + /** + * Get user by user name + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void getUserByNameTest() throws ApiException { + String username = null; + User response = + api.getUserByName(username); + + // TODO: test validations + } + + /** + * Logs user into the system + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void loginUserTest() throws ApiException { + String username = null; + String password = null; + String response = + api.loginUser(username, password); + + // TODO: test validations + } + + /** + * Logs out current logged in user session + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void logoutUserTest() throws ApiException { + + api.logoutUser(); + + // TODO: test validations + } + + /** + * Updated user + * + * This can only be done by the logged in user. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void updateUserTest() throws ApiException { + String username = null; + User user = null; + + api.updateUser(username, user); + + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/src/test/java/org/openapitools/client/model/CategoryTest.java b/samples/client/petstore/java/native/test-regenerated-fixed/src/test/java/org/openapitools/client/model/CategoryTest.java new file mode 100644 index 000000000000..ae23ab433a50 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/src/test/java/org/openapitools/client/model/CategoryTest.java @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Category + */ +class CategoryTest { + private final Category model = new Category(); + + /** + * Model tests for Category + */ + @Test + void testCategory() { + // TODO: test Category + } + + /** + * Test the property 'id' + */ + @Test + void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java b/samples/client/petstore/java/native/test-regenerated-fixed/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java new file mode 100644 index 000000000000..c846563bfe1f --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java @@ -0,0 +1,64 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ModelApiResponse + */ +class ModelApiResponseTest { + private final ModelApiResponse model = new ModelApiResponse(); + + /** + * Model tests for ModelApiResponse + */ + @Test + void testModelApiResponse() { + // TODO: test ModelApiResponse + } + + /** + * Test the property 'code' + */ + @Test + void codeTest() { + // TODO: test code + } + + /** + * Test the property 'type' + */ + @Test + void typeTest() { + // TODO: test type + } + + /** + * Test the property 'message' + */ + @Test + void messageTest() { + // TODO: test message + } + +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/src/test/java/org/openapitools/client/model/OrderTest.java b/samples/client/petstore/java/native/test-regenerated-fixed/src/test/java/org/openapitools/client/model/OrderTest.java new file mode 100644 index 000000000000..4d8d136809eb --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/src/test/java/org/openapitools/client/model/OrderTest.java @@ -0,0 +1,89 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Order + */ +class OrderTest { + private final Order model = new Order(); + + /** + * Model tests for Order + */ + @Test + void testOrder() { + // TODO: test Order + } + + /** + * Test the property 'id' + */ + @Test + void idTest() { + // TODO: test id + } + + /** + * Test the property 'petId' + */ + @Test + void petIdTest() { + // TODO: test petId + } + + /** + * Test the property 'quantity' + */ + @Test + void quantityTest() { + // TODO: test quantity + } + + /** + * Test the property 'shipDate' + */ + @Test + void shipDateTest() { + // TODO: test shipDate + } + + /** + * Test the property 'status' + */ + @Test + void statusTest() { + // TODO: test status + } + + /** + * Test the property 'complete' + */ + @Test + void completeTest() { + // TODO: test complete + } + +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/src/test/java/org/openapitools/client/model/PetTest.java b/samples/client/petstore/java/native/test-regenerated-fixed/src/test/java/org/openapitools/client/model/PetTest.java new file mode 100644 index 000000000000..84aff8adbf96 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/src/test/java/org/openapitools/client/model/PetTest.java @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Pet + */ +class PetTest { + private final Pet model = new Pet(); + + /** + * Model tests for Pet + */ + @Test + void testPet() { + // TODO: test Pet + } + + /** + * Test the property 'id' + */ + @Test + void idTest() { + // TODO: test id + } + + /** + * Test the property 'category' + */ + @Test + void categoryTest() { + // TODO: test category + } + + /** + * Test the property 'name' + */ + @Test + void nameTest() { + // TODO: test name + } + + /** + * Test the property 'photoUrls' + */ + @Test + void photoUrlsTest() { + // TODO: test photoUrls + } + + /** + * Test the property 'tags' + */ + @Test + void tagsTest() { + // TODO: test tags + } + + /** + * Test the property 'status' + */ + @Test + void statusTest() { + // TODO: test status + } + +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/src/test/java/org/openapitools/client/model/TagTest.java b/samples/client/petstore/java/native/test-regenerated-fixed/src/test/java/org/openapitools/client/model/TagTest.java new file mode 100644 index 000000000000..6bd8b9f5035e --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/src/test/java/org/openapitools/client/model/TagTest.java @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Tag + */ +class TagTest { + private final Tag model = new Tag(); + + /** + * Model tests for Tag + */ + @Test + void testTag() { + // TODO: test Tag + } + + /** + * Test the property 'id' + */ + @Test + void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed/src/test/java/org/openapitools/client/model/UserTest.java b/samples/client/petstore/java/native/test-regenerated-fixed/src/test/java/org/openapitools/client/model/UserTest.java new file mode 100644 index 000000000000..40f4892264aa --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed/src/test/java/org/openapitools/client/model/UserTest.java @@ -0,0 +1,104 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for User + */ +class UserTest { + private final User model = new User(); + + /** + * Model tests for User + */ + @Test + void testUser() { + // TODO: test User + } + + /** + * Test the property 'id' + */ + @Test + void idTest() { + // TODO: test id + } + + /** + * Test the property 'username' + */ + @Test + void usernameTest() { + // TODO: test username + } + + /** + * Test the property 'firstName' + */ + @Test + void firstNameTest() { + // TODO: test firstName + } + + /** + * Test the property 'lastName' + */ + @Test + void lastNameTest() { + // TODO: test lastName + } + + /** + * Test the property 'email' + */ + @Test + void emailTest() { + // TODO: test email + } + + /** + * Test the property 'password' + */ + @Test + void passwordTest() { + // TODO: test password + } + + /** + * Test the property 'phone' + */ + @Test + void phoneTest() { + // TODO: test phone + } + + /** + * Test the property 'userStatus' + */ + @Test + void userStatusTest() { + // TODO: test userStatus + } + +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/.github/workflows/maven.yml b/samples/client/petstore/java/native/test-regenerated-fixed2/.github/workflows/maven.yml new file mode 100644 index 000000000000..460f78bfd1b2 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/.github/workflows/maven.yml @@ -0,0 +1,30 @@ +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven +# +# This file is auto-generated by OpenAPI Generator (https://openapi-generator.tech) + +name: Java CI with Maven + +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] + +jobs: + build: + name: Build OpenAPI Petstore + runs-on: ubuntu-latest + strategy: + matrix: + java: [ 17, 21 ] + steps: + - uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.java }} + distribution: 'temurin' + cache: maven + - name: Build with Maven + run: mvn -B package --no-transfer-progress --file pom.xml diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/.gitignore b/samples/client/petstore/java/native/test-regenerated-fixed2/.gitignore new file mode 100644 index 000000000000..a530464afa1b --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/.gitignore @@ -0,0 +1,21 @@ +*.class + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.ear + +# exclude jar for gradle wrapper +!gradle/wrapper/*.jar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +# build files +**/target +target +.gradle +build diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/.openapi-generator-ignore b/samples/client/petstore/java/native/test-regenerated-fixed2/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/.openapi-generator/FILES b/samples/client/petstore/java/native/test-regenerated-fixed2/.openapi-generator/FILES new file mode 100644 index 000000000000..57d506c4c50b --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/.openapi-generator/FILES @@ -0,0 +1,56 @@ +.github/workflows/maven.yml +.gitignore +.openapi-generator-ignore +.travis.yml +README.md +api/openapi.yaml +build.gradle +build.sbt +docs/Category.md +docs/ModelApiResponse.md +docs/Order.md +docs/Pet.md +docs/PetApi.md +docs/StoreApi.md +docs/Tag.md +docs/User.md +docs/UserApi.md +git_push.sh +gradle.properties +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat +pom.xml +settings.gradle +src/main/AndroidManifest.xml +src/main/java/org/openapitools/client/ApiClient.java +src/main/java/org/openapitools/client/ApiException.java +src/main/java/org/openapitools/client/ApiResponse.java +src/main/java/org/openapitools/client/Configuration.java +src/main/java/org/openapitools/client/JSON.java +src/main/java/org/openapitools/client/Pair.java +src/main/java/org/openapitools/client/RFC3339DateFormat.java +src/main/java/org/openapitools/client/RFC3339InstantDeserializer.java +src/main/java/org/openapitools/client/RFC3339JavaTimeModule.java +src/main/java/org/openapitools/client/ServerConfiguration.java +src/main/java/org/openapitools/client/ServerVariable.java +src/main/java/org/openapitools/client/api/PetApi.java +src/main/java/org/openapitools/client/api/StoreApi.java +src/main/java/org/openapitools/client/api/UserApi.java +src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +src/main/java/org/openapitools/client/model/Category.java +src/main/java/org/openapitools/client/model/ModelApiResponse.java +src/main/java/org/openapitools/client/model/Order.java +src/main/java/org/openapitools/client/model/Pet.java +src/main/java/org/openapitools/client/model/Tag.java +src/main/java/org/openapitools/client/model/User.java +src/test/java/org/openapitools/client/api/PetApiTest.java +src/test/java/org/openapitools/client/api/StoreApiTest.java +src/test/java/org/openapitools/client/api/UserApiTest.java +src/test/java/org/openapitools/client/model/CategoryTest.java +src/test/java/org/openapitools/client/model/ModelApiResponseTest.java +src/test/java/org/openapitools/client/model/OrderTest.java +src/test/java/org/openapitools/client/model/PetTest.java +src/test/java/org/openapitools/client/model/TagTest.java +src/test/java/org/openapitools/client/model/UserTest.java diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/.openapi-generator/VERSION b/samples/client/petstore/java/native/test-regenerated-fixed2/.openapi-generator/VERSION new file mode 100644 index 000000000000..fc74d6ceba8e --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.15.0-SNAPSHOT diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/.travis.yml b/samples/client/petstore/java/native/test-regenerated-fixed2/.travis.yml new file mode 100644 index 000000000000..c94647479234 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/.travis.yml @@ -0,0 +1,16 @@ +# +# Generated by: https://openapi-generator.tech +# +language: java +jdk: + - oraclejdk11 +before_install: + # ensure gradlew has proper permission + - chmod a+x ./gradlew +script: + # test using maven + - mvn test + # uncomment below to test using gradle + # - gradle test + # uncomment below to test using sbt + # - sbt test diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/README.md b/samples/client/petstore/java/native/test-regenerated-fixed2/README.md new file mode 100644 index 000000000000..58ca90dfb57f --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/README.md @@ -0,0 +1,197 @@ +# openapi-java-client + +OpenAPI Petstore + +- API version: 1.0.0 + +- Build date: 2025-07-08T21:08:28.986952+07:00[Asia/Bangkok] + +- Generator version: 7.15.0-SNAPSHOT + +This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + + +*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* + +## Requirements + +Building the API client library requires: + +1. Java 11+ +2. Maven/Gradle + +## Installation + +To install the API client library to your local Maven repository, simply execute: + +```shell +mvn clean install +``` + +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: + +```shell +mvn clean deploy +``` + +Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. + +### Maven users + +Add this dependency to your project's POM: + +```xml + + org.openapitools + openapi-java-client + 1.0.0 + compile + +``` + +### Gradle users + +Add this dependency to your project's build file: + +```groovy +compile "org.openapitools:openapi-java-client:1.0.0" +``` + +### Others + +At first generate the JAR by executing: + +```shell +mvn clean package +``` + +Then manually install the following JARs: + +- `target/openapi-java-client-1.0.0.jar` +- `target/lib/*.jar` + +## Getting Started + +Please follow the [installation](#installation) instruction and execute the following Java code: + +```java + +import org.openapitools.client.*; +import org.openapitools.client.model.*; +import org.openapitools.client.api.PetApi; + +public class PetApiExample { + + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + // Configure clients using the `defaultClient` object, such as + // overriding the host and port, timeout, etc. + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + Pet result = apiInstance.addPet(pet); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store +*PetApi* | [**addPetWithHttpInfo**](docs/PetApi.md#addPetWithHttpInfo) | **POST** /pet | Add a new pet to the store +*PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**deletePetWithHttpInfo**](docs/PetApi.md#deletePetWithHttpInfo) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status +*PetApi* | [**findPetsByStatusWithHttpInfo**](docs/PetApi.md#findPetsByStatusWithHttpInfo) | **GET** /pet/findByStatus | Finds Pets by status +*PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags +*PetApi* | [**findPetsByTagsWithHttpInfo**](docs/PetApi.md#findPetsByTagsWithHttpInfo) | **GET** /pet/findByTags | Finds Pets by tags +*PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**getPetByIdWithHttpInfo**](docs/PetApi.md#getPetByIdWithHttpInfo) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**updatePet**](docs/PetApi.md#updatePet) | **PUT** /pet | Update an existing pet +*PetApi* | [**updatePetWithHttpInfo**](docs/PetApi.md#updatePetWithHttpInfo) | **PUT** /pet | Update an existing pet +*PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data +*PetApi* | [**updatePetWithFormWithHttpInfo**](docs/PetApi.md#updatePetWithFormWithHttpInfo) | **POST** /pet/{petId} | Updates a pet in the store with form data +*PetApi* | [**uploadFile**](docs/PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image +*PetApi* | [**uploadFileWithHttpInfo**](docs/PetApi.md#uploadFileWithHttpInfo) | **POST** /pet/{petId}/uploadImage | uploads an image +*StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID +*StoreApi* | [**deleteOrderWithHttpInfo**](docs/StoreApi.md#deleteOrderWithHttpInfo) | **DELETE** /store/order/{orderId} | Delete purchase order by ID +*StoreApi* | [**getInventory**](docs/StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status +*StoreApi* | [**getInventoryWithHttpInfo**](docs/StoreApi.md#getInventoryWithHttpInfo) | **GET** /store/inventory | Returns pet inventories by status +*StoreApi* | [**getOrderById**](docs/StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID +*StoreApi* | [**getOrderByIdWithHttpInfo**](docs/StoreApi.md#getOrderByIdWithHttpInfo) | **GET** /store/order/{orderId} | Find purchase order by ID +*StoreApi* | [**placeOrder**](docs/StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet +*StoreApi* | [**placeOrderWithHttpInfo**](docs/StoreApi.md#placeOrderWithHttpInfo) | **POST** /store/order | Place an order for a pet +*UserApi* | [**createUser**](docs/UserApi.md#createUser) | **POST** /user | Create user +*UserApi* | [**createUserWithHttpInfo**](docs/UserApi.md#createUserWithHttpInfo) | **POST** /user | Create user +*UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**createUsersWithArrayInputWithHttpInfo**](docs/UserApi.md#createUsersWithArrayInputWithHttpInfo) | **POST** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**createUsersWithListInput**](docs/UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array +*UserApi* | [**createUsersWithListInputWithHttpInfo**](docs/UserApi.md#createUsersWithListInputWithHttpInfo) | **POST** /user/createWithList | Creates list of users with given input array +*UserApi* | [**deleteUser**](docs/UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user +*UserApi* | [**deleteUserWithHttpInfo**](docs/UserApi.md#deleteUserWithHttpInfo) | **DELETE** /user/{username} | Delete user +*UserApi* | [**getUserByName**](docs/UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name +*UserApi* | [**getUserByNameWithHttpInfo**](docs/UserApi.md#getUserByNameWithHttpInfo) | **GET** /user/{username} | Get user by user name +*UserApi* | [**loginUser**](docs/UserApi.md#loginUser) | **GET** /user/login | Logs user into the system +*UserApi* | [**loginUserWithHttpInfo**](docs/UserApi.md#loginUserWithHttpInfo) | **GET** /user/login | Logs user into the system +*UserApi* | [**logoutUser**](docs/UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session +*UserApi* | [**logoutUserWithHttpInfo**](docs/UserApi.md#logoutUserWithHttpInfo) | **GET** /user/logout | Logs out current logged in user session +*UserApi* | [**updateUser**](docs/UserApi.md#updateUser) | **PUT** /user/{username} | Updated user +*UserApi* | [**updateUserWithHttpInfo**](docs/UserApi.md#updateUserWithHttpInfo) | **PUT** /user/{username} | Updated user + + +## Documentation for Models + + - [Category](docs/Category.md) + - [ModelApiResponse](docs/ModelApiResponse.md) + - [Order](docs/Order.md) + - [Pet](docs/Pet.md) + - [Tag](docs/Tag.md) + - [User](docs/User.md) + + + +## Documentation for Authorization + + +Authentication schemes defined for the API: + +### petstore_auth + + +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - write:pets: modify pets in your account + - read:pets: read your pets + + +### api_key + + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + + +## Recommendation + +It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. +However, the instances of the api clients created from the `ApiClient` are thread-safe and can be re-used. + +## Author + + + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/api/openapi.yaml b/samples/client/petstore/java/native/test-regenerated-fixed2/api/openapi.yaml new file mode 100644 index 000000000000..9b1b54b9454b --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/api/openapi.yaml @@ -0,0 +1,865 @@ +openapi: 3.0.0 +info: + description: "This is a sample server Petstore server. For this sample, you can\ + \ use the api key `special-key` to test the authorization filters." + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user +paths: + /pet: + post: + description: "" + operationId: addPet + requestBody: + $ref: "#/components/requestBodies/Pet" + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Pet" + application/json: + schema: + $ref: "#/components/schemas/Pet" + description: successful operation + "405": + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + x-content-type: application/json + x-accepts: + - application/json + - application/xml + put: + description: "" + operationId: updatePet + requestBody: + $ref: "#/components/requestBodies/Pet" + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Pet" + application/json: + schema: + $ref: "#/components/schemas/Pet" + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Pet not found + "405": + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + x-content-type: application/json + x-accepts: + - application/json + - application/xml + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + "200": + content: + application/xml: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + application/json: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + description: successful operation + "400": + description: Invalid status value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by status + tags: + - pet + x-accepts: + - application/json + - application/xml + /pet/findByTags: + get: + deprecated: true + description: "Multiple tags can be provided with comma separated strings. Use\ + \ tag1, tag2, tag3 for testing." + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + "200": + content: + application/xml: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + application/json: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + description: successful operation + "400": + description: Invalid tag value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by tags + tags: + - pet + x-accepts: + - application/json + - application/xml + /pet/{petId}: + delete: + description: "" + operationId: deletePet + parameters: + - explode: false + in: header + name: api_key + required: false + schema: + type: string + style: simple + - description: Pet id to delete + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "400": + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + x-accepts: + - application/json + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Pet" + application/json: + schema: + $ref: "#/components/schemas/Pet" + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + x-accepts: + - application/json + - application/xml + post: + description: "" + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/updatePetWithForm_request" + responses: + "405": + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + /pet/{petId}/uploadImage: + post: + description: "" + operationId: uploadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/uploadFile_request" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/ApiResponse" + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + x-content-type: multipart/form-data + x-accepts: + - application/json + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + "200": + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + x-accepts: + - application/json + /store/order: + post: + description: "" + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Order" + description: order placed for purchasing the pet + required: true + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Order" + application/json: + schema: + $ref: "#/components/schemas/Order" + description: successful operation + "400": + description: Invalid Order + summary: Place an order for a pet + tags: + - store + x-content-type: application/json + x-accepts: + - application/json + - application/xml + /store/order/{orderId}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + explode: false + in: path + name: orderId + required: true + schema: + type: string + style: simple + responses: + "400": + description: Invalid ID supplied + "404": + description: Order not found + summary: Delete purchase order by ID + tags: + - store + x-accepts: + - application/json + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + explode: false + in: path + name: orderId + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Order" + application/json: + schema: + $ref: "#/components/schemas/Order" + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Order not found + summary: Find purchase order by ID + tags: + - store + x-accepts: + - application/json + - application/xml + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/User" + description: Created user object + required: true + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Create user + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + /user/createWithArray: + post: + description: "" + operationId: createUsersWithArrayInput + requestBody: + $ref: "#/components/requestBodies/UserArray" + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + /user/createWithList: + post: + description: "" + operationId: createUsersWithListInput + requestBody: + $ref: "#/components/requestBodies/UserArray" + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + /user/login: + get: + description: "" + operationId: loginUser + parameters: + - description: The user name for login + explode: true + in: query + name: username + required: true + schema: + pattern: "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$" + type: string + style: form + - description: The password for login in clear text + explode: true + in: query + name: password + required: true + schema: + type: string + style: form + responses: + "200": + content: + application/xml: + schema: + type: string + application/json: + schema: + type: string + description: successful operation + headers: + Set-Cookie: + description: Cookie authentication key for use with the `api_key` apiKey + authentication. + explode: false + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + style: simple + X-Rate-Limit: + description: calls per hour allowed by the user + explode: false + schema: + format: int32 + type: integer + style: simple + X-Expires-After: + description: date in UTC when token expires + explode: false + schema: + format: date-time + type: string + style: simple + "400": + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + x-accepts: + - application/json + - application/xml + /user/logout: + get: + description: "" + operationId: logoutUser + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Logs out current logged in user session + tags: + - user + x-accepts: + - application/json + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + "400": + description: Invalid username supplied + "404": + description: User not found + security: + - api_key: [] + summary: Delete user + tags: + - user + x-accepts: + - application/json + get: + description: "" + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/User" + application/json: + schema: + $ref: "#/components/schemas/User" + description: successful operation + "400": + description: Invalid username supplied + "404": + description: User not found + summary: Get user by user name + tags: + - user + x-accepts: + - application/json + - application/xml + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/User" + description: Updated user object + required: true + responses: + "400": + description: Invalid user supplied + "404": + description: User not found + security: + - api_key: [] + summary: Updated user + tags: + - user + x-content-type: application/json + x-accepts: + - application/json +components: + requestBodies: + UserArray: + content: + application/json: + schema: + items: + $ref: "#/components/schemas/User" + type: array + description: List of user object + required: true + Pet: + content: + application/json: + schema: + $ref: "#/components/schemas/Pet" + application/xml: + schema: + $ref: "#/components/schemas/Pet" + description: Pet object that needs to be added to the store + required: true + schemas: + ApiResponse: + description: Describes the result of uploading an image resource + example: + code: 0 + type: type + message: message + properties: + code: + format: int32 + type: integer + type: + type: string + message: + type: string + title: An uploaded response + type: object + Pet: + description: A pet for sale in the pet store + example: + photoUrls: + - photoUrls + - photoUrls + name: doggie + id: 0 + category: + name: name + id: 6 + tags: + - name: name + id: 1 + - name: name + id: 1 + status: available + properties: + id: + format: int64 + type: integer + category: + $ref: "#/components/schemas/Category" + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + tags: + items: + $ref: "#/components/schemas/Tag" + type: array + xml: + name: tag + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + Order: + description: An order for a pets from the pet store + example: + petId: 6 + quantity: 1 + id: 0 + shipDate: 2000-01-23T04:56:07.000+00:00 + complete: false + status: placed + properties: + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + complete: + default: false + type: boolean + title: Pet Order + type: object + xml: + name: Order + User: + description: A User who is purchasing from the pet store + example: + firstName: firstName + lastName: lastName + password: password + userStatus: 6 + phone: phone + id: 0 + email: email + username: username + properties: + id: + format: int64 + type: integer + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + title: a User + type: object + xml: + name: User + Category: + description: A category for a pet + example: + name: name + id: 6 + properties: + id: + format: int64 + type: integer + name: + pattern: "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$" + type: string + title: Pet category + type: object + xml: + name: Category + Tag: + description: A tag for a pet + example: + name: name + id: 1 + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + updatePetWithForm_request: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + uploadFile_request: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + securitySchemes: + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 + api_key: + in: header + name: api_key + type: apiKey + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/build.gradle b/samples/client/petstore/java/native/test-regenerated-fixed2/build.gradle new file mode 100644 index 000000000000..56fa470fb767 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/build.gradle @@ -0,0 +1,109 @@ +apply plugin: 'idea' +apply plugin: 'eclipse' +apply plugin: 'com.diffplug.spotless' + +group = 'org.openapitools' +version = '1.0.0' + +buildscript { + repositories { + mavenCentral() + } + dependencies { + classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.11.0' + } +} + +repositories { + mavenCentral() +} + +apply plugin: 'java' +apply plugin: 'maven-publish' + +sourceCompatibility = JavaVersion.VERSION_11 +targetCompatibility = JavaVersion.VERSION_11 + +// Some text from the schema is copy pasted into the source files as UTF-8 +// but the default still seems to be to use platform encoding +tasks.withType(JavaCompile) { + configure(options) { + options.encoding = 'UTF-8' + } +} +javadoc { + options.encoding = 'UTF-8' +} + +publishing { + publications { + maven(MavenPublication) { + artifactId = 'openapi-java-client' + from components.java + } + } +} + +task execute(type:JavaExec) { + main = System.getProperty('mainClass') + classpath = sourceSets.main.runtimeClasspath +} + +task sourcesJar(type: Jar, dependsOn: classes) { + archiveClassifier = 'sources' + from sourceSets.main.allSource +} + +task javadocJar(type: Jar, dependsOn: javadoc) { + archiveClassifier = 'javadoc' + from javadoc.destinationDir +} + +artifacts { + archives sourcesJar + archives javadocJar +} + + +ext { + jackson_version = "2.17.1" + jakarta_annotation_version = "1.3.5" + beanvalidation_version = "2.0.2" + junit_version = "5.10.2" + httpmime_version = "4.5.13" +} + +dependencies { + implementation "com.google.code.findbugs:jsr305:3.0.2" + implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version" + implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" + implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_version" + implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" + implementation "org.openapitools:jackson-databind-nullable:0.2.1" + implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" + implementation "org.apache.httpcomponents:httpmime:$httpmime_version" + testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version" +} + +// Use spotless plugin to automatically format code, remove unused import, etc +// To apply changes directly to the file, run `gradlew spotlessApply` +// Ref: https://github.com/diffplug/spotless/tree/main/plugin-gradle +spotless { + // comment out below to run spotless as part of the `check` task + enforceCheck false + format 'misc', { + // define the files (e.g. '*.gradle', '*.md') to apply `misc` to + target '.gitignore' + // define the steps to apply to those files + trimTrailingWhitespace() + indentWithSpaces() // Takes an integer argument if you don't like 4 + endWithNewline() + } + java { + // don't need to set target, it is inferred from java + // apply a specific flavor of google-java-format + googleJavaFormat('1.8').aosp().reflowLongStrings() + removeUnusedImports() + importOrder() + } +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/build.sbt b/samples/client/petstore/java/native/test-regenerated-fixed2/build.sbt new file mode 100644 index 000000000000..464090415c47 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/build.sbt @@ -0,0 +1 @@ +# TODO diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/docs/Category.md b/samples/client/petstore/java/native/test-regenerated-fixed2/docs/Category.md new file mode 100644 index 000000000000..a7fc939d252e --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/docs/Category.md @@ -0,0 +1,15 @@ + + +# Category + +A category for a pet + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/docs/ModelApiResponse.md b/samples/client/petstore/java/native/test-regenerated-fixed2/docs/ModelApiResponse.md new file mode 100644 index 000000000000..cd7e3c400be6 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/docs/ModelApiResponse.md @@ -0,0 +1,16 @@ + + +# ModelApiResponse + +Describes the result of uploading an image resource + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**code** | **Integer** | | [optional] | +|**type** | **String** | | [optional] | +|**message** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/docs/Order.md b/samples/client/petstore/java/native/test-regenerated-fixed2/docs/Order.md new file mode 100644 index 000000000000..0c33059b8b6a --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/docs/Order.md @@ -0,0 +1,29 @@ + + +# Order + +An order for a pets from the pet store + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**petId** | **Long** | | [optional] | +|**quantity** | **Integer** | | [optional] | +|**shipDate** | **OffsetDateTime** | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional] | +|**complete** | **Boolean** | | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| PLACED | "placed" | +| APPROVED | "approved" | +| DELIVERED | "delivered" | + + + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/docs/Pet.md b/samples/client/petstore/java/native/test-regenerated-fixed2/docs/Pet.md new file mode 100644 index 000000000000..8bb363301232 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/docs/Pet.md @@ -0,0 +1,29 @@ + + +# Pet + +A pet for sale in the pet store + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**category** | [**Category**](Category.md) | | [optional] | +|**name** | **String** | | | +|**photoUrls** | **List<String>** | | | +|**tags** | [**List<Tag>**](Tag.md) | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| AVAILABLE | "available" | +| PENDING | "pending" | +| SOLD | "sold" | + + + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/docs/PetApi.md b/samples/client/petstore/java/native/test-regenerated-fixed2/docs/PetApi.md new file mode 100644 index 000000000000..51f089e85389 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/docs/PetApi.md @@ -0,0 +1,1212 @@ +# PetApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | +| [**addPetWithHttpInfo**](PetApi.md#addPetWithHttpInfo) | **POST** /pet | Add a new pet to the store | +| [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | +| [**deletePetWithHttpInfo**](PetApi.md#deletePetWithHttpInfo) | **DELETE** /pet/{petId} | Deletes a pet | +| [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | +| [**findPetsByStatusWithHttpInfo**](PetApi.md#findPetsByStatusWithHttpInfo) | **GET** /pet/findByStatus | Finds Pets by status | +| [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | +| [**findPetsByTagsWithHttpInfo**](PetApi.md#findPetsByTagsWithHttpInfo) | **GET** /pet/findByTags | Finds Pets by tags | +| [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | +| [**getPetByIdWithHttpInfo**](PetApi.md#getPetByIdWithHttpInfo) | **GET** /pet/{petId} | Find pet by ID | +| [**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet | +| [**updatePetWithHttpInfo**](PetApi.md#updatePetWithHttpInfo) | **PUT** /pet | Update an existing pet | +| [**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data | +| [**updatePetWithFormWithHttpInfo**](PetApi.md#updatePetWithFormWithHttpInfo) | **POST** /pet/{petId} | Updates a pet in the store with form data | +| [**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image | +| [**uploadFileWithHttpInfo**](PetApi.md#uploadFileWithHttpInfo) | **POST** /pet/{petId}/uploadImage | uploads an image | + + + +## addPet + +> Pet addPet(pet) + +Add a new pet to the store + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + Pet result = apiInstance.addPet(pet); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | + +### Return type + +[**Pet**](Pet.md) + + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: application/json, application/xml +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **405** | Invalid input | - | + +## addPetWithHttpInfo + +> ApiResponse addPet addPetWithHttpInfo(pet) + +Add a new pet to the store + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + ApiResponse response = apiInstance.addPetWithHttpInfo(pet); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | + +### Return type + +ApiResponse<[**Pet**](Pet.md)> + + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: application/json, application/xml +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **405** | Invalid input | - | + + +## deletePet + +> void deletePet(petId, apiKey) + +Deletes a pet + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | Pet id to delete + String apiKey = "apiKey_example"; // String | + try { + apiInstance.deletePet(petId, apiKey); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#deletePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| Pet id to delete | | +| **apiKey** | **String**| | [optional] | + +### Return type + + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid pet value | - | + +## deletePetWithHttpInfo + +> ApiResponse deletePet deletePetWithHttpInfo(petId, apiKey) + +Deletes a pet + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | Pet id to delete + String apiKey = "apiKey_example"; // String | + try { + ApiResponse response = apiInstance.deletePetWithHttpInfo(petId, apiKey); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#deletePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| Pet id to delete | | +| **apiKey** | **String**| | [optional] | + +### Return type + + +ApiResponse + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid pet value | - | + + +## findPetsByStatus + +> List findPetsByStatus(status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + List status = Arrays.asList("available"); // List | Status values that need to be considered for filter + try { + List result = apiInstance.findPetsByStatus(status); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByStatus"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [enum: available, pending, sold] | + +### Return type + +[**List<Pet>**](Pet.md) + + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid status value | - | + +## findPetsByStatusWithHttpInfo + +> ApiResponse> findPetsByStatus findPetsByStatusWithHttpInfo(status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + List status = Arrays.asList("available"); // List | Status values that need to be considered for filter + try { + ApiResponse> response = apiInstance.findPetsByStatusWithHttpInfo(status); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByStatus"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [enum: available, pending, sold] | + +### Return type + +ApiResponse<[**List<Pet>**](Pet.md)> + + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid status value | - | + + +## findPetsByTags + +> List findPetsByTags(tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + List tags = Arrays.asList(); // List | Tags to filter by + try { + List result = apiInstance.findPetsByTags(tags); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **tags** | [**List<String>**](String.md)| Tags to filter by | | + +### Return type + +[**List<Pet>**](Pet.md) + + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid tag value | - | + +## findPetsByTagsWithHttpInfo + +> ApiResponse> findPetsByTags findPetsByTagsWithHttpInfo(tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + List tags = Arrays.asList(); // List | Tags to filter by + try { + ApiResponse> response = apiInstance.findPetsByTagsWithHttpInfo(tags); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **tags** | [**List<String>**](String.md)| Tags to filter by | | + +### Return type + +ApiResponse<[**List<Pet>**](Pet.md)> + + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid tag value | - | + + +## getPetById + +> Pet getPetById(petId) + +Find pet by ID + +Returns a single pet + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to return + try { + Pet result = apiInstance.getPetById(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#getPetById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to return | | + +### Return type + +[**Pet**](Pet.md) + + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | + +## getPetByIdWithHttpInfo + +> ApiResponse getPetById getPetByIdWithHttpInfo(petId) + +Find pet by ID + +Returns a single pet + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to return + try { + ApiResponse response = apiInstance.getPetByIdWithHttpInfo(petId); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#getPetById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to return | | + +### Return type + +ApiResponse<[**Pet**](Pet.md)> + + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | + + +## updatePet + +> Pet updatePet(pet) + +Update an existing pet + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + Pet result = apiInstance.updatePet(pet); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | + +### Return type + +[**Pet**](Pet.md) + + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: application/json, application/xml +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | +| **405** | Validation exception | - | + +## updatePetWithHttpInfo + +> ApiResponse updatePet updatePetWithHttpInfo(pet) + +Update an existing pet + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + ApiResponse response = apiInstance.updatePetWithHttpInfo(pet); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | + +### Return type + +ApiResponse<[**Pet**](Pet.md)> + + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: application/json, application/xml +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | +| **405** | Validation exception | - | + + +## updatePetWithForm + +> void updatePetWithForm(petId, name, status) + +Updates a pet in the store with form data + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet that needs to be updated + String name = "name_example"; // String | Updated name of the pet + String status = "status_example"; // String | Updated status of the pet + try { + apiInstance.updatePetWithForm(petId, name, status); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePetWithForm"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet that needs to be updated | | +| **name** | **String**| Updated name of the pet | [optional] | +| **status** | **String**| Updated status of the pet | [optional] | + +### Return type + + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + +## updatePetWithFormWithHttpInfo + +> ApiResponse updatePetWithForm updatePetWithFormWithHttpInfo(petId, name, status) + +Updates a pet in the store with form data + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet that needs to be updated + String name = "name_example"; // String | Updated name of the pet + String status = "status_example"; // String | Updated status of the pet + try { + ApiResponse response = apiInstance.updatePetWithFormWithHttpInfo(petId, name, status); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePetWithForm"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet that needs to be updated | | +| **name** | **String**| Updated name of the pet | [optional] | +| **status** | **String**| Updated status of the pet | [optional] | + +### Return type + + +ApiResponse + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + + +## uploadFile + +> ModelApiResponse uploadFile(petId, additionalMetadata, _file) + +uploads an image + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + File _file = new File("/path/to/file"); // File | file to upload + try { + ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, _file); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | +| **additionalMetadata** | **String**| Additional data to pass to server | [optional] | +| **_file** | **File**| file to upload | [optional] | + +### Return type + +[**ModelApiResponse**](ModelApiResponse.md) + + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: multipart/form-data +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + +## uploadFileWithHttpInfo + +> ApiResponse uploadFile uploadFileWithHttpInfo(petId, additionalMetadata, _file) + +uploads an image + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + File _file = new File("/path/to/file"); // File | file to upload + try { + ApiResponse response = apiInstance.uploadFileWithHttpInfo(petId, additionalMetadata, _file); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | +| **additionalMetadata** | **String**| Additional data to pass to server | [optional] | +| **_file** | **File**| file to upload | [optional] | + +### Return type + +ApiResponse<[**ModelApiResponse**](ModelApiResponse.md)> + + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: multipart/form-data +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/docs/StoreApi.md b/samples/client/petstore/java/native/test-regenerated-fixed2/docs/StoreApi.md new file mode 100644 index 000000000000..7dfbbe315c11 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/docs/StoreApi.md @@ -0,0 +1,564 @@ +# StoreApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID | +| [**deleteOrderWithHttpInfo**](StoreApi.md#deleteOrderWithHttpInfo) | **DELETE** /store/order/{orderId} | Delete purchase order by ID | +| [**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status | +| [**getInventoryWithHttpInfo**](StoreApi.md#getInventoryWithHttpInfo) | **GET** /store/inventory | Returns pet inventories by status | +| [**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID | +| [**getOrderByIdWithHttpInfo**](StoreApi.md#getOrderByIdWithHttpInfo) | **GET** /store/order/{orderId} | Find purchase order by ID | +| [**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet | +| [**placeOrderWithHttpInfo**](StoreApi.md#placeOrderWithHttpInfo) | **POST** /store/order | Place an order for a pet | + + + +## deleteOrder + +> void deleteOrder(orderId) + +Delete purchase order by ID + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + String orderId = "orderId_example"; // String | ID of the order that needs to be deleted + try { + apiInstance.deleteOrder(orderId); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#deleteOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **orderId** | **String**| ID of the order that needs to be deleted | | + +### Return type + + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + +## deleteOrderWithHttpInfo + +> ApiResponse deleteOrder deleteOrderWithHttpInfo(orderId) + +Delete purchase order by ID + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + String orderId = "orderId_example"; // String | ID of the order that needs to be deleted + try { + ApiResponse response = apiInstance.deleteOrderWithHttpInfo(orderId); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#deleteOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **orderId** | **String**| ID of the order that needs to be deleted | | + +### Return type + + +ApiResponse + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + + +## getInventory + +> Map getInventory() + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + StoreApi apiInstance = new StoreApi(defaultClient); + try { + Map result = apiInstance.getInventory(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getInventory"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +**Map<String, Integer>** + + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + +## getInventoryWithHttpInfo + +> ApiResponse> getInventory getInventoryWithHttpInfo() + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + StoreApi apiInstance = new StoreApi(defaultClient); + try { + ApiResponse> response = apiInstance.getInventoryWithHttpInfo(); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getInventory"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +ApiResponse<**Map<String, Integer>**> + + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +## getOrderById + +> Order getOrderById(orderId) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + Long orderId = 56L; // Long | ID of pet that needs to be fetched + try { + Order result = apiInstance.getOrderById(orderId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getOrderById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **orderId** | **Long**| ID of pet that needs to be fetched | | + +### Return type + +[**Order**](Order.md) + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + +## getOrderByIdWithHttpInfo + +> ApiResponse getOrderById getOrderByIdWithHttpInfo(orderId) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + Long orderId = 56L; // Long | ID of pet that needs to be fetched + try { + ApiResponse response = apiInstance.getOrderByIdWithHttpInfo(orderId); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getOrderById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **orderId** | **Long**| ID of pet that needs to be fetched | | + +### Return type + +ApiResponse<[**Order**](Order.md)> + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + + +## placeOrder + +> Order placeOrder(order) + +Place an order for a pet + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + Order order = new Order(); // Order | order placed for purchasing the pet + try { + Order result = apiInstance.placeOrder(order); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#placeOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **order** | [**Order**](Order.md)| order placed for purchasing the pet | | + +### Return type + +[**Order**](Order.md) + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid Order | - | + +## placeOrderWithHttpInfo + +> ApiResponse placeOrder placeOrderWithHttpInfo(order) + +Place an order for a pet + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + Order order = new Order(); // Order | order placed for purchasing the pet + try { + ApiResponse response = apiInstance.placeOrderWithHttpInfo(order); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#placeOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **order** | [**Order**](Order.md)| order placed for purchasing the pet | | + +### Return type + +ApiResponse<[**Order**](Order.md)> + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid Order | - | + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/docs/Tag.md b/samples/client/petstore/java/native/test-regenerated-fixed2/docs/Tag.md new file mode 100644 index 000000000000..abfde4afb501 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/docs/Tag.md @@ -0,0 +1,15 @@ + + +# Tag + +A tag for a pet + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/docs/User.md b/samples/client/petstore/java/native/test-regenerated-fixed2/docs/User.md new file mode 100644 index 000000000000..426845227bd3 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/docs/User.md @@ -0,0 +1,21 @@ + + +# User + +A User who is purchasing from the pet store + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**username** | **String** | | [optional] | +|**firstName** | **String** | | [optional] | +|**lastName** | **String** | | [optional] | +|**email** | **String** | | [optional] | +|**password** | **String** | | [optional] | +|**phone** | **String** | | [optional] | +|**userStatus** | **Integer** | User Status | [optional] | + + + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/docs/UserApi.md b/samples/client/petstore/java/native/test-regenerated-fixed2/docs/UserApi.md new file mode 100644 index 000000000000..da72405c908b --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/docs/UserApi.md @@ -0,0 +1,1178 @@ +# UserApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**createUser**](UserApi.md#createUser) | **POST** /user | Create user | +| [**createUserWithHttpInfo**](UserApi.md#createUserWithHttpInfo) | **POST** /user | Create user | +| [**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array | +| [**createUsersWithArrayInputWithHttpInfo**](UserApi.md#createUsersWithArrayInputWithHttpInfo) | **POST** /user/createWithArray | Creates list of users with given input array | +| [**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array | +| [**createUsersWithListInputWithHttpInfo**](UserApi.md#createUsersWithListInputWithHttpInfo) | **POST** /user/createWithList | Creates list of users with given input array | +| [**deleteUser**](UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user | +| [**deleteUserWithHttpInfo**](UserApi.md#deleteUserWithHttpInfo) | **DELETE** /user/{username} | Delete user | +| [**getUserByName**](UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name | +| [**getUserByNameWithHttpInfo**](UserApi.md#getUserByNameWithHttpInfo) | **GET** /user/{username} | Get user by user name | +| [**loginUser**](UserApi.md#loginUser) | **GET** /user/login | Logs user into the system | +| [**loginUserWithHttpInfo**](UserApi.md#loginUserWithHttpInfo) | **GET** /user/login | Logs user into the system | +| [**logoutUser**](UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session | +| [**logoutUserWithHttpInfo**](UserApi.md#logoutUserWithHttpInfo) | **GET** /user/logout | Logs out current logged in user session | +| [**updateUser**](UserApi.md#updateUser) | **PUT** /user/{username} | Updated user | +| [**updateUserWithHttpInfo**](UserApi.md#updateUserWithHttpInfo) | **PUT** /user/{username} | Updated user | + + + +## createUser + +> void createUser(user) + +Create user + +This can only be done by the logged in user. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + User user = new User(); // User | Created user object + try { + apiInstance.createUser(user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**User**](User.md)| Created user object | | + +### Return type + + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + +## createUserWithHttpInfo + +> ApiResponse createUser createUserWithHttpInfo(user) + +Create user + +This can only be done by the logged in user. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + User user = new User(); // User | Created user object + try { + ApiResponse response = apiInstance.createUserWithHttpInfo(user); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**User**](User.md)| Created user object | | + +### Return type + + +ApiResponse + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +## createUsersWithArrayInput + +> void createUsersWithArrayInput(user) + +Creates list of users with given input array + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + List user = Arrays.asList(); // List | List of user object + try { + apiInstance.createUsersWithArrayInput(user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**List<User>**](User.md)| List of user object | | + +### Return type + + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + +## createUsersWithArrayInputWithHttpInfo + +> ApiResponse createUsersWithArrayInput createUsersWithArrayInputWithHttpInfo(user) + +Creates list of users with given input array + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + List user = Arrays.asList(); // List | List of user object + try { + ApiResponse response = apiInstance.createUsersWithArrayInputWithHttpInfo(user); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**List<User>**](User.md)| List of user object | | + +### Return type + + +ApiResponse + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +## createUsersWithListInput + +> void createUsersWithListInput(user) + +Creates list of users with given input array + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + List user = Arrays.asList(); // List | List of user object + try { + apiInstance.createUsersWithListInput(user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithListInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**List<User>**](User.md)| List of user object | | + +### Return type + + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + +## createUsersWithListInputWithHttpInfo + +> ApiResponse createUsersWithListInput createUsersWithListInputWithHttpInfo(user) + +Creates list of users with given input array + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + List user = Arrays.asList(); // List | List of user object + try { + ApiResponse response = apiInstance.createUsersWithListInputWithHttpInfo(user); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithListInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**List<User>**](User.md)| List of user object | | + +### Return type + + +ApiResponse + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +## deleteUser + +> void deleteUser(username) + +Delete user + +This can only be done by the logged in user. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be deleted + try { + apiInstance.deleteUser(username); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#deleteUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The name that needs to be deleted | | + +### Return type + + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + +## deleteUserWithHttpInfo + +> ApiResponse deleteUser deleteUserWithHttpInfo(username) + +Delete user + +This can only be done by the logged in user. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be deleted + try { + ApiResponse response = apiInstance.deleteUserWithHttpInfo(username); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#deleteUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The name that needs to be deleted | | + +### Return type + + +ApiResponse + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + + +## getUserByName + +> User getUserByName(username) + +Get user by user name + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. + try { + User result = apiInstance.getUserByName(username); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#getUserByName"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The name that needs to be fetched. Use user1 for testing. | | + +### Return type + +[**User**](User.md) + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + +## getUserByNameWithHttpInfo + +> ApiResponse getUserByName getUserByNameWithHttpInfo(username) + +Get user by user name + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. + try { + ApiResponse response = apiInstance.getUserByNameWithHttpInfo(username); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#getUserByName"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The name that needs to be fetched. Use user1 for testing. | | + +### Return type + +ApiResponse<[**User**](User.md)> + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + + +## loginUser + +> String loginUser(username, password) + +Logs user into the system + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The user name for login + String password = "password_example"; // String | The password for login in clear text + try { + String result = apiInstance.loginUser(username, password); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#loginUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The user name for login | | +| **password** | **String**| The password for login in clear text | | + +### Return type + +**String** + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +| **400** | Invalid username/password supplied | - | + +## loginUserWithHttpInfo + +> ApiResponse loginUser loginUserWithHttpInfo(username, password) + +Logs user into the system + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The user name for login + String password = "password_example"; // String | The password for login in clear text + try { + ApiResponse response = apiInstance.loginUserWithHttpInfo(username, password); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#loginUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The user name for login | | +| **password** | **String**| The password for login in clear text | | + +### Return type + +ApiResponse<**String**> + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +| **400** | Invalid username/password supplied | - | + + +## logoutUser + +> void logoutUser() + +Logs out current logged in user session + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + try { + apiInstance.logoutUser(); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#logoutUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + +## logoutUserWithHttpInfo + +> ApiResponse logoutUser logoutUserWithHttpInfo() + +Logs out current logged in user session + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + try { + ApiResponse response = apiInstance.logoutUserWithHttpInfo(); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#logoutUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + + +ApiResponse + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +## updateUser + +> void updateUser(username, user) + +Updated user + +This can only be done by the logged in user. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | name that need to be deleted + User user = new User(); // User | Updated user object + try { + apiInstance.updateUser(username, user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#updateUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| name that need to be deleted | | +| **user** | [**User**](User.md)| Updated user object | | + +### Return type + + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid user supplied | - | +| **404** | User not found | - | + +## updateUserWithHttpInfo + +> ApiResponse updateUser updateUserWithHttpInfo(username, user) + +Updated user + +This can only be done by the logged in user. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | name that need to be deleted + User user = new User(); // User | Updated user object + try { + ApiResponse response = apiInstance.updateUserWithHttpInfo(username, user); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#updateUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| name that need to be deleted | | +| **user** | [**User**](User.md)| Updated user object | | + +### Return type + + +ApiResponse + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid user supplied | - | +| **404** | User not found | - | + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/git_push.sh b/samples/client/petstore/java/native/test-regenerated-fixed2/git_push.sh new file mode 100644 index 000000000000..f53a75d4fabe --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/git_push.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=$(git remote) +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/gradle.properties b/samples/client/petstore/java/native/test-regenerated-fixed2/gradle.properties new file mode 100644 index 000000000000..a3408578278a --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/gradle.properties @@ -0,0 +1,6 @@ +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/native/test-regenerated-fixed2/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..e6441136f3d4ba8a0da8d277868979cfbc8ad796 GIT binary patch literal 43453 zcma&N1CXTcmMvW9vTb(Rwr$&4wr$(C?dmSu>@vG-+vuvg^_??!{yS%8zW-#zn-LkA z5&1^$^{lnmUON?}LBF8_K|(?T0Ra(xUH{($5eN!MR#ZihR#HxkUPe+_R8Cn`RRs(P z_^*#_XlXmGv7!4;*Y%p4nw?{bNp@UZHv1?Um8r6)Fei3p@ClJn0ECfg1hkeuUU@Or zDaPa;U3fE=3L}DooL;8f;P0ipPt0Z~9P0)lbStMS)ag54=uL9ia-Lm3nh|@(Y?B`; zx_#arJIpXH!U{fbCbI^17}6Ri*H<>OLR%c|^mh8+)*h~K8Z!9)DPf zR2h?lbDZQ`p9P;&DQ4F0sur@TMa!Y}S8irn(%d-gi0*WxxCSk*A?3lGh=gcYN?FGl z7D=Js!i~0=u3rox^eO3i@$0=n{K1lPNU zwmfjRVmLOCRfe=seV&P*1Iq=^i`502keY8Uy-WNPwVNNtJFx?IwAyRPZo2Wo1+S(xF37LJZ~%i)kpFQ3Fw=mXfd@>%+)RpYQLnr}B~~zoof(JVm^^&f zxKV^+3D3$A1G;qh4gPVjhrC8e(VYUHv#dy^)(RoUFM?o%W-EHxufuWf(l*@-l+7vt z=l`qmR56K~F|v<^Pd*p~1_y^P0P^aPC##d8+HqX4IR1gu+7w#~TBFphJxF)T$2WEa zxa?H&6=Qe7d(#tha?_1uQys2KtHQ{)Qco)qwGjrdNL7thd^G5i8Os)CHqc>iOidS} z%nFEDdm=GXBw=yXe1W-ShHHFb?Cc70+$W~z_+}nAoHFYI1MV1wZegw*0y^tC*s%3h zhD3tN8b=Gv&rj}!SUM6|ajSPp*58KR7MPpI{oAJCtY~JECm)*m_x>AZEu>DFgUcby z1Qaw8lU4jZpQ_$;*7RME+gq1KySGG#Wql>aL~k9tLrSO()LWn*q&YxHEuzmwd1?aAtI zBJ>P=&$=l1efe1CDU;`Fd+_;&wI07?V0aAIgc(!{a z0Jg6Y=inXc3^n!U0Atk`iCFIQooHqcWhO(qrieUOW8X(x?(RD}iYDLMjSwffH2~tB z)oDgNBLB^AJBM1M^c5HdRx6fBfka`(LD-qrlh5jqH~);#nw|iyp)()xVYak3;Ybik z0j`(+69aK*B>)e_p%=wu8XC&9e{AO4c~O1U`5X9}?0mrd*m$_EUek{R?DNSh(=br# z#Q61gBzEpmy`$pA*6!87 zSDD+=@fTY7<4A?GLqpA?Pb2z$pbCc4B4zL{BeZ?F-8`s$?>*lXXtn*NC61>|*w7J* z$?!iB{6R-0=KFmyp1nnEmLsA-H0a6l+1uaH^g%c(p{iT&YFrbQ$&PRb8Up#X3@Zsk zD^^&LK~111%cqlP%!_gFNa^dTYT?rhkGl}5=fL{a`UViaXWI$k-UcHJwmaH1s=S$4 z%4)PdWJX;hh5UoK?6aWoyLxX&NhNRqKam7tcOkLh{%j3K^4Mgx1@i|Pi&}<^5>hs5 zm8?uOS>%)NzT(%PjVPGa?X%`N2TQCKbeH2l;cTnHiHppPSJ<7y-yEIiC!P*ikl&!B z%+?>VttCOQM@ShFguHVjxX^?mHX^hSaO_;pnyh^v9EumqSZTi+#f&_Vaija0Q-e*| z7ulQj6Fs*bbmsWp{`auM04gGwsYYdNNZcg|ph0OgD>7O}Asn7^Z=eI>`$2*v78;sj-}oMoEj&@)9+ycEOo92xSyY344^ z11Hb8^kdOvbf^GNAK++bYioknrpdN>+u8R?JxG=!2Kd9r=YWCOJYXYuM0cOq^FhEd zBg2puKy__7VT3-r*dG4c62Wgxi52EMCQ`bKgf*#*ou(D4-ZN$+mg&7$u!! z-^+Z%;-3IDwqZ|K=ah85OLwkO zKxNBh+4QHh)u9D?MFtpbl)us}9+V!D%w9jfAMYEb>%$A;u)rrI zuBudh;5PN}_6J_}l55P3l_)&RMlH{m!)ai-i$g)&*M`eN$XQMw{v^r@-125^RRCF0 z^2>|DxhQw(mtNEI2Kj(;KblC7x=JlK$@78`O~>V!`|1Lm-^JR$-5pUANAnb(5}B}JGjBsliK4& zk6y(;$e&h)lh2)L=bvZKbvh@>vLlreBdH8No2>$#%_Wp1U0N7Ank!6$dFSi#xzh|( zRi{Uw%-4W!{IXZ)fWx@XX6;&(m_F%c6~X8hx=BN1&q}*( zoaNjWabE{oUPb!Bt$eyd#$5j9rItB-h*5JiNi(v^e|XKAj*8(k<5-2$&ZBR5fF|JA z9&m4fbzNQnAU}r8ab>fFV%J0z5awe#UZ|bz?Ur)U9bCIKWEzi2%A+5CLqh?}K4JHi z4vtM;+uPsVz{Lfr;78W78gC;z*yTch~4YkLr&m-7%-xc ztw6Mh2d>_iO*$Rd8(-Cr1_V8EO1f*^@wRoSozS) zy1UoC@pruAaC8Z_7~_w4Q6n*&B0AjOmMWa;sIav&gu z|J5&|{=a@vR!~k-OjKEgPFCzcJ>#A1uL&7xTDn;{XBdeM}V=l3B8fE1--DHjSaxoSjNKEM9|U9#m2<3>n{Iuo`r3UZp;>GkT2YBNAh|b z^jTq-hJp(ebZh#Lk8hVBP%qXwv-@vbvoREX$TqRGTgEi$%_F9tZES@z8Bx}$#5eeG zk^UsLBH{bc2VBW)*EdS({yw=?qmevwi?BL6*=12k9zM5gJv1>y#ML4!)iiPzVaH9% zgSImetD@dam~e>{LvVh!phhzpW+iFvWpGT#CVE5TQ40n%F|p(sP5mXxna+Ev7PDwA zamaV4m*^~*xV+&p;W749xhb_X=$|LD;FHuB&JL5?*Y2-oIT(wYY2;73<^#46S~Gx| z^cez%V7x$81}UWqS13Gz80379Rj;6~WdiXWOSsdmzY39L;Hg3MH43o*y8ibNBBH`(av4|u;YPq%{R;IuYow<+GEsf@R?=@tT@!}?#>zIIn0CoyV!hq3mw zHj>OOjfJM3F{RG#6ujzo?y32m^tgSXf@v=J$ELdJ+=5j|=F-~hP$G&}tDZsZE?5rX ztGj`!S>)CFmdkccxM9eGIcGnS2AfK#gXwj%esuIBNJQP1WV~b~+D7PJTmWGTSDrR` zEAu4B8l>NPuhsk5a`rReSya2nfV1EK01+G!x8aBdTs3Io$u5!6n6KX%uv@DxAp3F@{4UYg4SWJtQ-W~0MDb|j-$lwVn znAm*Pl!?Ps&3wO=R115RWKb*JKoexo*)uhhHBncEDMSVa_PyA>k{Zm2(wMQ(5NM3# z)jkza|GoWEQo4^s*wE(gHz?Xsg4`}HUAcs42cM1-qq_=+=!Gk^y710j=66(cSWqUe zklbm8+zB_syQv5A2rj!Vbw8;|$@C!vfNmNV!yJIWDQ>{+2x zKjuFX`~~HKG~^6h5FntRpnnHt=D&rq0>IJ9#F0eM)Y-)GpRjiN7gkA8wvnG#K=q{q z9dBn8_~wm4J<3J_vl|9H{7q6u2A!cW{bp#r*-f{gOV^e=8S{nc1DxMHFwuM$;aVI^ zz6A*}m8N-&x8;aunp1w7_vtB*pa+OYBw=TMc6QK=mbA-|Cf* zvyh8D4LRJImooUaSb7t*fVfih<97Gf@VE0|z>NcBwBQze);Rh!k3K_sfunToZY;f2 z^HmC4KjHRVg+eKYj;PRN^|E0>Gj_zagfRbrki68I^#~6-HaHg3BUW%+clM1xQEdPYt_g<2K+z!$>*$9nQ>; zf9Bei{?zY^-e{q_*|W#2rJG`2fy@{%6u0i_VEWTq$*(ZN37|8lFFFt)nCG({r!q#9 z5VK_kkSJ3?zOH)OezMT{!YkCuSSn!K#-Rhl$uUM(bq*jY? zi1xbMVthJ`E>d>(f3)~fozjg^@eheMF6<)I`oeJYx4*+M&%c9VArn(OM-wp%M<-`x z7sLP1&3^%Nld9Dhm@$3f2}87!quhI@nwd@3~fZl_3LYW-B?Ia>ui`ELg z&Qfe!7m6ze=mZ`Ia9$z|ARSw|IdMpooY4YiPN8K z4B(ts3p%2i(Td=tgEHX z0UQ_>URBtG+-?0E;E7Ld^dyZ;jjw0}XZ(}-QzC6+NN=40oDb2^v!L1g9xRvE#@IBR zO!b-2N7wVfLV;mhEaXQ9XAU+>=XVA6f&T4Z-@AX!leJ8obP^P^wP0aICND?~w&NykJ#54x3_@r7IDMdRNy4Hh;h*!u(Ol(#0bJdwEo$5437-UBjQ+j=Ic>Q2z` zJNDf0yO6@mr6y1#n3)s(W|$iE_i8r@Gd@!DWDqZ7J&~gAm1#~maIGJ1sls^gxL9LLG_NhU!pTGty!TbhzQnu)I*S^54U6Yu%ZeCg`R>Q zhBv$n5j0v%O_j{QYWG!R9W?5_b&67KB$t}&e2LdMvd(PxN6Ir!H4>PNlerpBL>Zvyy!yw z-SOo8caEpDt(}|gKPBd$qND5#a5nju^O>V&;f890?yEOfkSG^HQVmEbM3Ugzu+UtH zC(INPDdraBN?P%kE;*Ae%Wto&sgw(crfZ#Qy(<4nk;S|hD3j{IQRI6Yq|f^basLY; z-HB&Je%Gg}Jt@={_C{L$!RM;$$|iD6vu#3w?v?*;&()uB|I-XqEKqZPS!reW9JkLewLb!70T7n`i!gNtb1%vN- zySZj{8-1>6E%H&=V}LM#xmt`J3XQoaD|@XygXjdZ1+P77-=;=eYpoEQ01B@L*a(uW zrZeZz?HJsw_4g0vhUgkg@VF8<-X$B8pOqCuWAl28uB|@r`19DTUQQsb^pfqB6QtiT z*`_UZ`fT}vtUY#%sq2{rchyfu*pCg;uec2$-$N_xgjZcoumE5vSI{+s@iLWoz^Mf; zuI8kDP{!XY6OP~q5}%1&L}CtfH^N<3o4L@J@zg1-mt{9L`s^z$Vgb|mr{@WiwAqKg zp#t-lhrU>F8o0s1q_9y`gQNf~Vb!F%70f}$>i7o4ho$`uciNf=xgJ>&!gSt0g;M>*x4-`U)ysFW&Vs^Vk6m%?iuWU+o&m(2Jm26Y(3%TL; zA7T)BP{WS!&xmxNw%J=$MPfn(9*^*TV;$JwRy8Zl*yUZi8jWYF>==j~&S|Xinsb%c z2?B+kpet*muEW7@AzjBA^wAJBY8i|#C{WtO_or&Nj2{=6JTTX05}|H>N2B|Wf!*3_ z7hW*j6p3TvpghEc6-wufFiY!%-GvOx*bZrhZu+7?iSrZL5q9}igiF^*R3%DE4aCHZ zqu>xS8LkW+Auv%z-<1Xs92u23R$nk@Pk}MU5!gT|c7vGlEA%G^2th&Q*zfg%-D^=f z&J_}jskj|Q;73NP4<4k*Y%pXPU2Thoqr+5uH1yEYM|VtBPW6lXaetokD0u z9qVek6Q&wk)tFbQ8(^HGf3Wp16gKmr>G;#G(HRBx?F`9AIRboK+;OfHaLJ(P>IP0w zyTbTkx_THEOs%Q&aPrxbZrJlio+hCC_HK<4%f3ZoSAyG7Dn`=X=&h@m*|UYO-4Hq0 z-Bq&+Ie!S##4A6OGoC~>ZW`Y5J)*ouaFl_e9GA*VSL!O_@xGiBw!AF}1{tB)z(w%c zS1Hmrb9OC8>0a_$BzeiN?rkPLc9%&;1CZW*4}CDDNr2gcl_3z+WC15&H1Zc2{o~i) z)LLW=WQ{?ricmC`G1GfJ0Yp4Dy~Ba;j6ZV4r{8xRs`13{dD!xXmr^Aga|C=iSmor% z8hi|pTXH)5Yf&v~exp3o+sY4B^^b*eYkkCYl*T{*=-0HniSA_1F53eCb{x~1k3*`W zr~};p1A`k{1DV9=UPnLDgz{aJH=-LQo<5%+Em!DNN252xwIf*wF_zS^!(XSm(9eoj z=*dXG&n0>)_)N5oc6v!>-bd(2ragD8O=M|wGW z!xJQS<)u70m&6OmrF0WSsr@I%T*c#Qo#Ha4d3COcX+9}hM5!7JIGF>7<~C(Ear^Sn zm^ZFkV6~Ula6+8S?oOROOA6$C&q&dp`>oR-2Ym3(HT@O7Sd5c~+kjrmM)YmgPH*tL zX+znN>`tv;5eOfX?h{AuX^LK~V#gPCu=)Tigtq9&?7Xh$qN|%A$?V*v=&-2F$zTUv z`C#WyIrChS5|Kgm_GeudCFf;)!WH7FI60j^0o#65o6`w*S7R@)88n$1nrgU(oU0M9 zx+EuMkC>(4j1;m6NoGqEkpJYJ?vc|B zOlwT3t&UgL!pX_P*6g36`ZXQ; z9~Cv}ANFnJGp(;ZhS(@FT;3e)0)Kp;h^x;$*xZn*k0U6-&FwI=uOGaODdrsp-!K$Ac32^c{+FhI-HkYd5v=`PGsg%6I`4d9Jy)uW0y%) zm&j^9WBAp*P8#kGJUhB!L?a%h$hJgQrx!6KCB_TRo%9{t0J7KW8!o1B!NC)VGLM5! zpZy5Jc{`r{1e(jd%jsG7k%I+m#CGS*BPA65ZVW~fLYw0dA-H_}O zrkGFL&P1PG9p2(%QiEWm6x;U-U&I#;Em$nx-_I^wtgw3xUPVVu zqSuKnx&dIT-XT+T10p;yjo1Y)z(x1fb8Dzfn8e yu?e%!_ptzGB|8GrCfu%p?(_ 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

NnX)EH+Nua)3Y(c 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 '} +case $link in #( +/*) app_path=$link ;; #( +*) app_path=$APP_HOME$link ;; +esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { +echo "$*" +} >&2 + +die () { +echo +echo "$*" +echo +exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( +CYGWIN* ) cygwin=true ;; #( +Darwin* ) darwin=true ;; #( +MSYS* | MINGW* ) msys=true ;; #( +NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then +if [ -x "$JAVA_HOME/jre/sh/java" ] ; then +# IBM's JDK on AIX uses strange locations for the executables +JAVACMD=$JAVA_HOME/jre/sh/java +else +JAVACMD=$JAVA_HOME/bin/java +fi +if [ ! -x "$JAVACMD" ] ; then +die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +else +JAVACMD=java +if ! command -v java >/dev/null 2>&1 +then +die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then +case $MAX_FD in #( +max*) +# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +MAX_FD=$( ulimit -H -n ) || +warn "Could not query maximum file descriptor limit" +esac +case $MAX_FD in #( +'' | soft) :;; #( +*) +# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +ulimit -n "$MAX_FD" || +warn "Could not set maximum file descriptor limit to $MAX_FD" +esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then +APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) +CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + +JAVACMD=$( cygpath --unix "$JAVACMD" ) + +# Now convert the arguments - kludge to limit ourselves to /bin/sh +for arg do +if +case $arg in #( +-*) false ;; # don't mess with options #( +/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath +[ -e "$t" ] ;; #( +*) false ;; +esac +then +arg=$( cygpath --path --ignore --mixed "$arg" ) +fi +# Roll the args list around exactly as many times as the number of +# args, so each arg winds up back in the position where it started, but +# possibly modified. +# +# NB: a `for` loop captures its iteration list before it begins, so +# changing the positional parameters here affects neither the number of +# iterations, nor the values presented in `arg`. +shift # remove old arg +set -- "$@" "$arg" # push replacement arg +done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ +"-Dorg.gradle.appname=$APP_BASE_NAME" \ +-classpath "$CLASSPATH" \ +org.gradle.wrapper.GradleWrapperMain \ +"$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then +die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( +printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | +xargs -n1 | +sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | +tr '\n' ' ' +)" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/gradlew.bat b/samples/client/petstore/java/native/test-regenerated-fixed2/gradlew.bat new file mode 100644 index 000000000000..25da30dbdeee --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/pom.xml b/samples/client/petstore/java/native/test-regenerated-fixed2/pom.xml new file mode 100644 index 000000000000..10a3beca26fb --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/pom.xml @@ -0,0 +1,264 @@ + + 4.0.0 + org.openapitools + openapi-java-client + jar + openapi-java-client + 1.0.0 + https://github.com/openapitools/openapi-generator + OpenAPI Java + + scm:git:git@github.com:openapitools/openapi-generator.git + scm:git:git@github.com:openapitools/openapi-generator.git + https://github.com/openapitools/openapi-generator + + + + + Unlicense + https://www.apache.org/licenses/LICENSE-2.0.html + repo + + + + + + OpenAPI-Generator Contributors + team@openapitools.org + OpenAPITools.org + http://openapitools.org + + + + + + + maven-enforcer-plugin + 3.1.0 + + + enforce-maven + + enforce + + + + + 3 + + + 11 + + + + + + + + maven-surefire-plugin + 3.2.5 + + + conf/log4j.properties + + -Xms512m -Xmx1500m + methods + 10 + + + + maven-dependency-plugin + 3.3.0 + + + package + + copy-dependencies + + + ${project.build.directory}/lib + + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.3.0 + + + + test-jar + + + + + + + + maven-compiler-plugin + 3.10.1 + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.4.1 + + + attach-javadocs + + jar + + + + + + maven-source-plugin + 3.2.1 + + + attach-sources + + jar-no-fork + + + + + + + com.diffplug.spotless + spotless-maven-plugin + ${spotless.version} + + + + + + + .gitignore + + + + + + true + 4 + + + + + + + + + + 1.8 + + true + + + + + + + + + + + + sign-artifacts + + + + maven-gpg-plugin + 3.0.1 + + + sign-artifacts + verify + + sign + + + + + + + + + + + + + + com.fasterxml.jackson.core + jackson-core + ${jackson-version} + + + com.fasterxml.jackson.core + jackson-annotations + ${jackson-version} + + + com.fasterxml.jackson.core + jackson-databind + ${jackson-version} + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson-version} + + + org.openapitools + jackson-databind-nullable + ${jackson-databind-nullable-version} + + + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + jakarta.annotation + jakarta.annotation-api + ${jakarta-annotation-version} + provided + + + org.apache.httpcomponents + httpmime + ${httpmime-version} + + + + + org.junit.jupiter + junit-jupiter-api + ${junit-version} + test + + + + + UTF-8 + 11 + 11 + 2.17.1 + 0.2.6 + 1.3.5 + 2.0.2 + 4.5.14 + 5.10.2 + 2.27.2 + + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/settings.gradle b/samples/client/petstore/java/native/test-regenerated-fixed2/settings.gradle new file mode 100644 index 000000000000..369ba54a9e06 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/settings.gradle @@ -0,0 +1 @@ +rootProject.name = "openapi-java-client" \ No newline at end of file diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/AndroidManifest.xml b/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/AndroidManifest.xml new file mode 100644 index 000000000000..54fbcb3da1e8 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/AndroidManifest.xml @@ -0,0 +1,3 @@ + + + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/ApiClient.java new file mode 100644 index 000000000000..35de9dbe844b --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/ApiClient.java @@ -0,0 +1,457 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import org.openapitools.jackson.nullable.JsonNullableModule; + +import java.io.InputStream; +import java.net.URI; +import java.net.URLEncoder; +import java.net.http.HttpClient; +import java.net.http.HttpConnectTimeoutException; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.StringJoiner; +import java.util.function.Consumer; +import java.util.stream.Collectors; + +import static java.nio.charset.StandardCharsets.UTF_8; + +/** + * Configuration and utility class for API clients. + * + *

This class can be constructed and modified, then used to instantiate the + * various API classes. The API classes use the settings in this class to + * configure themselves, but otherwise do not store a link to this class.

+ * + *

This class is mutable and not synchronized, so it is not thread-safe. + * The API classes generated from this are immutable and thread-safe.

+ * + *

The setter methods of this class return the current object to facilitate + * a fluent style of configuration.

+ */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:08:28.986952+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class ApiClient { + + protected HttpClient.Builder builder; + protected ObjectMapper mapper; + protected String scheme; + protected String host; + protected int port; + protected String basePath; + protected Consumer interceptor; + protected Consumer> responseInterceptor; + protected Consumer> asyncResponseInterceptor; + protected Duration readTimeout; + protected Duration connectTimeout; + + public static String valueToString(Object value) { + if (value == null) { + return ""; + } + if (value instanceof OffsetDateTime) { + return ((OffsetDateTime) value).format(DateTimeFormatter.ISO_OFFSET_DATE_TIME); + } + return value.toString(); + } + + /** + * URL encode a string in the UTF-8 encoding. + * + * @param s String to encode. + * @return URL-encoded representation of the input string. + */ + public static String urlEncode(String s) { + return URLEncoder.encode(s, UTF_8).replaceAll("\\+", "%20"); + } + + /** + * Convert a URL query name/value parameter to a list of encoded {@link Pair} + * objects. + * + *

The value can be null, in which case an empty list is returned.

+ * + * @param name The query name parameter. + * @param value The query value, which may not be a collection but may be + * null. + * @return A singleton list of the {@link Pair} objects representing the input + * parameters, which is encoded for use in a URL. If the value is null, an + * empty list is returned. + */ + public static List parameterToPairs(String name, Object value) { + if (name == null || name.isEmpty() || value == null) { + return Collections.emptyList(); + } + return Collections.singletonList(new Pair(urlEncode(name), urlEncode(valueToString(value)))); + } + + /** + * Convert a URL query name/collection parameter to a list of encoded + * {@link Pair} objects. + * + * @param collectionFormat The swagger collectionFormat string (csv, tsv, etc). + * @param name The query name parameter. + * @param values A collection of values for the given query name, which may be + * null. + * @return A list of {@link Pair} objects representing the input parameters, + * which is encoded for use in a URL. If the values collection is null, an + * empty list is returned. + */ + public static List parameterToPairs( + String collectionFormat, String name, Collection values) { + if (name == null || name.isEmpty() || values == null || values.isEmpty()) { + return Collections.emptyList(); + } + + // get the collection format (default: csv) + String format = collectionFormat == null || collectionFormat.isEmpty() ? "csv" : collectionFormat; + + // create the params based on the collection format + if ("multi".equals(format)) { + return values.stream() + .map(value -> new Pair(urlEncode(name), urlEncode(valueToString(value)))) + .collect(Collectors.toList()); + } + + String delimiter; + switch(format) { + case "csv": + delimiter = urlEncode(","); + break; + case "ssv": + delimiter = urlEncode(" "); + break; + case "tsv": + delimiter = urlEncode("\t"); + break; + case "pipes": + delimiter = urlEncode("|"); + break; + default: + throw new IllegalArgumentException("Illegal collection format: " + collectionFormat); + } + + StringJoiner joiner = new StringJoiner(delimiter); + for (Object value : values) { + joiner.add(urlEncode(valueToString(value))); + } + + return Collections.singletonList(new Pair(urlEncode(name), joiner.toString())); + } + + /** + * Create an instance of ApiClient. + */ + public ApiClient() { + this.builder = createDefaultHttpClientBuilder(); + this.mapper = createDefaultObjectMapper(); + updateBaseUri(getDefaultBaseUri()); + interceptor = null; + readTimeout = null; + connectTimeout = null; + responseInterceptor = null; + asyncResponseInterceptor = null; + } + + /** + * Create an instance of ApiClient. + * + * @param builder Http client builder. + * @param mapper Object mapper. + * @param baseUri Base URI + */ + public ApiClient(HttpClient.Builder builder, ObjectMapper mapper, String baseUri) { + this.builder = builder; + this.mapper = mapper; + updateBaseUri(baseUri != null ? baseUri : getDefaultBaseUri()); + interceptor = null; + readTimeout = null; + connectTimeout = null; + responseInterceptor = null; + asyncResponseInterceptor = null; + } + + public static ObjectMapper createDefaultObjectMapper() { + ObjectMapper mapper = new ObjectMapper(); + mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, false); + mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); + mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); + mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); + mapper.disable(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE); + mapper.registerModule(new JavaTimeModule()); + mapper.registerModule(new JsonNullableModule()); + mapper.registerModule(new RFC3339JavaTimeModule()); + return mapper; + } + + protected String getDefaultBaseUri() { + return "http://petstore.swagger.io/v2"; + } + + public static HttpClient.Builder createDefaultHttpClientBuilder() { + return HttpClient.newBuilder(); + } + + public final void updateBaseUri(String baseUri) { + URI uri = URI.create(baseUri); + scheme = uri.getScheme(); + host = uri.getHost(); + port = uri.getPort(); + basePath = uri.getRawPath(); + } + + /** + * Set a custom {@link HttpClient.Builder} object to use when creating the + * {@link HttpClient} that is used by the API client. + * + * @param builder Custom client builder. + * @return This object. + */ + public ApiClient setHttpClientBuilder(HttpClient.Builder builder) { + this.builder = builder; + return this; + } + + /** + * Get an {@link HttpClient} based on the current {@link HttpClient.Builder}. + * + *

The returned object is immutable and thread-safe.

+ * + * @return The HTTP client. + */ + public HttpClient getHttpClient() { + return builder.build(); + } + + /** + * Set a custom {@link ObjectMapper} to serialize and deserialize the request + * and response bodies. + * + * @param mapper Custom object mapper. + * @return This object. + */ + public ApiClient setObjectMapper(ObjectMapper mapper) { + this.mapper = mapper; + return this; + } + + /** + * Get a copy of the current {@link ObjectMapper}. + * + * @return A copy of the current object mapper. + */ + public ObjectMapper getObjectMapper() { + return mapper.copy(); + } + + /** + * Set a custom host name for the target service. + * + * @param host The host name of the target service. + * @return This object. + */ + public ApiClient setHost(String host) { + this.host = host; + return this; + } + + /** + * Set a custom port number for the target service. + * + * @param port The port of the target service. Set this to -1 to reset the + * value to the default for the scheme. + * @return This object. + */ + public ApiClient setPort(int port) { + this.port = port; + return this; + } + + /** + * Set a custom base path for the target service, for example '/v2'. + * + * @param basePath The base path against which the rest of the path is + * resolved. + * @return This object. + */ + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + return this; + } + + /** + * Get the base URI to resolve the endpoint paths against. + * + * @return The complete base URI that the rest of the API parameters are + * resolved against. + */ + public String getBaseUri() { + return scheme + "://" + host + (port == -1 ? "" : ":" + port) + basePath; + } + + /** + * Set a custom scheme for the target service, for example 'https'. + * + * @param scheme The scheme of the target service + * @return This object. + */ + public ApiClient setScheme(String scheme){ + this.scheme = scheme; + return this; + } + + /** + * Set a custom request interceptor. + * + *

A request interceptor is a mechanism for altering each request before it + * is sent. After the request has been fully configured but not yet built, the + * request builder is passed into this function for further modification, + * after which it is sent out.

+ * + *

This is useful for altering the requests in a custom manner, such as + * adding headers. It could also be used for logging and monitoring.

+ * + * @param interceptor A function invoked before creating each request. A value + * of null resets the interceptor to a no-op. + * @return This object. + */ + public ApiClient setRequestInterceptor(Consumer interceptor) { + this.interceptor = interceptor; + return this; + } + + /** + * Get the custom interceptor. + * + * @return The custom interceptor that was set, or null if there isn't any. + */ + public Consumer getRequestInterceptor() { + return interceptor; + } + + /** + * Set a custom response interceptor. + * + *

This is useful for logging, monitoring or extraction of header variables

+ * + * @param interceptor A function invoked before creating each request. A value + * of null resets the interceptor to a no-op. + * @return This object. + */ + public ApiClient setResponseInterceptor(Consumer> interceptor) { + this.responseInterceptor = interceptor; + return this; + } + + /** + * Get the custom response interceptor. + * + * @return The custom interceptor that was set, or null if there isn't any. + */ + public Consumer> getResponseInterceptor() { + return responseInterceptor; + } + + /** + * Set a custom async response interceptor. Use this interceptor when asyncNative is set to 'true'. + * + *

This is useful for logging, monitoring or extraction of header variables

+ * + * @param interceptor A function invoked before creating each request. A value + * of null resets the interceptor to a no-op. + * @return This object. + */ + public ApiClient setAsyncResponseInterceptor(Consumer> interceptor) { + this.asyncResponseInterceptor = interceptor; + return this; + } + + /** + * Get the custom async response interceptor. Use this interceptor when asyncNative is set to 'true'. + * + * @return The custom interceptor that was set, or null if there isn't any. + */ + public Consumer> getAsyncResponseInterceptor() { + return asyncResponseInterceptor; + } + + /** + * Set the read timeout for the http client. + * + *

This is the value used by default for each request, though it can be + * overridden on a per-request basis with a request interceptor.

+ * + * @param readTimeout The read timeout used by default by the http client. + * Setting this value to null resets the timeout to an + * effectively infinite value. + * @return This object. + */ + public ApiClient setReadTimeout(Duration readTimeout) { + this.readTimeout = readTimeout; + return this; + } + + /** + * Get the read timeout that was set. + * + * @return The read timeout, or null if no timeout was set. Null represents + * an infinite wait time. + */ + public Duration getReadTimeout() { + return readTimeout; + } + /** + * Sets the connect timeout (in milliseconds) for the http client. + * + *

In the case where a new connection needs to be established, if + * the connection cannot be established within the given {@code + * duration}, then {@link HttpClient#send(HttpRequest,BodyHandler) + * HttpClient::send} throws an {@link HttpConnectTimeoutException}, or + * {@link HttpClient#sendAsync(HttpRequest,BodyHandler) + * HttpClient::sendAsync} completes exceptionally with an + * {@code HttpConnectTimeoutException}. If a new connection does not + * need to be established, for example if a connection can be reused + * from a previous request, then this timeout duration has no effect. + * + * @param connectTimeout connection timeout in milliseconds + * + * @return This object. + */ + public ApiClient setConnectTimeout(Duration connectTimeout) { + this.connectTimeout = connectTimeout; + this.builder.connectTimeout(connectTimeout); + return this; + } + + /** + * Get connection timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public Duration getConnectTimeout() { + return connectTimeout; + } +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/ApiException.java new file mode 100644 index 000000000000..40cf030871e8 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/ApiException.java @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +import java.net.http.HttpHeaders; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:08:28.986952+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class ApiException extends Exception { + private static final long serialVersionUID = 1L; + + private int code = 0; + private HttpHeaders responseHeaders = null; + private String responseBody = null; + + public ApiException() {} + + public ApiException(Throwable throwable) { + super(throwable); + } + + public ApiException(String message) { + super(message); + } + + public ApiException(String message, Throwable throwable, int code, HttpHeaders responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + public ApiException(String message, int code, HttpHeaders responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(String message, Throwable throwable, int code, HttpHeaders responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } + + public ApiException(int code, HttpHeaders responseHeaders, String responseBody) { + this((String) null, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + public ApiException(int code, String message, HttpHeaders responseHeaders, String responseBody) { + this(code, message); + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + /** + * Get the HTTP status code. + * + * @return HTTP status code + */ + public int getCode() { + return code; + } + + /** + * Get the HTTP response headers. + * + * @return Headers as an HttpHeaders object + */ + public HttpHeaders getResponseHeaders() { + return responseHeaders; + } + + /** + * Get the HTTP response body. + * + * @return Response body in the form of string + */ + public String getResponseBody() { + return responseBody; + } +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/ApiResponse.java b/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/ApiResponse.java new file mode 100644 index 000000000000..4fe1c50cb640 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/ApiResponse.java @@ -0,0 +1,60 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +import java.util.List; +import java.util.Map; + +/** + * API response returned by API call. + * + * @param The type of data that is deserialized from response body + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:08:28.986952+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class ApiResponse { + final private int statusCode; + final private Map> headers; + final private T data; + + /** + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + */ + public ApiResponse(int statusCode, Map> headers) { + this(statusCode, headers, null); + } + + /** + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + * @param data The object deserialized from response bod + */ + public ApiResponse(int statusCode, Map> headers, T data) { + this.statusCode = statusCode; + this.headers = headers; + this.data = data; + } + + public int getStatusCode() { + return statusCode; + } + + public Map> getHeaders() { + return headers; + } + + public T getData() { + return data; + } +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/Configuration.java b/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/Configuration.java new file mode 100644 index 000000000000..0cae581b9224 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/Configuration.java @@ -0,0 +1,63 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +import java.util.Objects; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Supplier; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:08:28.986952+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class Configuration { + public static final String VERSION = "1.0.0"; + + private static final AtomicReference defaultApiClient = new AtomicReference<>(); + private static volatile Supplier apiClientFactory = ApiClient::new; + + /** + * Get the default API client, which would be used when creating API instances without providing an API client. + * + * @return Default API client + */ + public static ApiClient getDefaultApiClient() { + ApiClient client = defaultApiClient.get(); + if (client == null) { + client = defaultApiClient.updateAndGet(val -> { + if (val != null) { // changed by another thread + return val; + } + return apiClientFactory.get(); + }); + } + return client; + } + + /** + * Set the default API client, which would be used when creating API instances without providing an API client. + * + * @param apiClient API client + */ + public static void setDefaultApiClient(ApiClient apiClient) { + defaultApiClient.set(apiClient); + } + + /** + * set the callback used to create new ApiClient objects + */ + public static void setApiClientFactory(Supplier factory) { + apiClientFactory = Objects.requireNonNull(factory); + } + + private Configuration() { + } +} \ No newline at end of file diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/JSON.java new file mode 100644 index 000000000000..a31feec3de37 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/JSON.java @@ -0,0 +1,264 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.*; +import com.fasterxml.jackson.databind.json.JsonMapper; +import org.openapitools.jackson.nullable.JsonNullableModule; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import org.openapitools.client.model.*; + +import java.text.DateFormat; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:08:28.986952+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class JSON { + private ObjectMapper mapper; + + public JSON() { + mapper = JsonMapper.builder() + .serializationInclusion(JsonInclude.Include.NON_NULL) + .disable(MapperFeature.ALLOW_COERCION_OF_SCALARS) + .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE) + .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) + .enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING) + .enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING) + .defaultDateFormat(new RFC3339DateFormat()) + .addModule(new JavaTimeModule()) + .build(); + JsonNullableModule jnm = new JsonNullableModule(); + mapper.registerModule(jnm); + } + + /** + * Set the date format for JSON (de)serialization with Date properties. + * + * @param dateFormat Date format + */ + public void setDateFormat(DateFormat dateFormat) { + mapper.setDateFormat(dateFormat); + } + + /** + * Get the object mapper + * + * @return object mapper + */ + public ObjectMapper getMapper() { return mapper; } + + /** + * Returns the target model class that should be used to deserialize the input data. + * The discriminator mappings are used to determine the target model class. + * + * @param node The input data. + * @param modelClass The class that contains the discriminator mappings. + * + * @return the target model class. + */ + public static Class getClassForElement(JsonNode node, Class modelClass) { + ClassDiscriminatorMapping cdm = modelDiscriminators.get(modelClass); + if (cdm != null) { + return cdm.getClassForElement(node, new HashSet>()); + } + return null; + } + + /** + * Helper class to register the discriminator mappings. + */ + @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:08:28.986952+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") + private static class ClassDiscriminatorMapping { + // The model class name. + Class modelClass; + // The name of the discriminator property. + String discriminatorName; + // The discriminator mappings for a model class. + Map> discriminatorMappings; + + // Constructs a new class discriminator. + ClassDiscriminatorMapping(Class cls, String propertyName, Map> mappings) { + modelClass = cls; + discriminatorName = propertyName; + discriminatorMappings = new HashMap>(); + if (mappings != null) { + discriminatorMappings.putAll(mappings); + } + } + + // Return the name of the discriminator property for this model class. + String getDiscriminatorPropertyName() { + return discriminatorName; + } + + // Return the discriminator value or null if the discriminator is not + // present in the payload. + String getDiscriminatorValue(JsonNode node) { + // Determine the value of the discriminator property in the input data. + if (discriminatorName != null) { + // Get the value of the discriminator property, if present in the input payload. + node = node.get(discriminatorName); + if (node != null && node.isValueNode()) { + String discrValue = node.asText(); + if (discrValue != null) { + return discrValue; + } + } + } + return null; + } + + /** + * Returns the target model class that should be used to deserialize the input data. + * This function can be invoked for anyOf/oneOf composed models with discriminator mappings. + * The discriminator mappings are used to determine the target model class. + * + * @param node The input data. + * @param visitedClasses The set of classes that have already been visited. + * + * @return the target model class. + */ + Class getClassForElement(JsonNode node, Set> visitedClasses) { + if (visitedClasses.contains(modelClass)) { + // Class has already been visited. + return null; + } + // Determine the value of the discriminator property in the input data. + String discrValue = getDiscriminatorValue(node); + if (discrValue == null) { + return null; + } + Class cls = discriminatorMappings.get(discrValue); + // It may not be sufficient to return this cls directly because that target class + // may itself be a composed schema, possibly with its own discriminator. + visitedClasses.add(modelClass); + for (Class childClass : discriminatorMappings.values()) { + ClassDiscriminatorMapping childCdm = modelDiscriminators.get(childClass); + if (childCdm == null) { + continue; + } + if (!discriminatorName.equals(childCdm.discriminatorName)) { + discrValue = getDiscriminatorValue(node); + if (discrValue == null) { + continue; + } + } + if (childCdm != null) { + // Recursively traverse the discriminator mappings. + Class childDiscr = childCdm.getClassForElement(node, visitedClasses); + if (childDiscr != null) { + return childDiscr; + } + } + } + return cls; + } + } + + /** + * Returns true if inst is an instance of modelClass in the OpenAPI model hierarchy. + * + * The Java class hierarchy is not implemented the same way as the OpenAPI model hierarchy, + * so it's not possible to use the instanceof keyword. + * + * @param modelClass A OpenAPI model class. + * @param inst The instance object. + * @param visitedClasses The set of classes that have already been visited. + * + * @return true if inst is an instance of modelClass in the OpenAPI model hierarchy. + */ + public static boolean isInstanceOf(Class modelClass, Object inst, Set> visitedClasses) { + if (modelClass.isInstance(inst)) { + // This handles the 'allOf' use case with single parent inheritance. + return true; + } + if (visitedClasses.contains(modelClass)) { + // This is to prevent infinite recursion when the composed schemas have + // a circular dependency. + return false; + } + visitedClasses.add(modelClass); + + // Traverse the oneOf/anyOf composed schemas. + Map> descendants = modelDescendants.get(modelClass); + if (descendants != null) { + for (Class childType : descendants.values()) { + if (isInstanceOf(childType, inst, visitedClasses)) { + return true; + } + } + } + return false; + } + + /** + * A map of discriminators for all model classes. + */ + private static Map, ClassDiscriminatorMapping> modelDiscriminators = new HashMap<>(); + + /** + * A map of oneOf/anyOf descendants for each model class. + */ + private static Map, Map>> modelDescendants = new HashMap<>(); + + /** + * Register a model class discriminator. + * + * @param modelClass the model class + * @param discriminatorPropertyName the name of the discriminator property + * @param mappings a map with the discriminator mappings. + */ + public static void registerDiscriminator(Class modelClass, String discriminatorPropertyName, Map> mappings) { + ClassDiscriminatorMapping m = new ClassDiscriminatorMapping(modelClass, discriminatorPropertyName, mappings); + modelDiscriminators.put(modelClass, m); + } + + /** + * Register the oneOf/anyOf descendants of the modelClass. + * + * @param modelClass the model class + * @param descendants a map of oneOf/anyOf descendants. + */ + public static void registerDescendants(Class modelClass, Map> descendants) { + modelDescendants.put(modelClass, descendants); + } + + private static JSON json; + + static { + json = new JSON(); + } + + /** + * Get the default JSON instance. + * + * @return the default JSON instance + */ + public static JSON getDefault() { + return json; + } + + /** + * Set the default JSON instance. + * + * @param json JSON instance to be used + */ + public static void setDefault(JSON json) { + JSON.json = json; + } +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/Pair.java new file mode 100644 index 000000000000..f68c7c4267ee --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/Pair.java @@ -0,0 +1,37 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:08:28.986952+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class Pair { + private final String name; + private final String value; + + public Pair(String name, String value) { + this.name = isValidString(name) ? name : ""; + this.value = isValidString(value) ? value : ""; + } + + public String getName() { + return this.name; + } + + public String getValue() { + return this.value; + } + + private static boolean isValidString(String arg) { + return arg != null; + } +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/RFC3339DateFormat.java b/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/RFC3339DateFormat.java new file mode 100644 index 000000000000..bf31c230689b --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/RFC3339DateFormat.java @@ -0,0 +1,58 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client; + +import com.fasterxml.jackson.databind.util.StdDateFormat; + +import java.text.DateFormat; +import java.text.FieldPosition; +import java.text.ParsePosition; +import java.util.Date; +import java.text.DecimalFormat; +import java.util.GregorianCalendar; +import java.util.TimeZone; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:08:28.986952+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class RFC3339DateFormat extends DateFormat { + private static final long serialVersionUID = 1L; + private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + + public RFC3339DateFormat() { + this.calendar = new GregorianCalendar(); + this.numberFormat = new DecimalFormat(); + } + + @Override + public Date parse(String source) { + return parse(source, new ParsePosition(0)); + } + + @Override + public Date parse(String source, ParsePosition pos) { + return fmt.parse(source, pos); + } + + @Override + public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { + return fmt.format(date, toAppendTo, fieldPosition); + } + + @Override + public Object clone() { + return super.clone(); + } +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/RFC3339InstantDeserializer.java b/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/RFC3339InstantDeserializer.java new file mode 100644 index 000000000000..bf2c22b0307e --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/RFC3339InstantDeserializer.java @@ -0,0 +1,100 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client; + +import java.io.IOException; +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneId; +import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; +import java.time.temporal.Temporal; +import java.time.temporal.TemporalAccessor; +import java.util.function.BiFunction; +import java.util.function.Function; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeFeature; +import com.fasterxml.jackson.datatype.jsr310.deser.InstantDeserializer; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:08:28.986952+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class RFC3339InstantDeserializer extends InstantDeserializer { + private static final long serialVersionUID = 1L; + private final static boolean DEFAULT_NORMALIZE_ZONE_ID = JavaTimeFeature.NORMALIZE_DESERIALIZED_ZONE_ID.enabledByDefault(); + private final static boolean DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS + = JavaTimeFeature.ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS.enabledByDefault(); + + public static final RFC3339InstantDeserializer INSTANT = new RFC3339InstantDeserializer<>( + Instant.class, DateTimeFormatter.ISO_INSTANT, + Instant::from, + a -> Instant.ofEpochMilli( a.value ), + a -> Instant.ofEpochSecond( a.integer, a.fraction ), + null, + true, // yes, replace zero offset with Z + DEFAULT_NORMALIZE_ZONE_ID, + DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS + ); + + public static final RFC3339InstantDeserializer OFFSET_DATE_TIME = new RFC3339InstantDeserializer<>( + OffsetDateTime.class, DateTimeFormatter.ISO_OFFSET_DATE_TIME, + OffsetDateTime::from, + a -> OffsetDateTime.ofInstant( Instant.ofEpochMilli( a.value ), a.zoneId ), + a -> OffsetDateTime.ofInstant( Instant.ofEpochSecond( a.integer, a.fraction ), a.zoneId ), + (d, z) -> ( d.isEqual( OffsetDateTime.MIN ) || d.isEqual( OffsetDateTime.MAX ) ? + d : + d.withOffsetSameInstant( z.getRules().getOffset( d.toLocalDateTime() ) ) ), + true, // yes, replace zero offset with Z + DEFAULT_NORMALIZE_ZONE_ID, + DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS + ); + + public static final RFC3339InstantDeserializer ZONED_DATE_TIME = new RFC3339InstantDeserializer<>( + ZonedDateTime.class, DateTimeFormatter.ISO_ZONED_DATE_TIME, + ZonedDateTime::from, + a -> ZonedDateTime.ofInstant( Instant.ofEpochMilli( a.value ), a.zoneId ), + a -> ZonedDateTime.ofInstant( Instant.ofEpochSecond( a.integer, a.fraction ), a.zoneId ), + ZonedDateTime::withZoneSameInstant, + false, // keep zero offset and Z separate since zones explicitly supported + DEFAULT_NORMALIZE_ZONE_ID, + DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS + ); + + protected RFC3339InstantDeserializer( + Class supportedType, + DateTimeFormatter formatter, + Function parsedToValue, + Function fromMilliseconds, + Function fromNanoseconds, + BiFunction adjust, + boolean replaceZeroOffsetAsZ, + boolean normalizeZoneId, + boolean readNumericStringsAsTimestamp) { + super( + supportedType, + formatter, + parsedToValue, + fromMilliseconds, + fromNanoseconds, + adjust, + replaceZeroOffsetAsZ, + normalizeZoneId, + readNumericStringsAsTimestamp + ); + } + + @Override + protected T _fromString(JsonParser p, DeserializationContext ctxt, String string0) throws IOException { + return super._fromString(p, ctxt, string0.replace( ' ', 'T' )); + } +} \ No newline at end of file diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/RFC3339JavaTimeModule.java b/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/RFC3339JavaTimeModule.java new file mode 100644 index 000000000000..4a1b4455149c --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/RFC3339JavaTimeModule.java @@ -0,0 +1,32 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client; + +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZonedDateTime; + +import com.fasterxml.jackson.databind.module.SimpleModule; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:08:28.986952+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class RFC3339JavaTimeModule extends SimpleModule { + private static final long serialVersionUID = 1L; + + public RFC3339JavaTimeModule() { + super("RFC3339JavaTimeModule"); + + addDeserializer(Instant.class, RFC3339InstantDeserializer.INSTANT); + addDeserializer(OffsetDateTime.class, RFC3339InstantDeserializer.OFFSET_DATE_TIME); + addDeserializer(ZonedDateTime.class, RFC3339InstantDeserializer.ZONED_DATE_TIME); + } +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/ServerConfiguration.java new file mode 100644 index 000000000000..f8f7463b36bd --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -0,0 +1,72 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +import java.util.Map; + +/** + * Representing a Server configuration. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:08:28.986952+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class ServerConfiguration { + public String URL; + public String description; + public Map variables; + + /** + * @param URL A URL to the target host. + * @param description A description of the host designated by the URL. + * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. + */ + public ServerConfiguration(String URL, String description, Map variables) { + this.URL = URL; + this.description = description; + this.variables = variables; + } + + /** + * Format URL template using given variables. + * + * @param variables A map between a variable name and its value. + * @return Formatted URL. + */ + public String URL(Map variables) { + String url = this.URL; + + // go through variables and replace placeholders + for (Map.Entry variable: this.variables.entrySet()) { + String name = variable.getKey(); + ServerVariable serverVariable = variable.getValue(); + String value = serverVariable.defaultValue; + + if (variables != null && variables.containsKey(name)) { + value = variables.get(name); + if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) { + throw new IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + "."); + } + } + url = url.replace("{" + name + "}", value); + } + return url; + } + + /** + * Format URL template using default server variables. + * + * @return Formatted URL. + */ + public String URL() { + return URL(null); + } +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/ServerVariable.java new file mode 100644 index 000000000000..d55d94af33d3 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/ServerVariable.java @@ -0,0 +1,37 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +import java.util.HashSet; + +/** + * Representing a Server Variable for server URL template substitution. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:08:28.986952+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class ServerVariable { + public String description; + public String defaultValue; + public HashSet enumValues = null; + + /** + * @param description A description for the server variable. + * @param defaultValue The default value to use for substitution. + * @param enumValues An enumeration of string values to be used if the substitution options are from a limited set. + */ + public ServerVariable(String description, String defaultValue, HashSet enumValues) { + this.description = description; + this.defaultValue = defaultValue; + this.enumValues = enumValues; + } +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/api/PetApi.java new file mode 100644 index 000000000000..f821c11fe67e --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/api/PetApi.java @@ -0,0 +1,1110 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client.api; + +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; + +import java.io.File; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.Pet; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; + +import org.apache.http.HttpEntity; +import org.apache.http.NameValuePair; +import org.apache.http.entity.mime.MultipartEntityBuilder; +import org.apache.http.message.BasicNameValuePair; +import org.apache.http.client.entity.UrlEncodedFormEntity; + +import java.io.InputStream; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.OutputStream; +import java.net.http.HttpRequest; +import java.nio.channels.Channels; +import java.nio.channels.Pipe; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.time.Duration; + +import java.util.ArrayList; +import java.util.StringJoiner; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.function.Consumer; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:08:28.986952+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class PetApi { + private final HttpClient memberVarHttpClient; + private final ObjectMapper memberVarObjectMapper; + private final String memberVarBaseUri; + private final Consumer memberVarInterceptor; + private final Duration memberVarReadTimeout; + private final Consumer> memberVarResponseInterceptor; + private final Consumer> memberVarAsyncResponseInterceptor; + + public PetApi() { + this(Configuration.getDefaultApiClient()); + } + + public PetApi(ApiClient apiClient) { + memberVarHttpClient = apiClient.getHttpClient(); + memberVarObjectMapper = apiClient.getObjectMapper(); + memberVarBaseUri = apiClient.getBaseUri(); + memberVarInterceptor = apiClient.getRequestInterceptor(); + memberVarReadTimeout = apiClient.getReadTimeout(); + memberVarResponseInterceptor = apiClient.getResponseInterceptor(); + memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); + } + + + protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { + String body = response.body() == null ? null : new String(response.body().readAllBytes()); + String message = formatExceptionMessage(operationId, response.statusCode(), body); + return new ApiException(response.statusCode(), message, response.headers(), body); + } + + private String formatExceptionMessage(String operationId, int statusCode, String body) { + if (body == null || body.isEmpty()) { + body = "[no body]"; + } + return operationId + " call failed with: " + statusCode + " - " + body; + } + + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store (required) + * @return Pet + * @throws ApiException if fails to make API call + */ + public Pet addPet(@javax.annotation.Nonnull Pet pet) throws ApiException { + return addPet(pet, null); + } + + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store (required) + * @param headers Optional headers to include in the request + * @return Pet + * @throws ApiException if fails to make API call + */ + public Pet addPet(@javax.annotation.Nonnull Pet pet, Map headers) throws ApiException { + ApiResponse localVarResponse = addPetWithHttpInfo(pet, headers); + return localVarResponse.getData(); + } + + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store (required) + * @return ApiResponse<Pet> + * @throws ApiException if fails to make API call + */ + public ApiResponse addPetWithHttpInfo(@javax.annotation.Nonnull Pet pet) throws ApiException { + return addPetWithHttpInfo(pet, null); + } + + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Pet> + * @throws ApiException if fails to make API call + */ + public ApiResponse addPetWithHttpInfo(@javax.annotation.Nonnull Pet pet, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = addPetRequestBuilder(pet, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("addPet", localVarResponse); + } + if (localVarResponse.body() == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + String responseBody = new String(localVarResponse.body().readAllBytes()); + localVarResponse.body().close(); + + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}) + ); + } finally { + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder addPetRequestBuilder(@javax.annotation.Nonnull Pet pet, Map headers) throws ApiException { + // verify the required parameter 'pet' is set + if (pet == null) { + throw new ApiException(400, "Missing the required parameter 'pet' when calling addPet"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/pet"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/xml, application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(pet); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @throws ApiException if fails to make API call + */ + public void deletePet(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey) throws ApiException { + return deletePet(petId, apiKey, null); + } + + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void deletePet(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, Map headers) throws ApiException { + deletePetWithHttpInfo(petId, apiKey, headers); + } + + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse deletePetWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey) throws ApiException { + return deletePetWithHttpInfo(petId, apiKey, null); + } + + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse deletePetWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = deletePetRequestBuilder(petId, apiKey, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("deletePet", localVarResponse); + } + return new ApiResponse<>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } finally { + // Drain the InputStream + while (localVarResponse.body().read() != -1) { + // Ignore + } + localVarResponse.body().close(); + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder deletePetRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, Map headers) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException(400, "Missing the required parameter 'petId' when calling deletePet"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/pet/{petId}" + .replace("{petId}", ApiClient.urlEncode(petId.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + if (apiKey != null) { + localVarRequestBuilder.header("api_key", apiKey.toString()); + } + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("DELETE", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Finds Pets by status + * Multiple status values can be provided with comma separated strings + * @param status Status values that need to be considered for filter (required) + * @return List<Pet> + * @throws ApiException if fails to make API call + */ + public List findPetsByStatus(@javax.annotation.Nonnull List status) throws ApiException { + return findPetsByStatus(status, null); + } + + /** + * Finds Pets by status + * Multiple status values can be provided with comma separated strings + * @param status Status values that need to be considered for filter (required) + * @param headers Optional headers to include in the request + * @return List<Pet> + * @throws ApiException if fails to make API call + */ + public List findPetsByStatus(@javax.annotation.Nonnull List status, Map headers) throws ApiException { + ApiResponse> localVarResponse = findPetsByStatusWithHttpInfo(status, headers); + return localVarResponse.getData(); + } + + /** + * Finds Pets by status + * Multiple status values can be provided with comma separated strings + * @param status Status values that need to be considered for filter (required) + * @return ApiResponse<List<Pet>> + * @throws ApiException if fails to make API call + */ + public ApiResponse> findPetsByStatusWithHttpInfo(@javax.annotation.Nonnull List status) throws ApiException { + return findPetsByStatusWithHttpInfo(status, null); + } + + /** + * Finds Pets by status + * Multiple status values can be provided with comma separated strings + * @param status Status values that need to be considered for filter (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<List<Pet>> + * @throws ApiException if fails to make API call + */ + public ApiResponse> findPetsByStatusWithHttpInfo(@javax.annotation.Nonnull List status, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = findPetsByStatusRequestBuilder(status, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("findPetsByStatus", localVarResponse); + } + if (localVarResponse.body() == null) { + return new ApiResponse>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + String responseBody = new String(localVarResponse.body().readAllBytes()); + localVarResponse.body().close(); + + return new ApiResponse>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference>() {}) + ); + } finally { + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder findPetsByStatusRequestBuilder(@javax.annotation.Nonnull List status, Map headers) throws ApiException { + // verify the required parameter 'status' is set + if (status == null) { + throw new ApiException(400, "Missing the required parameter 'status' when calling findPetsByStatus"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/pet/findByStatus"; + + List localVarQueryParams = new ArrayList<>(); + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + localVarQueryParameterBaseName = "status"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("csv", "status", status)); + + if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) { + StringJoiner queryJoiner = new StringJoiner("&"); + localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue())); + if (localVarQueryStringJoiner.length() != 0) { + queryJoiner.add(localVarQueryStringJoiner.toString()); + } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } + + localVarRequestBuilder.header("Accept", "application/xml, application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) + * @return List<Pet> + * @throws ApiException if fails to make API call + * @deprecated + */ + @Deprecated + public List findPetsByTags(@javax.annotation.Nonnull List tags) throws ApiException { + return findPetsByTags(tags, null); + } + + /** + * Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) + * @param headers Optional headers to include in the request + * @return List<Pet> + * @throws ApiException if fails to make API call + * @deprecated + */ + @Deprecated + public List findPetsByTags(@javax.annotation.Nonnull List tags, Map headers) throws ApiException { + ApiResponse> localVarResponse = findPetsByTagsWithHttpInfo(tags, headers); + return localVarResponse.getData(); + } + + /** + * Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) + * @return ApiResponse<List<Pet>> + * @throws ApiException if fails to make API call + * @deprecated + */ + @Deprecated + public ApiResponse> findPetsByTagsWithHttpInfo(@javax.annotation.Nonnull List tags) throws ApiException { + return findPetsByTagsWithHttpInfo(tags, null); + } + + /** + * Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<List<Pet>> + * @throws ApiException if fails to make API call + * @deprecated + */ + @Deprecated + public ApiResponse> findPetsByTagsWithHttpInfo(@javax.annotation.Nonnull List tags, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = findPetsByTagsRequestBuilder(tags, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("findPetsByTags", localVarResponse); + } + if (localVarResponse.body() == null) { + return new ApiResponse>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + String responseBody = new String(localVarResponse.body().readAllBytes()); + localVarResponse.body().close(); + + return new ApiResponse>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference>() {}) + ); + } finally { + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder findPetsByTagsRequestBuilder(@javax.annotation.Nonnull List tags, Map headers) throws ApiException { + // verify the required parameter 'tags' is set + if (tags == null) { + throw new ApiException(400, "Missing the required parameter 'tags' when calling findPetsByTags"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/pet/findByTags"; + + List localVarQueryParams = new ArrayList<>(); + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + localVarQueryParameterBaseName = "tags"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("csv", "tags", tags)); + + if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) { + StringJoiner queryJoiner = new StringJoiner("&"); + localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue())); + if (localVarQueryStringJoiner.length() != 0) { + queryJoiner.add(localVarQueryStringJoiner.toString()); + } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } + + localVarRequestBuilder.header("Accept", "application/xml, application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @return Pet + * @throws ApiException if fails to make API call + */ + public Pet getPetById(@javax.annotation.Nonnull Long petId) throws ApiException { + return getPetById(petId, null); + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @param headers Optional headers to include in the request + * @return Pet + * @throws ApiException if fails to make API call + */ + public Pet getPetById(@javax.annotation.Nonnull Long petId, Map headers) throws ApiException { + ApiResponse localVarResponse = getPetByIdWithHttpInfo(petId, headers); + return localVarResponse.getData(); + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @return ApiResponse<Pet> + * @throws ApiException if fails to make API call + */ + public ApiResponse getPetByIdWithHttpInfo(@javax.annotation.Nonnull Long petId) throws ApiException { + return getPetByIdWithHttpInfo(petId, null); + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Pet> + * @throws ApiException if fails to make API call + */ + public ApiResponse getPetByIdWithHttpInfo(@javax.annotation.Nonnull Long petId, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = getPetByIdRequestBuilder(petId, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("getPetById", localVarResponse); + } + if (localVarResponse.body() == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + String responseBody = new String(localVarResponse.body().readAllBytes()); + localVarResponse.body().close(); + + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}) + ); + } finally { + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder getPetByIdRequestBuilder(@javax.annotation.Nonnull Long petId, Map headers) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetById"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/pet/{petId}" + .replace("{petId}", ApiClient.urlEncode(petId.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/xml, application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store (required) + * @return Pet + * @throws ApiException if fails to make API call + */ + public Pet updatePet(@javax.annotation.Nonnull Pet pet) throws ApiException { + return updatePet(pet, null); + } + + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store (required) + * @param headers Optional headers to include in the request + * @return Pet + * @throws ApiException if fails to make API call + */ + public Pet updatePet(@javax.annotation.Nonnull Pet pet, Map headers) throws ApiException { + ApiResponse localVarResponse = updatePetWithHttpInfo(pet, headers); + return localVarResponse.getData(); + } + + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store (required) + * @return ApiResponse<Pet> + * @throws ApiException if fails to make API call + */ + public ApiResponse updatePetWithHttpInfo(@javax.annotation.Nonnull Pet pet) throws ApiException { + return updatePetWithHttpInfo(pet, null); + } + + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Pet> + * @throws ApiException if fails to make API call + */ + public ApiResponse updatePetWithHttpInfo(@javax.annotation.Nonnull Pet pet, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = updatePetRequestBuilder(pet, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("updatePet", localVarResponse); + } + if (localVarResponse.body() == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + String responseBody = new String(localVarResponse.body().readAllBytes()); + localVarResponse.body().close(); + + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}) + ); + } finally { + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder updatePetRequestBuilder(@javax.annotation.Nonnull Pet pet, Map headers) throws ApiException { + // verify the required parameter 'pet' is set + if (pet == null) { + throw new ApiException(400, "Missing the required parameter 'pet' when calling updatePet"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/pet"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/xml, application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(pet); + localVarRequestBuilder.method("PUT", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @throws ApiException if fails to make API call + */ + public void updatePetWithForm(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status) throws ApiException { + return updatePetWithForm(petId, name, status, null); + } + + /** + * Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void updatePetWithForm(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, Map headers) throws ApiException { + updatePetWithFormWithHttpInfo(petId, name, status, headers); + } + + /** + * Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse updatePetWithFormWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status) throws ApiException { + return updatePetWithFormWithHttpInfo(petId, name, status, null); + } + + /** + * Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse updatePetWithFormWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = updatePetWithFormRequestBuilder(petId, name, status, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("updatePetWithForm", localVarResponse); + } + return new ApiResponse<>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } finally { + // Drain the InputStream + while (localVarResponse.body().read() != -1) { + // Ignore + } + localVarResponse.body().close(); + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder updatePetWithFormRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, Map headers) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException(400, "Missing the required parameter 'petId' when calling updatePetWithForm"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/pet/{petId}" + .replace("{petId}", ApiClient.urlEncode(petId.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/json"); + + List formValues = new ArrayList<>(); + if (name != null) { + formValues.add(new BasicNameValuePair("name", name.toString())); + } + if (status != null) { + formValues.add(new BasicNameValuePair("status", status.toString())); + } + HttpEntity entity = new UrlEncodedFormEntity(formValues, java.nio.charset.StandardCharsets.UTF_8); + ByteArrayOutputStream formOutputStream = new ByteArrayOutputStream(); + try { + entity.writeTo(formOutputStream); + } catch (IOException e) { + throw new RuntimeException(e); + } + localVarRequestBuilder + .header("Content-Type", entity.getContentType().getValue()) + .method("POST", HttpRequest.BodyPublishers + .ofInputStream(() -> new ByteArrayInputStream(formOutputStream.toByteArray()))); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @return ModelApiResponse + * @throws ApiException if fails to make API call + */ + public ModelApiResponse uploadFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { + return uploadFile(petId, additionalMetadata, _file, null); + } + + /** + * uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @param headers Optional headers to include in the request + * @return ModelApiResponse + * @throws ApiException if fails to make API call + */ + public ModelApiResponse uploadFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, Map headers) throws ApiException { + ApiResponse localVarResponse = uploadFileWithHttpInfo(petId, additionalMetadata, _file, headers); + return localVarResponse.getData(); + } + + /** + * uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @return ApiResponse<ModelApiResponse> + * @throws ApiException if fails to make API call + */ + public ApiResponse uploadFileWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { + return uploadFileWithHttpInfo(petId, additionalMetadata, _file, null); + } + + /** + * uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<ModelApiResponse> + * @throws ApiException if fails to make API call + */ + public ApiResponse uploadFileWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = uploadFileRequestBuilder(petId, additionalMetadata, _file, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("uploadFile", localVarResponse); + } + if (localVarResponse.body() == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + String responseBody = new String(localVarResponse.body().readAllBytes()); + localVarResponse.body().close(); + + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}) + ); + } finally { + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder uploadFileRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, Map headers) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFile"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/pet/{petId}/uploadImage" + .replace("{petId}", ApiClient.urlEncode(petId.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/json"); + + MultipartEntityBuilder multiPartBuilder = MultipartEntityBuilder.create(); + boolean hasFiles = false; + if (additionalMetadata != null) { + multiPartBuilder.addTextBody("additionalMetadata", additionalMetadata.toString()); + } + multiPartBuilder.addBinaryBody("file", _file); + hasFiles = true; + HttpEntity entity = multiPartBuilder.build(); + HttpRequest.BodyPublisher formDataPublisher; + if (hasFiles) { + Pipe pipe; + try { + pipe = Pipe.open(); + } catch (IOException e) { + throw new RuntimeException(e); + } + new Thread(() -> { + try (OutputStream outputStream = Channels.newOutputStream(pipe.sink())) { + entity.writeTo(outputStream); + } catch (IOException e) { + e.printStackTrace(); + } + }).start(); + formDataPublisher = HttpRequest.BodyPublishers.ofInputStream(() -> Channels.newInputStream(pipe.source())); + } else { + ByteArrayOutputStream formOutputStream = new ByteArrayOutputStream(); + try { + entity.writeTo(formOutputStream); + } catch (IOException e) { + throw new RuntimeException(e); + } + formDataPublisher = HttpRequest.BodyPublishers + .ofInputStream(() -> new ByteArrayInputStream(formOutputStream.toByteArray())); + } + localVarRequestBuilder + .header("Content-Type", entity.getContentType().getValue()) + .method("POST", formDataPublisher); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/api/StoreApi.java new file mode 100644 index 000000000000..7d7f807eb763 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/api/StoreApi.java @@ -0,0 +1,535 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client.api; + +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; + +import org.openapitools.client.model.Order; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; + +import org.apache.http.HttpEntity; +import org.apache.http.NameValuePair; +import org.apache.http.entity.mime.MultipartEntityBuilder; +import org.apache.http.message.BasicNameValuePair; +import org.apache.http.client.entity.UrlEncodedFormEntity; + +import java.io.InputStream; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.OutputStream; +import java.net.http.HttpRequest; +import java.nio.channels.Channels; +import java.nio.channels.Pipe; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.time.Duration; + +import java.util.ArrayList; +import java.util.StringJoiner; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.function.Consumer; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:08:28.986952+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class StoreApi { + private final HttpClient memberVarHttpClient; + private final ObjectMapper memberVarObjectMapper; + private final String memberVarBaseUri; + private final Consumer memberVarInterceptor; + private final Duration memberVarReadTimeout; + private final Consumer> memberVarResponseInterceptor; + private final Consumer> memberVarAsyncResponseInterceptor; + + public StoreApi() { + this(Configuration.getDefaultApiClient()); + } + + public StoreApi(ApiClient apiClient) { + memberVarHttpClient = apiClient.getHttpClient(); + memberVarObjectMapper = apiClient.getObjectMapper(); + memberVarBaseUri = apiClient.getBaseUri(); + memberVarInterceptor = apiClient.getRequestInterceptor(); + memberVarReadTimeout = apiClient.getReadTimeout(); + memberVarResponseInterceptor = apiClient.getResponseInterceptor(); + memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); + } + + + protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { + String body = response.body() == null ? null : new String(response.body().readAllBytes()); + String message = formatExceptionMessage(operationId, response.statusCode(), body); + return new ApiException(response.statusCode(), message, response.headers(), body); + } + + private String formatExceptionMessage(String operationId, int statusCode, String body) { + if (body == null || body.isEmpty()) { + body = "[no body]"; + } + return operationId + " call failed with: " + statusCode + " - " + body; + } + + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted (required) + * @throws ApiException if fails to make API call + */ + public void deleteOrder(@javax.annotation.Nonnull String orderId) throws ApiException { + return deleteOrder(orderId, null); + } + + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted (required) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void deleteOrder(@javax.annotation.Nonnull String orderId, Map headers) throws ApiException { + deleteOrderWithHttpInfo(orderId, headers); + } + + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse deleteOrderWithHttpInfo(@javax.annotation.Nonnull String orderId) throws ApiException { + return deleteOrderWithHttpInfo(orderId, null); + } + + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse deleteOrderWithHttpInfo(@javax.annotation.Nonnull String orderId, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = deleteOrderRequestBuilder(orderId, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("deleteOrder", localVarResponse); + } + return new ApiResponse<>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } finally { + // Drain the InputStream + while (localVarResponse.body().read() != -1) { + // Ignore + } + localVarResponse.body().close(); + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder deleteOrderRequestBuilder(@javax.annotation.Nonnull String orderId, Map headers) throws ApiException { + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/store/order/{orderId}" + .replace("{orderId}", ApiClient.urlEncode(orderId.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("DELETE", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @return Map<String, Integer> + * @throws ApiException if fails to make API call + */ + public Map getInventory() throws ApiException { + return getInventory(, null); + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @param headers Optional headers to include in the request + * @return Map<String, Integer> + * @throws ApiException if fails to make API call + */ + public Map getInventory(Map headers) throws ApiException { + ApiResponse> localVarResponse = getInventoryWithHttpInfo(headers); + return localVarResponse.getData(); + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @return ApiResponse<Map<String, Integer>> + * @throws ApiException if fails to make API call + */ + public ApiResponse> getInventoryWithHttpInfo() throws ApiException { + return getInventoryWithHttpInfo(, null); + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @param headers Optional headers to include in the request + * @return ApiResponse<Map<String, Integer>> + * @throws ApiException if fails to make API call + */ + public ApiResponse> getInventoryWithHttpInfo(Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = getInventoryRequestBuilder(headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("getInventory", localVarResponse); + } + if (localVarResponse.body() == null) { + return new ApiResponse>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + String responseBody = new String(localVarResponse.body().readAllBytes()); + localVarResponse.body().close(); + + return new ApiResponse>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference>() {}) + ); + } finally { + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder getInventoryRequestBuilder(Map headers) throws ApiException { + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/store/inventory"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @return Order + * @throws ApiException if fails to make API call + */ + public Order getOrderById(@javax.annotation.Nonnull Long orderId) throws ApiException { + return getOrderById(orderId, null); + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @param headers Optional headers to include in the request + * @return Order + * @throws ApiException if fails to make API call + */ + public Order getOrderById(@javax.annotation.Nonnull Long orderId, Map headers) throws ApiException { + ApiResponse localVarResponse = getOrderByIdWithHttpInfo(orderId, headers); + return localVarResponse.getData(); + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @return ApiResponse<Order> + * @throws ApiException if fails to make API call + */ + public ApiResponse getOrderByIdWithHttpInfo(@javax.annotation.Nonnull Long orderId) throws ApiException { + return getOrderByIdWithHttpInfo(orderId, null); + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Order> + * @throws ApiException if fails to make API call + */ + public ApiResponse getOrderByIdWithHttpInfo(@javax.annotation.Nonnull Long orderId, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = getOrderByIdRequestBuilder(orderId, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("getOrderById", localVarResponse); + } + if (localVarResponse.body() == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + String responseBody = new String(localVarResponse.body().readAllBytes()); + localVarResponse.body().close(); + + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}) + ); + } finally { + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder getOrderByIdRequestBuilder(@javax.annotation.Nonnull Long orderId, Map headers) throws ApiException { + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/store/order/{orderId}" + .replace("{orderId}", ApiClient.urlEncode(orderId.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/xml, application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @return Order + * @throws ApiException if fails to make API call + */ + public Order placeOrder(@javax.annotation.Nonnull Order order) throws ApiException { + return placeOrder(order, null); + } + + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @param headers Optional headers to include in the request + * @return Order + * @throws ApiException if fails to make API call + */ + public Order placeOrder(@javax.annotation.Nonnull Order order, Map headers) throws ApiException { + ApiResponse localVarResponse = placeOrderWithHttpInfo(order, headers); + return localVarResponse.getData(); + } + + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @return ApiResponse<Order> + * @throws ApiException if fails to make API call + */ + public ApiResponse placeOrderWithHttpInfo(@javax.annotation.Nonnull Order order) throws ApiException { + return placeOrderWithHttpInfo(order, null); + } + + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Order> + * @throws ApiException if fails to make API call + */ + public ApiResponse placeOrderWithHttpInfo(@javax.annotation.Nonnull Order order, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = placeOrderRequestBuilder(order, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("placeOrder", localVarResponse); + } + if (localVarResponse.body() == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + String responseBody = new String(localVarResponse.body().readAllBytes()); + localVarResponse.body().close(); + + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}) + ); + } finally { + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder placeOrderRequestBuilder(@javax.annotation.Nonnull Order order, Map headers) throws ApiException { + // verify the required parameter 'order' is set + if (order == null) { + throw new ApiException(400, "Missing the required parameter 'order' when calling placeOrder"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/store/order"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/xml, application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(order); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/api/UserApi.java new file mode 100644 index 000000000000..a47a70c5cdbb --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/api/UserApi.java @@ -0,0 +1,995 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client.api; + +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; + +import java.time.OffsetDateTime; +import org.openapitools.client.model.User; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; + +import org.apache.http.HttpEntity; +import org.apache.http.NameValuePair; +import org.apache.http.entity.mime.MultipartEntityBuilder; +import org.apache.http.message.BasicNameValuePair; +import org.apache.http.client.entity.UrlEncodedFormEntity; + +import java.io.InputStream; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.OutputStream; +import java.net.http.HttpRequest; +import java.nio.channels.Channels; +import java.nio.channels.Pipe; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.time.Duration; + +import java.util.ArrayList; +import java.util.StringJoiner; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.function.Consumer; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:08:28.986952+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class UserApi { + private final HttpClient memberVarHttpClient; + private final ObjectMapper memberVarObjectMapper; + private final String memberVarBaseUri; + private final Consumer memberVarInterceptor; + private final Duration memberVarReadTimeout; + private final Consumer> memberVarResponseInterceptor; + private final Consumer> memberVarAsyncResponseInterceptor; + + public UserApi() { + this(Configuration.getDefaultApiClient()); + } + + public UserApi(ApiClient apiClient) { + memberVarHttpClient = apiClient.getHttpClient(); + memberVarObjectMapper = apiClient.getObjectMapper(); + memberVarBaseUri = apiClient.getBaseUri(); + memberVarInterceptor = apiClient.getRequestInterceptor(); + memberVarReadTimeout = apiClient.getReadTimeout(); + memberVarResponseInterceptor = apiClient.getResponseInterceptor(); + memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); + } + + + protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { + String body = response.body() == null ? null : new String(response.body().readAllBytes()); + String message = formatExceptionMessage(operationId, response.statusCode(), body); + return new ApiException(response.statusCode(), message, response.headers(), body); + } + + private String formatExceptionMessage(String operationId, int statusCode, String body) { + if (body == null || body.isEmpty()) { + body = "[no body]"; + } + return operationId + " call failed with: " + statusCode + " - " + body; + } + + /** + * Create user + * This can only be done by the logged in user. + * @param user Created user object (required) + * @throws ApiException if fails to make API call + */ + public void createUser(@javax.annotation.Nonnull User user) throws ApiException { + return createUser(user, null); + } + + /** + * Create user + * This can only be done by the logged in user. + * @param user Created user object (required) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void createUser(@javax.annotation.Nonnull User user, Map headers) throws ApiException { + createUserWithHttpInfo(user, headers); + } + + /** + * Create user + * This can only be done by the logged in user. + * @param user Created user object (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse createUserWithHttpInfo(@javax.annotation.Nonnull User user) throws ApiException { + return createUserWithHttpInfo(user, null); + } + + /** + * Create user + * This can only be done by the logged in user. + * @param user Created user object (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse createUserWithHttpInfo(@javax.annotation.Nonnull User user, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = createUserRequestBuilder(user, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("createUser", localVarResponse); + } + return new ApiResponse<>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } finally { + // Drain the InputStream + while (localVarResponse.body().read() != -1) { + // Ignore + } + localVarResponse.body().close(); + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder createUserRequestBuilder(@javax.annotation.Nonnull User user, Map headers) throws ApiException { + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException(400, "Missing the required parameter 'user' when calling createUser"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/user"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(user); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @throws ApiException if fails to make API call + */ + public void createUsersWithArrayInput(@javax.annotation.Nonnull List user) throws ApiException { + return createUsersWithArrayInput(user, null); + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void createUsersWithArrayInput(@javax.annotation.Nonnull List user, Map headers) throws ApiException { + createUsersWithArrayInputWithHttpInfo(user, headers); + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse createUsersWithArrayInputWithHttpInfo(@javax.annotation.Nonnull List user) throws ApiException { + return createUsersWithArrayInputWithHttpInfo(user, null); + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse createUsersWithArrayInputWithHttpInfo(@javax.annotation.Nonnull List user, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = createUsersWithArrayInputRequestBuilder(user, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("createUsersWithArrayInput", localVarResponse); + } + return new ApiResponse<>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } finally { + // Drain the InputStream + while (localVarResponse.body().read() != -1) { + // Ignore + } + localVarResponse.body().close(); + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder createUsersWithArrayInputRequestBuilder(@javax.annotation.Nonnull List user, Map headers) throws ApiException { + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithArrayInput"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/user/createWithArray"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(user); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @throws ApiException if fails to make API call + */ + public void createUsersWithListInput(@javax.annotation.Nonnull List user) throws ApiException { + return createUsersWithListInput(user, null); + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void createUsersWithListInput(@javax.annotation.Nonnull List user, Map headers) throws ApiException { + createUsersWithListInputWithHttpInfo(user, headers); + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse createUsersWithListInputWithHttpInfo(@javax.annotation.Nonnull List user) throws ApiException { + return createUsersWithListInputWithHttpInfo(user, null); + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse createUsersWithListInputWithHttpInfo(@javax.annotation.Nonnull List user, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = createUsersWithListInputRequestBuilder(user, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("createUsersWithListInput", localVarResponse); + } + return new ApiResponse<>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } finally { + // Drain the InputStream + while (localVarResponse.body().read() != -1) { + // Ignore + } + localVarResponse.body().close(); + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder createUsersWithListInputRequestBuilder(@javax.annotation.Nonnull List user, Map headers) throws ApiException { + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithListInput"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/user/createWithList"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(user); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @throws ApiException if fails to make API call + */ + public void deleteUser(@javax.annotation.Nonnull String username) throws ApiException { + return deleteUser(username, null); + } + + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void deleteUser(@javax.annotation.Nonnull String username, Map headers) throws ApiException { + deleteUserWithHttpInfo(username, headers); + } + + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse deleteUserWithHttpInfo(@javax.annotation.Nonnull String username) throws ApiException { + return deleteUserWithHttpInfo(username, null); + } + + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse deleteUserWithHttpInfo(@javax.annotation.Nonnull String username, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = deleteUserRequestBuilder(username, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("deleteUser", localVarResponse); + } + return new ApiResponse<>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } finally { + // Drain the InputStream + while (localVarResponse.body().read() != -1) { + // Ignore + } + localVarResponse.body().close(); + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder deleteUserRequestBuilder(@javax.annotation.Nonnull String username, Map headers) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException(400, "Missing the required parameter 'username' when calling deleteUser"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/user/{username}" + .replace("{username}", ApiClient.urlEncode(username.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("DELETE", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return User + * @throws ApiException if fails to make API call + */ + public User getUserByName(@javax.annotation.Nonnull String username) throws ApiException { + return getUserByName(username, null); + } + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @param headers Optional headers to include in the request + * @return User + * @throws ApiException if fails to make API call + */ + public User getUserByName(@javax.annotation.Nonnull String username, Map headers) throws ApiException { + ApiResponse localVarResponse = getUserByNameWithHttpInfo(username, headers); + return localVarResponse.getData(); + } + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return ApiResponse<User> + * @throws ApiException if fails to make API call + */ + public ApiResponse getUserByNameWithHttpInfo(@javax.annotation.Nonnull String username) throws ApiException { + return getUserByNameWithHttpInfo(username, null); + } + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<User> + * @throws ApiException if fails to make API call + */ + public ApiResponse getUserByNameWithHttpInfo(@javax.annotation.Nonnull String username, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = getUserByNameRequestBuilder(username, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("getUserByName", localVarResponse); + } + if (localVarResponse.body() == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + String responseBody = new String(localVarResponse.body().readAllBytes()); + localVarResponse.body().close(); + + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}) + ); + } finally { + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder getUserByNameRequestBuilder(@javax.annotation.Nonnull String username, Map headers) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException(400, "Missing the required parameter 'username' when calling getUserByName"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/user/{username}" + .replace("{username}", ApiClient.urlEncode(username.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/xml, application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @return String + * @throws ApiException if fails to make API call + */ + public String loginUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException { + return loginUser(username, password, null); + } + + /** + * Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @param headers Optional headers to include in the request + * @return String + * @throws ApiException if fails to make API call + */ + public String loginUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, Map headers) throws ApiException { + ApiResponse localVarResponse = loginUserWithHttpInfo(username, password, headers); + return localVarResponse.getData(); + } + + /** + * Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @return ApiResponse<String> + * @throws ApiException if fails to make API call + */ + public ApiResponse loginUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException { + return loginUserWithHttpInfo(username, password, null); + } + + /** + * Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<String> + * @throws ApiException if fails to make API call + */ + public ApiResponse loginUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = loginUserRequestBuilder(username, password, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("loginUser", localVarResponse); + } + if (localVarResponse.body() == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + String responseBody = new String(localVarResponse.body().readAllBytes()); + localVarResponse.body().close(); + + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}) + ); + } finally { + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder loginUserRequestBuilder(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, Map headers) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException(400, "Missing the required parameter 'username' when calling loginUser"); + } + // verify the required parameter 'password' is set + if (password == null) { + throw new ApiException(400, "Missing the required parameter 'password' when calling loginUser"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/user/login"; + + List localVarQueryParams = new ArrayList<>(); + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + localVarQueryParameterBaseName = "username"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("username", username)); + localVarQueryParameterBaseName = "password"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("password", password)); + + if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) { + StringJoiner queryJoiner = new StringJoiner("&"); + localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue())); + if (localVarQueryStringJoiner.length() != 0) { + queryJoiner.add(localVarQueryStringJoiner.toString()); + } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } + + localVarRequestBuilder.header("Accept", "application/xml, application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Logs out current logged in user session + * + * @throws ApiException if fails to make API call + */ + public void logoutUser() throws ApiException { + return logoutUser(, null); + } + + /** + * Logs out current logged in user session + * + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void logoutUser(Map headers) throws ApiException { + logoutUserWithHttpInfo(headers); + } + + /** + * Logs out current logged in user session + * + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse logoutUserWithHttpInfo() throws ApiException { + return logoutUserWithHttpInfo(, null); + } + + /** + * Logs out current logged in user session + * + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse logoutUserWithHttpInfo(Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = logoutUserRequestBuilder(headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("logoutUser", localVarResponse); + } + return new ApiResponse<>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } finally { + // Drain the InputStream + while (localVarResponse.body().read() != -1) { + // Ignore + } + localVarResponse.body().close(); + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder logoutUserRequestBuilder(Map headers) throws ApiException { + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/user/logout"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param user Updated user object (required) + * @throws ApiException if fails to make API call + */ + public void updateUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user) throws ApiException { + return updateUser(username, user, null); + } + + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param user Updated user object (required) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void updateUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, Map headers) throws ApiException { + updateUserWithHttpInfo(username, user, headers); + } + + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param user Updated user object (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse updateUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user) throws ApiException { + return updateUserWithHttpInfo(username, user, null); + } + + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param user Updated user object (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse updateUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = updateUserRequestBuilder(username, user, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("updateUser", localVarResponse); + } + return new ApiResponse<>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } finally { + // Drain the InputStream + while (localVarResponse.body().read() != -1) { + // Ignore + } + localVarResponse.body().close(); + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder updateUserRequestBuilder(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, Map headers) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser"); + } + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException(400, "Missing the required parameter 'user' when calling updateUser"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/user/{username}" + .replace("{username}", ApiClient.urlEncode(username.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(user); + localVarRequestBuilder.method("PUT", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java new file mode 100644 index 000000000000..e8067ce57039 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java @@ -0,0 +1,147 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.lang.reflect.Type; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:08:28.986952+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public abstract class AbstractOpenApiSchema { + + // store the actual instance of the schema/object + private Object instance; + + // is nullable + private Boolean isNullable; + + // schema type (e.g. oneOf, anyOf) + private final String schemaType; + + public AbstractOpenApiSchema(String schemaType, Boolean isNullable) { + this.schemaType = schemaType; + this.isNullable = isNullable; + } + + /** + * Get the list of oneOf/anyOf composed schemas allowed to be stored in this object + * + * @return an instance of the actual schema/object + */ + public abstract Map> getSchemas(); + + /** + * Get the actual instance + * + * @return an instance of the actual schema/object + */ + @JsonValue + public Object getActualInstance() {return instance;} + + /** + * Set the actual instance + * + * @param instance the actual instance of the schema/object + */ + public void setActualInstance(Object instance) {this.instance = instance;} + + /** + * Get the instant recursively when the schemas defined in oneOf/anyof happen to be oneOf/anyOf schema as well + * + * @return an instance of the actual schema/object + */ + public Object getActualInstanceRecursively() { + return getActualInstanceRecursively(this); + } + + private Object getActualInstanceRecursively(AbstractOpenApiSchema object) { + if (object.getActualInstance() == null) { + return null; + } else if (object.getActualInstance() instanceof AbstractOpenApiSchema) { + return getActualInstanceRecursively((AbstractOpenApiSchema)object.getActualInstance()); + } else { + return object.getActualInstance(); + } + } + + /** + * Get the schema type (e.g. anyOf, oneOf) + * + * @return the schema type + */ + public String getSchemaType() { + return schemaType; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ").append(getClass()).append(" {\n"); + sb.append(" instance: ").append(toIndentedString(instance)).append("\n"); + sb.append(" isNullable: ").append(toIndentedString(isNullable)).append("\n"); + sb.append(" schemaType: ").append(toIndentedString(schemaType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AbstractOpenApiSchema a = (AbstractOpenApiSchema) o; + return Objects.equals(this.instance, a.instance) && + Objects.equals(this.isNullable, a.isNullable) && + Objects.equals(this.schemaType, a.schemaType); + } + + @Override + public int hashCode() { + return Objects.hash(instance, isNullable, schemaType); + } + + /** + * Is nullable + * + * @return true if it's nullable + */ + public Boolean isNullable() { + if (Boolean.TRUE.equals(isNullable)) { + return Boolean.TRUE; + } else { + return Boolean.FALSE; + } + } + + + +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/model/Category.java new file mode 100644 index 000000000000..3fc25d568852 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/model/Category.java @@ -0,0 +1,187 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import org.openapitools.client.ApiClient; +/** + * A category for a pet + */ +@JsonPropertyOrder({ + Category.JSON_PROPERTY_ID, + Category.JSON_PROPERTY_NAME +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:08:28.986952+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class Category { + public static final String JSON_PROPERTY_ID = "id"; + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_NAME = "name"; + @javax.annotation.Nullable + private String name; + + public Category() { + } + + public Category id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getId() { + return id; + } + + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Category name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getName() { + return name; + } + + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + /** + * Return true if this Category object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Category category = (Category) o; + return Objects.equals(this.id, category.id) && + Objects.equals(this.name, category.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Category {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `id` to the URL query string + if (getId() != null) { + joiner.add(String.format("%sid%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getId())))); + } + + // add `name` to the URL query string + if (getName() != null) { + joiner.add(String.format("%sname%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getName())))); + } + + return joiner.toString(); + } +} + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/model/ModelApiResponse.java new file mode 100644 index 000000000000..69587939b7ae --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -0,0 +1,223 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import org.openapitools.client.ApiClient; +/** + * Describes the result of uploading an image resource + */ +@JsonPropertyOrder({ + ModelApiResponse.JSON_PROPERTY_CODE, + ModelApiResponse.JSON_PROPERTY_TYPE, + ModelApiResponse.JSON_PROPERTY_MESSAGE +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:08:28.986952+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class ModelApiResponse { + public static final String JSON_PROPERTY_CODE = "code"; + @javax.annotation.Nullable + private Integer code; + + public static final String JSON_PROPERTY_TYPE = "type"; + @javax.annotation.Nullable + private String type; + + public static final String JSON_PROPERTY_MESSAGE = "message"; + @javax.annotation.Nullable + private String message; + + public ModelApiResponse() { + } + + public ModelApiResponse code(@javax.annotation.Nullable Integer code) { + this.code = code; + return this; + } + + /** + * Get code + * @return code + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CODE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getCode() { + return code; + } + + + @JsonProperty(JSON_PROPERTY_CODE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCode(@javax.annotation.Nullable Integer code) { + this.code = code; + } + + + public ModelApiResponse type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getType() { + return type; + } + + + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public ModelApiResponse message(@javax.annotation.Nullable String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getMessage() { + return message; + } + + + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMessage(@javax.annotation.Nullable String message) { + this.message = message; + } + + + /** + * Return true if this ApiResponse object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelApiResponse _apiResponse = (ModelApiResponse) o; + return Objects.equals(this.code, _apiResponse.code) && + Objects.equals(this.type, _apiResponse.type) && + Objects.equals(this.message, _apiResponse.message); + } + + @Override + public int hashCode() { + return Objects.hash(code, type, message); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelApiResponse {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `code` to the URL query string + if (getCode() != null) { + joiner.add(String.format("%scode%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getCode())))); + } + + // add `type` to the URL query string + if (getType() != null) { + joiner.add(String.format("%stype%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getType())))); + } + + // add `message` to the URL query string + if (getMessage() != null) { + joiner.add(String.format("%smessage%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getMessage())))); + } + + return joiner.toString(); + } +} + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/model/Order.java new file mode 100644 index 000000000000..04d9d6ddfe99 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/model/Order.java @@ -0,0 +1,369 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.time.OffsetDateTime; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import org.openapitools.client.ApiClient; +/** + * An order for a pets from the pet store + */ +@JsonPropertyOrder({ + Order.JSON_PROPERTY_ID, + Order.JSON_PROPERTY_PET_ID, + Order.JSON_PROPERTY_QUANTITY, + Order.JSON_PROPERTY_SHIP_DATE, + Order.JSON_PROPERTY_STATUS, + Order.JSON_PROPERTY_COMPLETE +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:08:28.986952+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class Order { + public static final String JSON_PROPERTY_ID = "id"; + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_PET_ID = "petId"; + @javax.annotation.Nullable + private Long petId; + + public static final String JSON_PROPERTY_QUANTITY = "quantity"; + @javax.annotation.Nullable + private Integer quantity; + + public static final String JSON_PROPERTY_SHIP_DATE = "shipDate"; + @javax.annotation.Nullable + private OffsetDateTime shipDate; + + /** + * Order Status + */ + public enum StatusEnum { + PLACED(String.valueOf("placed")), + + APPROVED(String.valueOf("approved")), + + DELIVERED(String.valueOf("delivered")); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_STATUS = "status"; + @javax.annotation.Nullable + private StatusEnum status; + + public static final String JSON_PROPERTY_COMPLETE = "complete"; + @javax.annotation.Nullable + private Boolean complete = false; + + public Order() { + } + + public Order id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getId() { + return id; + } + + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Order petId(@javax.annotation.Nullable Long petId) { + this.petId = petId; + return this; + } + + /** + * Get petId + * @return petId + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PET_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getPetId() { + return petId; + } + + + @JsonProperty(JSON_PROPERTY_PET_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPetId(@javax.annotation.Nullable Long petId) { + this.petId = petId; + } + + + public Order quantity(@javax.annotation.Nullable Integer quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get quantity + * @return quantity + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_QUANTITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getQuantity() { + return quantity; + } + + + @JsonProperty(JSON_PROPERTY_QUANTITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setQuantity(@javax.annotation.Nullable Integer quantity) { + this.quantity = quantity; + } + + + public Order shipDate(@javax.annotation.Nullable OffsetDateTime shipDate) { + this.shipDate = shipDate; + return this; + } + + /** + * Get shipDate + * @return shipDate + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SHIP_DATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getShipDate() { + return shipDate; + } + + + @JsonProperty(JSON_PROPERTY_SHIP_DATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setShipDate(@javax.annotation.Nullable OffsetDateTime shipDate) { + this.shipDate = shipDate; + } + + + public Order status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * Order Status + * @return status + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public StatusEnum getStatus() { + return status; + } + + + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + + public Order complete(@javax.annotation.Nullable Boolean complete) { + this.complete = complete; + return this; + } + + /** + * Get complete + * @return complete + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_COMPLETE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getComplete() { + return complete; + } + + + @JsonProperty(JSON_PROPERTY_COMPLETE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setComplete(@javax.annotation.Nullable Boolean complete) { + this.complete = complete; + } + + + /** + * Return true if this Order object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Order order = (Order) o; + return Objects.equals(this.id, order.id) && + Objects.equals(this.petId, order.petId) && + Objects.equals(this.quantity, order.quantity) && + Objects.equals(this.shipDate, order.shipDate) && + Objects.equals(this.status, order.status) && + Objects.equals(this.complete, order.complete); + } + + @Override + public int hashCode() { + return Objects.hash(id, petId, quantity, shipDate, status, complete); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Order {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" petId: ").append(toIndentedString(petId)).append("\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append(" shipDate: ").append(toIndentedString(shipDate)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" complete: ").append(toIndentedString(complete)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `id` to the URL query string + if (getId() != null) { + joiner.add(String.format("%sid%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getId())))); + } + + // add `petId` to the URL query string + if (getPetId() != null) { + joiner.add(String.format("%spetId%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getPetId())))); + } + + // add `quantity` to the URL query string + if (getQuantity() != null) { + joiner.add(String.format("%squantity%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getQuantity())))); + } + + // add `shipDate` to the URL query string + if (getShipDate() != null) { + joiner.add(String.format("%sshipDate%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getShipDate())))); + } + + // add `status` to the URL query string + if (getStatus() != null) { + joiner.add(String.format("%sstatus%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getStatus())))); + } + + // add `complete` to the URL query string + if (getComplete() != null) { + joiner.add(String.format("%scomplete%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getComplete())))); + } + + return joiner.toString(); + } +} + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/model/Pet.java new file mode 100644 index 000000000000..279392c70ca1 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/model/Pet.java @@ -0,0 +1,397 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import org.openapitools.client.ApiClient; +/** + * A pet for sale in the pet store + */ +@JsonPropertyOrder({ + Pet.JSON_PROPERTY_ID, + Pet.JSON_PROPERTY_CATEGORY, + Pet.JSON_PROPERTY_NAME, + Pet.JSON_PROPERTY_PHOTO_URLS, + Pet.JSON_PROPERTY_TAGS, + Pet.JSON_PROPERTY_STATUS +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:08:28.986952+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class Pet { + public static final String JSON_PROPERTY_ID = "id"; + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_CATEGORY = "category"; + @javax.annotation.Nullable + private Category category; + + public static final String JSON_PROPERTY_NAME = "name"; + @javax.annotation.Nonnull + private String name; + + public static final String JSON_PROPERTY_PHOTO_URLS = "photoUrls"; + @javax.annotation.Nonnull + private List photoUrls = new ArrayList<>(); + + public static final String JSON_PROPERTY_TAGS = "tags"; + @javax.annotation.Nullable + private List tags = new ArrayList<>(); + + /** + * pet status in the store + */ + public enum StatusEnum { + AVAILABLE(String.valueOf("available")), + + PENDING(String.valueOf("pending")), + + SOLD(String.valueOf("sold")); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_STATUS = "status"; + @javax.annotation.Nullable + private StatusEnum status; + + public Pet() { + } + + public Pet id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getId() { + return id; + } + + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Pet category(@javax.annotation.Nullable Category category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CATEGORY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Category getCategory() { + return category; + } + + + @JsonProperty(JSON_PROPERTY_CATEGORY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCategory(@javax.annotation.Nullable Category category) { + this.category = category; + } + + + public Pet name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public Pet photoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public Pet addPhotoUrlsItem(String photoUrlsItem) { + if (this.photoUrls == null) { + this.photoUrls = new ArrayList<>(); + } + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + */ + @javax.annotation.Nonnull + @JsonProperty(JSON_PROPERTY_PHOTO_URLS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getPhotoUrls() { + return photoUrls; + } + + + @JsonProperty(JSON_PROPERTY_PHOTO_URLS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setPhotoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + } + + + public Pet tags(@javax.annotation.Nullable List tags) { + this.tags = tags; + return this; + } + + public Pet addTagsItem(Tag tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Get tags + * @return tags + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TAGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getTags() { + return tags; + } + + + @JsonProperty(JSON_PROPERTY_TAGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTags(@javax.annotation.Nullable List tags) { + this.tags = tags; + } + + + public Pet status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public StatusEnum getStatus() { + return status; + } + + + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + + /** + * Return true if this Pet object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Pet pet = (Pet) o; + return Objects.equals(this.id, pet.id) && + Objects.equals(this.category, pet.category) && + Objects.equals(this.name, pet.name) && + Objects.equals(this.photoUrls, pet.photoUrls) && + Objects.equals(this.tags, pet.tags) && + Objects.equals(this.status, pet.status); + } + + @Override + public int hashCode() { + return Objects.hash(id, category, name, photoUrls, tags, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Pet {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `id` to the URL query string + if (getId() != null) { + joiner.add(String.format("%sid%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getId())))); + } + + // add `category` to the URL query string + if (getCategory() != null) { + joiner.add(getCategory().toUrlQueryString(prefix + "category" + suffix)); + } + + // add `name` to the URL query string + if (getName() != null) { + joiner.add(String.format("%sname%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getName())))); + } + + // add `photoUrls` to the URL query string + if (getPhotoUrls() != null) { + for (int i = 0; i < getPhotoUrls().size(); i++) { + joiner.add(String.format("%sphotoUrls%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix), + ApiClient.urlEncode(ApiClient.valueToString(getPhotoUrls().get(i))))); + } + } + + // add `tags` to the URL query string + if (getTags() != null) { + for (int i = 0; i < getTags().size(); i++) { + if (getTags().get(i) != null) { + joiner.add(getTags().get(i).toUrlQueryString(String.format("%stags%s%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix)))); + } + } + } + + // add `status` to the URL query string + if (getStatus() != null) { + joiner.add(String.format("%sstatus%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getStatus())))); + } + + return joiner.toString(); + } +} + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/model/Tag.java new file mode 100644 index 000000000000..990e6df14174 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/model/Tag.java @@ -0,0 +1,187 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import org.openapitools.client.ApiClient; +/** + * A tag for a pet + */ +@JsonPropertyOrder({ + Tag.JSON_PROPERTY_ID, + Tag.JSON_PROPERTY_NAME +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:08:28.986952+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class Tag { + public static final String JSON_PROPERTY_ID = "id"; + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_NAME = "name"; + @javax.annotation.Nullable + private String name; + + public Tag() { + } + + public Tag id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getId() { + return id; + } + + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Tag name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getName() { + return name; + } + + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + /** + * Return true if this Tag object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Tag tag = (Tag) o; + return Objects.equals(this.id, tag.id) && + Objects.equals(this.name, tag.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Tag {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `id` to the URL query string + if (getId() != null) { + joiner.add(String.format("%sid%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getId())))); + } + + // add `name` to the URL query string + if (getName() != null) { + joiner.add(String.format("%sname%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getName())))); + } + + return joiner.toString(); + } +} + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/model/User.java new file mode 100644 index 000000000000..5c1220725114 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/src/main/java/org/openapitools/client/model/User.java @@ -0,0 +1,403 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import org.openapitools.client.ApiClient; +/** + * A User who is purchasing from the pet store + */ +@JsonPropertyOrder({ + User.JSON_PROPERTY_ID, + User.JSON_PROPERTY_USERNAME, + User.JSON_PROPERTY_FIRST_NAME, + User.JSON_PROPERTY_LAST_NAME, + User.JSON_PROPERTY_EMAIL, + User.JSON_PROPERTY_PASSWORD, + User.JSON_PROPERTY_PHONE, + User.JSON_PROPERTY_USER_STATUS +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:08:28.986952+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class User { + public static final String JSON_PROPERTY_ID = "id"; + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_USERNAME = "username"; + @javax.annotation.Nullable + private String username; + + public static final String JSON_PROPERTY_FIRST_NAME = "firstName"; + @javax.annotation.Nullable + private String firstName; + + public static final String JSON_PROPERTY_LAST_NAME = "lastName"; + @javax.annotation.Nullable + private String lastName; + + public static final String JSON_PROPERTY_EMAIL = "email"; + @javax.annotation.Nullable + private String email; + + public static final String JSON_PROPERTY_PASSWORD = "password"; + @javax.annotation.Nullable + private String password; + + public static final String JSON_PROPERTY_PHONE = "phone"; + @javax.annotation.Nullable + private String phone; + + public static final String JSON_PROPERTY_USER_STATUS = "userStatus"; + @javax.annotation.Nullable + private Integer userStatus; + + public User() { + } + + public User id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getId() { + return id; + } + + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public User username(@javax.annotation.Nullable String username) { + this.username = username; + return this; + } + + /** + * Get username + * @return username + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_USERNAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getUsername() { + return username; + } + + + @JsonProperty(JSON_PROPERTY_USERNAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setUsername(@javax.annotation.Nullable String username) { + this.username = username; + } + + + public User firstName(@javax.annotation.Nullable String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Get firstName + * @return firstName + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_FIRST_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getFirstName() { + return firstName; + } + + + @JsonProperty(JSON_PROPERTY_FIRST_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setFirstName(@javax.annotation.Nullable String firstName) { + this.firstName = firstName; + } + + + public User lastName(@javax.annotation.Nullable String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Get lastName + * @return lastName + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_LAST_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getLastName() { + return lastName; + } + + + @JsonProperty(JSON_PROPERTY_LAST_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setLastName(@javax.annotation.Nullable String lastName) { + this.lastName = lastName; + } + + + public User email(@javax.annotation.Nullable String email) { + this.email = email; + return this; + } + + /** + * Get email + * @return email + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_EMAIL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getEmail() { + return email; + } + + + @JsonProperty(JSON_PROPERTY_EMAIL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setEmail(@javax.annotation.Nullable String email) { + this.email = email; + } + + + public User password(@javax.annotation.Nullable String password) { + this.password = password; + return this; + } + + /** + * Get password + * @return password + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PASSWORD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getPassword() { + return password; + } + + + @JsonProperty(JSON_PROPERTY_PASSWORD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPassword(@javax.annotation.Nullable String password) { + this.password = password; + } + + + public User phone(@javax.annotation.Nullable String phone) { + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PHONE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getPhone() { + return phone; + } + + + @JsonProperty(JSON_PROPERTY_PHONE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPhone(@javax.annotation.Nullable String phone) { + this.phone = phone; + } + + + public User userStatus(@javax.annotation.Nullable Integer userStatus) { + this.userStatus = userStatus; + return this; + } + + /** + * User Status + * @return userStatus + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_USER_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getUserStatus() { + return userStatus; + } + + + @JsonProperty(JSON_PROPERTY_USER_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setUserStatus(@javax.annotation.Nullable Integer userStatus) { + this.userStatus = userStatus; + } + + + /** + * Return true if this User object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + User user = (User) o; + return Objects.equals(this.id, user.id) && + Objects.equals(this.username, user.username) && + Objects.equals(this.firstName, user.firstName) && + Objects.equals(this.lastName, user.lastName) && + Objects.equals(this.email, user.email) && + Objects.equals(this.password, user.password) && + Objects.equals(this.phone, user.phone) && + Objects.equals(this.userStatus, user.userStatus); + } + + @Override + public int hashCode() { + return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class User {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" username: ").append(toIndentedString(username)).append("\n"); + sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); + sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" userStatus: ").append(toIndentedString(userStatus)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `id` to the URL query string + if (getId() != null) { + joiner.add(String.format("%sid%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getId())))); + } + + // add `username` to the URL query string + if (getUsername() != null) { + joiner.add(String.format("%susername%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getUsername())))); + } + + // add `firstName` to the URL query string + if (getFirstName() != null) { + joiner.add(String.format("%sfirstName%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getFirstName())))); + } + + // add `lastName` to the URL query string + if (getLastName() != null) { + joiner.add(String.format("%slastName%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getLastName())))); + } + + // add `email` to the URL query string + if (getEmail() != null) { + joiner.add(String.format("%semail%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getEmail())))); + } + + // add `password` to the URL query string + if (getPassword() != null) { + joiner.add(String.format("%spassword%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getPassword())))); + } + + // add `phone` to the URL query string + if (getPhone() != null) { + joiner.add(String.format("%sphone%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getPhone())))); + } + + // add `userStatus` to the URL query string + if (getUserStatus() != null) { + joiner.add(String.format("%suserStatus%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getUserStatus())))); + } + + return joiner.toString(); + } +} + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/src/test/java/org/openapitools/client/api/PetApiTest.java b/samples/client/petstore/java/native/test-regenerated-fixed2/src/test/java/org/openapitools/client/api/PetApiTest.java new file mode 100644 index 000000000000..f725ba246938 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/src/test/java/org/openapitools/client/api/PetApiTest.java @@ -0,0 +1,180 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import java.io.File; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.Pet; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + + +/** + * API tests for PetApi + */ +@Disabled +public class PetApiTest { + + private final PetApi api = new PetApi(); + + + /** + * Add a new pet to the store + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void addPetTest() throws ApiException { + Pet pet = null; + Pet response = + api.addPet(pet); + + // TODO: test validations + } + + /** + * Deletes a pet + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void deletePetTest() throws ApiException { + Long petId = null; + String apiKey = null; + + api.deletePet(petId, apiKey); + + // TODO: test validations + } + + /** + * Finds Pets by status + * + * Multiple status values can be provided with comma separated strings + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void findPetsByStatusTest() throws ApiException { + List status = null; + List response = + api.findPetsByStatus(status); + + // TODO: test validations + } + + /** + * Finds Pets by tags + * + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void findPetsByTagsTest() throws ApiException { + List tags = null; + List response = + api.findPetsByTags(tags); + + // TODO: test validations + } + + /** + * Find pet by ID + * + * Returns a single pet + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void getPetByIdTest() throws ApiException { + Long petId = null; + Pet response = + api.getPetById(petId); + + // TODO: test validations + } + + /** + * Update an existing pet + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void updatePetTest() throws ApiException { + Pet pet = null; + Pet response = + api.updatePet(pet); + + // TODO: test validations + } + + /** + * Updates a pet in the store with form data + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void updatePetWithFormTest() throws ApiException { + Long petId = null; + String name = null; + String status = null; + + api.updatePetWithForm(petId, name, status); + + // TODO: test validations + } + + /** + * uploads an image + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void uploadFileTest() throws ApiException { + Long petId = null; + String additionalMetadata = null; + File _file = null; + ModelApiResponse response = + api.uploadFile(petId, additionalMetadata, _file); + + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/src/test/java/org/openapitools/client/api/StoreApiTest.java b/samples/client/petstore/java/native/test-regenerated-fixed2/src/test/java/org/openapitools/client/api/StoreApiTest.java new file mode 100644 index 000000000000..be318cab8b1e --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/src/test/java/org/openapitools/client/api/StoreApiTest.java @@ -0,0 +1,104 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.model.Order; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + + +/** + * API tests for StoreApi + */ +@Disabled +public class StoreApiTest { + + private final StoreApi api = new StoreApi(); + + + /** + * Delete purchase order by ID + * + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void deleteOrderTest() throws ApiException { + String orderId = null; + + api.deleteOrder(orderId); + + // TODO: test validations + } + + /** + * Returns pet inventories by status + * + * Returns a map of status codes to quantities + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void getInventoryTest() throws ApiException { + Map response = + api.getInventory(); + + // TODO: test validations + } + + /** + * Find purchase order by ID + * + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void getOrderByIdTest() throws ApiException { + Long orderId = null; + Order response = + api.getOrderById(orderId); + + // TODO: test validations + } + + /** + * Place an order for a pet + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void placeOrderTest() throws ApiException { + Order order = null; + Order response = + api.placeOrder(order); + + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/src/test/java/org/openapitools/client/api/UserApiTest.java b/samples/client/petstore/java/native/test-regenerated-fixed2/src/test/java/org/openapitools/client/api/UserApiTest.java new file mode 100644 index 000000000000..2b2b7a60fd21 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/src/test/java/org/openapitools/client/api/UserApiTest.java @@ -0,0 +1,175 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import java.time.OffsetDateTime; +import org.openapitools.client.model.User; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + + +/** + * API tests for UserApi + */ +@Disabled +public class UserApiTest { + + private final UserApi api = new UserApi(); + + + /** + * Create user + * + * This can only be done by the logged in user. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void createUserTest() throws ApiException { + User user = null; + + api.createUser(user); + + // TODO: test validations + } + + /** + * Creates list of users with given input array + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void createUsersWithArrayInputTest() throws ApiException { + List user = null; + + api.createUsersWithArrayInput(user); + + // TODO: test validations + } + + /** + * Creates list of users with given input array + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void createUsersWithListInputTest() throws ApiException { + List user = null; + + api.createUsersWithListInput(user); + + // TODO: test validations + } + + /** + * Delete user + * + * This can only be done by the logged in user. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void deleteUserTest() throws ApiException { + String username = null; + + api.deleteUser(username); + + // TODO: test validations + } + + /** + * Get user by user name + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void getUserByNameTest() throws ApiException { + String username = null; + User response = + api.getUserByName(username); + + // TODO: test validations + } + + /** + * Logs user into the system + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void loginUserTest() throws ApiException { + String username = null; + String password = null; + String response = + api.loginUser(username, password); + + // TODO: test validations + } + + /** + * Logs out current logged in user session + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void logoutUserTest() throws ApiException { + + api.logoutUser(); + + // TODO: test validations + } + + /** + * Updated user + * + * This can only be done by the logged in user. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void updateUserTest() throws ApiException { + String username = null; + User user = null; + + api.updateUser(username, user); + + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/src/test/java/org/openapitools/client/model/CategoryTest.java b/samples/client/petstore/java/native/test-regenerated-fixed2/src/test/java/org/openapitools/client/model/CategoryTest.java new file mode 100644 index 000000000000..ae23ab433a50 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/src/test/java/org/openapitools/client/model/CategoryTest.java @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Category + */ +class CategoryTest { + private final Category model = new Category(); + + /** + * Model tests for Category + */ + @Test + void testCategory() { + // TODO: test Category + } + + /** + * Test the property 'id' + */ + @Test + void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java b/samples/client/petstore/java/native/test-regenerated-fixed2/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java new file mode 100644 index 000000000000..c846563bfe1f --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java @@ -0,0 +1,64 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ModelApiResponse + */ +class ModelApiResponseTest { + private final ModelApiResponse model = new ModelApiResponse(); + + /** + * Model tests for ModelApiResponse + */ + @Test + void testModelApiResponse() { + // TODO: test ModelApiResponse + } + + /** + * Test the property 'code' + */ + @Test + void codeTest() { + // TODO: test code + } + + /** + * Test the property 'type' + */ + @Test + void typeTest() { + // TODO: test type + } + + /** + * Test the property 'message' + */ + @Test + void messageTest() { + // TODO: test message + } + +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/src/test/java/org/openapitools/client/model/OrderTest.java b/samples/client/petstore/java/native/test-regenerated-fixed2/src/test/java/org/openapitools/client/model/OrderTest.java new file mode 100644 index 000000000000..4d8d136809eb --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/src/test/java/org/openapitools/client/model/OrderTest.java @@ -0,0 +1,89 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Order + */ +class OrderTest { + private final Order model = new Order(); + + /** + * Model tests for Order + */ + @Test + void testOrder() { + // TODO: test Order + } + + /** + * Test the property 'id' + */ + @Test + void idTest() { + // TODO: test id + } + + /** + * Test the property 'petId' + */ + @Test + void petIdTest() { + // TODO: test petId + } + + /** + * Test the property 'quantity' + */ + @Test + void quantityTest() { + // TODO: test quantity + } + + /** + * Test the property 'shipDate' + */ + @Test + void shipDateTest() { + // TODO: test shipDate + } + + /** + * Test the property 'status' + */ + @Test + void statusTest() { + // TODO: test status + } + + /** + * Test the property 'complete' + */ + @Test + void completeTest() { + // TODO: test complete + } + +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/src/test/java/org/openapitools/client/model/PetTest.java b/samples/client/petstore/java/native/test-regenerated-fixed2/src/test/java/org/openapitools/client/model/PetTest.java new file mode 100644 index 000000000000..84aff8adbf96 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/src/test/java/org/openapitools/client/model/PetTest.java @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Pet + */ +class PetTest { + private final Pet model = new Pet(); + + /** + * Model tests for Pet + */ + @Test + void testPet() { + // TODO: test Pet + } + + /** + * Test the property 'id' + */ + @Test + void idTest() { + // TODO: test id + } + + /** + * Test the property 'category' + */ + @Test + void categoryTest() { + // TODO: test category + } + + /** + * Test the property 'name' + */ + @Test + void nameTest() { + // TODO: test name + } + + /** + * Test the property 'photoUrls' + */ + @Test + void photoUrlsTest() { + // TODO: test photoUrls + } + + /** + * Test the property 'tags' + */ + @Test + void tagsTest() { + // TODO: test tags + } + + /** + * Test the property 'status' + */ + @Test + void statusTest() { + // TODO: test status + } + +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/src/test/java/org/openapitools/client/model/TagTest.java b/samples/client/petstore/java/native/test-regenerated-fixed2/src/test/java/org/openapitools/client/model/TagTest.java new file mode 100644 index 000000000000..6bd8b9f5035e --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/src/test/java/org/openapitools/client/model/TagTest.java @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Tag + */ +class TagTest { + private final Tag model = new Tag(); + + /** + * Model tests for Tag + */ + @Test + void testTag() { + // TODO: test Tag + } + + /** + * Test the property 'id' + */ + @Test + void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed2/src/test/java/org/openapitools/client/model/UserTest.java b/samples/client/petstore/java/native/test-regenerated-fixed2/src/test/java/org/openapitools/client/model/UserTest.java new file mode 100644 index 000000000000..40f4892264aa --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed2/src/test/java/org/openapitools/client/model/UserTest.java @@ -0,0 +1,104 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for User + */ +class UserTest { + private final User model = new User(); + + /** + * Model tests for User + */ + @Test + void testUser() { + // TODO: test User + } + + /** + * Test the property 'id' + */ + @Test + void idTest() { + // TODO: test id + } + + /** + * Test the property 'username' + */ + @Test + void usernameTest() { + // TODO: test username + } + + /** + * Test the property 'firstName' + */ + @Test + void firstNameTest() { + // TODO: test firstName + } + + /** + * Test the property 'lastName' + */ + @Test + void lastNameTest() { + // TODO: test lastName + } + + /** + * Test the property 'email' + */ + @Test + void emailTest() { + // TODO: test email + } + + /** + * Test the property 'password' + */ + @Test + void passwordTest() { + // TODO: test password + } + + /** + * Test the property 'phone' + */ + @Test + void phoneTest() { + // TODO: test phone + } + + /** + * Test the property 'userStatus' + */ + @Test + void userStatusTest() { + // TODO: test userStatus + } + +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/.github/workflows/maven.yml b/samples/client/petstore/java/native/test-regenerated-fixed3/.github/workflows/maven.yml new file mode 100644 index 000000000000..460f78bfd1b2 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/.github/workflows/maven.yml @@ -0,0 +1,30 @@ +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven +# +# This file is auto-generated by OpenAPI Generator (https://openapi-generator.tech) + +name: Java CI with Maven + +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] + +jobs: + build: + name: Build OpenAPI Petstore + runs-on: ubuntu-latest + strategy: + matrix: + java: [ 17, 21 ] + steps: + - uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.java }} + distribution: 'temurin' + cache: maven + - name: Build with Maven + run: mvn -B package --no-transfer-progress --file pom.xml diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/.gitignore b/samples/client/petstore/java/native/test-regenerated-fixed3/.gitignore new file mode 100644 index 000000000000..a530464afa1b --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/.gitignore @@ -0,0 +1,21 @@ +*.class + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.ear + +# exclude jar for gradle wrapper +!gradle/wrapper/*.jar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +# build files +**/target +target +.gradle +build diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/.openapi-generator-ignore b/samples/client/petstore/java/native/test-regenerated-fixed3/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/.openapi-generator/FILES b/samples/client/petstore/java/native/test-regenerated-fixed3/.openapi-generator/FILES new file mode 100644 index 000000000000..57d506c4c50b --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/.openapi-generator/FILES @@ -0,0 +1,56 @@ +.github/workflows/maven.yml +.gitignore +.openapi-generator-ignore +.travis.yml +README.md +api/openapi.yaml +build.gradle +build.sbt +docs/Category.md +docs/ModelApiResponse.md +docs/Order.md +docs/Pet.md +docs/PetApi.md +docs/StoreApi.md +docs/Tag.md +docs/User.md +docs/UserApi.md +git_push.sh +gradle.properties +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat +pom.xml +settings.gradle +src/main/AndroidManifest.xml +src/main/java/org/openapitools/client/ApiClient.java +src/main/java/org/openapitools/client/ApiException.java +src/main/java/org/openapitools/client/ApiResponse.java +src/main/java/org/openapitools/client/Configuration.java +src/main/java/org/openapitools/client/JSON.java +src/main/java/org/openapitools/client/Pair.java +src/main/java/org/openapitools/client/RFC3339DateFormat.java +src/main/java/org/openapitools/client/RFC3339InstantDeserializer.java +src/main/java/org/openapitools/client/RFC3339JavaTimeModule.java +src/main/java/org/openapitools/client/ServerConfiguration.java +src/main/java/org/openapitools/client/ServerVariable.java +src/main/java/org/openapitools/client/api/PetApi.java +src/main/java/org/openapitools/client/api/StoreApi.java +src/main/java/org/openapitools/client/api/UserApi.java +src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +src/main/java/org/openapitools/client/model/Category.java +src/main/java/org/openapitools/client/model/ModelApiResponse.java +src/main/java/org/openapitools/client/model/Order.java +src/main/java/org/openapitools/client/model/Pet.java +src/main/java/org/openapitools/client/model/Tag.java +src/main/java/org/openapitools/client/model/User.java +src/test/java/org/openapitools/client/api/PetApiTest.java +src/test/java/org/openapitools/client/api/StoreApiTest.java +src/test/java/org/openapitools/client/api/UserApiTest.java +src/test/java/org/openapitools/client/model/CategoryTest.java +src/test/java/org/openapitools/client/model/ModelApiResponseTest.java +src/test/java/org/openapitools/client/model/OrderTest.java +src/test/java/org/openapitools/client/model/PetTest.java +src/test/java/org/openapitools/client/model/TagTest.java +src/test/java/org/openapitools/client/model/UserTest.java diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/.openapi-generator/VERSION b/samples/client/petstore/java/native/test-regenerated-fixed3/.openapi-generator/VERSION new file mode 100644 index 000000000000..fc74d6ceba8e --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.15.0-SNAPSHOT diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/.travis.yml b/samples/client/petstore/java/native/test-regenerated-fixed3/.travis.yml new file mode 100644 index 000000000000..c94647479234 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/.travis.yml @@ -0,0 +1,16 @@ +# +# Generated by: https://openapi-generator.tech +# +language: java +jdk: + - oraclejdk11 +before_install: + # ensure gradlew has proper permission + - chmod a+x ./gradlew +script: + # test using maven + - mvn test + # uncomment below to test using gradle + # - gradle test + # uncomment below to test using sbt + # - sbt test diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/README.md b/samples/client/petstore/java/native/test-regenerated-fixed3/README.md new file mode 100644 index 000000000000..7da3e246f9b3 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/README.md @@ -0,0 +1,197 @@ +# openapi-java-client + +OpenAPI Petstore + +- API version: 1.0.0 + +- Build date: 2025-07-08T21:09:56.830832+07:00[Asia/Bangkok] + +- Generator version: 7.15.0-SNAPSHOT + +This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + + +*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* + +## Requirements + +Building the API client library requires: + +1. Java 11+ +2. Maven/Gradle + +## Installation + +To install the API client library to your local Maven repository, simply execute: + +```shell +mvn clean install +``` + +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: + +```shell +mvn clean deploy +``` + +Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. + +### Maven users + +Add this dependency to your project's POM: + +```xml + + org.openapitools + openapi-java-client + 1.0.0 + compile + +``` + +### Gradle users + +Add this dependency to your project's build file: + +```groovy +compile "org.openapitools:openapi-java-client:1.0.0" +``` + +### Others + +At first generate the JAR by executing: + +```shell +mvn clean package +``` + +Then manually install the following JARs: + +- `target/openapi-java-client-1.0.0.jar` +- `target/lib/*.jar` + +## Getting Started + +Please follow the [installation](#installation) instruction and execute the following Java code: + +```java + +import org.openapitools.client.*; +import org.openapitools.client.model.*; +import org.openapitools.client.api.PetApi; + +public class PetApiExample { + + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + // Configure clients using the `defaultClient` object, such as + // overriding the host and port, timeout, etc. + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + Pet result = apiInstance.addPet(pet); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store +*PetApi* | [**addPetWithHttpInfo**](docs/PetApi.md#addPetWithHttpInfo) | **POST** /pet | Add a new pet to the store +*PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**deletePetWithHttpInfo**](docs/PetApi.md#deletePetWithHttpInfo) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status +*PetApi* | [**findPetsByStatusWithHttpInfo**](docs/PetApi.md#findPetsByStatusWithHttpInfo) | **GET** /pet/findByStatus | Finds Pets by status +*PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags +*PetApi* | [**findPetsByTagsWithHttpInfo**](docs/PetApi.md#findPetsByTagsWithHttpInfo) | **GET** /pet/findByTags | Finds Pets by tags +*PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**getPetByIdWithHttpInfo**](docs/PetApi.md#getPetByIdWithHttpInfo) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**updatePet**](docs/PetApi.md#updatePet) | **PUT** /pet | Update an existing pet +*PetApi* | [**updatePetWithHttpInfo**](docs/PetApi.md#updatePetWithHttpInfo) | **PUT** /pet | Update an existing pet +*PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data +*PetApi* | [**updatePetWithFormWithHttpInfo**](docs/PetApi.md#updatePetWithFormWithHttpInfo) | **POST** /pet/{petId} | Updates a pet in the store with form data +*PetApi* | [**uploadFile**](docs/PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image +*PetApi* | [**uploadFileWithHttpInfo**](docs/PetApi.md#uploadFileWithHttpInfo) | **POST** /pet/{petId}/uploadImage | uploads an image +*StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID +*StoreApi* | [**deleteOrderWithHttpInfo**](docs/StoreApi.md#deleteOrderWithHttpInfo) | **DELETE** /store/order/{orderId} | Delete purchase order by ID +*StoreApi* | [**getInventory**](docs/StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status +*StoreApi* | [**getInventoryWithHttpInfo**](docs/StoreApi.md#getInventoryWithHttpInfo) | **GET** /store/inventory | Returns pet inventories by status +*StoreApi* | [**getOrderById**](docs/StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID +*StoreApi* | [**getOrderByIdWithHttpInfo**](docs/StoreApi.md#getOrderByIdWithHttpInfo) | **GET** /store/order/{orderId} | Find purchase order by ID +*StoreApi* | [**placeOrder**](docs/StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet +*StoreApi* | [**placeOrderWithHttpInfo**](docs/StoreApi.md#placeOrderWithHttpInfo) | **POST** /store/order | Place an order for a pet +*UserApi* | [**createUser**](docs/UserApi.md#createUser) | **POST** /user | Create user +*UserApi* | [**createUserWithHttpInfo**](docs/UserApi.md#createUserWithHttpInfo) | **POST** /user | Create user +*UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**createUsersWithArrayInputWithHttpInfo**](docs/UserApi.md#createUsersWithArrayInputWithHttpInfo) | **POST** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**createUsersWithListInput**](docs/UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array +*UserApi* | [**createUsersWithListInputWithHttpInfo**](docs/UserApi.md#createUsersWithListInputWithHttpInfo) | **POST** /user/createWithList | Creates list of users with given input array +*UserApi* | [**deleteUser**](docs/UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user +*UserApi* | [**deleteUserWithHttpInfo**](docs/UserApi.md#deleteUserWithHttpInfo) | **DELETE** /user/{username} | Delete user +*UserApi* | [**getUserByName**](docs/UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name +*UserApi* | [**getUserByNameWithHttpInfo**](docs/UserApi.md#getUserByNameWithHttpInfo) | **GET** /user/{username} | Get user by user name +*UserApi* | [**loginUser**](docs/UserApi.md#loginUser) | **GET** /user/login | Logs user into the system +*UserApi* | [**loginUserWithHttpInfo**](docs/UserApi.md#loginUserWithHttpInfo) | **GET** /user/login | Logs user into the system +*UserApi* | [**logoutUser**](docs/UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session +*UserApi* | [**logoutUserWithHttpInfo**](docs/UserApi.md#logoutUserWithHttpInfo) | **GET** /user/logout | Logs out current logged in user session +*UserApi* | [**updateUser**](docs/UserApi.md#updateUser) | **PUT** /user/{username} | Updated user +*UserApi* | [**updateUserWithHttpInfo**](docs/UserApi.md#updateUserWithHttpInfo) | **PUT** /user/{username} | Updated user + + +## Documentation for Models + + - [Category](docs/Category.md) + - [ModelApiResponse](docs/ModelApiResponse.md) + - [Order](docs/Order.md) + - [Pet](docs/Pet.md) + - [Tag](docs/Tag.md) + - [User](docs/User.md) + + + +## Documentation for Authorization + + +Authentication schemes defined for the API: + +### petstore_auth + + +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - write:pets: modify pets in your account + - read:pets: read your pets + + +### api_key + + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + + +## Recommendation + +It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. +However, the instances of the api clients created from the `ApiClient` are thread-safe and can be re-used. + +## Author + + + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/api/openapi.yaml b/samples/client/petstore/java/native/test-regenerated-fixed3/api/openapi.yaml new file mode 100644 index 000000000000..9b1b54b9454b --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/api/openapi.yaml @@ -0,0 +1,865 @@ +openapi: 3.0.0 +info: + description: "This is a sample server Petstore server. For this sample, you can\ + \ use the api key `special-key` to test the authorization filters." + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user +paths: + /pet: + post: + description: "" + operationId: addPet + requestBody: + $ref: "#/components/requestBodies/Pet" + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Pet" + application/json: + schema: + $ref: "#/components/schemas/Pet" + description: successful operation + "405": + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + x-content-type: application/json + x-accepts: + - application/json + - application/xml + put: + description: "" + operationId: updatePet + requestBody: + $ref: "#/components/requestBodies/Pet" + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Pet" + application/json: + schema: + $ref: "#/components/schemas/Pet" + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Pet not found + "405": + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + x-content-type: application/json + x-accepts: + - application/json + - application/xml + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + "200": + content: + application/xml: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + application/json: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + description: successful operation + "400": + description: Invalid status value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by status + tags: + - pet + x-accepts: + - application/json + - application/xml + /pet/findByTags: + get: + deprecated: true + description: "Multiple tags can be provided with comma separated strings. Use\ + \ tag1, tag2, tag3 for testing." + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + "200": + content: + application/xml: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + application/json: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + description: successful operation + "400": + description: Invalid tag value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by tags + tags: + - pet + x-accepts: + - application/json + - application/xml + /pet/{petId}: + delete: + description: "" + operationId: deletePet + parameters: + - explode: false + in: header + name: api_key + required: false + schema: + type: string + style: simple + - description: Pet id to delete + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "400": + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + x-accepts: + - application/json + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Pet" + application/json: + schema: + $ref: "#/components/schemas/Pet" + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + x-accepts: + - application/json + - application/xml + post: + description: "" + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/updatePetWithForm_request" + responses: + "405": + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + /pet/{petId}/uploadImage: + post: + description: "" + operationId: uploadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/uploadFile_request" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/ApiResponse" + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + x-content-type: multipart/form-data + x-accepts: + - application/json + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + "200": + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + x-accepts: + - application/json + /store/order: + post: + description: "" + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Order" + description: order placed for purchasing the pet + required: true + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Order" + application/json: + schema: + $ref: "#/components/schemas/Order" + description: successful operation + "400": + description: Invalid Order + summary: Place an order for a pet + tags: + - store + x-content-type: application/json + x-accepts: + - application/json + - application/xml + /store/order/{orderId}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + explode: false + in: path + name: orderId + required: true + schema: + type: string + style: simple + responses: + "400": + description: Invalid ID supplied + "404": + description: Order not found + summary: Delete purchase order by ID + tags: + - store + x-accepts: + - application/json + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + explode: false + in: path + name: orderId + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Order" + application/json: + schema: + $ref: "#/components/schemas/Order" + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Order not found + summary: Find purchase order by ID + tags: + - store + x-accepts: + - application/json + - application/xml + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/User" + description: Created user object + required: true + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Create user + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + /user/createWithArray: + post: + description: "" + operationId: createUsersWithArrayInput + requestBody: + $ref: "#/components/requestBodies/UserArray" + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + /user/createWithList: + post: + description: "" + operationId: createUsersWithListInput + requestBody: + $ref: "#/components/requestBodies/UserArray" + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + /user/login: + get: + description: "" + operationId: loginUser + parameters: + - description: The user name for login + explode: true + in: query + name: username + required: true + schema: + pattern: "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$" + type: string + style: form + - description: The password for login in clear text + explode: true + in: query + name: password + required: true + schema: + type: string + style: form + responses: + "200": + content: + application/xml: + schema: + type: string + application/json: + schema: + type: string + description: successful operation + headers: + Set-Cookie: + description: Cookie authentication key for use with the `api_key` apiKey + authentication. + explode: false + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + style: simple + X-Rate-Limit: + description: calls per hour allowed by the user + explode: false + schema: + format: int32 + type: integer + style: simple + X-Expires-After: + description: date in UTC when token expires + explode: false + schema: + format: date-time + type: string + style: simple + "400": + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + x-accepts: + - application/json + - application/xml + /user/logout: + get: + description: "" + operationId: logoutUser + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Logs out current logged in user session + tags: + - user + x-accepts: + - application/json + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + "400": + description: Invalid username supplied + "404": + description: User not found + security: + - api_key: [] + summary: Delete user + tags: + - user + x-accepts: + - application/json + get: + description: "" + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/User" + application/json: + schema: + $ref: "#/components/schemas/User" + description: successful operation + "400": + description: Invalid username supplied + "404": + description: User not found + summary: Get user by user name + tags: + - user + x-accepts: + - application/json + - application/xml + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/User" + description: Updated user object + required: true + responses: + "400": + description: Invalid user supplied + "404": + description: User not found + security: + - api_key: [] + summary: Updated user + tags: + - user + x-content-type: application/json + x-accepts: + - application/json +components: + requestBodies: + UserArray: + content: + application/json: + schema: + items: + $ref: "#/components/schemas/User" + type: array + description: List of user object + required: true + Pet: + content: + application/json: + schema: + $ref: "#/components/schemas/Pet" + application/xml: + schema: + $ref: "#/components/schemas/Pet" + description: Pet object that needs to be added to the store + required: true + schemas: + ApiResponse: + description: Describes the result of uploading an image resource + example: + code: 0 + type: type + message: message + properties: + code: + format: int32 + type: integer + type: + type: string + message: + type: string + title: An uploaded response + type: object + Pet: + description: A pet for sale in the pet store + example: + photoUrls: + - photoUrls + - photoUrls + name: doggie + id: 0 + category: + name: name + id: 6 + tags: + - name: name + id: 1 + - name: name + id: 1 + status: available + properties: + id: + format: int64 + type: integer + category: + $ref: "#/components/schemas/Category" + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + tags: + items: + $ref: "#/components/schemas/Tag" + type: array + xml: + name: tag + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + Order: + description: An order for a pets from the pet store + example: + petId: 6 + quantity: 1 + id: 0 + shipDate: 2000-01-23T04:56:07.000+00:00 + complete: false + status: placed + properties: + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + complete: + default: false + type: boolean + title: Pet Order + type: object + xml: + name: Order + User: + description: A User who is purchasing from the pet store + example: + firstName: firstName + lastName: lastName + password: password + userStatus: 6 + phone: phone + id: 0 + email: email + username: username + properties: + id: + format: int64 + type: integer + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + title: a User + type: object + xml: + name: User + Category: + description: A category for a pet + example: + name: name + id: 6 + properties: + id: + format: int64 + type: integer + name: + pattern: "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$" + type: string + title: Pet category + type: object + xml: + name: Category + Tag: + description: A tag for a pet + example: + name: name + id: 1 + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + updatePetWithForm_request: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + uploadFile_request: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + securitySchemes: + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 + api_key: + in: header + name: api_key + type: apiKey + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/build.gradle b/samples/client/petstore/java/native/test-regenerated-fixed3/build.gradle new file mode 100644 index 000000000000..56fa470fb767 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/build.gradle @@ -0,0 +1,109 @@ +apply plugin: 'idea' +apply plugin: 'eclipse' +apply plugin: 'com.diffplug.spotless' + +group = 'org.openapitools' +version = '1.0.0' + +buildscript { + repositories { + mavenCentral() + } + dependencies { + classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.11.0' + } +} + +repositories { + mavenCentral() +} + +apply plugin: 'java' +apply plugin: 'maven-publish' + +sourceCompatibility = JavaVersion.VERSION_11 +targetCompatibility = JavaVersion.VERSION_11 + +// Some text from the schema is copy pasted into the source files as UTF-8 +// but the default still seems to be to use platform encoding +tasks.withType(JavaCompile) { + configure(options) { + options.encoding = 'UTF-8' + } +} +javadoc { + options.encoding = 'UTF-8' +} + +publishing { + publications { + maven(MavenPublication) { + artifactId = 'openapi-java-client' + from components.java + } + } +} + +task execute(type:JavaExec) { + main = System.getProperty('mainClass') + classpath = sourceSets.main.runtimeClasspath +} + +task sourcesJar(type: Jar, dependsOn: classes) { + archiveClassifier = 'sources' + from sourceSets.main.allSource +} + +task javadocJar(type: Jar, dependsOn: javadoc) { + archiveClassifier = 'javadoc' + from javadoc.destinationDir +} + +artifacts { + archives sourcesJar + archives javadocJar +} + + +ext { + jackson_version = "2.17.1" + jakarta_annotation_version = "1.3.5" + beanvalidation_version = "2.0.2" + junit_version = "5.10.2" + httpmime_version = "4.5.13" +} + +dependencies { + implementation "com.google.code.findbugs:jsr305:3.0.2" + implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version" + implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" + implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_version" + implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" + implementation "org.openapitools:jackson-databind-nullable:0.2.1" + implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" + implementation "org.apache.httpcomponents:httpmime:$httpmime_version" + testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version" +} + +// Use spotless plugin to automatically format code, remove unused import, etc +// To apply changes directly to the file, run `gradlew spotlessApply` +// Ref: https://github.com/diffplug/spotless/tree/main/plugin-gradle +spotless { + // comment out below to run spotless as part of the `check` task + enforceCheck false + format 'misc', { + // define the files (e.g. '*.gradle', '*.md') to apply `misc` to + target '.gitignore' + // define the steps to apply to those files + trimTrailingWhitespace() + indentWithSpaces() // Takes an integer argument if you don't like 4 + endWithNewline() + } + java { + // don't need to set target, it is inferred from java + // apply a specific flavor of google-java-format + googleJavaFormat('1.8').aosp().reflowLongStrings() + removeUnusedImports() + importOrder() + } +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/build.sbt b/samples/client/petstore/java/native/test-regenerated-fixed3/build.sbt new file mode 100644 index 000000000000..464090415c47 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/build.sbt @@ -0,0 +1 @@ +# TODO diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/docs/Category.md b/samples/client/petstore/java/native/test-regenerated-fixed3/docs/Category.md new file mode 100644 index 000000000000..a7fc939d252e --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/docs/Category.md @@ -0,0 +1,15 @@ + + +# Category + +A category for a pet + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/docs/ModelApiResponse.md b/samples/client/petstore/java/native/test-regenerated-fixed3/docs/ModelApiResponse.md new file mode 100644 index 000000000000..cd7e3c400be6 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/docs/ModelApiResponse.md @@ -0,0 +1,16 @@ + + +# ModelApiResponse + +Describes the result of uploading an image resource + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**code** | **Integer** | | [optional] | +|**type** | **String** | | [optional] | +|**message** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/docs/Order.md b/samples/client/petstore/java/native/test-regenerated-fixed3/docs/Order.md new file mode 100644 index 000000000000..0c33059b8b6a --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/docs/Order.md @@ -0,0 +1,29 @@ + + +# Order + +An order for a pets from the pet store + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**petId** | **Long** | | [optional] | +|**quantity** | **Integer** | | [optional] | +|**shipDate** | **OffsetDateTime** | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional] | +|**complete** | **Boolean** | | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| PLACED | "placed" | +| APPROVED | "approved" | +| DELIVERED | "delivered" | + + + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/docs/Pet.md b/samples/client/petstore/java/native/test-regenerated-fixed3/docs/Pet.md new file mode 100644 index 000000000000..8bb363301232 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/docs/Pet.md @@ -0,0 +1,29 @@ + + +# Pet + +A pet for sale in the pet store + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**category** | [**Category**](Category.md) | | [optional] | +|**name** | **String** | | | +|**photoUrls** | **List<String>** | | | +|**tags** | [**List<Tag>**](Tag.md) | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| AVAILABLE | "available" | +| PENDING | "pending" | +| SOLD | "sold" | + + + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/docs/PetApi.md b/samples/client/petstore/java/native/test-regenerated-fixed3/docs/PetApi.md new file mode 100644 index 000000000000..51f089e85389 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/docs/PetApi.md @@ -0,0 +1,1212 @@ +# PetApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | +| [**addPetWithHttpInfo**](PetApi.md#addPetWithHttpInfo) | **POST** /pet | Add a new pet to the store | +| [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | +| [**deletePetWithHttpInfo**](PetApi.md#deletePetWithHttpInfo) | **DELETE** /pet/{petId} | Deletes a pet | +| [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | +| [**findPetsByStatusWithHttpInfo**](PetApi.md#findPetsByStatusWithHttpInfo) | **GET** /pet/findByStatus | Finds Pets by status | +| [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | +| [**findPetsByTagsWithHttpInfo**](PetApi.md#findPetsByTagsWithHttpInfo) | **GET** /pet/findByTags | Finds Pets by tags | +| [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | +| [**getPetByIdWithHttpInfo**](PetApi.md#getPetByIdWithHttpInfo) | **GET** /pet/{petId} | Find pet by ID | +| [**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet | +| [**updatePetWithHttpInfo**](PetApi.md#updatePetWithHttpInfo) | **PUT** /pet | Update an existing pet | +| [**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data | +| [**updatePetWithFormWithHttpInfo**](PetApi.md#updatePetWithFormWithHttpInfo) | **POST** /pet/{petId} | Updates a pet in the store with form data | +| [**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image | +| [**uploadFileWithHttpInfo**](PetApi.md#uploadFileWithHttpInfo) | **POST** /pet/{petId}/uploadImage | uploads an image | + + + +## addPet + +> Pet addPet(pet) + +Add a new pet to the store + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + Pet result = apiInstance.addPet(pet); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | + +### Return type + +[**Pet**](Pet.md) + + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: application/json, application/xml +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **405** | Invalid input | - | + +## addPetWithHttpInfo + +> ApiResponse addPet addPetWithHttpInfo(pet) + +Add a new pet to the store + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + ApiResponse response = apiInstance.addPetWithHttpInfo(pet); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | + +### Return type + +ApiResponse<[**Pet**](Pet.md)> + + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: application/json, application/xml +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **405** | Invalid input | - | + + +## deletePet + +> void deletePet(petId, apiKey) + +Deletes a pet + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | Pet id to delete + String apiKey = "apiKey_example"; // String | + try { + apiInstance.deletePet(petId, apiKey); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#deletePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| Pet id to delete | | +| **apiKey** | **String**| | [optional] | + +### Return type + + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid pet value | - | + +## deletePetWithHttpInfo + +> ApiResponse deletePet deletePetWithHttpInfo(petId, apiKey) + +Deletes a pet + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | Pet id to delete + String apiKey = "apiKey_example"; // String | + try { + ApiResponse response = apiInstance.deletePetWithHttpInfo(petId, apiKey); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#deletePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| Pet id to delete | | +| **apiKey** | **String**| | [optional] | + +### Return type + + +ApiResponse + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid pet value | - | + + +## findPetsByStatus + +> List findPetsByStatus(status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + List status = Arrays.asList("available"); // List | Status values that need to be considered for filter + try { + List result = apiInstance.findPetsByStatus(status); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByStatus"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [enum: available, pending, sold] | + +### Return type + +[**List<Pet>**](Pet.md) + + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid status value | - | + +## findPetsByStatusWithHttpInfo + +> ApiResponse> findPetsByStatus findPetsByStatusWithHttpInfo(status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + List status = Arrays.asList("available"); // List | Status values that need to be considered for filter + try { + ApiResponse> response = apiInstance.findPetsByStatusWithHttpInfo(status); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByStatus"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [enum: available, pending, sold] | + +### Return type + +ApiResponse<[**List<Pet>**](Pet.md)> + + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid status value | - | + + +## findPetsByTags + +> List findPetsByTags(tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + List tags = Arrays.asList(); // List | Tags to filter by + try { + List result = apiInstance.findPetsByTags(tags); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **tags** | [**List<String>**](String.md)| Tags to filter by | | + +### Return type + +[**List<Pet>**](Pet.md) + + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid tag value | - | + +## findPetsByTagsWithHttpInfo + +> ApiResponse> findPetsByTags findPetsByTagsWithHttpInfo(tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + List tags = Arrays.asList(); // List | Tags to filter by + try { + ApiResponse> response = apiInstance.findPetsByTagsWithHttpInfo(tags); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **tags** | [**List<String>**](String.md)| Tags to filter by | | + +### Return type + +ApiResponse<[**List<Pet>**](Pet.md)> + + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid tag value | - | + + +## getPetById + +> Pet getPetById(petId) + +Find pet by ID + +Returns a single pet + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to return + try { + Pet result = apiInstance.getPetById(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#getPetById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to return | | + +### Return type + +[**Pet**](Pet.md) + + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | + +## getPetByIdWithHttpInfo + +> ApiResponse getPetById getPetByIdWithHttpInfo(petId) + +Find pet by ID + +Returns a single pet + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to return + try { + ApiResponse response = apiInstance.getPetByIdWithHttpInfo(petId); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#getPetById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to return | | + +### Return type + +ApiResponse<[**Pet**](Pet.md)> + + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | + + +## updatePet + +> Pet updatePet(pet) + +Update an existing pet + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + Pet result = apiInstance.updatePet(pet); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | + +### Return type + +[**Pet**](Pet.md) + + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: application/json, application/xml +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | +| **405** | Validation exception | - | + +## updatePetWithHttpInfo + +> ApiResponse updatePet updatePetWithHttpInfo(pet) + +Update an existing pet + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + ApiResponse response = apiInstance.updatePetWithHttpInfo(pet); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | + +### Return type + +ApiResponse<[**Pet**](Pet.md)> + + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: application/json, application/xml +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | +| **405** | Validation exception | - | + + +## updatePetWithForm + +> void updatePetWithForm(petId, name, status) + +Updates a pet in the store with form data + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet that needs to be updated + String name = "name_example"; // String | Updated name of the pet + String status = "status_example"; // String | Updated status of the pet + try { + apiInstance.updatePetWithForm(petId, name, status); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePetWithForm"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet that needs to be updated | | +| **name** | **String**| Updated name of the pet | [optional] | +| **status** | **String**| Updated status of the pet | [optional] | + +### Return type + + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + +## updatePetWithFormWithHttpInfo + +> ApiResponse updatePetWithForm updatePetWithFormWithHttpInfo(petId, name, status) + +Updates a pet in the store with form data + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet that needs to be updated + String name = "name_example"; // String | Updated name of the pet + String status = "status_example"; // String | Updated status of the pet + try { + ApiResponse response = apiInstance.updatePetWithFormWithHttpInfo(petId, name, status); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePetWithForm"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet that needs to be updated | | +| **name** | **String**| Updated name of the pet | [optional] | +| **status** | **String**| Updated status of the pet | [optional] | + +### Return type + + +ApiResponse + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + + +## uploadFile + +> ModelApiResponse uploadFile(petId, additionalMetadata, _file) + +uploads an image + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + File _file = new File("/path/to/file"); // File | file to upload + try { + ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, _file); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | +| **additionalMetadata** | **String**| Additional data to pass to server | [optional] | +| **_file** | **File**| file to upload | [optional] | + +### Return type + +[**ModelApiResponse**](ModelApiResponse.md) + + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: multipart/form-data +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + +## uploadFileWithHttpInfo + +> ApiResponse uploadFile uploadFileWithHttpInfo(petId, additionalMetadata, _file) + +uploads an image + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + File _file = new File("/path/to/file"); // File | file to upload + try { + ApiResponse response = apiInstance.uploadFileWithHttpInfo(petId, additionalMetadata, _file); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | +| **additionalMetadata** | **String**| Additional data to pass to server | [optional] | +| **_file** | **File**| file to upload | [optional] | + +### Return type + +ApiResponse<[**ModelApiResponse**](ModelApiResponse.md)> + + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: multipart/form-data +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/docs/StoreApi.md b/samples/client/petstore/java/native/test-regenerated-fixed3/docs/StoreApi.md new file mode 100644 index 000000000000..7dfbbe315c11 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/docs/StoreApi.md @@ -0,0 +1,564 @@ +# StoreApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID | +| [**deleteOrderWithHttpInfo**](StoreApi.md#deleteOrderWithHttpInfo) | **DELETE** /store/order/{orderId} | Delete purchase order by ID | +| [**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status | +| [**getInventoryWithHttpInfo**](StoreApi.md#getInventoryWithHttpInfo) | **GET** /store/inventory | Returns pet inventories by status | +| [**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID | +| [**getOrderByIdWithHttpInfo**](StoreApi.md#getOrderByIdWithHttpInfo) | **GET** /store/order/{orderId} | Find purchase order by ID | +| [**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet | +| [**placeOrderWithHttpInfo**](StoreApi.md#placeOrderWithHttpInfo) | **POST** /store/order | Place an order for a pet | + + + +## deleteOrder + +> void deleteOrder(orderId) + +Delete purchase order by ID + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + String orderId = "orderId_example"; // String | ID of the order that needs to be deleted + try { + apiInstance.deleteOrder(orderId); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#deleteOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **orderId** | **String**| ID of the order that needs to be deleted | | + +### Return type + + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + +## deleteOrderWithHttpInfo + +> ApiResponse deleteOrder deleteOrderWithHttpInfo(orderId) + +Delete purchase order by ID + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + String orderId = "orderId_example"; // String | ID of the order that needs to be deleted + try { + ApiResponse response = apiInstance.deleteOrderWithHttpInfo(orderId); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#deleteOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **orderId** | **String**| ID of the order that needs to be deleted | | + +### Return type + + +ApiResponse + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + + +## getInventory + +> Map getInventory() + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + StoreApi apiInstance = new StoreApi(defaultClient); + try { + Map result = apiInstance.getInventory(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getInventory"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +**Map<String, Integer>** + + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + +## getInventoryWithHttpInfo + +> ApiResponse> getInventory getInventoryWithHttpInfo() + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + StoreApi apiInstance = new StoreApi(defaultClient); + try { + ApiResponse> response = apiInstance.getInventoryWithHttpInfo(); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getInventory"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +ApiResponse<**Map<String, Integer>**> + + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +## getOrderById + +> Order getOrderById(orderId) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + Long orderId = 56L; // Long | ID of pet that needs to be fetched + try { + Order result = apiInstance.getOrderById(orderId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getOrderById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **orderId** | **Long**| ID of pet that needs to be fetched | | + +### Return type + +[**Order**](Order.md) + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + +## getOrderByIdWithHttpInfo + +> ApiResponse getOrderById getOrderByIdWithHttpInfo(orderId) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + Long orderId = 56L; // Long | ID of pet that needs to be fetched + try { + ApiResponse response = apiInstance.getOrderByIdWithHttpInfo(orderId); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getOrderById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **orderId** | **Long**| ID of pet that needs to be fetched | | + +### Return type + +ApiResponse<[**Order**](Order.md)> + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + + +## placeOrder + +> Order placeOrder(order) + +Place an order for a pet + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + Order order = new Order(); // Order | order placed for purchasing the pet + try { + Order result = apiInstance.placeOrder(order); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#placeOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **order** | [**Order**](Order.md)| order placed for purchasing the pet | | + +### Return type + +[**Order**](Order.md) + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid Order | - | + +## placeOrderWithHttpInfo + +> ApiResponse placeOrder placeOrderWithHttpInfo(order) + +Place an order for a pet + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + Order order = new Order(); // Order | order placed for purchasing the pet + try { + ApiResponse response = apiInstance.placeOrderWithHttpInfo(order); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#placeOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **order** | [**Order**](Order.md)| order placed for purchasing the pet | | + +### Return type + +ApiResponse<[**Order**](Order.md)> + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid Order | - | + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/docs/Tag.md b/samples/client/petstore/java/native/test-regenerated-fixed3/docs/Tag.md new file mode 100644 index 000000000000..abfde4afb501 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/docs/Tag.md @@ -0,0 +1,15 @@ + + +# Tag + +A tag for a pet + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/docs/User.md b/samples/client/petstore/java/native/test-regenerated-fixed3/docs/User.md new file mode 100644 index 000000000000..426845227bd3 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/docs/User.md @@ -0,0 +1,21 @@ + + +# User + +A User who is purchasing from the pet store + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**username** | **String** | | [optional] | +|**firstName** | **String** | | [optional] | +|**lastName** | **String** | | [optional] | +|**email** | **String** | | [optional] | +|**password** | **String** | | [optional] | +|**phone** | **String** | | [optional] | +|**userStatus** | **Integer** | User Status | [optional] | + + + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/docs/UserApi.md b/samples/client/petstore/java/native/test-regenerated-fixed3/docs/UserApi.md new file mode 100644 index 000000000000..da72405c908b --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/docs/UserApi.md @@ -0,0 +1,1178 @@ +# UserApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**createUser**](UserApi.md#createUser) | **POST** /user | Create user | +| [**createUserWithHttpInfo**](UserApi.md#createUserWithHttpInfo) | **POST** /user | Create user | +| [**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array | +| [**createUsersWithArrayInputWithHttpInfo**](UserApi.md#createUsersWithArrayInputWithHttpInfo) | **POST** /user/createWithArray | Creates list of users with given input array | +| [**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array | +| [**createUsersWithListInputWithHttpInfo**](UserApi.md#createUsersWithListInputWithHttpInfo) | **POST** /user/createWithList | Creates list of users with given input array | +| [**deleteUser**](UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user | +| [**deleteUserWithHttpInfo**](UserApi.md#deleteUserWithHttpInfo) | **DELETE** /user/{username} | Delete user | +| [**getUserByName**](UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name | +| [**getUserByNameWithHttpInfo**](UserApi.md#getUserByNameWithHttpInfo) | **GET** /user/{username} | Get user by user name | +| [**loginUser**](UserApi.md#loginUser) | **GET** /user/login | Logs user into the system | +| [**loginUserWithHttpInfo**](UserApi.md#loginUserWithHttpInfo) | **GET** /user/login | Logs user into the system | +| [**logoutUser**](UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session | +| [**logoutUserWithHttpInfo**](UserApi.md#logoutUserWithHttpInfo) | **GET** /user/logout | Logs out current logged in user session | +| [**updateUser**](UserApi.md#updateUser) | **PUT** /user/{username} | Updated user | +| [**updateUserWithHttpInfo**](UserApi.md#updateUserWithHttpInfo) | **PUT** /user/{username} | Updated user | + + + +## createUser + +> void createUser(user) + +Create user + +This can only be done by the logged in user. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + User user = new User(); // User | Created user object + try { + apiInstance.createUser(user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**User**](User.md)| Created user object | | + +### Return type + + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + +## createUserWithHttpInfo + +> ApiResponse createUser createUserWithHttpInfo(user) + +Create user + +This can only be done by the logged in user. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + User user = new User(); // User | Created user object + try { + ApiResponse response = apiInstance.createUserWithHttpInfo(user); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**User**](User.md)| Created user object | | + +### Return type + + +ApiResponse + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +## createUsersWithArrayInput + +> void createUsersWithArrayInput(user) + +Creates list of users with given input array + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + List user = Arrays.asList(); // List | List of user object + try { + apiInstance.createUsersWithArrayInput(user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**List<User>**](User.md)| List of user object | | + +### Return type + + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + +## createUsersWithArrayInputWithHttpInfo + +> ApiResponse createUsersWithArrayInput createUsersWithArrayInputWithHttpInfo(user) + +Creates list of users with given input array + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + List user = Arrays.asList(); // List | List of user object + try { + ApiResponse response = apiInstance.createUsersWithArrayInputWithHttpInfo(user); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**List<User>**](User.md)| List of user object | | + +### Return type + + +ApiResponse + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +## createUsersWithListInput + +> void createUsersWithListInput(user) + +Creates list of users with given input array + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + List user = Arrays.asList(); // List | List of user object + try { + apiInstance.createUsersWithListInput(user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithListInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**List<User>**](User.md)| List of user object | | + +### Return type + + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + +## createUsersWithListInputWithHttpInfo + +> ApiResponse createUsersWithListInput createUsersWithListInputWithHttpInfo(user) + +Creates list of users with given input array + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + List user = Arrays.asList(); // List | List of user object + try { + ApiResponse response = apiInstance.createUsersWithListInputWithHttpInfo(user); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithListInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**List<User>**](User.md)| List of user object | | + +### Return type + + +ApiResponse + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +## deleteUser + +> void deleteUser(username) + +Delete user + +This can only be done by the logged in user. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be deleted + try { + apiInstance.deleteUser(username); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#deleteUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The name that needs to be deleted | | + +### Return type + + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + +## deleteUserWithHttpInfo + +> ApiResponse deleteUser deleteUserWithHttpInfo(username) + +Delete user + +This can only be done by the logged in user. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be deleted + try { + ApiResponse response = apiInstance.deleteUserWithHttpInfo(username); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#deleteUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The name that needs to be deleted | | + +### Return type + + +ApiResponse + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + + +## getUserByName + +> User getUserByName(username) + +Get user by user name + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. + try { + User result = apiInstance.getUserByName(username); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#getUserByName"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The name that needs to be fetched. Use user1 for testing. | | + +### Return type + +[**User**](User.md) + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + +## getUserByNameWithHttpInfo + +> ApiResponse getUserByName getUserByNameWithHttpInfo(username) + +Get user by user name + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. + try { + ApiResponse response = apiInstance.getUserByNameWithHttpInfo(username); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#getUserByName"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The name that needs to be fetched. Use user1 for testing. | | + +### Return type + +ApiResponse<[**User**](User.md)> + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + + +## loginUser + +> String loginUser(username, password) + +Logs user into the system + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The user name for login + String password = "password_example"; // String | The password for login in clear text + try { + String result = apiInstance.loginUser(username, password); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#loginUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The user name for login | | +| **password** | **String**| The password for login in clear text | | + +### Return type + +**String** + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +| **400** | Invalid username/password supplied | - | + +## loginUserWithHttpInfo + +> ApiResponse loginUser loginUserWithHttpInfo(username, password) + +Logs user into the system + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The user name for login + String password = "password_example"; // String | The password for login in clear text + try { + ApiResponse response = apiInstance.loginUserWithHttpInfo(username, password); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#loginUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The user name for login | | +| **password** | **String**| The password for login in clear text | | + +### Return type + +ApiResponse<**String**> + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +| **400** | Invalid username/password supplied | - | + + +## logoutUser + +> void logoutUser() + +Logs out current logged in user session + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + try { + apiInstance.logoutUser(); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#logoutUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + +## logoutUserWithHttpInfo + +> ApiResponse logoutUser logoutUserWithHttpInfo() + +Logs out current logged in user session + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + try { + ApiResponse response = apiInstance.logoutUserWithHttpInfo(); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#logoutUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + + +ApiResponse + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +## updateUser + +> void updateUser(username, user) + +Updated user + +This can only be done by the logged in user. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | name that need to be deleted + User user = new User(); // User | Updated user object + try { + apiInstance.updateUser(username, user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#updateUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| name that need to be deleted | | +| **user** | [**User**](User.md)| Updated user object | | + +### Return type + + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid user supplied | - | +| **404** | User not found | - | + +## updateUserWithHttpInfo + +> ApiResponse updateUser updateUserWithHttpInfo(username, user) + +Updated user + +This can only be done by the logged in user. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | name that need to be deleted + User user = new User(); // User | Updated user object + try { + ApiResponse response = apiInstance.updateUserWithHttpInfo(username, user); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#updateUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| name that need to be deleted | | +| **user** | [**User**](User.md)| Updated user object | | + +### Return type + + +ApiResponse + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid user supplied | - | +| **404** | User not found | - | + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/git_push.sh b/samples/client/petstore/java/native/test-regenerated-fixed3/git_push.sh new file mode 100644 index 000000000000..f53a75d4fabe --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/git_push.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=$(git remote) +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/gradle.properties b/samples/client/petstore/java/native/test-regenerated-fixed3/gradle.properties new file mode 100644 index 000000000000..a3408578278a --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/gradle.properties @@ -0,0 +1,6 @@ +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/native/test-regenerated-fixed3/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..e6441136f3d4ba8a0da8d277868979cfbc8ad796 GIT binary patch literal 43453 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 yu?e%!_ptzGB|8GrCfu%p?(_ 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

NnX)EH+Nua)3Y(c z&{(nX_ht=QbJ%DzAya}!&uNu!4V0xI)QE$SY__m)SAKcN0P(&JcoK*Lxr@P zY&P=}&B3*UWNlc|&$Oh{BEqwK2+N2U$4WB7Fd|aIal`FGANUa9E-O)!gV`((ZGCc$ zBJA|FFrlg~9OBp#f7aHodCe{6= zay$6vN~zj1ddMZ9gQ4p32(7wD?(dE>KA2;SOzXRmPBiBc6g`eOsy+pVcHu=;Yd8@{ zSGgXf@%sKKQz~;!J;|2fC@emm#^_rnO0esEn^QxXgJYd`#FPWOUU5b;9eMAF zZhfiZb|gk8aJIw*YLp4!*(=3l8Cp{(%p?ho22*vN9+5NLV0TTazNY$B5L6UKUrd$n zjbX%#m7&F#U?QNOBXkiiWB*_tk+H?N3`vg;1F-I+83{M2!8<^nydGr5XX}tC!10&e z7D36bLaB56WrjL&HiiMVtpff|K%|*{t*ltt^5ood{FOG0<>k&1h95qPio)2`eL${YAGIx(b4VN*~nKn6E~SIQUuRH zQ+5zP6jfnP$S0iJ@~t!Ai3o`X7biohli;E zT#yXyl{bojG@-TGZzpdVDXhbmF%F9+-^YSIv|MT1l3j zrxOFq>gd2%U}?6}8mIj?M zc077Zc9fq(-)4+gXv?Az26IO6eV`RAJz8e3)SC7~>%rlzDwySVx*q$ygTR5kW2ds- z!HBgcq0KON9*8Ff$X0wOq$`T7ml(@TF)VeoF}x1OttjuVHn3~sHrMB++}f7f9H%@f z=|kP_?#+fve@{0MlbkC9tyvQ_R?lRdRJ@$qcB(8*jyMyeME5ns6ypVI1Xm*Zr{DuS zZ!1)rQfa89c~;l~VkCiHI|PCBd`S*2RLNQM8!g9L6?n`^evQNEwfO@&JJRme+uopQX0%Jo zgd5G&#&{nX{o?TQwQvF1<^Cg3?2co;_06=~Hcb6~4XWpNFL!WU{+CK;>gH%|BLOh7@!hsa(>pNDAmpcuVO-?;Bic17R}^|6@8DahH)G z!EmhsfunLL|3b=M0MeK2vqZ|OqUqS8npxwge$w-4pFVXFq$_EKrZY?BuP@Az@(k`L z`ViQBSk`y+YwRT;&W| z2e3UfkCo^uTA4}Qmmtqs+nk#gNr2W4 zTH%hhErhB)pkXR{B!q5P3-OM+M;qu~f>}IjtF%>w{~K-0*jPVLl?Chz&zIdxp}bjx zStp&Iufr58FTQ36AHU)0+CmvaOpKF;W@sMTFpJ`j;3d)J_$tNQI^c<^1o<49Z(~K> z;EZTBaVT%14(bFw2ob@?JLQ2@(1pCdg3S%E4*dJ}dA*v}_a4_P(a`cHnBFJxNobAv zf&Zl-Yt*lhn-wjZsq<9v-IsXxAxMZ58C@e0!rzhJ+D@9^3~?~yllY^s$?&oNwyH!#~6x4gUrfxplCvK#!f z$viuszW>MFEcFL?>ux*((!L$;R?xc*myjRIjgnQX79@UPD$6Dz0jutM@7h_pq z0Zr)#O<^y_K6jfY^X%A-ip>P%3saX{!v;fxT-*0C_j4=UMH+Xth(XVkVGiiKE#f)q z%Jp=JT)uy{&}Iq2E*xr4YsJ5>w^=#-mRZ4vPXpI6q~1aFwi+lQcimO45V-JXP;>(Q zo={U`{=_JF`EQj87Wf}{Qy35s8r1*9Mxg({CvOt}?Vh9d&(}iI-quvs-rm~P;eRA@ zG5?1HO}puruc@S{YNAF3vmUc2B4!k*yi))<5BQmvd3tr}cIs#9)*AX>t`=~{f#Uz0 z0&Nk!7sSZwJe}=)-R^$0{yeS!V`Dh7w{w5rZ9ir!Z7Cd7dwZcK;BT#V0bzTt>;@Cl z#|#A!-IL6CZ@eHH!CG>OO8!%G8&8t4)Ro@}USB*k>oEUo0LsljsJ-%5Mo^MJF2I8- z#v7a5VdJ-Cd%(a+y6QwTmi+?f8Nxtm{g-+WGL>t;s#epv7ug>inqimZCVm!uT5Pf6 ziEgQt7^%xJf#!aPWbuC_3Nxfb&CFbQy!(8ANpkWLI4oSnH?Q3f?0k1t$3d+lkQs{~(>06l&v|MpcFsyAv zin6N!-;pggosR*vV=DO(#+}4ps|5$`udE%Kdmp?G7B#y%H`R|i8skKOd9Xzx8xgR$>Zo2R2Ytktq^w#ul4uicxW#{ zFjG_RNlBroV_n;a7U(KIpcp*{M~e~@>Q#Av90Jc5v%0c>egEdY4v3%|K1XvB{O_8G zkTWLC>OZKf;XguMH2-Pw{BKbFzaY;4v2seZV0>^7Q~d4O=AwaPhP3h|!hw5aqOtT@ z!SNz}$of**Bl3TK209@F=Tn1+mgZa8yh(Png%Zd6Mt}^NSjy)etQrF zme*llAW=N_8R*O~d2!apJnF%(JcN??=`$qs3Y+~xs>L9x`0^NIn!8mMRFA_tg`etw z3k{9JAjnl@ygIiJcNHTy02GMAvBVqEss&t2<2mnw!; zU`J)0>lWiqVqo|ex7!+@0i>B~BSU1A_0w#Ee+2pJx0BFiZ7RDHEvE*ptc9md(B{&+ zKE>TM)+Pd>HEmdJao7U@S>nL(qq*A)#eLOuIfAS@j`_sK0UEY6OAJJ-kOrHG zjHx`g!9j*_jRcJ%>CE9K2MVf?BUZKFHY?EpV6ai7sET-tqk=nDFh-(65rhjtlKEY% z@G&cQ<5BKatfdA1FKuB=i>CCC5(|9TMW%K~GbA4}80I5%B}(gck#Wlq@$nO3%@QP_ z8nvPkJFa|znk>V92cA!K1rKtr)skHEJD;k8P|R8RkCq1Rh^&}Evwa4BUJz2f!2=MH zo4j8Y$YL2313}H~F7@J7mh>u%556Hw0VUOz-Un@ZASCL)y8}4XXS`t1AC*^>PLwIc zUQok5PFS=*#)Z!3JZN&eZ6ZDP^-c@StY*t20JhCnbMxXf=LK#;`4KHEqMZ-Ly9KsS zI2VUJGY&PmdbM+iT)zek)#Qc#_i4uH43 z@T5SZBrhNCiK~~esjsO9!qBpaWK<`>!-`b71Y5ReXQ4AJU~T2Njri1CEp5oKw;Lnm)-Y@Z3sEY}XIgSy%xo=uek(kAAH5MsV$V3uTUsoTzxp_rF=tx zV07vlJNKtJhCu`b}*#m&5LV4TAE&%KtHViDAdv#c^x`J7bg z&N;#I2GkF@SIGht6p-V}`!F_~lCXjl1BdTLIjD2hH$J^YFN`7f{Q?OHPFEM$65^!u zNwkelo*5+$ZT|oQ%o%;rBX$+?xhvjb)SHgNHE_yP%wYkkvXHS{Bf$OiKJ5d1gI0j< zF6N}Aq=(WDo(J{e-uOecxPD>XZ@|u-tgTR<972`q8;&ZD!cep^@B5CaqFz|oU!iFj zU0;6fQX&~15E53EW&w1s9gQQ~Zk16X%6 zjG`j0yq}4deX2?Tr(03kg>C(!7a|b9qFI?jcE^Y>-VhudI@&LI6Qa}WQ>4H_!UVyF z((cm&!3gmq@;BD#5P~0;_2qgZhtJS|>WdtjY=q zLnHH~Fm!cxw|Z?Vw8*~?I$g#9j&uvgm7vPr#&iZgPP~v~BI4jOv;*OQ?jYJtzO<^y z7-#C={r7CO810!^s(MT!@@Vz_SVU)7VBi(e1%1rvS!?PTa}Uv`J!EP3s6Y!xUgM^8 z4f!fq<3Wer_#;u!5ECZ|^c1{|q_lh3m^9|nsMR1#Qm|?4Yp5~|er2?W^7~cl;_r4WSme_o68J9p03~Hc%X#VcX!xAu%1`R!dfGJCp zV*&m47>s^%Ib0~-2f$6oSgn3jg8m%UA;ArcdcRyM5;}|r;)?a^D*lel5C`V5G=c~k zy*w_&BfySOxE!(~PI$*dwG><+-%KT5p?whOUMA*k<9*gi#T{h3DAxzAPxN&Xws8o9Cp*`PA5>d9*Z-ynV# z9yY*1WR^D8|C%I@vo+d8r^pjJ$>eo|j>XiLWvTWLl(^;JHCsoPgem6PvegHb-OTf| zvTgsHSa;BkbG=(NgPO|CZu9gUCGr$8*EoH2_Z#^BnxF0yM~t`|9ws_xZ8X8iZYqh! zAh;HXJ)3P&)Q0(&F>!LN0g#bdbis-cQxyGn9Qgh`q+~49Fqd2epikEUw9caM%V6WgP)532RMRW}8gNS%V%Hx7apSz}tn@bQy!<=lbhmAH=FsMD?leawbnP5BWM0 z5{)@EEIYMu5;u)!+HQWhQ;D3_Cm_NADNeb-f56}<{41aYq8p4=93d=-=q0Yx#knGYfXVt z+kMxlus}t2T5FEyCN~!}90O_X@@PQpuy;kuGz@bWft%diBTx?d)_xWd_-(!LmVrh**oKg!1CNF&LX4{*j|) zIvjCR0I2UUuuEXh<9}oT_zT#jOrJAHNLFT~Ilh9hGJPI1<5`C-WA{tUYlyMeoy!+U zhA#=p!u1R7DNg9u4|QfED-2TuKI}>p#2P9--z;Bbf4Op*;Q9LCbO&aL2i<0O$ByoI z!9;Ght733FC>Pz>$_mw(F`zU?`m@>gE`9_p*=7o=7av`-&ifU(^)UU`Kg3Kw`h9-1 z6`e6+im=|m2v`pN(2dE%%n8YyQz;#3Q-|x`91z?gj68cMrHl}C25|6(_dIGk*8cA3 zRHB|Nwv{@sP4W+YZM)VKI>RlB`n=Oj~Rzx~M+Khz$N$45rLn6k1nvvD^&HtsMA4`s=MmuOJID@$s8Ph4E zAmSV^+s-z8cfv~Yd(40Sh4JG#F~aB>WFoX7ykaOr3JaJ&Lb49=B8Vk-SQT9%7TYhv z?-Pprt{|=Y5ZQ1?od|A<_IJU93|l4oAfBm?3-wk{O<8ea+`}u%(kub(LFo2zFtd?4 zwpN|2mBNywv+d^y_8#<$r>*5+$wRTCygFLcrwT(qc^n&@9r+}Kd_u@Ithz(6Qb4}A zWo_HdBj#V$VE#l6pD0a=NfB0l^6W^g`vm^sta>Tly?$E&{F?TTX~DsKF~poFfmN%2 z4x`Dc{u{Lkqz&y!33;X}weD}&;7p>xiI&ZUb1H9iD25a(gI|`|;G^NwJPv=1S5e)j z;U;`?n}jnY6rA{V^ zxTd{bK)Gi^odL3l989DQlN+Zs39Xe&otGeY(b5>rlIqfc7Ap4}EC?j<{M=hlH{1+d zw|c}}yx88_xQr`{98Z!d^FNH77=u(p-L{W6RvIn40f-BldeF-YD>p6#)(Qzf)lfZj z?3wAMtPPp>vMehkT`3gToPd%|D8~4`5WK{`#+}{L{jRUMt zrFz+O$C7y8$M&E4@+p+oV5c%uYzbqd2Y%SSgYy#xh4G3hQv>V*BnuKQhBa#=oZB~w{azUB+q%bRe_R^ z>fHBilnRTUfaJ201czL8^~Ix#+qOHSO)A|xWLqOxB$dT2W~)e-r9;bm=;p;RjYahB z*1hegN(VKK+ztr~h1}YP@6cfj{e#|sS`;3tJhIJK=tVJ-*h-5y9n*&cYCSdg#EHE# zSIx=r#qOaLJoVVf6v;(okg6?*L_55atl^W(gm^yjR?$GplNP>BZsBYEf_>wM0Lc;T zhf&gpzOWNxS>m+mN92N0{;4uw`P+9^*|-1~$uXpggj4- z^SFc4`uzj2OwdEVT@}Q`(^EcQ_5(ZtXTql*yGzdS&vrS_w>~~ra|Nb5abwf}Y!uq6R5f&6g2ge~2p(%c< z@O)cz%%rr4*cRJ5f`n@lvHNk@lE1a*96Kw6lJ~B-XfJW%?&-y?;E&?1AacU@`N`!O z6}V>8^%RZ7SQnZ-z$(jsX`amu*5Fj8g!3RTRwK^`2_QHe;_2y_n|6gSaGyPmI#kA0sYV<_qOZc#-2BO%hX)f$s-Z3xlI!ub z^;3ru11DA`4heAu%}HIXo&ctujzE2!6DIGE{?Zs>2}J+p&C$rc7gJC35gxhflorvsb%sGOxpuWhF)dL_&7&Z99=5M0b~Qa;Mo!j&Ti_kXW!86N%n= zSC@6Lw>UQ__F&+&Rzv?gscwAz8IP!n63>SP)^62(HK98nGjLY2*e^OwOq`3O|C92? z;TVhZ2SK%9AGW4ZavTB9?)mUbOoF`V7S=XM;#3EUpR+^oHtdV!GK^nXzCu>tpR|89 zdD{fnvCaN^^LL%amZ^}-E+214g&^56rpdc@yv0b<3}Ys?)f|fXN4oHf$six)-@<;W&&_kj z-B}M5U*1sb4)77aR=@%I?|Wkn-QJVuA96an25;~!gq(g1@O-5VGo7y&E_srxL6ZfS z*R%$gR}dyONgju*D&?geiSj7SZ@ftyA|}(*Y4KbvU!YLsi1EDQQCnb+-cM=K1io78o!v*);o<XwjaQH%)uIP&Zm?)Nfbfn;jIr z)d#!$gOe3QHp}2NBak@yYv3m(CPKkwI|{;d=gi552u?xj9ObCU^DJFQp4t4e1tPzM zvsRIGZ6VF+{6PvqsplMZWhz10YwS={?`~O0Ec$`-!klNUYtzWA^f9m7tkEzCy<_nS z=&<(awFeZvt51>@o_~>PLs05CY)$;}Oo$VDO)?l-{CS1Co=nxjqben*O1BR>#9`0^ zkwk^k-wcLCLGh|XLjdWv0_Hg54B&OzCE^3NCP}~OajK-LuRW53CkV~Su0U>zN%yQP zH8UH#W5P3-!ToO-2k&)}nFe`t+mdqCxxAHgcifup^gKpMObbox9LFK;LP3}0dP-UW z?Zo*^nrQ6*$FtZ(>kLCc2LY*|{!dUn$^RW~m9leoF|@Jy|M5p-G~j%+P0_#orRKf8 zvuu5<*XO!B?1E}-*SY~MOa$6c%2cM+xa8}_8x*aVn~57v&W(0mqN1W`5a7*VN{SUH zXz98DDyCnX2EPl-`Lesf`=AQT%YSDb`$%;(jUTrNen$NPJrlpPDP}prI>Ml!r6bCT;mjsg@X^#&<}CGf0JtR{Ecwd&)2zuhr#nqdgHj+g2n}GK9CHuwO zk>oZxy{vcOL)$8-}L^iVfJHAGfwN$prHjYV0ju}8%jWquw>}_W6j~m<}Jf!G?~r5&Rx)!9JNX!ts#SGe2HzobV5); zpj@&`cNcO&q+%*<%D7za|?m5qlmFK$=MJ_iv{aRs+BGVrs)98BlN^nMr{V_fcl_;jkzRju+c-y?gqBC_@J0dFLq-D9@VN&-`R9U;nv$Hg?>$oe4N&Ht$V_(JR3TG^! zzJsbQbi zFE6-{#9{G{+Z}ww!ycl*7rRdmU#_&|DqPfX3CR1I{Kk;bHwF6jh0opI`UV2W{*|nn zf_Y@%wW6APb&9RrbEN=PQRBEpM(N1w`81s=(xQj6 z-eO0k9=Al|>Ej|Mw&G`%q8e$2xVz1v4DXAi8G};R$y)ww638Y=9y$ZYFDM$}vzusg zUf+~BPX>(SjA|tgaFZr_e0{)+z9i6G#lgt=F_n$d=beAt0Sa0a7>z-?vcjl3e+W}+ z1&9=|vC=$co}-Zh*%3588G?v&U7%N1Qf-wNWJ)(v`iO5KHSkC5&g7CrKu8V}uQGcfcz zmBz#Lbqwqy#Z~UzHgOQ;Q-rPxrRNvl(&u6ts4~0=KkeS;zqURz%!-ERppmd%0v>iRlEf+H$yl{_8TMJzo0 z>n)`On|7=WQdsqhXI?#V{>+~}qt-cQbokEbgwV3QvSP7&hK4R{Z{aGHVS3;+h{|Hz z6$Js}_AJr383c_+6sNR|$qu6dqHXQTc6?(XWPCVZv=)D#6_;D_8P-=zOGEN5&?~8S zl5jQ?NL$c%O)*bOohdNwGIKM#jSAC?BVY={@A#c9GmX0=T(0G}xs`-%f3r=m6-cpK z!%waekyAvm9C3%>sixdZj+I(wQlbB4wv9xKI*T13DYG^T%}zZYJ|0$Oj^YtY+d$V$ zAVudSc-)FMl|54n=N{BnZTM|!>=bhaja?o7s+v1*U$!v!qQ%`T-6fBvmdPbVmro&d zk07TOp*KuxRUSTLRrBj{mjsnF8`d}rMViY8j`jo~Hp$fkv9F_g(jUo#Arp;Xw0M$~ zRIN!B22~$kx;QYmOkos@%|5k)!QypDMVe}1M9tZfkpXKGOxvKXB!=lo`p?|R1l=tA zp(1}c6T3Fwj_CPJwVsYtgeRKg?9?}%oRq0F+r+kdB=bFUdVDRPa;E~~>2$w}>O>v=?|e>#(-Lyx?nbg=ckJ#5U6;RT zNvHhXk$P}m9wSvFyU3}=7!y?Y z=fg$PbV8d7g25&-jOcs{%}wTDKm>!Vk);&rr;O1nvO0VrU&Q?TtYVU=ir`te8SLlS zKSNmV=+vF|ATGg`4$N1uS|n??f}C_4Sz!f|4Ly8#yTW-FBfvS48Tef|-46C(wEO_%pPhUC5$-~Y?!0vFZ^Gu`x=m7X99_?C-`|h zfmMM&Y@zdfitA@KPw4Mc(YHcY1)3*1xvW9V-r4n-9ZuBpFcf{yz+SR{ zo$ZSU_|fgwF~aakGr(9Be`~A|3)B=9`$M-TWKipq-NqRDRQc}ABo*s_5kV%doIX7LRLRau_gd@Rd_aLFXGSU+U?uAqh z8qusWWcvgQ&wu{|sRXmv?sl=xc<$6AR$+cl& zFNh5q1~kffG{3lDUdvEZu5c(aAG~+64FxdlfwY^*;JSS|m~CJusvi-!$XR`6@XtY2 znDHSz7}_Bx7zGq-^5{stTRy|I@N=>*y$zz>m^}^{d&~h;0kYiq8<^Wq7Dz0w31ShO^~LUfW6rfitR0(=3;Uue`Y%y@ex#eKPOW zO~V?)M#AeHB2kovn1v=n^D?2{2jhIQd9t|_Q+c|ZFaWt+r&#yrOu-!4pXAJuxM+Cx z*H&>eZ0v8Y`t}8{TV6smOj=__gFC=eah)mZt9gwz>>W$!>b3O;Rm^Ig*POZP8Rl0f zT~o=Nu1J|lO>}xX&#P58%Yl z83`HRs5#32Qm9mdCrMlV|NKNC+Z~ z9OB8xk5HJ>gBLi+m@(pvpw)1(OaVJKs*$Ou#@Knd#bk+V@y;YXT?)4eP9E5{J%KGtYinNYJUH9PU3A}66c>Xn zZ{Bn0<;8$WCOAL$^NqTjwM?5d=RHgw3!72WRo0c;+houoUA@HWLZM;^U$&sycWrFd zE7ekt9;kb0`lps{>R(}YnXlyGY}5pPd9zBpgXeJTY_jwaJGSJQC#-KJqmh-;ad&F- z-Y)E>!&`Rz!HtCz>%yOJ|v(u7P*I$jqEY3}(Z-orn4 zlI?CYKNl`6I){#2P1h)y(6?i;^z`N3bxTV%wNvQW+eu|x=kbj~s8rhCR*0H=iGkSj zk23lr9kr|p7#qKL=UjgO`@UnvzU)`&fI>1Qs7ubq{@+lK{hH* zvl6eSb9%yngRn^T<;jG1SVa)eA>T^XX=yUS@NCKpk?ovCW1D@!=@kn;l_BrG;hOTC z6K&H{<8K#dI(A+zw-MWxS+~{g$tI7|SfP$EYKxA}LlVO^sT#Oby^grkdZ^^lA}uEF zBSj$weBJG{+Bh@Yffzsw=HyChS(dtLE3i*}Zj@~!_T-Ay7z=B)+*~3|?w`Zd)Co2t zC&4DyB!o&YgSw+fJn6`sn$e)29`kUwAc+1MND7YjV%lO;H2}fNy>hD#=gT ze+-aFNpyKIoXY~Vq-}OWPBe?Rfu^{ps8>Xy%42r@RV#*QV~P83jdlFNgkPN=T|Kt7 zV*M`Rh*30&AWlb$;ae130e@}Tqi3zx2^JQHpM>j$6x`#{mu%tZlwx9Gj@Hc92IuY* zarmT|*d0E~vt6<+r?W^UW0&#U&)8B6+1+;k^2|FWBRP9?C4Rk)HAh&=AS8FS|NQaZ z2j!iZ)nbEyg4ZTp-zHwVlfLC~tXIrv(xrP8PAtR{*c;T24ycA-;auWsya-!kF~CWZ zw_uZ|%urXgUbc@x=L=_g@QJ@m#5beS@6W195Hn7>_}z@Xt{DIEA`A&V82bc^#!q8$ zFh?z_Vn|ozJ;NPd^5uu(9tspo8t%&-U9Ckay-s@DnM*R5rtu|4)~e)`z0P-sy?)kc zs_k&J@0&0!q4~%cKL)2l;N*T&0;mqX5T{Qy60%JtKTQZ-xb%KOcgqwJmb%MOOKk7N zgq})R_6**{8A|6H?fO+2`#QU)p$Ei2&nbj6TpLSIT^D$|`TcSeh+)}VMb}LmvZ{O| ze*1IdCt3+yhdYVxcM)Q_V0bIXLgr6~%JS<<&dxIgfL=Vnx4YHuU@I34JXA|+$_S3~ zy~X#gO_X!cSs^XM{yzDGNM>?v(+sF#<0;AH^YrE8smx<36bUsHbN#y57K8WEu(`qHvQ6cAZPo=J5C(lSmUCZ57Rj6cx!e^rfaI5%w}unz}4 zoX=nt)FVNV%QDJH`o!u9olLD4O5fl)xp+#RloZlaA92o3x4->?rB4`gS$;WO{R;Z3>cG3IgFX2EA?PK^M}@%1%A;?f6}s&CV$cIyEr#q5;yHdNZ9h{| z-=dX+a5elJoDo?Eq&Og!nN6A)5yYpnGEp}?=!C-V)(*~z-+?kY1Q7qs#Rsy%hu_60rdbB+QQNr?S1 z?;xtjUv|*E3}HmuNyB9aFL5H~3Ho0UsmuMZELp1a#CA1g`P{-mT?BchuLEtK}!QZ=3AWakRu~?f9V~3F;TV`5%9Pcs_$gq&CcU}r8gOO zC2&SWPsSG{&o-LIGTBqp6SLQZPvYKp$$7L4WRRZ0BR$Kf0I0SCFkqveCp@f)o8W)! z$%7D1R`&j7W9Q9CGus_)b%+B#J2G;l*FLz#s$hw{BHS~WNLODV#(!u_2Pe&tMsq={ zdm7>_WecWF#D=?eMjLj=-_z`aHMZ=3_-&E8;ibPmM}61i6J3is*=dKf%HC>=xbj4$ zS|Q-hWQ8T5mWde6h@;mS+?k=89?1FU<%qH9B(l&O>k|u_aD|DY*@~(`_pb|B#rJ&g zR0(~(68fpUPz6TdS@4JT5MOPrqDh5_H(eX1$P2SQrkvN8sTxwV>l0)Qq z0pzTuvtEAKRDkKGhhv^jk%|HQ1DdF%5oKq5BS>szk-CIke{%js?~%@$uaN3^Uz6Wf z_iyx{bZ(;9y4X&>LPV=L=d+A}7I4GkK0c1Xts{rrW1Q7apHf-))`BgC^0^F(>At1* za@e7{lq%yAkn*NH8Q1{@{lKhRg*^TfGvv!Sn*ed*x@6>M%aaqySxR|oNadYt1mpUZ z6H(rupHYf&Z z29$5g#|0MX#aR6TZ$@eGxxABRKakDYtD%5BmKp;HbG_ZbT+=81E&=XRk6m_3t9PvD zr5Cqy(v?gHcYvYvXkNH@S#Po~q(_7MOuCAB8G$a9BC##gw^5mW16cML=T=ERL7wsk zzNEayTG?mtB=x*wc@ifBCJ|irFVMOvH)AFRW8WE~U()QT=HBCe@s$dA9O!@`zAAT) zaOZ7l6vyR+Nk_OOF!ZlZmjoImKh)dxFbbR~z(cMhfeX1l7S_`;h|v3gI}n9$sSQ>+3@AFAy9=B_y$)q;Wdl|C-X|VV3w8 z2S#>|5dGA8^9%Bu&fhmVRrTX>Z7{~3V&0UpJNEl0=N32euvDGCJ>#6dUSi&PxFW*s zS`}TB>?}H(T2lxBJ!V#2taV;q%zd6fOr=SGHpoSG*4PDaiG0pdb5`jelVipkEk%FV zThLc@Hc_AL1#D&T4D=w@UezYNJ%0=f3iVRuVL5H?eeZM}4W*bomebEU@e2d`M<~uW zf#Bugwf`VezG|^Qbt6R_=U0}|=k;mIIakz99*>FrsQR{0aQRP6ko?5<7bkDN8evZ& zB@_KqQG?ErKL=1*ZM9_5?Pq%lcS4uLSzN(Mr5=t6xHLS~Ym`UgM@D&VNu8e?_=nSFtF$u@hpPSmI4Vo_t&v?>$~K4y(O~Rb*(MFy_igM7 z*~yYUyR6yQgzWnWMUgDov!!g=lInM+=lOmOk4L`O?{i&qxy&D*_qorRbDwj6?)!ef z#JLd7F6Z2I$S0iYI={rZNk*<{HtIl^mx=h>Cim*04K4+Z4IJtd*-)%6XV2(MCscPiw_a+y*?BKbTS@BZ3AUao^%Zi#PhoY9Vib4N>SE%4>=Jco0v zH_Miey{E;FkdlZSq)e<{`+S3W=*ttvD#hB8w=|2aV*D=yOV}(&p%0LbEWH$&@$X3x~CiF-?ejQ*N+-M zc8zT@3iwkdRT2t(XS`d7`tJQAjRmKAhiw{WOqpuvFp`i@Q@!KMhwKgsA}%@sw8Xo5Y=F zhRJZg)O4uqNWj?V&&vth*H#je6T}}p_<>!Dr#89q@uSjWv~JuW(>FqoJ5^ho0%K?E z9?x_Q;kmcsQ@5=}z@tdljMSt9-Z3xn$k)kEjK|qXS>EfuDmu(Z8|(W?gY6-l z@R_#M8=vxKMAoi&PwnaIYw2COJM@atcgfr=zK1bvjW?9B`-+Voe$Q+H$j!1$Tjn+* z&LY<%)L@;zhnJlB^Og6I&BOR-m?{IW;tyYC%FZ!&Z>kGjHJ6cqM-F z&19n+e1=9AH1VrVeHrIzqlC`w9=*zfmrerF?JMzO&|Mmv;!4DKc(sp+jy^Dx?(8>1 zH&yS_4yL7m&GWX~mdfgH*AB4{CKo;+egw=PrvkTaoBU+P-4u?E|&!c z)DKc;>$$B6u*Zr1SjUh2)FeuWLWHl5TH(UHWkf zLs>7px!c5n;rbe^lO@qlYLzlDVp(z?6rPZel=YB)Uv&n!2{+Mb$-vQl=xKw( zve&>xYx+jW_NJh!FV||r?;hdP*jOXYcLCp>DOtJ?2S^)DkM{{Eb zS$!L$e_o0(^}n3tA1R3-$SNvgBq;DOEo}fNc|tB%%#g4RA3{|euq)p+xd3I8^4E&m zFrD%}nvG^HUAIKe9_{tXB;tl|G<%>yk6R;8L2)KUJw4yHJXUOPM>(-+jxq4R;z8H#>rnJy*)8N+$wA$^F zN+H*3t)eFEgxLw+Nw3};4WV$qj&_D`%ADV2%r zJCPCo%{=z7;`F98(us5JnT(G@sKTZ^;2FVitXyLe-S5(hV&Ium+1pIUB(CZ#h|g)u zSLJJ<@HgrDiA-}V_6B^x1>c9B6%~847JkQ!^KLZ2skm;q*edo;UA)~?SghG8;QbHh z_6M;ouo_1rq9=x$<`Y@EA{C%6-pEV}B(1#sDoe_e1s3^Y>n#1Sw;N|}8D|s|VPd+g z-_$QhCz`vLxxrVMx3ape1xu3*wjx=yKSlM~nFgkNWb4?DDr*!?U)L_VeffF<+!j|b zZ$Wn2$TDv3C3V@BHpSgv3JUif8%hk%OsGZ=OxH@8&4`bbf$`aAMchl^qN>Eyu3JH} z9-S!x8-s4fE=lad%Pkp8hAs~u?|uRnL48O|;*DEU! zuS0{cpk%1E0nc__2%;apFsTm0bKtd&A0~S3Cj^?72-*Owk3V!ZG*PswDfS~}2<8le z5+W^`Y(&R)yVF*tU_s!XMcJS`;(Tr`J0%>p=Z&InR%D3@KEzzI+-2)HK zuoNZ&o=wUC&+*?ofPb0a(E6(<2Amd6%uSu_^-<1?hsxs~0K5^f(LsGqgEF^+0_H=uNk9S0bb!|O8d?m5gQjUKevPaO+*VfSn^2892K~%crWM8+6 z25@V?Y@J<9w%@NXh-2!}SK_(X)O4AM1-WTg>sj1{lj5@=q&dxE^9xng1_z9w9DK>| z6Iybcd0e zyi;Ew!KBRIfGPGytQ6}z}MeXCfLY0?9%RiyagSp_D1?N&c{ zyo>VbJ4Gy`@Fv+5cKgUgs~na$>BV{*em7PU3%lloy_aEovR+J7TfQKh8BJXyL6|P8un-Jnq(ghd!_HEOh$zlv2$~y3krgeH;9zC}V3f`uDtW(%mT#944DQa~^8ZI+zAUu4U(j0YcDfKR$bK#gvn_{JZ>|gZ5+)u?T$w7Q%F^;!Wk?G z(le7r!ufT*cxS}PR6hIVtXa)i`d$-_1KkyBU>qmgz-=T};uxx&sKgv48akIWQ89F{ z0XiY?WM^~;|T8zBOr zs#zuOONzH?svv*jokd5SK8wG>+yMC)LYL|vLqm^PMHcT=`}V$=nIRHe2?h)8WQa6O zPAU}d`1y(>kZiP~Gr=mtJLMu`i<2CspL|q2DqAgAD^7*$xzM`PU4^ga`ilE134XBQ z99P(LhHU@7qvl9Yzg$M`+dlS=x^(m-_3t|h>S}E0bcFMn=C|KamQ)=w2^e)35p`zY zRV8X?d;s^>Cof2SPR&nP3E+-LCkS0J$H!eh8~k0qo$}00b=7!H_I2O+Ro@3O$nPdm ztmbOO^B+IHzQ5w>@@@J4cKw5&^_w6s!s=H%&byAbUtczPQ7}wfTqxxtQNfn*u73Qw zGuWsrky_ajPx-5`R<)6xHf>C(oqGf_Fw|-U*GfS?xLML$kv;h_pZ@Kk$y0X(S+K80 z6^|z)*`5VUkawg}=z`S;VhZhxyDfrE0$(PMurAxl~<>lfZa>JZ288ULK7D` zl9|#L^JL}Y$j*j`0-K6kH#?bRmg#5L3iB4Z)%iF@SqT+Lp|{i`m%R-|ZE94Np7Pa5 zCqC^V3}B(FR340pmF*qaa}M}+h6}mqE~7Sh!9bDv9YRT|>vBNAqv09zXHMlcuhKD| zcjjA(b*XCIwJ33?CB!+;{)vX@9xns_b-VO{i0y?}{!sdXj1GM8+$#v>W7nw;+O_9B z_{4L;C6ol?(?W0<6taGEn1^uG=?Q3i29sE`RfYCaV$3DKc_;?HsL?D_fSYg}SuO5U zOB_f4^vZ_x%o`5|C@9C5+o=mFy@au{s)sKw!UgC&L35aH(sgDxRE2De%(%OT=VUdN ziVLEmdOvJ&5*tCMKRyXctCwQu_RH%;m*$YK&m;jtbdH#Ak~13T1^f89tn`A%QEHWs~jnY~E}p_Z$XC z=?YXLCkzVSK+Id`xZYTegb@W8_baLt-Fq`Tv|=)JPbFsKRm)4UW;yT+J`<)%#ue9DPOkje)YF2fsCilK9MIIK>p*`fkoD5nGfmLwt)!KOT+> zOFq*VZktDDyM3P5UOg`~XL#cbzC}eL%qMB=Q5$d89MKuN#$6|4gx_Jt0Gfn8w&q}%lq4QU%6#jT*MRT% zrLz~C8FYKHawn-EQWN1B75O&quS+Z81(zN)G>~vN8VwC+e+y(`>HcxC{MrJ;H1Z4k zZWuv$w_F0-Ub%MVcpIc){4PGL^I7M{>;hS?;eH!;gmcOE66z3;Z1Phqo(t zVP(Hg6q#0gIKgsg7L7WE!{Y#1nI(45tx2{$34dDd#!Z0NIyrm)HOn5W#7;f4pQci# zDW!FI(g4e668kI9{2+mLwB+=#9bfqgX%!B34V-$wwSN(_cm*^{y0jQtv*4}eO^sOV z*9xoNvX)c9isB}Tgx&ZRjp3kwhTVK?r9;n!x>^XYT z@Q^7zp{rkIs{2mUSE^2!Gf6$6;j~&4=-0cSJJDizZp6LTe8b45;{AKM%v99}{{FfC zz709%u0mC=1KXTo(=TqmZQ;c?$M3z(!xah>aywrj40sc2y3rKFw4jCq+Y+u=CH@_V zxz|qeTwa>+<|H%8Dz5u>ZI5MmjTFwXS-Fv!TDd*`>3{krWoNVx$<133`(ftS?ZPyY z&4@ah^3^i`vL$BZa>O|Nt?ucewzsF)0zX3qmM^|waXr=T0pfIb0*$AwU=?Ipl|1Y; z*Pk6{C-p4MY;j@IJ|DW>QHZQJcp;Z~?8(Q+Kk3^0qJ}SCk^*n4W zu9ZFwLHUx-$6xvaQ)SUQcYd6fF8&x)V`1bIuX@>{mE$b|Yd(qomn3;bPwnDUc0F=; zh*6_((%bqAYQWQ~odER?h>1mkL4kpb3s7`0m@rDKGU*oyF)$j~Ffd4fXV$?`f~rHf zB%Y)@5SXZvfwm10RY5X?TEo)PK_`L6qgBp=#>fO49$D zDq8Ozj0q6213tV5Qq=;fZ0$|KroY{Dz=l@lU^J)?Ko@ti20TRplXzphBi>XGx4bou zEWrkNjz0t5j!_ke{g5I#PUlEU$Km8g8TE|XK=MkU@PT4T><2OVamoK;wJ}3X0L$vX zgd7gNa359*nc)R-0!`2X@FOTB`+oETOPc=ubp5R)VQgY+5BTZZJ2?9QwnO=dnulIUF3gFn;BODC2)65)HeVd%t86sL7Rv^Y+nbn+&l z6BAJY(ETvwI)Ts$aiE8rht4KD*qNyE{8{x6R|%akbTBzw;2+6Echkt+W+`u^XX z_z&x%n '} +case $link in #( +/*) app_path=$link ;; #( +*) app_path=$APP_HOME$link ;; +esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { +echo "$*" +} >&2 + +die () { +echo +echo "$*" +echo +exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( +CYGWIN* ) cygwin=true ;; #( +Darwin* ) darwin=true ;; #( +MSYS* | MINGW* ) msys=true ;; #( +NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then +if [ -x "$JAVA_HOME/jre/sh/java" ] ; then +# IBM's JDK on AIX uses strange locations for the executables +JAVACMD=$JAVA_HOME/jre/sh/java +else +JAVACMD=$JAVA_HOME/bin/java +fi +if [ ! -x "$JAVACMD" ] ; then +die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +else +JAVACMD=java +if ! command -v java >/dev/null 2>&1 +then +die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then +case $MAX_FD in #( +max*) +# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +MAX_FD=$( ulimit -H -n ) || +warn "Could not query maximum file descriptor limit" +esac +case $MAX_FD in #( +'' | soft) :;; #( +*) +# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +ulimit -n "$MAX_FD" || +warn "Could not set maximum file descriptor limit to $MAX_FD" +esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then +APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) +CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + +JAVACMD=$( cygpath --unix "$JAVACMD" ) + +# Now convert the arguments - kludge to limit ourselves to /bin/sh +for arg do +if +case $arg in #( +-*) false ;; # don't mess with options #( +/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath +[ -e "$t" ] ;; #( +*) false ;; +esac +then +arg=$( cygpath --path --ignore --mixed "$arg" ) +fi +# Roll the args list around exactly as many times as the number of +# args, so each arg winds up back in the position where it started, but +# possibly modified. +# +# NB: a `for` loop captures its iteration list before it begins, so +# changing the positional parameters here affects neither the number of +# iterations, nor the values presented in `arg`. +shift # remove old arg +set -- "$@" "$arg" # push replacement arg +done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ +"-Dorg.gradle.appname=$APP_BASE_NAME" \ +-classpath "$CLASSPATH" \ +org.gradle.wrapper.GradleWrapperMain \ +"$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then +die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( +printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | +xargs -n1 | +sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | +tr '\n' ' ' +)" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/gradlew.bat b/samples/client/petstore/java/native/test-regenerated-fixed3/gradlew.bat new file mode 100644 index 000000000000..25da30dbdeee --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/pom.xml b/samples/client/petstore/java/native/test-regenerated-fixed3/pom.xml new file mode 100644 index 000000000000..10a3beca26fb --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/pom.xml @@ -0,0 +1,264 @@ + + 4.0.0 + org.openapitools + openapi-java-client + jar + openapi-java-client + 1.0.0 + https://github.com/openapitools/openapi-generator + OpenAPI Java + + scm:git:git@github.com:openapitools/openapi-generator.git + scm:git:git@github.com:openapitools/openapi-generator.git + https://github.com/openapitools/openapi-generator + + + + + Unlicense + https://www.apache.org/licenses/LICENSE-2.0.html + repo + + + + + + OpenAPI-Generator Contributors + team@openapitools.org + OpenAPITools.org + http://openapitools.org + + + + + + + maven-enforcer-plugin + 3.1.0 + + + enforce-maven + + enforce + + + + + 3 + + + 11 + + + + + + + + maven-surefire-plugin + 3.2.5 + + + conf/log4j.properties + + -Xms512m -Xmx1500m + methods + 10 + + + + maven-dependency-plugin + 3.3.0 + + + package + + copy-dependencies + + + ${project.build.directory}/lib + + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.3.0 + + + + test-jar + + + + + + + + maven-compiler-plugin + 3.10.1 + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.4.1 + + + attach-javadocs + + jar + + + + + + maven-source-plugin + 3.2.1 + + + attach-sources + + jar-no-fork + + + + + + + com.diffplug.spotless + spotless-maven-plugin + ${spotless.version} + + + + + + + .gitignore + + + + + + true + 4 + + + + + + + + + + 1.8 + + true + + + + + + + + + + + + sign-artifacts + + + + maven-gpg-plugin + 3.0.1 + + + sign-artifacts + verify + + sign + + + + + + + + + + + + + + com.fasterxml.jackson.core + jackson-core + ${jackson-version} + + + com.fasterxml.jackson.core + jackson-annotations + ${jackson-version} + + + com.fasterxml.jackson.core + jackson-databind + ${jackson-version} + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson-version} + + + org.openapitools + jackson-databind-nullable + ${jackson-databind-nullable-version} + + + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + jakarta.annotation + jakarta.annotation-api + ${jakarta-annotation-version} + provided + + + org.apache.httpcomponents + httpmime + ${httpmime-version} + + + + + org.junit.jupiter + junit-jupiter-api + ${junit-version} + test + + + + + UTF-8 + 11 + 11 + 2.17.1 + 0.2.6 + 1.3.5 + 2.0.2 + 4.5.14 + 5.10.2 + 2.27.2 + + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/settings.gradle b/samples/client/petstore/java/native/test-regenerated-fixed3/settings.gradle new file mode 100644 index 000000000000..369ba54a9e06 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/settings.gradle @@ -0,0 +1 @@ +rootProject.name = "openapi-java-client" \ No newline at end of file diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/AndroidManifest.xml b/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/AndroidManifest.xml new file mode 100644 index 000000000000..54fbcb3da1e8 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/AndroidManifest.xml @@ -0,0 +1,3 @@ + + + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/ApiClient.java new file mode 100644 index 000000000000..f6996146c172 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/ApiClient.java @@ -0,0 +1,457 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import org.openapitools.jackson.nullable.JsonNullableModule; + +import java.io.InputStream; +import java.net.URI; +import java.net.URLEncoder; +import java.net.http.HttpClient; +import java.net.http.HttpConnectTimeoutException; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.StringJoiner; +import java.util.function.Consumer; +import java.util.stream.Collectors; + +import static java.nio.charset.StandardCharsets.UTF_8; + +/** + * Configuration and utility class for API clients. + * + *

This class can be constructed and modified, then used to instantiate the + * various API classes. The API classes use the settings in this class to + * configure themselves, but otherwise do not store a link to this class.

+ * + *

This class is mutable and not synchronized, so it is not thread-safe. + * The API classes generated from this are immutable and thread-safe.

+ * + *

The setter methods of this class return the current object to facilitate + * a fluent style of configuration.

+ */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:09:56.830832+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class ApiClient { + + protected HttpClient.Builder builder; + protected ObjectMapper mapper; + protected String scheme; + protected String host; + protected int port; + protected String basePath; + protected Consumer interceptor; + protected Consumer> responseInterceptor; + protected Consumer> asyncResponseInterceptor; + protected Duration readTimeout; + protected Duration connectTimeout; + + public static String valueToString(Object value) { + if (value == null) { + return ""; + } + if (value instanceof OffsetDateTime) { + return ((OffsetDateTime) value).format(DateTimeFormatter.ISO_OFFSET_DATE_TIME); + } + return value.toString(); + } + + /** + * URL encode a string in the UTF-8 encoding. + * + * @param s String to encode. + * @return URL-encoded representation of the input string. + */ + public static String urlEncode(String s) { + return URLEncoder.encode(s, UTF_8).replaceAll("\\+", "%20"); + } + + /** + * Convert a URL query name/value parameter to a list of encoded {@link Pair} + * objects. + * + *

The value can be null, in which case an empty list is returned.

+ * + * @param name The query name parameter. + * @param value The query value, which may not be a collection but may be + * null. + * @return A singleton list of the {@link Pair} objects representing the input + * parameters, which is encoded for use in a URL. If the value is null, an + * empty list is returned. + */ + public static List parameterToPairs(String name, Object value) { + if (name == null || name.isEmpty() || value == null) { + return Collections.emptyList(); + } + return Collections.singletonList(new Pair(urlEncode(name), urlEncode(valueToString(value)))); + } + + /** + * Convert a URL query name/collection parameter to a list of encoded + * {@link Pair} objects. + * + * @param collectionFormat The swagger collectionFormat string (csv, tsv, etc). + * @param name The query name parameter. + * @param values A collection of values for the given query name, which may be + * null. + * @return A list of {@link Pair} objects representing the input parameters, + * which is encoded for use in a URL. If the values collection is null, an + * empty list is returned. + */ + public static List parameterToPairs( + String collectionFormat, String name, Collection values) { + if (name == null || name.isEmpty() || values == null || values.isEmpty()) { + return Collections.emptyList(); + } + + // get the collection format (default: csv) + String format = collectionFormat == null || collectionFormat.isEmpty() ? "csv" : collectionFormat; + + // create the params based on the collection format + if ("multi".equals(format)) { + return values.stream() + .map(value -> new Pair(urlEncode(name), urlEncode(valueToString(value)))) + .collect(Collectors.toList()); + } + + String delimiter; + switch(format) { + case "csv": + delimiter = urlEncode(","); + break; + case "ssv": + delimiter = urlEncode(" "); + break; + case "tsv": + delimiter = urlEncode("\t"); + break; + case "pipes": + delimiter = urlEncode("|"); + break; + default: + throw new IllegalArgumentException("Illegal collection format: " + collectionFormat); + } + + StringJoiner joiner = new StringJoiner(delimiter); + for (Object value : values) { + joiner.add(urlEncode(valueToString(value))); + } + + return Collections.singletonList(new Pair(urlEncode(name), joiner.toString())); + } + + /** + * Create an instance of ApiClient. + */ + public ApiClient() { + this.builder = createDefaultHttpClientBuilder(); + this.mapper = createDefaultObjectMapper(); + updateBaseUri(getDefaultBaseUri()); + interceptor = null; + readTimeout = null; + connectTimeout = null; + responseInterceptor = null; + asyncResponseInterceptor = null; + } + + /** + * Create an instance of ApiClient. + * + * @param builder Http client builder. + * @param mapper Object mapper. + * @param baseUri Base URI + */ + public ApiClient(HttpClient.Builder builder, ObjectMapper mapper, String baseUri) { + this.builder = builder; + this.mapper = mapper; + updateBaseUri(baseUri != null ? baseUri : getDefaultBaseUri()); + interceptor = null; + readTimeout = null; + connectTimeout = null; + responseInterceptor = null; + asyncResponseInterceptor = null; + } + + public static ObjectMapper createDefaultObjectMapper() { + ObjectMapper mapper = new ObjectMapper(); + mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, false); + mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); + mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); + mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); + mapper.disable(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE); + mapper.registerModule(new JavaTimeModule()); + mapper.registerModule(new JsonNullableModule()); + mapper.registerModule(new RFC3339JavaTimeModule()); + return mapper; + } + + protected String getDefaultBaseUri() { + return "http://petstore.swagger.io/v2"; + } + + public static HttpClient.Builder createDefaultHttpClientBuilder() { + return HttpClient.newBuilder(); + } + + public final void updateBaseUri(String baseUri) { + URI uri = URI.create(baseUri); + scheme = uri.getScheme(); + host = uri.getHost(); + port = uri.getPort(); + basePath = uri.getRawPath(); + } + + /** + * Set a custom {@link HttpClient.Builder} object to use when creating the + * {@link HttpClient} that is used by the API client. + * + * @param builder Custom client builder. + * @return This object. + */ + public ApiClient setHttpClientBuilder(HttpClient.Builder builder) { + this.builder = builder; + return this; + } + + /** + * Get an {@link HttpClient} based on the current {@link HttpClient.Builder}. + * + *

The returned object is immutable and thread-safe.

+ * + * @return The HTTP client. + */ + public HttpClient getHttpClient() { + return builder.build(); + } + + /** + * Set a custom {@link ObjectMapper} to serialize and deserialize the request + * and response bodies. + * + * @param mapper Custom object mapper. + * @return This object. + */ + public ApiClient setObjectMapper(ObjectMapper mapper) { + this.mapper = mapper; + return this; + } + + /** + * Get a copy of the current {@link ObjectMapper}. + * + * @return A copy of the current object mapper. + */ + public ObjectMapper getObjectMapper() { + return mapper.copy(); + } + + /** + * Set a custom host name for the target service. + * + * @param host The host name of the target service. + * @return This object. + */ + public ApiClient setHost(String host) { + this.host = host; + return this; + } + + /** + * Set a custom port number for the target service. + * + * @param port The port of the target service. Set this to -1 to reset the + * value to the default for the scheme. + * @return This object. + */ + public ApiClient setPort(int port) { + this.port = port; + return this; + } + + /** + * Set a custom base path for the target service, for example '/v2'. + * + * @param basePath The base path against which the rest of the path is + * resolved. + * @return This object. + */ + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + return this; + } + + /** + * Get the base URI to resolve the endpoint paths against. + * + * @return The complete base URI that the rest of the API parameters are + * resolved against. + */ + public String getBaseUri() { + return scheme + "://" + host + (port == -1 ? "" : ":" + port) + basePath; + } + + /** + * Set a custom scheme for the target service, for example 'https'. + * + * @param scheme The scheme of the target service + * @return This object. + */ + public ApiClient setScheme(String scheme){ + this.scheme = scheme; + return this; + } + + /** + * Set a custom request interceptor. + * + *

A request interceptor is a mechanism for altering each request before it + * is sent. After the request has been fully configured but not yet built, the + * request builder is passed into this function for further modification, + * after which it is sent out.

+ * + *

This is useful for altering the requests in a custom manner, such as + * adding headers. It could also be used for logging and monitoring.

+ * + * @param interceptor A function invoked before creating each request. A value + * of null resets the interceptor to a no-op. + * @return This object. + */ + public ApiClient setRequestInterceptor(Consumer interceptor) { + this.interceptor = interceptor; + return this; + } + + /** + * Get the custom interceptor. + * + * @return The custom interceptor that was set, or null if there isn't any. + */ + public Consumer getRequestInterceptor() { + return interceptor; + } + + /** + * Set a custom response interceptor. + * + *

This is useful for logging, monitoring or extraction of header variables

+ * + * @param interceptor A function invoked before creating each request. A value + * of null resets the interceptor to a no-op. + * @return This object. + */ + public ApiClient setResponseInterceptor(Consumer> interceptor) { + this.responseInterceptor = interceptor; + return this; + } + + /** + * Get the custom response interceptor. + * + * @return The custom interceptor that was set, or null if there isn't any. + */ + public Consumer> getResponseInterceptor() { + return responseInterceptor; + } + + /** + * Set a custom async response interceptor. Use this interceptor when asyncNative is set to 'true'. + * + *

This is useful for logging, monitoring or extraction of header variables

+ * + * @param interceptor A function invoked before creating each request. A value + * of null resets the interceptor to a no-op. + * @return This object. + */ + public ApiClient setAsyncResponseInterceptor(Consumer> interceptor) { + this.asyncResponseInterceptor = interceptor; + return this; + } + + /** + * Get the custom async response interceptor. Use this interceptor when asyncNative is set to 'true'. + * + * @return The custom interceptor that was set, or null if there isn't any. + */ + public Consumer> getAsyncResponseInterceptor() { + return asyncResponseInterceptor; + } + + /** + * Set the read timeout for the http client. + * + *

This is the value used by default for each request, though it can be + * overridden on a per-request basis with a request interceptor.

+ * + * @param readTimeout The read timeout used by default by the http client. + * Setting this value to null resets the timeout to an + * effectively infinite value. + * @return This object. + */ + public ApiClient setReadTimeout(Duration readTimeout) { + this.readTimeout = readTimeout; + return this; + } + + /** + * Get the read timeout that was set. + * + * @return The read timeout, or null if no timeout was set. Null represents + * an infinite wait time. + */ + public Duration getReadTimeout() { + return readTimeout; + } + /** + * Sets the connect timeout (in milliseconds) for the http client. + * + *

In the case where a new connection needs to be established, if + * the connection cannot be established within the given {@code + * duration}, then {@link HttpClient#send(HttpRequest,BodyHandler) + * HttpClient::send} throws an {@link HttpConnectTimeoutException}, or + * {@link HttpClient#sendAsync(HttpRequest,BodyHandler) + * HttpClient::sendAsync} completes exceptionally with an + * {@code HttpConnectTimeoutException}. If a new connection does not + * need to be established, for example if a connection can be reused + * from a previous request, then this timeout duration has no effect. + * + * @param connectTimeout connection timeout in milliseconds + * + * @return This object. + */ + public ApiClient setConnectTimeout(Duration connectTimeout) { + this.connectTimeout = connectTimeout; + this.builder.connectTimeout(connectTimeout); + return this; + } + + /** + * Get connection timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public Duration getConnectTimeout() { + return connectTimeout; + } +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/ApiException.java new file mode 100644 index 000000000000..d481fc94ab1f --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/ApiException.java @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +import java.net.http.HttpHeaders; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:09:56.830832+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class ApiException extends Exception { + private static final long serialVersionUID = 1L; + + private int code = 0; + private HttpHeaders responseHeaders = null; + private String responseBody = null; + + public ApiException() {} + + public ApiException(Throwable throwable) { + super(throwable); + } + + public ApiException(String message) { + super(message); + } + + public ApiException(String message, Throwable throwable, int code, HttpHeaders responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + public ApiException(String message, int code, HttpHeaders responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(String message, Throwable throwable, int code, HttpHeaders responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } + + public ApiException(int code, HttpHeaders responseHeaders, String responseBody) { + this((String) null, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + public ApiException(int code, String message, HttpHeaders responseHeaders, String responseBody) { + this(code, message); + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + /** + * Get the HTTP status code. + * + * @return HTTP status code + */ + public int getCode() { + return code; + } + + /** + * Get the HTTP response headers. + * + * @return Headers as an HttpHeaders object + */ + public HttpHeaders getResponseHeaders() { + return responseHeaders; + } + + /** + * Get the HTTP response body. + * + * @return Response body in the form of string + */ + public String getResponseBody() { + return responseBody; + } +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/ApiResponse.java b/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/ApiResponse.java new file mode 100644 index 000000000000..5494a9af8da3 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/ApiResponse.java @@ -0,0 +1,60 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +import java.util.List; +import java.util.Map; + +/** + * API response returned by API call. + * + * @param The type of data that is deserialized from response body + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:09:56.830832+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class ApiResponse { + final private int statusCode; + final private Map> headers; + final private T data; + + /** + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + */ + public ApiResponse(int statusCode, Map> headers) { + this(statusCode, headers, null); + } + + /** + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + * @param data The object deserialized from response bod + */ + public ApiResponse(int statusCode, Map> headers, T data) { + this.statusCode = statusCode; + this.headers = headers; + this.data = data; + } + + public int getStatusCode() { + return statusCode; + } + + public Map> getHeaders() { + return headers; + } + + public T getData() { + return data; + } +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/Configuration.java b/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/Configuration.java new file mode 100644 index 000000000000..b94cbd072ab0 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/Configuration.java @@ -0,0 +1,63 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +import java.util.Objects; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Supplier; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:09:56.830832+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class Configuration { + public static final String VERSION = "1.0.0"; + + private static final AtomicReference defaultApiClient = new AtomicReference<>(); + private static volatile Supplier apiClientFactory = ApiClient::new; + + /** + * Get the default API client, which would be used when creating API instances without providing an API client. + * + * @return Default API client + */ + public static ApiClient getDefaultApiClient() { + ApiClient client = defaultApiClient.get(); + if (client == null) { + client = defaultApiClient.updateAndGet(val -> { + if (val != null) { // changed by another thread + return val; + } + return apiClientFactory.get(); + }); + } + return client; + } + + /** + * Set the default API client, which would be used when creating API instances without providing an API client. + * + * @param apiClient API client + */ + public static void setDefaultApiClient(ApiClient apiClient) { + defaultApiClient.set(apiClient); + } + + /** + * set the callback used to create new ApiClient objects + */ + public static void setApiClientFactory(Supplier factory) { + apiClientFactory = Objects.requireNonNull(factory); + } + + private Configuration() { + } +} \ No newline at end of file diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/JSON.java new file mode 100644 index 000000000000..24ebd07afeb8 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/JSON.java @@ -0,0 +1,264 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.*; +import com.fasterxml.jackson.databind.json.JsonMapper; +import org.openapitools.jackson.nullable.JsonNullableModule; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import org.openapitools.client.model.*; + +import java.text.DateFormat; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:09:56.830832+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class JSON { + private ObjectMapper mapper; + + public JSON() { + mapper = JsonMapper.builder() + .serializationInclusion(JsonInclude.Include.NON_NULL) + .disable(MapperFeature.ALLOW_COERCION_OF_SCALARS) + .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE) + .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) + .enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING) + .enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING) + .defaultDateFormat(new RFC3339DateFormat()) + .addModule(new JavaTimeModule()) + .build(); + JsonNullableModule jnm = new JsonNullableModule(); + mapper.registerModule(jnm); + } + + /** + * Set the date format for JSON (de)serialization with Date properties. + * + * @param dateFormat Date format + */ + public void setDateFormat(DateFormat dateFormat) { + mapper.setDateFormat(dateFormat); + } + + /** + * Get the object mapper + * + * @return object mapper + */ + public ObjectMapper getMapper() { return mapper; } + + /** + * Returns the target model class that should be used to deserialize the input data. + * The discriminator mappings are used to determine the target model class. + * + * @param node The input data. + * @param modelClass The class that contains the discriminator mappings. + * + * @return the target model class. + */ + public static Class getClassForElement(JsonNode node, Class modelClass) { + ClassDiscriminatorMapping cdm = modelDiscriminators.get(modelClass); + if (cdm != null) { + return cdm.getClassForElement(node, new HashSet>()); + } + return null; + } + + /** + * Helper class to register the discriminator mappings. + */ + @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:09:56.830832+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") + private static class ClassDiscriminatorMapping { + // The model class name. + Class modelClass; + // The name of the discriminator property. + String discriminatorName; + // The discriminator mappings for a model class. + Map> discriminatorMappings; + + // Constructs a new class discriminator. + ClassDiscriminatorMapping(Class cls, String propertyName, Map> mappings) { + modelClass = cls; + discriminatorName = propertyName; + discriminatorMappings = new HashMap>(); + if (mappings != null) { + discriminatorMappings.putAll(mappings); + } + } + + // Return the name of the discriminator property for this model class. + String getDiscriminatorPropertyName() { + return discriminatorName; + } + + // Return the discriminator value or null if the discriminator is not + // present in the payload. + String getDiscriminatorValue(JsonNode node) { + // Determine the value of the discriminator property in the input data. + if (discriminatorName != null) { + // Get the value of the discriminator property, if present in the input payload. + node = node.get(discriminatorName); + if (node != null && node.isValueNode()) { + String discrValue = node.asText(); + if (discrValue != null) { + return discrValue; + } + } + } + return null; + } + + /** + * Returns the target model class that should be used to deserialize the input data. + * This function can be invoked for anyOf/oneOf composed models with discriminator mappings. + * The discriminator mappings are used to determine the target model class. + * + * @param node The input data. + * @param visitedClasses The set of classes that have already been visited. + * + * @return the target model class. + */ + Class getClassForElement(JsonNode node, Set> visitedClasses) { + if (visitedClasses.contains(modelClass)) { + // Class has already been visited. + return null; + } + // Determine the value of the discriminator property in the input data. + String discrValue = getDiscriminatorValue(node); + if (discrValue == null) { + return null; + } + Class cls = discriminatorMappings.get(discrValue); + // It may not be sufficient to return this cls directly because that target class + // may itself be a composed schema, possibly with its own discriminator. + visitedClasses.add(modelClass); + for (Class childClass : discriminatorMappings.values()) { + ClassDiscriminatorMapping childCdm = modelDiscriminators.get(childClass); + if (childCdm == null) { + continue; + } + if (!discriminatorName.equals(childCdm.discriminatorName)) { + discrValue = getDiscriminatorValue(node); + if (discrValue == null) { + continue; + } + } + if (childCdm != null) { + // Recursively traverse the discriminator mappings. + Class childDiscr = childCdm.getClassForElement(node, visitedClasses); + if (childDiscr != null) { + return childDiscr; + } + } + } + return cls; + } + } + + /** + * Returns true if inst is an instance of modelClass in the OpenAPI model hierarchy. + * + * The Java class hierarchy is not implemented the same way as the OpenAPI model hierarchy, + * so it's not possible to use the instanceof keyword. + * + * @param modelClass A OpenAPI model class. + * @param inst The instance object. + * @param visitedClasses The set of classes that have already been visited. + * + * @return true if inst is an instance of modelClass in the OpenAPI model hierarchy. + */ + public static boolean isInstanceOf(Class modelClass, Object inst, Set> visitedClasses) { + if (modelClass.isInstance(inst)) { + // This handles the 'allOf' use case with single parent inheritance. + return true; + } + if (visitedClasses.contains(modelClass)) { + // This is to prevent infinite recursion when the composed schemas have + // a circular dependency. + return false; + } + visitedClasses.add(modelClass); + + // Traverse the oneOf/anyOf composed schemas. + Map> descendants = modelDescendants.get(modelClass); + if (descendants != null) { + for (Class childType : descendants.values()) { + if (isInstanceOf(childType, inst, visitedClasses)) { + return true; + } + } + } + return false; + } + + /** + * A map of discriminators for all model classes. + */ + private static Map, ClassDiscriminatorMapping> modelDiscriminators = new HashMap<>(); + + /** + * A map of oneOf/anyOf descendants for each model class. + */ + private static Map, Map>> modelDescendants = new HashMap<>(); + + /** + * Register a model class discriminator. + * + * @param modelClass the model class + * @param discriminatorPropertyName the name of the discriminator property + * @param mappings a map with the discriminator mappings. + */ + public static void registerDiscriminator(Class modelClass, String discriminatorPropertyName, Map> mappings) { + ClassDiscriminatorMapping m = new ClassDiscriminatorMapping(modelClass, discriminatorPropertyName, mappings); + modelDiscriminators.put(modelClass, m); + } + + /** + * Register the oneOf/anyOf descendants of the modelClass. + * + * @param modelClass the model class + * @param descendants a map of oneOf/anyOf descendants. + */ + public static void registerDescendants(Class modelClass, Map> descendants) { + modelDescendants.put(modelClass, descendants); + } + + private static JSON json; + + static { + json = new JSON(); + } + + /** + * Get the default JSON instance. + * + * @return the default JSON instance + */ + public static JSON getDefault() { + return json; + } + + /** + * Set the default JSON instance. + * + * @param json JSON instance to be used + */ + public static void setDefault(JSON json) { + JSON.json = json; + } +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/Pair.java new file mode 100644 index 000000000000..a25bfacf0228 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/Pair.java @@ -0,0 +1,37 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:09:56.830832+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class Pair { + private final String name; + private final String value; + + public Pair(String name, String value) { + this.name = isValidString(name) ? name : ""; + this.value = isValidString(value) ? value : ""; + } + + public String getName() { + return this.name; + } + + public String getValue() { + return this.value; + } + + private static boolean isValidString(String arg) { + return arg != null; + } +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/RFC3339DateFormat.java b/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/RFC3339DateFormat.java new file mode 100644 index 000000000000..9e1ec51a5f8e --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/RFC3339DateFormat.java @@ -0,0 +1,58 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client; + +import com.fasterxml.jackson.databind.util.StdDateFormat; + +import java.text.DateFormat; +import java.text.FieldPosition; +import java.text.ParsePosition; +import java.util.Date; +import java.text.DecimalFormat; +import java.util.GregorianCalendar; +import java.util.TimeZone; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:09:56.830832+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class RFC3339DateFormat extends DateFormat { + private static final long serialVersionUID = 1L; + private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + + public RFC3339DateFormat() { + this.calendar = new GregorianCalendar(); + this.numberFormat = new DecimalFormat(); + } + + @Override + public Date parse(String source) { + return parse(source, new ParsePosition(0)); + } + + @Override + public Date parse(String source, ParsePosition pos) { + return fmt.parse(source, pos); + } + + @Override + public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { + return fmt.format(date, toAppendTo, fieldPosition); + } + + @Override + public Object clone() { + return super.clone(); + } +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/RFC3339InstantDeserializer.java b/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/RFC3339InstantDeserializer.java new file mode 100644 index 000000000000..f822913c3133 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/RFC3339InstantDeserializer.java @@ -0,0 +1,100 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client; + +import java.io.IOException; +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneId; +import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; +import java.time.temporal.Temporal; +import java.time.temporal.TemporalAccessor; +import java.util.function.BiFunction; +import java.util.function.Function; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeFeature; +import com.fasterxml.jackson.datatype.jsr310.deser.InstantDeserializer; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:09:56.830832+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class RFC3339InstantDeserializer extends InstantDeserializer { + private static final long serialVersionUID = 1L; + private final static boolean DEFAULT_NORMALIZE_ZONE_ID = JavaTimeFeature.NORMALIZE_DESERIALIZED_ZONE_ID.enabledByDefault(); + private final static boolean DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS + = JavaTimeFeature.ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS.enabledByDefault(); + + public static final RFC3339InstantDeserializer INSTANT = new RFC3339InstantDeserializer<>( + Instant.class, DateTimeFormatter.ISO_INSTANT, + Instant::from, + a -> Instant.ofEpochMilli( a.value ), + a -> Instant.ofEpochSecond( a.integer, a.fraction ), + null, + true, // yes, replace zero offset with Z + DEFAULT_NORMALIZE_ZONE_ID, + DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS + ); + + public static final RFC3339InstantDeserializer OFFSET_DATE_TIME = new RFC3339InstantDeserializer<>( + OffsetDateTime.class, DateTimeFormatter.ISO_OFFSET_DATE_TIME, + OffsetDateTime::from, + a -> OffsetDateTime.ofInstant( Instant.ofEpochMilli( a.value ), a.zoneId ), + a -> OffsetDateTime.ofInstant( Instant.ofEpochSecond( a.integer, a.fraction ), a.zoneId ), + (d, z) -> ( d.isEqual( OffsetDateTime.MIN ) || d.isEqual( OffsetDateTime.MAX ) ? + d : + d.withOffsetSameInstant( z.getRules().getOffset( d.toLocalDateTime() ) ) ), + true, // yes, replace zero offset with Z + DEFAULT_NORMALIZE_ZONE_ID, + DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS + ); + + public static final RFC3339InstantDeserializer ZONED_DATE_TIME = new RFC3339InstantDeserializer<>( + ZonedDateTime.class, DateTimeFormatter.ISO_ZONED_DATE_TIME, + ZonedDateTime::from, + a -> ZonedDateTime.ofInstant( Instant.ofEpochMilli( a.value ), a.zoneId ), + a -> ZonedDateTime.ofInstant( Instant.ofEpochSecond( a.integer, a.fraction ), a.zoneId ), + ZonedDateTime::withZoneSameInstant, + false, // keep zero offset and Z separate since zones explicitly supported + DEFAULT_NORMALIZE_ZONE_ID, + DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS + ); + + protected RFC3339InstantDeserializer( + Class supportedType, + DateTimeFormatter formatter, + Function parsedToValue, + Function fromMilliseconds, + Function fromNanoseconds, + BiFunction adjust, + boolean replaceZeroOffsetAsZ, + boolean normalizeZoneId, + boolean readNumericStringsAsTimestamp) { + super( + supportedType, + formatter, + parsedToValue, + fromMilliseconds, + fromNanoseconds, + adjust, + replaceZeroOffsetAsZ, + normalizeZoneId, + readNumericStringsAsTimestamp + ); + } + + @Override + protected T _fromString(JsonParser p, DeserializationContext ctxt, String string0) throws IOException { + return super._fromString(p, ctxt, string0.replace( ' ', 'T' )); + } +} \ No newline at end of file diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/RFC3339JavaTimeModule.java b/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/RFC3339JavaTimeModule.java new file mode 100644 index 000000000000..3f00b05afebd --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/RFC3339JavaTimeModule.java @@ -0,0 +1,32 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client; + +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZonedDateTime; + +import com.fasterxml.jackson.databind.module.SimpleModule; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:09:56.830832+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class RFC3339JavaTimeModule extends SimpleModule { + private static final long serialVersionUID = 1L; + + public RFC3339JavaTimeModule() { + super("RFC3339JavaTimeModule"); + + addDeserializer(Instant.class, RFC3339InstantDeserializer.INSTANT); + addDeserializer(OffsetDateTime.class, RFC3339InstantDeserializer.OFFSET_DATE_TIME); + addDeserializer(ZonedDateTime.class, RFC3339InstantDeserializer.ZONED_DATE_TIME); + } +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/ServerConfiguration.java new file mode 100644 index 000000000000..c4b9d58bd5a7 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -0,0 +1,72 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +import java.util.Map; + +/** + * Representing a Server configuration. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:09:56.830832+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class ServerConfiguration { + public String URL; + public String description; + public Map variables; + + /** + * @param URL A URL to the target host. + * @param description A description of the host designated by the URL. + * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. + */ + public ServerConfiguration(String URL, String description, Map variables) { + this.URL = URL; + this.description = description; + this.variables = variables; + } + + /** + * Format URL template using given variables. + * + * @param variables A map between a variable name and its value. + * @return Formatted URL. + */ + public String URL(Map variables) { + String url = this.URL; + + // go through variables and replace placeholders + for (Map.Entry variable: this.variables.entrySet()) { + String name = variable.getKey(); + ServerVariable serverVariable = variable.getValue(); + String value = serverVariable.defaultValue; + + if (variables != null && variables.containsKey(name)) { + value = variables.get(name); + if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) { + throw new IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + "."); + } + } + url = url.replace("{" + name + "}", value); + } + return url; + } + + /** + * Format URL template using default server variables. + * + * @return Formatted URL. + */ + public String URL() { + return URL(null); + } +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/ServerVariable.java new file mode 100644 index 000000000000..30dc73830abf --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/ServerVariable.java @@ -0,0 +1,37 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +import java.util.HashSet; + +/** + * Representing a Server Variable for server URL template substitution. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:09:56.830832+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class ServerVariable { + public String description; + public String defaultValue; + public HashSet enumValues = null; + + /** + * @param description A description for the server variable. + * @param defaultValue The default value to use for substitution. + * @param enumValues An enumeration of string values to be used if the substitution options are from a limited set. + */ + public ServerVariable(String description, String defaultValue, HashSet enumValues) { + this.description = description; + this.defaultValue = defaultValue; + this.enumValues = enumValues; + } +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/api/PetApi.java new file mode 100644 index 000000000000..4a7d64d51bd5 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/api/PetApi.java @@ -0,0 +1,1110 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client.api; + +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; + +import java.io.File; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.Pet; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; + +import org.apache.http.HttpEntity; +import org.apache.http.NameValuePair; +import org.apache.http.entity.mime.MultipartEntityBuilder; +import org.apache.http.message.BasicNameValuePair; +import org.apache.http.client.entity.UrlEncodedFormEntity; + +import java.io.InputStream; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.OutputStream; +import java.net.http.HttpRequest; +import java.nio.channels.Channels; +import java.nio.channels.Pipe; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.time.Duration; + +import java.util.ArrayList; +import java.util.StringJoiner; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.function.Consumer; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:09:56.830832+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class PetApi { + private final HttpClient memberVarHttpClient; + private final ObjectMapper memberVarObjectMapper; + private final String memberVarBaseUri; + private final Consumer memberVarInterceptor; + private final Duration memberVarReadTimeout; + private final Consumer> memberVarResponseInterceptor; + private final Consumer> memberVarAsyncResponseInterceptor; + + public PetApi() { + this(Configuration.getDefaultApiClient()); + } + + public PetApi(ApiClient apiClient) { + memberVarHttpClient = apiClient.getHttpClient(); + memberVarObjectMapper = apiClient.getObjectMapper(); + memberVarBaseUri = apiClient.getBaseUri(); + memberVarInterceptor = apiClient.getRequestInterceptor(); + memberVarReadTimeout = apiClient.getReadTimeout(); + memberVarResponseInterceptor = apiClient.getResponseInterceptor(); + memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); + } + + + protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { + String body = response.body() == null ? null : new String(response.body().readAllBytes()); + String message = formatExceptionMessage(operationId, response.statusCode(), body); + return new ApiException(response.statusCode(), message, response.headers(), body); + } + + private String formatExceptionMessage(String operationId, int statusCode, String body) { + if (body == null || body.isEmpty()) { + body = "[no body]"; + } + return operationId + " call failed with: " + statusCode + " - " + body; + } + + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store (required) + * @return Pet + * @throws ApiException if fails to make API call + */ + public Pet addPet(@javax.annotation.Nonnull Pet pet) throws ApiException { + return addPet(pet, null); + } + + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store (required) + * @param headers Optional headers to include in the request + * @return Pet + * @throws ApiException if fails to make API call + */ + public Pet addPet(@javax.annotation.Nonnull Pet pet, Map headers) throws ApiException { + ApiResponse localVarResponse = addPetWithHttpInfo(pet, headers); + return localVarResponse.getData(); + } + + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store (required) + * @return ApiResponse<Pet> + * @throws ApiException if fails to make API call + */ + public ApiResponse addPetWithHttpInfo(@javax.annotation.Nonnull Pet pet) throws ApiException { + return addPetWithHttpInfo(pet, null); + } + + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Pet> + * @throws ApiException if fails to make API call + */ + public ApiResponse addPetWithHttpInfo(@javax.annotation.Nonnull Pet pet, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = addPetRequestBuilder(pet, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("addPet", localVarResponse); + } + if (localVarResponse.body() == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + String responseBody = new String(localVarResponse.body().readAllBytes()); + localVarResponse.body().close(); + + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}) + ); + } finally { + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder addPetRequestBuilder(@javax.annotation.Nonnull Pet pet, Map headers) throws ApiException { + // verify the required parameter 'pet' is set + if (pet == null) { + throw new ApiException(400, "Missing the required parameter 'pet' when calling addPet"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/pet"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/xml, application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(pet); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @throws ApiException if fails to make API call + */ + public void deletePet(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey) throws ApiException { + deletePet(petId, apiKey, null); + } + + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void deletePet(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, Map headers) throws ApiException { + deletePetWithHttpInfo(petId, apiKey, headers); + } + + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse deletePetWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey) throws ApiException { + return deletePetWithHttpInfo(petId, apiKey, null); + } + + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse deletePetWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = deletePetRequestBuilder(petId, apiKey, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("deletePet", localVarResponse); + } + return new ApiResponse<>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } finally { + // Drain the InputStream + while (localVarResponse.body().read() != -1) { + // Ignore + } + localVarResponse.body().close(); + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder deletePetRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, Map headers) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException(400, "Missing the required parameter 'petId' when calling deletePet"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/pet/{petId}" + .replace("{petId}", ApiClient.urlEncode(petId.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + if (apiKey != null) { + localVarRequestBuilder.header("api_key", apiKey.toString()); + } + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("DELETE", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Finds Pets by status + * Multiple status values can be provided with comma separated strings + * @param status Status values that need to be considered for filter (required) + * @return List<Pet> + * @throws ApiException if fails to make API call + */ + public List findPetsByStatus(@javax.annotation.Nonnull List status) throws ApiException { + return findPetsByStatus(status, null); + } + + /** + * Finds Pets by status + * Multiple status values can be provided with comma separated strings + * @param status Status values that need to be considered for filter (required) + * @param headers Optional headers to include in the request + * @return List<Pet> + * @throws ApiException if fails to make API call + */ + public List findPetsByStatus(@javax.annotation.Nonnull List status, Map headers) throws ApiException { + ApiResponse> localVarResponse = findPetsByStatusWithHttpInfo(status, headers); + return localVarResponse.getData(); + } + + /** + * Finds Pets by status + * Multiple status values can be provided with comma separated strings + * @param status Status values that need to be considered for filter (required) + * @return ApiResponse<List<Pet>> + * @throws ApiException if fails to make API call + */ + public ApiResponse> findPetsByStatusWithHttpInfo(@javax.annotation.Nonnull List status) throws ApiException { + return findPetsByStatusWithHttpInfo(status, null); + } + + /** + * Finds Pets by status + * Multiple status values can be provided with comma separated strings + * @param status Status values that need to be considered for filter (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<List<Pet>> + * @throws ApiException if fails to make API call + */ + public ApiResponse> findPetsByStatusWithHttpInfo(@javax.annotation.Nonnull List status, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = findPetsByStatusRequestBuilder(status, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("findPetsByStatus", localVarResponse); + } + if (localVarResponse.body() == null) { + return new ApiResponse>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + String responseBody = new String(localVarResponse.body().readAllBytes()); + localVarResponse.body().close(); + + return new ApiResponse>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference>() {}) + ); + } finally { + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder findPetsByStatusRequestBuilder(@javax.annotation.Nonnull List status, Map headers) throws ApiException { + // verify the required parameter 'status' is set + if (status == null) { + throw new ApiException(400, "Missing the required parameter 'status' when calling findPetsByStatus"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/pet/findByStatus"; + + List localVarQueryParams = new ArrayList<>(); + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + localVarQueryParameterBaseName = "status"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("csv", "status", status)); + + if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) { + StringJoiner queryJoiner = new StringJoiner("&"); + localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue())); + if (localVarQueryStringJoiner.length() != 0) { + queryJoiner.add(localVarQueryStringJoiner.toString()); + } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } + + localVarRequestBuilder.header("Accept", "application/xml, application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) + * @return List<Pet> + * @throws ApiException if fails to make API call + * @deprecated + */ + @Deprecated + public List findPetsByTags(@javax.annotation.Nonnull List tags) throws ApiException { + return findPetsByTags(tags, null); + } + + /** + * Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) + * @param headers Optional headers to include in the request + * @return List<Pet> + * @throws ApiException if fails to make API call + * @deprecated + */ + @Deprecated + public List findPetsByTags(@javax.annotation.Nonnull List tags, Map headers) throws ApiException { + ApiResponse> localVarResponse = findPetsByTagsWithHttpInfo(tags, headers); + return localVarResponse.getData(); + } + + /** + * Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) + * @return ApiResponse<List<Pet>> + * @throws ApiException if fails to make API call + * @deprecated + */ + @Deprecated + public ApiResponse> findPetsByTagsWithHttpInfo(@javax.annotation.Nonnull List tags) throws ApiException { + return findPetsByTagsWithHttpInfo(tags, null); + } + + /** + * Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<List<Pet>> + * @throws ApiException if fails to make API call + * @deprecated + */ + @Deprecated + public ApiResponse> findPetsByTagsWithHttpInfo(@javax.annotation.Nonnull List tags, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = findPetsByTagsRequestBuilder(tags, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("findPetsByTags", localVarResponse); + } + if (localVarResponse.body() == null) { + return new ApiResponse>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + String responseBody = new String(localVarResponse.body().readAllBytes()); + localVarResponse.body().close(); + + return new ApiResponse>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference>() {}) + ); + } finally { + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder findPetsByTagsRequestBuilder(@javax.annotation.Nonnull List tags, Map headers) throws ApiException { + // verify the required parameter 'tags' is set + if (tags == null) { + throw new ApiException(400, "Missing the required parameter 'tags' when calling findPetsByTags"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/pet/findByTags"; + + List localVarQueryParams = new ArrayList<>(); + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + localVarQueryParameterBaseName = "tags"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("csv", "tags", tags)); + + if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) { + StringJoiner queryJoiner = new StringJoiner("&"); + localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue())); + if (localVarQueryStringJoiner.length() != 0) { + queryJoiner.add(localVarQueryStringJoiner.toString()); + } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } + + localVarRequestBuilder.header("Accept", "application/xml, application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @return Pet + * @throws ApiException if fails to make API call + */ + public Pet getPetById(@javax.annotation.Nonnull Long petId) throws ApiException { + return getPetById(petId, null); + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @param headers Optional headers to include in the request + * @return Pet + * @throws ApiException if fails to make API call + */ + public Pet getPetById(@javax.annotation.Nonnull Long petId, Map headers) throws ApiException { + ApiResponse localVarResponse = getPetByIdWithHttpInfo(petId, headers); + return localVarResponse.getData(); + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @return ApiResponse<Pet> + * @throws ApiException if fails to make API call + */ + public ApiResponse getPetByIdWithHttpInfo(@javax.annotation.Nonnull Long petId) throws ApiException { + return getPetByIdWithHttpInfo(petId, null); + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Pet> + * @throws ApiException if fails to make API call + */ + public ApiResponse getPetByIdWithHttpInfo(@javax.annotation.Nonnull Long petId, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = getPetByIdRequestBuilder(petId, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("getPetById", localVarResponse); + } + if (localVarResponse.body() == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + String responseBody = new String(localVarResponse.body().readAllBytes()); + localVarResponse.body().close(); + + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}) + ); + } finally { + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder getPetByIdRequestBuilder(@javax.annotation.Nonnull Long petId, Map headers) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetById"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/pet/{petId}" + .replace("{petId}", ApiClient.urlEncode(petId.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/xml, application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store (required) + * @return Pet + * @throws ApiException if fails to make API call + */ + public Pet updatePet(@javax.annotation.Nonnull Pet pet) throws ApiException { + return updatePet(pet, null); + } + + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store (required) + * @param headers Optional headers to include in the request + * @return Pet + * @throws ApiException if fails to make API call + */ + public Pet updatePet(@javax.annotation.Nonnull Pet pet, Map headers) throws ApiException { + ApiResponse localVarResponse = updatePetWithHttpInfo(pet, headers); + return localVarResponse.getData(); + } + + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store (required) + * @return ApiResponse<Pet> + * @throws ApiException if fails to make API call + */ + public ApiResponse updatePetWithHttpInfo(@javax.annotation.Nonnull Pet pet) throws ApiException { + return updatePetWithHttpInfo(pet, null); + } + + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Pet> + * @throws ApiException if fails to make API call + */ + public ApiResponse updatePetWithHttpInfo(@javax.annotation.Nonnull Pet pet, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = updatePetRequestBuilder(pet, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("updatePet", localVarResponse); + } + if (localVarResponse.body() == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + String responseBody = new String(localVarResponse.body().readAllBytes()); + localVarResponse.body().close(); + + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}) + ); + } finally { + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder updatePetRequestBuilder(@javax.annotation.Nonnull Pet pet, Map headers) throws ApiException { + // verify the required parameter 'pet' is set + if (pet == null) { + throw new ApiException(400, "Missing the required parameter 'pet' when calling updatePet"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/pet"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/xml, application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(pet); + localVarRequestBuilder.method("PUT", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @throws ApiException if fails to make API call + */ + public void updatePetWithForm(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status) throws ApiException { + updatePetWithForm(petId, name, status, null); + } + + /** + * Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void updatePetWithForm(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, Map headers) throws ApiException { + updatePetWithFormWithHttpInfo(petId, name, status, headers); + } + + /** + * Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse updatePetWithFormWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status) throws ApiException { + return updatePetWithFormWithHttpInfo(petId, name, status, null); + } + + /** + * Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse updatePetWithFormWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = updatePetWithFormRequestBuilder(petId, name, status, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("updatePetWithForm", localVarResponse); + } + return new ApiResponse<>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } finally { + // Drain the InputStream + while (localVarResponse.body().read() != -1) { + // Ignore + } + localVarResponse.body().close(); + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder updatePetWithFormRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, Map headers) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException(400, "Missing the required parameter 'petId' when calling updatePetWithForm"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/pet/{petId}" + .replace("{petId}", ApiClient.urlEncode(petId.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/json"); + + List formValues = new ArrayList<>(); + if (name != null) { + formValues.add(new BasicNameValuePair("name", name.toString())); + } + if (status != null) { + formValues.add(new BasicNameValuePair("status", status.toString())); + } + HttpEntity entity = new UrlEncodedFormEntity(formValues, java.nio.charset.StandardCharsets.UTF_8); + ByteArrayOutputStream formOutputStream = new ByteArrayOutputStream(); + try { + entity.writeTo(formOutputStream); + } catch (IOException e) { + throw new RuntimeException(e); + } + localVarRequestBuilder + .header("Content-Type", entity.getContentType().getValue()) + .method("POST", HttpRequest.BodyPublishers + .ofInputStream(() -> new ByteArrayInputStream(formOutputStream.toByteArray()))); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @return ModelApiResponse + * @throws ApiException if fails to make API call + */ + public ModelApiResponse uploadFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { + return uploadFile(petId, additionalMetadata, _file, null); + } + + /** + * uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @param headers Optional headers to include in the request + * @return ModelApiResponse + * @throws ApiException if fails to make API call + */ + public ModelApiResponse uploadFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, Map headers) throws ApiException { + ApiResponse localVarResponse = uploadFileWithHttpInfo(petId, additionalMetadata, _file, headers); + return localVarResponse.getData(); + } + + /** + * uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @return ApiResponse<ModelApiResponse> + * @throws ApiException if fails to make API call + */ + public ApiResponse uploadFileWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { + return uploadFileWithHttpInfo(petId, additionalMetadata, _file, null); + } + + /** + * uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<ModelApiResponse> + * @throws ApiException if fails to make API call + */ + public ApiResponse uploadFileWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = uploadFileRequestBuilder(petId, additionalMetadata, _file, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("uploadFile", localVarResponse); + } + if (localVarResponse.body() == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + String responseBody = new String(localVarResponse.body().readAllBytes()); + localVarResponse.body().close(); + + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}) + ); + } finally { + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder uploadFileRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, Map headers) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFile"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/pet/{petId}/uploadImage" + .replace("{petId}", ApiClient.urlEncode(petId.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/json"); + + MultipartEntityBuilder multiPartBuilder = MultipartEntityBuilder.create(); + boolean hasFiles = false; + if (additionalMetadata != null) { + multiPartBuilder.addTextBody("additionalMetadata", additionalMetadata.toString()); + } + multiPartBuilder.addBinaryBody("file", _file); + hasFiles = true; + HttpEntity entity = multiPartBuilder.build(); + HttpRequest.BodyPublisher formDataPublisher; + if (hasFiles) { + Pipe pipe; + try { + pipe = Pipe.open(); + } catch (IOException e) { + throw new RuntimeException(e); + } + new Thread(() -> { + try (OutputStream outputStream = Channels.newOutputStream(pipe.sink())) { + entity.writeTo(outputStream); + } catch (IOException e) { + e.printStackTrace(); + } + }).start(); + formDataPublisher = HttpRequest.BodyPublishers.ofInputStream(() -> Channels.newInputStream(pipe.source())); + } else { + ByteArrayOutputStream formOutputStream = new ByteArrayOutputStream(); + try { + entity.writeTo(formOutputStream); + } catch (IOException e) { + throw new RuntimeException(e); + } + formDataPublisher = HttpRequest.BodyPublishers + .ofInputStream(() -> new ByteArrayInputStream(formOutputStream.toByteArray())); + } + localVarRequestBuilder + .header("Content-Type", entity.getContentType().getValue()) + .method("POST", formDataPublisher); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/api/StoreApi.java new file mode 100644 index 000000000000..63a40aa0e047 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/api/StoreApi.java @@ -0,0 +1,535 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client.api; + +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; + +import org.openapitools.client.model.Order; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; + +import org.apache.http.HttpEntity; +import org.apache.http.NameValuePair; +import org.apache.http.entity.mime.MultipartEntityBuilder; +import org.apache.http.message.BasicNameValuePair; +import org.apache.http.client.entity.UrlEncodedFormEntity; + +import java.io.InputStream; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.OutputStream; +import java.net.http.HttpRequest; +import java.nio.channels.Channels; +import java.nio.channels.Pipe; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.time.Duration; + +import java.util.ArrayList; +import java.util.StringJoiner; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.function.Consumer; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:09:56.830832+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class StoreApi { + private final HttpClient memberVarHttpClient; + private final ObjectMapper memberVarObjectMapper; + private final String memberVarBaseUri; + private final Consumer memberVarInterceptor; + private final Duration memberVarReadTimeout; + private final Consumer> memberVarResponseInterceptor; + private final Consumer> memberVarAsyncResponseInterceptor; + + public StoreApi() { + this(Configuration.getDefaultApiClient()); + } + + public StoreApi(ApiClient apiClient) { + memberVarHttpClient = apiClient.getHttpClient(); + memberVarObjectMapper = apiClient.getObjectMapper(); + memberVarBaseUri = apiClient.getBaseUri(); + memberVarInterceptor = apiClient.getRequestInterceptor(); + memberVarReadTimeout = apiClient.getReadTimeout(); + memberVarResponseInterceptor = apiClient.getResponseInterceptor(); + memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); + } + + + protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { + String body = response.body() == null ? null : new String(response.body().readAllBytes()); + String message = formatExceptionMessage(operationId, response.statusCode(), body); + return new ApiException(response.statusCode(), message, response.headers(), body); + } + + private String formatExceptionMessage(String operationId, int statusCode, String body) { + if (body == null || body.isEmpty()) { + body = "[no body]"; + } + return operationId + " call failed with: " + statusCode + " - " + body; + } + + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted (required) + * @throws ApiException if fails to make API call + */ + public void deleteOrder(@javax.annotation.Nonnull String orderId) throws ApiException { + deleteOrder(orderId, null); + } + + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted (required) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void deleteOrder(@javax.annotation.Nonnull String orderId, Map headers) throws ApiException { + deleteOrderWithHttpInfo(orderId, headers); + } + + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse deleteOrderWithHttpInfo(@javax.annotation.Nonnull String orderId) throws ApiException { + return deleteOrderWithHttpInfo(orderId, null); + } + + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse deleteOrderWithHttpInfo(@javax.annotation.Nonnull String orderId, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = deleteOrderRequestBuilder(orderId, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("deleteOrder", localVarResponse); + } + return new ApiResponse<>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } finally { + // Drain the InputStream + while (localVarResponse.body().read() != -1) { + // Ignore + } + localVarResponse.body().close(); + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder deleteOrderRequestBuilder(@javax.annotation.Nonnull String orderId, Map headers) throws ApiException { + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/store/order/{orderId}" + .replace("{orderId}", ApiClient.urlEncode(orderId.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("DELETE", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @return Map<String, Integer> + * @throws ApiException if fails to make API call + */ + public Map getInventory() throws ApiException { + return getInventory(null); + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @param headers Optional headers to include in the request + * @return Map<String, Integer> + * @throws ApiException if fails to make API call + */ + public Map getInventory(Map headers) throws ApiException { + ApiResponse> localVarResponse = getInventoryWithHttpInfo(headers); + return localVarResponse.getData(); + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @return ApiResponse<Map<String, Integer>> + * @throws ApiException if fails to make API call + */ + public ApiResponse> getInventoryWithHttpInfo() throws ApiException { + return getInventoryWithHttpInfo(null); + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @param headers Optional headers to include in the request + * @return ApiResponse<Map<String, Integer>> + * @throws ApiException if fails to make API call + */ + public ApiResponse> getInventoryWithHttpInfo(Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = getInventoryRequestBuilder(headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("getInventory", localVarResponse); + } + if (localVarResponse.body() == null) { + return new ApiResponse>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + String responseBody = new String(localVarResponse.body().readAllBytes()); + localVarResponse.body().close(); + + return new ApiResponse>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference>() {}) + ); + } finally { + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder getInventoryRequestBuilder(Map headers) throws ApiException { + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/store/inventory"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @return Order + * @throws ApiException if fails to make API call + */ + public Order getOrderById(@javax.annotation.Nonnull Long orderId) throws ApiException { + return getOrderById(orderId, null); + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @param headers Optional headers to include in the request + * @return Order + * @throws ApiException if fails to make API call + */ + public Order getOrderById(@javax.annotation.Nonnull Long orderId, Map headers) throws ApiException { + ApiResponse localVarResponse = getOrderByIdWithHttpInfo(orderId, headers); + return localVarResponse.getData(); + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @return ApiResponse<Order> + * @throws ApiException if fails to make API call + */ + public ApiResponse getOrderByIdWithHttpInfo(@javax.annotation.Nonnull Long orderId) throws ApiException { + return getOrderByIdWithHttpInfo(orderId, null); + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Order> + * @throws ApiException if fails to make API call + */ + public ApiResponse getOrderByIdWithHttpInfo(@javax.annotation.Nonnull Long orderId, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = getOrderByIdRequestBuilder(orderId, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("getOrderById", localVarResponse); + } + if (localVarResponse.body() == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + String responseBody = new String(localVarResponse.body().readAllBytes()); + localVarResponse.body().close(); + + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}) + ); + } finally { + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder getOrderByIdRequestBuilder(@javax.annotation.Nonnull Long orderId, Map headers) throws ApiException { + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/store/order/{orderId}" + .replace("{orderId}", ApiClient.urlEncode(orderId.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/xml, application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @return Order + * @throws ApiException if fails to make API call + */ + public Order placeOrder(@javax.annotation.Nonnull Order order) throws ApiException { + return placeOrder(order, null); + } + + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @param headers Optional headers to include in the request + * @return Order + * @throws ApiException if fails to make API call + */ + public Order placeOrder(@javax.annotation.Nonnull Order order, Map headers) throws ApiException { + ApiResponse localVarResponse = placeOrderWithHttpInfo(order, headers); + return localVarResponse.getData(); + } + + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @return ApiResponse<Order> + * @throws ApiException if fails to make API call + */ + public ApiResponse placeOrderWithHttpInfo(@javax.annotation.Nonnull Order order) throws ApiException { + return placeOrderWithHttpInfo(order, null); + } + + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Order> + * @throws ApiException if fails to make API call + */ + public ApiResponse placeOrderWithHttpInfo(@javax.annotation.Nonnull Order order, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = placeOrderRequestBuilder(order, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("placeOrder", localVarResponse); + } + if (localVarResponse.body() == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + String responseBody = new String(localVarResponse.body().readAllBytes()); + localVarResponse.body().close(); + + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}) + ); + } finally { + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder placeOrderRequestBuilder(@javax.annotation.Nonnull Order order, Map headers) throws ApiException { + // verify the required parameter 'order' is set + if (order == null) { + throw new ApiException(400, "Missing the required parameter 'order' when calling placeOrder"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/store/order"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/xml, application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(order); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/api/UserApi.java new file mode 100644 index 000000000000..636380546e71 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/api/UserApi.java @@ -0,0 +1,995 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client.api; + +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; + +import java.time.OffsetDateTime; +import org.openapitools.client.model.User; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; + +import org.apache.http.HttpEntity; +import org.apache.http.NameValuePair; +import org.apache.http.entity.mime.MultipartEntityBuilder; +import org.apache.http.message.BasicNameValuePair; +import org.apache.http.client.entity.UrlEncodedFormEntity; + +import java.io.InputStream; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.OutputStream; +import java.net.http.HttpRequest; +import java.nio.channels.Channels; +import java.nio.channels.Pipe; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.time.Duration; + +import java.util.ArrayList; +import java.util.StringJoiner; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.function.Consumer; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:09:56.830832+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class UserApi { + private final HttpClient memberVarHttpClient; + private final ObjectMapper memberVarObjectMapper; + private final String memberVarBaseUri; + private final Consumer memberVarInterceptor; + private final Duration memberVarReadTimeout; + private final Consumer> memberVarResponseInterceptor; + private final Consumer> memberVarAsyncResponseInterceptor; + + public UserApi() { + this(Configuration.getDefaultApiClient()); + } + + public UserApi(ApiClient apiClient) { + memberVarHttpClient = apiClient.getHttpClient(); + memberVarObjectMapper = apiClient.getObjectMapper(); + memberVarBaseUri = apiClient.getBaseUri(); + memberVarInterceptor = apiClient.getRequestInterceptor(); + memberVarReadTimeout = apiClient.getReadTimeout(); + memberVarResponseInterceptor = apiClient.getResponseInterceptor(); + memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); + } + + + protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { + String body = response.body() == null ? null : new String(response.body().readAllBytes()); + String message = formatExceptionMessage(operationId, response.statusCode(), body); + return new ApiException(response.statusCode(), message, response.headers(), body); + } + + private String formatExceptionMessage(String operationId, int statusCode, String body) { + if (body == null || body.isEmpty()) { + body = "[no body]"; + } + return operationId + " call failed with: " + statusCode + " - " + body; + } + + /** + * Create user + * This can only be done by the logged in user. + * @param user Created user object (required) + * @throws ApiException if fails to make API call + */ + public void createUser(@javax.annotation.Nonnull User user) throws ApiException { + createUser(user, null); + } + + /** + * Create user + * This can only be done by the logged in user. + * @param user Created user object (required) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void createUser(@javax.annotation.Nonnull User user, Map headers) throws ApiException { + createUserWithHttpInfo(user, headers); + } + + /** + * Create user + * This can only be done by the logged in user. + * @param user Created user object (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse createUserWithHttpInfo(@javax.annotation.Nonnull User user) throws ApiException { + return createUserWithHttpInfo(user, null); + } + + /** + * Create user + * This can only be done by the logged in user. + * @param user Created user object (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse createUserWithHttpInfo(@javax.annotation.Nonnull User user, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = createUserRequestBuilder(user, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("createUser", localVarResponse); + } + return new ApiResponse<>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } finally { + // Drain the InputStream + while (localVarResponse.body().read() != -1) { + // Ignore + } + localVarResponse.body().close(); + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder createUserRequestBuilder(@javax.annotation.Nonnull User user, Map headers) throws ApiException { + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException(400, "Missing the required parameter 'user' when calling createUser"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/user"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(user); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @throws ApiException if fails to make API call + */ + public void createUsersWithArrayInput(@javax.annotation.Nonnull List user) throws ApiException { + createUsersWithArrayInput(user, null); + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void createUsersWithArrayInput(@javax.annotation.Nonnull List user, Map headers) throws ApiException { + createUsersWithArrayInputWithHttpInfo(user, headers); + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse createUsersWithArrayInputWithHttpInfo(@javax.annotation.Nonnull List user) throws ApiException { + return createUsersWithArrayInputWithHttpInfo(user, null); + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse createUsersWithArrayInputWithHttpInfo(@javax.annotation.Nonnull List user, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = createUsersWithArrayInputRequestBuilder(user, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("createUsersWithArrayInput", localVarResponse); + } + return new ApiResponse<>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } finally { + // Drain the InputStream + while (localVarResponse.body().read() != -1) { + // Ignore + } + localVarResponse.body().close(); + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder createUsersWithArrayInputRequestBuilder(@javax.annotation.Nonnull List user, Map headers) throws ApiException { + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithArrayInput"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/user/createWithArray"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(user); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @throws ApiException if fails to make API call + */ + public void createUsersWithListInput(@javax.annotation.Nonnull List user) throws ApiException { + createUsersWithListInput(user, null); + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void createUsersWithListInput(@javax.annotation.Nonnull List user, Map headers) throws ApiException { + createUsersWithListInputWithHttpInfo(user, headers); + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse createUsersWithListInputWithHttpInfo(@javax.annotation.Nonnull List user) throws ApiException { + return createUsersWithListInputWithHttpInfo(user, null); + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse createUsersWithListInputWithHttpInfo(@javax.annotation.Nonnull List user, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = createUsersWithListInputRequestBuilder(user, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("createUsersWithListInput", localVarResponse); + } + return new ApiResponse<>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } finally { + // Drain the InputStream + while (localVarResponse.body().read() != -1) { + // Ignore + } + localVarResponse.body().close(); + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder createUsersWithListInputRequestBuilder(@javax.annotation.Nonnull List user, Map headers) throws ApiException { + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithListInput"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/user/createWithList"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(user); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @throws ApiException if fails to make API call + */ + public void deleteUser(@javax.annotation.Nonnull String username) throws ApiException { + deleteUser(username, null); + } + + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void deleteUser(@javax.annotation.Nonnull String username, Map headers) throws ApiException { + deleteUserWithHttpInfo(username, headers); + } + + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse deleteUserWithHttpInfo(@javax.annotation.Nonnull String username) throws ApiException { + return deleteUserWithHttpInfo(username, null); + } + + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse deleteUserWithHttpInfo(@javax.annotation.Nonnull String username, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = deleteUserRequestBuilder(username, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("deleteUser", localVarResponse); + } + return new ApiResponse<>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } finally { + // Drain the InputStream + while (localVarResponse.body().read() != -1) { + // Ignore + } + localVarResponse.body().close(); + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder deleteUserRequestBuilder(@javax.annotation.Nonnull String username, Map headers) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException(400, "Missing the required parameter 'username' when calling deleteUser"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/user/{username}" + .replace("{username}", ApiClient.urlEncode(username.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("DELETE", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return User + * @throws ApiException if fails to make API call + */ + public User getUserByName(@javax.annotation.Nonnull String username) throws ApiException { + return getUserByName(username, null); + } + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @param headers Optional headers to include in the request + * @return User + * @throws ApiException if fails to make API call + */ + public User getUserByName(@javax.annotation.Nonnull String username, Map headers) throws ApiException { + ApiResponse localVarResponse = getUserByNameWithHttpInfo(username, headers); + return localVarResponse.getData(); + } + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return ApiResponse<User> + * @throws ApiException if fails to make API call + */ + public ApiResponse getUserByNameWithHttpInfo(@javax.annotation.Nonnull String username) throws ApiException { + return getUserByNameWithHttpInfo(username, null); + } + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<User> + * @throws ApiException if fails to make API call + */ + public ApiResponse getUserByNameWithHttpInfo(@javax.annotation.Nonnull String username, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = getUserByNameRequestBuilder(username, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("getUserByName", localVarResponse); + } + if (localVarResponse.body() == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + String responseBody = new String(localVarResponse.body().readAllBytes()); + localVarResponse.body().close(); + + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}) + ); + } finally { + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder getUserByNameRequestBuilder(@javax.annotation.Nonnull String username, Map headers) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException(400, "Missing the required parameter 'username' when calling getUserByName"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/user/{username}" + .replace("{username}", ApiClient.urlEncode(username.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/xml, application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @return String + * @throws ApiException if fails to make API call + */ + public String loginUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException { + return loginUser(username, password, null); + } + + /** + * Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @param headers Optional headers to include in the request + * @return String + * @throws ApiException if fails to make API call + */ + public String loginUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, Map headers) throws ApiException { + ApiResponse localVarResponse = loginUserWithHttpInfo(username, password, headers); + return localVarResponse.getData(); + } + + /** + * Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @return ApiResponse<String> + * @throws ApiException if fails to make API call + */ + public ApiResponse loginUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException { + return loginUserWithHttpInfo(username, password, null); + } + + /** + * Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<String> + * @throws ApiException if fails to make API call + */ + public ApiResponse loginUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = loginUserRequestBuilder(username, password, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("loginUser", localVarResponse); + } + if (localVarResponse.body() == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + String responseBody = new String(localVarResponse.body().readAllBytes()); + localVarResponse.body().close(); + + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}) + ); + } finally { + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder loginUserRequestBuilder(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, Map headers) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException(400, "Missing the required parameter 'username' when calling loginUser"); + } + // verify the required parameter 'password' is set + if (password == null) { + throw new ApiException(400, "Missing the required parameter 'password' when calling loginUser"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/user/login"; + + List localVarQueryParams = new ArrayList<>(); + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + localVarQueryParameterBaseName = "username"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("username", username)); + localVarQueryParameterBaseName = "password"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("password", password)); + + if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) { + StringJoiner queryJoiner = new StringJoiner("&"); + localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue())); + if (localVarQueryStringJoiner.length() != 0) { + queryJoiner.add(localVarQueryStringJoiner.toString()); + } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } + + localVarRequestBuilder.header("Accept", "application/xml, application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Logs out current logged in user session + * + * @throws ApiException if fails to make API call + */ + public void logoutUser() throws ApiException { + logoutUser(null); + } + + /** + * Logs out current logged in user session + * + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void logoutUser(Map headers) throws ApiException { + logoutUserWithHttpInfo(headers); + } + + /** + * Logs out current logged in user session + * + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse logoutUserWithHttpInfo() throws ApiException { + return logoutUserWithHttpInfo(null); + } + + /** + * Logs out current logged in user session + * + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse logoutUserWithHttpInfo(Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = logoutUserRequestBuilder(headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("logoutUser", localVarResponse); + } + return new ApiResponse<>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } finally { + // Drain the InputStream + while (localVarResponse.body().read() != -1) { + // Ignore + } + localVarResponse.body().close(); + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder logoutUserRequestBuilder(Map headers) throws ApiException { + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/user/logout"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param user Updated user object (required) + * @throws ApiException if fails to make API call + */ + public void updateUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user) throws ApiException { + updateUser(username, user, null); + } + + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param user Updated user object (required) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void updateUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, Map headers) throws ApiException { + updateUserWithHttpInfo(username, user, headers); + } + + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param user Updated user object (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse updateUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user) throws ApiException { + return updateUserWithHttpInfo(username, user, null); + } + + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param user Updated user object (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse updateUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = updateUserRequestBuilder(username, user, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("updateUser", localVarResponse); + } + return new ApiResponse<>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } finally { + // Drain the InputStream + while (localVarResponse.body().read() != -1) { + // Ignore + } + localVarResponse.body().close(); + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder updateUserRequestBuilder(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, Map headers) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser"); + } + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException(400, "Missing the required parameter 'user' when calling updateUser"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/user/{username}" + .replace("{username}", ApiClient.urlEncode(username.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(user); + localVarRequestBuilder.method("PUT", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java new file mode 100644 index 000000000000..1be882a5a25f --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java @@ -0,0 +1,147 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.lang.reflect.Type; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:09:56.830832+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public abstract class AbstractOpenApiSchema { + + // store the actual instance of the schema/object + private Object instance; + + // is nullable + private Boolean isNullable; + + // schema type (e.g. oneOf, anyOf) + private final String schemaType; + + public AbstractOpenApiSchema(String schemaType, Boolean isNullable) { + this.schemaType = schemaType; + this.isNullable = isNullable; + } + + /** + * Get the list of oneOf/anyOf composed schemas allowed to be stored in this object + * + * @return an instance of the actual schema/object + */ + public abstract Map> getSchemas(); + + /** + * Get the actual instance + * + * @return an instance of the actual schema/object + */ + @JsonValue + public Object getActualInstance() {return instance;} + + /** + * Set the actual instance + * + * @param instance the actual instance of the schema/object + */ + public void setActualInstance(Object instance) {this.instance = instance;} + + /** + * Get the instant recursively when the schemas defined in oneOf/anyof happen to be oneOf/anyOf schema as well + * + * @return an instance of the actual schema/object + */ + public Object getActualInstanceRecursively() { + return getActualInstanceRecursively(this); + } + + private Object getActualInstanceRecursively(AbstractOpenApiSchema object) { + if (object.getActualInstance() == null) { + return null; + } else if (object.getActualInstance() instanceof AbstractOpenApiSchema) { + return getActualInstanceRecursively((AbstractOpenApiSchema)object.getActualInstance()); + } else { + return object.getActualInstance(); + } + } + + /** + * Get the schema type (e.g. anyOf, oneOf) + * + * @return the schema type + */ + public String getSchemaType() { + return schemaType; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ").append(getClass()).append(" {\n"); + sb.append(" instance: ").append(toIndentedString(instance)).append("\n"); + sb.append(" isNullable: ").append(toIndentedString(isNullable)).append("\n"); + sb.append(" schemaType: ").append(toIndentedString(schemaType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AbstractOpenApiSchema a = (AbstractOpenApiSchema) o; + return Objects.equals(this.instance, a.instance) && + Objects.equals(this.isNullable, a.isNullable) && + Objects.equals(this.schemaType, a.schemaType); + } + + @Override + public int hashCode() { + return Objects.hash(instance, isNullable, schemaType); + } + + /** + * Is nullable + * + * @return true if it's nullable + */ + public Boolean isNullable() { + if (Boolean.TRUE.equals(isNullable)) { + return Boolean.TRUE; + } else { + return Boolean.FALSE; + } + } + + + +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/model/Category.java new file mode 100644 index 000000000000..00ab496b51e0 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/model/Category.java @@ -0,0 +1,187 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import org.openapitools.client.ApiClient; +/** + * A category for a pet + */ +@JsonPropertyOrder({ + Category.JSON_PROPERTY_ID, + Category.JSON_PROPERTY_NAME +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:09:56.830832+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class Category { + public static final String JSON_PROPERTY_ID = "id"; + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_NAME = "name"; + @javax.annotation.Nullable + private String name; + + public Category() { + } + + public Category id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getId() { + return id; + } + + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Category name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getName() { + return name; + } + + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + /** + * Return true if this Category object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Category category = (Category) o; + return Objects.equals(this.id, category.id) && + Objects.equals(this.name, category.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Category {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `id` to the URL query string + if (getId() != null) { + joiner.add(String.format("%sid%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getId())))); + } + + // add `name` to the URL query string + if (getName() != null) { + joiner.add(String.format("%sname%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getName())))); + } + + return joiner.toString(); + } +} + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/model/ModelApiResponse.java new file mode 100644 index 000000000000..78606a6eea9b --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -0,0 +1,223 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import org.openapitools.client.ApiClient; +/** + * Describes the result of uploading an image resource + */ +@JsonPropertyOrder({ + ModelApiResponse.JSON_PROPERTY_CODE, + ModelApiResponse.JSON_PROPERTY_TYPE, + ModelApiResponse.JSON_PROPERTY_MESSAGE +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:09:56.830832+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class ModelApiResponse { + public static final String JSON_PROPERTY_CODE = "code"; + @javax.annotation.Nullable + private Integer code; + + public static final String JSON_PROPERTY_TYPE = "type"; + @javax.annotation.Nullable + private String type; + + public static final String JSON_PROPERTY_MESSAGE = "message"; + @javax.annotation.Nullable + private String message; + + public ModelApiResponse() { + } + + public ModelApiResponse code(@javax.annotation.Nullable Integer code) { + this.code = code; + return this; + } + + /** + * Get code + * @return code + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CODE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getCode() { + return code; + } + + + @JsonProperty(JSON_PROPERTY_CODE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCode(@javax.annotation.Nullable Integer code) { + this.code = code; + } + + + public ModelApiResponse type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getType() { + return type; + } + + + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public ModelApiResponse message(@javax.annotation.Nullable String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getMessage() { + return message; + } + + + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMessage(@javax.annotation.Nullable String message) { + this.message = message; + } + + + /** + * Return true if this ApiResponse object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelApiResponse _apiResponse = (ModelApiResponse) o; + return Objects.equals(this.code, _apiResponse.code) && + Objects.equals(this.type, _apiResponse.type) && + Objects.equals(this.message, _apiResponse.message); + } + + @Override + public int hashCode() { + return Objects.hash(code, type, message); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelApiResponse {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `code` to the URL query string + if (getCode() != null) { + joiner.add(String.format("%scode%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getCode())))); + } + + // add `type` to the URL query string + if (getType() != null) { + joiner.add(String.format("%stype%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getType())))); + } + + // add `message` to the URL query string + if (getMessage() != null) { + joiner.add(String.format("%smessage%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getMessage())))); + } + + return joiner.toString(); + } +} + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/model/Order.java new file mode 100644 index 000000000000..dd17ee540177 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/model/Order.java @@ -0,0 +1,369 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.time.OffsetDateTime; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import org.openapitools.client.ApiClient; +/** + * An order for a pets from the pet store + */ +@JsonPropertyOrder({ + Order.JSON_PROPERTY_ID, + Order.JSON_PROPERTY_PET_ID, + Order.JSON_PROPERTY_QUANTITY, + Order.JSON_PROPERTY_SHIP_DATE, + Order.JSON_PROPERTY_STATUS, + Order.JSON_PROPERTY_COMPLETE +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:09:56.830832+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class Order { + public static final String JSON_PROPERTY_ID = "id"; + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_PET_ID = "petId"; + @javax.annotation.Nullable + private Long petId; + + public static final String JSON_PROPERTY_QUANTITY = "quantity"; + @javax.annotation.Nullable + private Integer quantity; + + public static final String JSON_PROPERTY_SHIP_DATE = "shipDate"; + @javax.annotation.Nullable + private OffsetDateTime shipDate; + + /** + * Order Status + */ + public enum StatusEnum { + PLACED(String.valueOf("placed")), + + APPROVED(String.valueOf("approved")), + + DELIVERED(String.valueOf("delivered")); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_STATUS = "status"; + @javax.annotation.Nullable + private StatusEnum status; + + public static final String JSON_PROPERTY_COMPLETE = "complete"; + @javax.annotation.Nullable + private Boolean complete = false; + + public Order() { + } + + public Order id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getId() { + return id; + } + + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Order petId(@javax.annotation.Nullable Long petId) { + this.petId = petId; + return this; + } + + /** + * Get petId + * @return petId + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PET_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getPetId() { + return petId; + } + + + @JsonProperty(JSON_PROPERTY_PET_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPetId(@javax.annotation.Nullable Long petId) { + this.petId = petId; + } + + + public Order quantity(@javax.annotation.Nullable Integer quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get quantity + * @return quantity + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_QUANTITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getQuantity() { + return quantity; + } + + + @JsonProperty(JSON_PROPERTY_QUANTITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setQuantity(@javax.annotation.Nullable Integer quantity) { + this.quantity = quantity; + } + + + public Order shipDate(@javax.annotation.Nullable OffsetDateTime shipDate) { + this.shipDate = shipDate; + return this; + } + + /** + * Get shipDate + * @return shipDate + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SHIP_DATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getShipDate() { + return shipDate; + } + + + @JsonProperty(JSON_PROPERTY_SHIP_DATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setShipDate(@javax.annotation.Nullable OffsetDateTime shipDate) { + this.shipDate = shipDate; + } + + + public Order status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * Order Status + * @return status + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public StatusEnum getStatus() { + return status; + } + + + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + + public Order complete(@javax.annotation.Nullable Boolean complete) { + this.complete = complete; + return this; + } + + /** + * Get complete + * @return complete + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_COMPLETE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getComplete() { + return complete; + } + + + @JsonProperty(JSON_PROPERTY_COMPLETE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setComplete(@javax.annotation.Nullable Boolean complete) { + this.complete = complete; + } + + + /** + * Return true if this Order object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Order order = (Order) o; + return Objects.equals(this.id, order.id) && + Objects.equals(this.petId, order.petId) && + Objects.equals(this.quantity, order.quantity) && + Objects.equals(this.shipDate, order.shipDate) && + Objects.equals(this.status, order.status) && + Objects.equals(this.complete, order.complete); + } + + @Override + public int hashCode() { + return Objects.hash(id, petId, quantity, shipDate, status, complete); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Order {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" petId: ").append(toIndentedString(petId)).append("\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append(" shipDate: ").append(toIndentedString(shipDate)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" complete: ").append(toIndentedString(complete)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `id` to the URL query string + if (getId() != null) { + joiner.add(String.format("%sid%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getId())))); + } + + // add `petId` to the URL query string + if (getPetId() != null) { + joiner.add(String.format("%spetId%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getPetId())))); + } + + // add `quantity` to the URL query string + if (getQuantity() != null) { + joiner.add(String.format("%squantity%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getQuantity())))); + } + + // add `shipDate` to the URL query string + if (getShipDate() != null) { + joiner.add(String.format("%sshipDate%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getShipDate())))); + } + + // add `status` to the URL query string + if (getStatus() != null) { + joiner.add(String.format("%sstatus%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getStatus())))); + } + + // add `complete` to the URL query string + if (getComplete() != null) { + joiner.add(String.format("%scomplete%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getComplete())))); + } + + return joiner.toString(); + } +} + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/model/Pet.java new file mode 100644 index 000000000000..31d5e511b5e7 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/model/Pet.java @@ -0,0 +1,397 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import org.openapitools.client.ApiClient; +/** + * A pet for sale in the pet store + */ +@JsonPropertyOrder({ + Pet.JSON_PROPERTY_ID, + Pet.JSON_PROPERTY_CATEGORY, + Pet.JSON_PROPERTY_NAME, + Pet.JSON_PROPERTY_PHOTO_URLS, + Pet.JSON_PROPERTY_TAGS, + Pet.JSON_PROPERTY_STATUS +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:09:56.830832+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class Pet { + public static final String JSON_PROPERTY_ID = "id"; + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_CATEGORY = "category"; + @javax.annotation.Nullable + private Category category; + + public static final String JSON_PROPERTY_NAME = "name"; + @javax.annotation.Nonnull + private String name; + + public static final String JSON_PROPERTY_PHOTO_URLS = "photoUrls"; + @javax.annotation.Nonnull + private List photoUrls = new ArrayList<>(); + + public static final String JSON_PROPERTY_TAGS = "tags"; + @javax.annotation.Nullable + private List tags = new ArrayList<>(); + + /** + * pet status in the store + */ + public enum StatusEnum { + AVAILABLE(String.valueOf("available")), + + PENDING(String.valueOf("pending")), + + SOLD(String.valueOf("sold")); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_STATUS = "status"; + @javax.annotation.Nullable + private StatusEnum status; + + public Pet() { + } + + public Pet id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getId() { + return id; + } + + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Pet category(@javax.annotation.Nullable Category category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CATEGORY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Category getCategory() { + return category; + } + + + @JsonProperty(JSON_PROPERTY_CATEGORY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCategory(@javax.annotation.Nullable Category category) { + this.category = category; + } + + + public Pet name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public Pet photoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public Pet addPhotoUrlsItem(String photoUrlsItem) { + if (this.photoUrls == null) { + this.photoUrls = new ArrayList<>(); + } + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + */ + @javax.annotation.Nonnull + @JsonProperty(JSON_PROPERTY_PHOTO_URLS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getPhotoUrls() { + return photoUrls; + } + + + @JsonProperty(JSON_PROPERTY_PHOTO_URLS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setPhotoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + } + + + public Pet tags(@javax.annotation.Nullable List tags) { + this.tags = tags; + return this; + } + + public Pet addTagsItem(Tag tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Get tags + * @return tags + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TAGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getTags() { + return tags; + } + + + @JsonProperty(JSON_PROPERTY_TAGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTags(@javax.annotation.Nullable List tags) { + this.tags = tags; + } + + + public Pet status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public StatusEnum getStatus() { + return status; + } + + + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + + /** + * Return true if this Pet object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Pet pet = (Pet) o; + return Objects.equals(this.id, pet.id) && + Objects.equals(this.category, pet.category) && + Objects.equals(this.name, pet.name) && + Objects.equals(this.photoUrls, pet.photoUrls) && + Objects.equals(this.tags, pet.tags) && + Objects.equals(this.status, pet.status); + } + + @Override + public int hashCode() { + return Objects.hash(id, category, name, photoUrls, tags, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Pet {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `id` to the URL query string + if (getId() != null) { + joiner.add(String.format("%sid%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getId())))); + } + + // add `category` to the URL query string + if (getCategory() != null) { + joiner.add(getCategory().toUrlQueryString(prefix + "category" + suffix)); + } + + // add `name` to the URL query string + if (getName() != null) { + joiner.add(String.format("%sname%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getName())))); + } + + // add `photoUrls` to the URL query string + if (getPhotoUrls() != null) { + for (int i = 0; i < getPhotoUrls().size(); i++) { + joiner.add(String.format("%sphotoUrls%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix), + ApiClient.urlEncode(ApiClient.valueToString(getPhotoUrls().get(i))))); + } + } + + // add `tags` to the URL query string + if (getTags() != null) { + for (int i = 0; i < getTags().size(); i++) { + if (getTags().get(i) != null) { + joiner.add(getTags().get(i).toUrlQueryString(String.format("%stags%s%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix)))); + } + } + } + + // add `status` to the URL query string + if (getStatus() != null) { + joiner.add(String.format("%sstatus%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getStatus())))); + } + + return joiner.toString(); + } +} + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/model/Tag.java new file mode 100644 index 000000000000..bda2f24ac2c2 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/model/Tag.java @@ -0,0 +1,187 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import org.openapitools.client.ApiClient; +/** + * A tag for a pet + */ +@JsonPropertyOrder({ + Tag.JSON_PROPERTY_ID, + Tag.JSON_PROPERTY_NAME +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:09:56.830832+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class Tag { + public static final String JSON_PROPERTY_ID = "id"; + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_NAME = "name"; + @javax.annotation.Nullable + private String name; + + public Tag() { + } + + public Tag id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getId() { + return id; + } + + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Tag name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getName() { + return name; + } + + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + /** + * Return true if this Tag object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Tag tag = (Tag) o; + return Objects.equals(this.id, tag.id) && + Objects.equals(this.name, tag.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Tag {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `id` to the URL query string + if (getId() != null) { + joiner.add(String.format("%sid%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getId())))); + } + + // add `name` to the URL query string + if (getName() != null) { + joiner.add(String.format("%sname%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getName())))); + } + + return joiner.toString(); + } +} + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/model/User.java new file mode 100644 index 000000000000..4c5a5db4e5d1 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/src/main/java/org/openapitools/client/model/User.java @@ -0,0 +1,403 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import org.openapitools.client.ApiClient; +/** + * A User who is purchasing from the pet store + */ +@JsonPropertyOrder({ + User.JSON_PROPERTY_ID, + User.JSON_PROPERTY_USERNAME, + User.JSON_PROPERTY_FIRST_NAME, + User.JSON_PROPERTY_LAST_NAME, + User.JSON_PROPERTY_EMAIL, + User.JSON_PROPERTY_PASSWORD, + User.JSON_PROPERTY_PHONE, + User.JSON_PROPERTY_USER_STATUS +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:09:56.830832+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class User { + public static final String JSON_PROPERTY_ID = "id"; + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_USERNAME = "username"; + @javax.annotation.Nullable + private String username; + + public static final String JSON_PROPERTY_FIRST_NAME = "firstName"; + @javax.annotation.Nullable + private String firstName; + + public static final String JSON_PROPERTY_LAST_NAME = "lastName"; + @javax.annotation.Nullable + private String lastName; + + public static final String JSON_PROPERTY_EMAIL = "email"; + @javax.annotation.Nullable + private String email; + + public static final String JSON_PROPERTY_PASSWORD = "password"; + @javax.annotation.Nullable + private String password; + + public static final String JSON_PROPERTY_PHONE = "phone"; + @javax.annotation.Nullable + private String phone; + + public static final String JSON_PROPERTY_USER_STATUS = "userStatus"; + @javax.annotation.Nullable + private Integer userStatus; + + public User() { + } + + public User id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getId() { + return id; + } + + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public User username(@javax.annotation.Nullable String username) { + this.username = username; + return this; + } + + /** + * Get username + * @return username + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_USERNAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getUsername() { + return username; + } + + + @JsonProperty(JSON_PROPERTY_USERNAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setUsername(@javax.annotation.Nullable String username) { + this.username = username; + } + + + public User firstName(@javax.annotation.Nullable String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Get firstName + * @return firstName + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_FIRST_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getFirstName() { + return firstName; + } + + + @JsonProperty(JSON_PROPERTY_FIRST_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setFirstName(@javax.annotation.Nullable String firstName) { + this.firstName = firstName; + } + + + public User lastName(@javax.annotation.Nullable String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Get lastName + * @return lastName + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_LAST_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getLastName() { + return lastName; + } + + + @JsonProperty(JSON_PROPERTY_LAST_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setLastName(@javax.annotation.Nullable String lastName) { + this.lastName = lastName; + } + + + public User email(@javax.annotation.Nullable String email) { + this.email = email; + return this; + } + + /** + * Get email + * @return email + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_EMAIL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getEmail() { + return email; + } + + + @JsonProperty(JSON_PROPERTY_EMAIL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setEmail(@javax.annotation.Nullable String email) { + this.email = email; + } + + + public User password(@javax.annotation.Nullable String password) { + this.password = password; + return this; + } + + /** + * Get password + * @return password + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PASSWORD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getPassword() { + return password; + } + + + @JsonProperty(JSON_PROPERTY_PASSWORD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPassword(@javax.annotation.Nullable String password) { + this.password = password; + } + + + public User phone(@javax.annotation.Nullable String phone) { + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PHONE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getPhone() { + return phone; + } + + + @JsonProperty(JSON_PROPERTY_PHONE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPhone(@javax.annotation.Nullable String phone) { + this.phone = phone; + } + + + public User userStatus(@javax.annotation.Nullable Integer userStatus) { + this.userStatus = userStatus; + return this; + } + + /** + * User Status + * @return userStatus + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_USER_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getUserStatus() { + return userStatus; + } + + + @JsonProperty(JSON_PROPERTY_USER_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setUserStatus(@javax.annotation.Nullable Integer userStatus) { + this.userStatus = userStatus; + } + + + /** + * Return true if this User object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + User user = (User) o; + return Objects.equals(this.id, user.id) && + Objects.equals(this.username, user.username) && + Objects.equals(this.firstName, user.firstName) && + Objects.equals(this.lastName, user.lastName) && + Objects.equals(this.email, user.email) && + Objects.equals(this.password, user.password) && + Objects.equals(this.phone, user.phone) && + Objects.equals(this.userStatus, user.userStatus); + } + + @Override + public int hashCode() { + return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class User {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" username: ").append(toIndentedString(username)).append("\n"); + sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); + sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" userStatus: ").append(toIndentedString(userStatus)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `id` to the URL query string + if (getId() != null) { + joiner.add(String.format("%sid%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getId())))); + } + + // add `username` to the URL query string + if (getUsername() != null) { + joiner.add(String.format("%susername%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getUsername())))); + } + + // add `firstName` to the URL query string + if (getFirstName() != null) { + joiner.add(String.format("%sfirstName%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getFirstName())))); + } + + // add `lastName` to the URL query string + if (getLastName() != null) { + joiner.add(String.format("%slastName%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getLastName())))); + } + + // add `email` to the URL query string + if (getEmail() != null) { + joiner.add(String.format("%semail%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getEmail())))); + } + + // add `password` to the URL query string + if (getPassword() != null) { + joiner.add(String.format("%spassword%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getPassword())))); + } + + // add `phone` to the URL query string + if (getPhone() != null) { + joiner.add(String.format("%sphone%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getPhone())))); + } + + // add `userStatus` to the URL query string + if (getUserStatus() != null) { + joiner.add(String.format("%suserStatus%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getUserStatus())))); + } + + return joiner.toString(); + } +} + diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/src/test/java/org/openapitools/client/api/PetApiTest.java b/samples/client/petstore/java/native/test-regenerated-fixed3/src/test/java/org/openapitools/client/api/PetApiTest.java new file mode 100644 index 000000000000..f725ba246938 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/src/test/java/org/openapitools/client/api/PetApiTest.java @@ -0,0 +1,180 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import java.io.File; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.Pet; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + + +/** + * API tests for PetApi + */ +@Disabled +public class PetApiTest { + + private final PetApi api = new PetApi(); + + + /** + * Add a new pet to the store + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void addPetTest() throws ApiException { + Pet pet = null; + Pet response = + api.addPet(pet); + + // TODO: test validations + } + + /** + * Deletes a pet + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void deletePetTest() throws ApiException { + Long petId = null; + String apiKey = null; + + api.deletePet(petId, apiKey); + + // TODO: test validations + } + + /** + * Finds Pets by status + * + * Multiple status values can be provided with comma separated strings + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void findPetsByStatusTest() throws ApiException { + List status = null; + List response = + api.findPetsByStatus(status); + + // TODO: test validations + } + + /** + * Finds Pets by tags + * + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void findPetsByTagsTest() throws ApiException { + List tags = null; + List response = + api.findPetsByTags(tags); + + // TODO: test validations + } + + /** + * Find pet by ID + * + * Returns a single pet + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void getPetByIdTest() throws ApiException { + Long petId = null; + Pet response = + api.getPetById(petId); + + // TODO: test validations + } + + /** + * Update an existing pet + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void updatePetTest() throws ApiException { + Pet pet = null; + Pet response = + api.updatePet(pet); + + // TODO: test validations + } + + /** + * Updates a pet in the store with form data + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void updatePetWithFormTest() throws ApiException { + Long petId = null; + String name = null; + String status = null; + + api.updatePetWithForm(petId, name, status); + + // TODO: test validations + } + + /** + * uploads an image + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void uploadFileTest() throws ApiException { + Long petId = null; + String additionalMetadata = null; + File _file = null; + ModelApiResponse response = + api.uploadFile(petId, additionalMetadata, _file); + + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/src/test/java/org/openapitools/client/api/StoreApiTest.java b/samples/client/petstore/java/native/test-regenerated-fixed3/src/test/java/org/openapitools/client/api/StoreApiTest.java new file mode 100644 index 000000000000..be318cab8b1e --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/src/test/java/org/openapitools/client/api/StoreApiTest.java @@ -0,0 +1,104 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.model.Order; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + + +/** + * API tests for StoreApi + */ +@Disabled +public class StoreApiTest { + + private final StoreApi api = new StoreApi(); + + + /** + * Delete purchase order by ID + * + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void deleteOrderTest() throws ApiException { + String orderId = null; + + api.deleteOrder(orderId); + + // TODO: test validations + } + + /** + * Returns pet inventories by status + * + * Returns a map of status codes to quantities + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void getInventoryTest() throws ApiException { + Map response = + api.getInventory(); + + // TODO: test validations + } + + /** + * Find purchase order by ID + * + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void getOrderByIdTest() throws ApiException { + Long orderId = null; + Order response = + api.getOrderById(orderId); + + // TODO: test validations + } + + /** + * Place an order for a pet + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void placeOrderTest() throws ApiException { + Order order = null; + Order response = + api.placeOrder(order); + + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/src/test/java/org/openapitools/client/api/UserApiTest.java b/samples/client/petstore/java/native/test-regenerated-fixed3/src/test/java/org/openapitools/client/api/UserApiTest.java new file mode 100644 index 000000000000..2b2b7a60fd21 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/src/test/java/org/openapitools/client/api/UserApiTest.java @@ -0,0 +1,175 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import java.time.OffsetDateTime; +import org.openapitools.client.model.User; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + + +/** + * API tests for UserApi + */ +@Disabled +public class UserApiTest { + + private final UserApi api = new UserApi(); + + + /** + * Create user + * + * This can only be done by the logged in user. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void createUserTest() throws ApiException { + User user = null; + + api.createUser(user); + + // TODO: test validations + } + + /** + * Creates list of users with given input array + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void createUsersWithArrayInputTest() throws ApiException { + List user = null; + + api.createUsersWithArrayInput(user); + + // TODO: test validations + } + + /** + * Creates list of users with given input array + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void createUsersWithListInputTest() throws ApiException { + List user = null; + + api.createUsersWithListInput(user); + + // TODO: test validations + } + + /** + * Delete user + * + * This can only be done by the logged in user. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void deleteUserTest() throws ApiException { + String username = null; + + api.deleteUser(username); + + // TODO: test validations + } + + /** + * Get user by user name + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void getUserByNameTest() throws ApiException { + String username = null; + User response = + api.getUserByName(username); + + // TODO: test validations + } + + /** + * Logs user into the system + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void loginUserTest() throws ApiException { + String username = null; + String password = null; + String response = + api.loginUser(username, password); + + // TODO: test validations + } + + /** + * Logs out current logged in user session + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void logoutUserTest() throws ApiException { + + api.logoutUser(); + + // TODO: test validations + } + + /** + * Updated user + * + * This can only be done by the logged in user. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void updateUserTest() throws ApiException { + String username = null; + User user = null; + + api.updateUser(username, user); + + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/src/test/java/org/openapitools/client/model/CategoryTest.java b/samples/client/petstore/java/native/test-regenerated-fixed3/src/test/java/org/openapitools/client/model/CategoryTest.java new file mode 100644 index 000000000000..ae23ab433a50 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/src/test/java/org/openapitools/client/model/CategoryTest.java @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Category + */ +class CategoryTest { + private final Category model = new Category(); + + /** + * Model tests for Category + */ + @Test + void testCategory() { + // TODO: test Category + } + + /** + * Test the property 'id' + */ + @Test + void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java b/samples/client/petstore/java/native/test-regenerated-fixed3/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java new file mode 100644 index 000000000000..c846563bfe1f --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java @@ -0,0 +1,64 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ModelApiResponse + */ +class ModelApiResponseTest { + private final ModelApiResponse model = new ModelApiResponse(); + + /** + * Model tests for ModelApiResponse + */ + @Test + void testModelApiResponse() { + // TODO: test ModelApiResponse + } + + /** + * Test the property 'code' + */ + @Test + void codeTest() { + // TODO: test code + } + + /** + * Test the property 'type' + */ + @Test + void typeTest() { + // TODO: test type + } + + /** + * Test the property 'message' + */ + @Test + void messageTest() { + // TODO: test message + } + +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/src/test/java/org/openapitools/client/model/OrderTest.java b/samples/client/petstore/java/native/test-regenerated-fixed3/src/test/java/org/openapitools/client/model/OrderTest.java new file mode 100644 index 000000000000..4d8d136809eb --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/src/test/java/org/openapitools/client/model/OrderTest.java @@ -0,0 +1,89 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Order + */ +class OrderTest { + private final Order model = new Order(); + + /** + * Model tests for Order + */ + @Test + void testOrder() { + // TODO: test Order + } + + /** + * Test the property 'id' + */ + @Test + void idTest() { + // TODO: test id + } + + /** + * Test the property 'petId' + */ + @Test + void petIdTest() { + // TODO: test petId + } + + /** + * Test the property 'quantity' + */ + @Test + void quantityTest() { + // TODO: test quantity + } + + /** + * Test the property 'shipDate' + */ + @Test + void shipDateTest() { + // TODO: test shipDate + } + + /** + * Test the property 'status' + */ + @Test + void statusTest() { + // TODO: test status + } + + /** + * Test the property 'complete' + */ + @Test + void completeTest() { + // TODO: test complete + } + +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/src/test/java/org/openapitools/client/model/PetTest.java b/samples/client/petstore/java/native/test-regenerated-fixed3/src/test/java/org/openapitools/client/model/PetTest.java new file mode 100644 index 000000000000..84aff8adbf96 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/src/test/java/org/openapitools/client/model/PetTest.java @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Pet + */ +class PetTest { + private final Pet model = new Pet(); + + /** + * Model tests for Pet + */ + @Test + void testPet() { + // TODO: test Pet + } + + /** + * Test the property 'id' + */ + @Test + void idTest() { + // TODO: test id + } + + /** + * Test the property 'category' + */ + @Test + void categoryTest() { + // TODO: test category + } + + /** + * Test the property 'name' + */ + @Test + void nameTest() { + // TODO: test name + } + + /** + * Test the property 'photoUrls' + */ + @Test + void photoUrlsTest() { + // TODO: test photoUrls + } + + /** + * Test the property 'tags' + */ + @Test + void tagsTest() { + // TODO: test tags + } + + /** + * Test the property 'status' + */ + @Test + void statusTest() { + // TODO: test status + } + +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/src/test/java/org/openapitools/client/model/TagTest.java b/samples/client/petstore/java/native/test-regenerated-fixed3/src/test/java/org/openapitools/client/model/TagTest.java new file mode 100644 index 000000000000..6bd8b9f5035e --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/src/test/java/org/openapitools/client/model/TagTest.java @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Tag + */ +class TagTest { + private final Tag model = new Tag(); + + /** + * Model tests for Tag + */ + @Test + void testTag() { + // TODO: test Tag + } + + /** + * Test the property 'id' + */ + @Test + void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/native/test-regenerated-fixed3/src/test/java/org/openapitools/client/model/UserTest.java b/samples/client/petstore/java/native/test-regenerated-fixed3/src/test/java/org/openapitools/client/model/UserTest.java new file mode 100644 index 000000000000..40f4892264aa --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated-fixed3/src/test/java/org/openapitools/client/model/UserTest.java @@ -0,0 +1,104 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for User + */ +class UserTest { + private final User model = new User(); + + /** + * Model tests for User + */ + @Test + void testUser() { + // TODO: test User + } + + /** + * Test the property 'id' + */ + @Test + void idTest() { + // TODO: test id + } + + /** + * Test the property 'username' + */ + @Test + void usernameTest() { + // TODO: test username + } + + /** + * Test the property 'firstName' + */ + @Test + void firstNameTest() { + // TODO: test firstName + } + + /** + * Test the property 'lastName' + */ + @Test + void lastNameTest() { + // TODO: test lastName + } + + /** + * Test the property 'email' + */ + @Test + void emailTest() { + // TODO: test email + } + + /** + * Test the property 'password' + */ + @Test + void passwordTest() { + // TODO: test password + } + + /** + * Test the property 'phone' + */ + @Test + void phoneTest() { + // TODO: test phone + } + + /** + * Test the property 'userStatus' + */ + @Test + void userStatusTest() { + // TODO: test userStatus + } + +} diff --git a/samples/client/petstore/java/native/test-regenerated/.github/workflows/maven.yml b/samples/client/petstore/java/native/test-regenerated/.github/workflows/maven.yml new file mode 100644 index 000000000000..460f78bfd1b2 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/.github/workflows/maven.yml @@ -0,0 +1,30 @@ +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven +# +# This file is auto-generated by OpenAPI Generator (https://openapi-generator.tech) + +name: Java CI with Maven + +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] + +jobs: + build: + name: Build OpenAPI Petstore + runs-on: ubuntu-latest + strategy: + matrix: + java: [ 17, 21 ] + steps: + - uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.java }} + distribution: 'temurin' + cache: maven + - name: Build with Maven + run: mvn -B package --no-transfer-progress --file pom.xml diff --git a/samples/client/petstore/java/native/test-regenerated/.gitignore b/samples/client/petstore/java/native/test-regenerated/.gitignore new file mode 100644 index 000000000000..a530464afa1b --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/.gitignore @@ -0,0 +1,21 @@ +*.class + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.ear + +# exclude jar for gradle wrapper +!gradle/wrapper/*.jar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +# build files +**/target +target +.gradle +build diff --git a/samples/client/petstore/java/native/test-regenerated/.openapi-generator-ignore b/samples/client/petstore/java/native/test-regenerated/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/petstore/java/native/test-regenerated/.openapi-generator/FILES b/samples/client/petstore/java/native/test-regenerated/.openapi-generator/FILES new file mode 100644 index 000000000000..57d506c4c50b --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/.openapi-generator/FILES @@ -0,0 +1,56 @@ +.github/workflows/maven.yml +.gitignore +.openapi-generator-ignore +.travis.yml +README.md +api/openapi.yaml +build.gradle +build.sbt +docs/Category.md +docs/ModelApiResponse.md +docs/Order.md +docs/Pet.md +docs/PetApi.md +docs/StoreApi.md +docs/Tag.md +docs/User.md +docs/UserApi.md +git_push.sh +gradle.properties +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat +pom.xml +settings.gradle +src/main/AndroidManifest.xml +src/main/java/org/openapitools/client/ApiClient.java +src/main/java/org/openapitools/client/ApiException.java +src/main/java/org/openapitools/client/ApiResponse.java +src/main/java/org/openapitools/client/Configuration.java +src/main/java/org/openapitools/client/JSON.java +src/main/java/org/openapitools/client/Pair.java +src/main/java/org/openapitools/client/RFC3339DateFormat.java +src/main/java/org/openapitools/client/RFC3339InstantDeserializer.java +src/main/java/org/openapitools/client/RFC3339JavaTimeModule.java +src/main/java/org/openapitools/client/ServerConfiguration.java +src/main/java/org/openapitools/client/ServerVariable.java +src/main/java/org/openapitools/client/api/PetApi.java +src/main/java/org/openapitools/client/api/StoreApi.java +src/main/java/org/openapitools/client/api/UserApi.java +src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +src/main/java/org/openapitools/client/model/Category.java +src/main/java/org/openapitools/client/model/ModelApiResponse.java +src/main/java/org/openapitools/client/model/Order.java +src/main/java/org/openapitools/client/model/Pet.java +src/main/java/org/openapitools/client/model/Tag.java +src/main/java/org/openapitools/client/model/User.java +src/test/java/org/openapitools/client/api/PetApiTest.java +src/test/java/org/openapitools/client/api/StoreApiTest.java +src/test/java/org/openapitools/client/api/UserApiTest.java +src/test/java/org/openapitools/client/model/CategoryTest.java +src/test/java/org/openapitools/client/model/ModelApiResponseTest.java +src/test/java/org/openapitools/client/model/OrderTest.java +src/test/java/org/openapitools/client/model/PetTest.java +src/test/java/org/openapitools/client/model/TagTest.java +src/test/java/org/openapitools/client/model/UserTest.java diff --git a/samples/client/petstore/java/native/test-regenerated/.openapi-generator/VERSION b/samples/client/petstore/java/native/test-regenerated/.openapi-generator/VERSION new file mode 100644 index 000000000000..fc74d6ceba8e --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.15.0-SNAPSHOT diff --git a/samples/client/petstore/java/native/test-regenerated/.travis.yml b/samples/client/petstore/java/native/test-regenerated/.travis.yml new file mode 100644 index 000000000000..c94647479234 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/.travis.yml @@ -0,0 +1,16 @@ +# +# Generated by: https://openapi-generator.tech +# +language: java +jdk: + - oraclejdk11 +before_install: + # ensure gradlew has proper permission + - chmod a+x ./gradlew +script: + # test using maven + - mvn test + # uncomment below to test using gradle + # - gradle test + # uncomment below to test using sbt + # - sbt test diff --git a/samples/client/petstore/java/native/test-regenerated/README.md b/samples/client/petstore/java/native/test-regenerated/README.md new file mode 100644 index 000000000000..82fe1fdd26ea --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/README.md @@ -0,0 +1,197 @@ +# openapi-java-client + +OpenAPI Petstore + +- API version: 1.0.0 + +- Build date: 2025-07-08T21:01:56.363494+07:00[Asia/Bangkok] + +- Generator version: 7.15.0-SNAPSHOT + +This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + + +*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* + +## Requirements + +Building the API client library requires: + +1. Java 11+ +2. Maven/Gradle + +## Installation + +To install the API client library to your local Maven repository, simply execute: + +```shell +mvn clean install +``` + +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: + +```shell +mvn clean deploy +``` + +Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. + +### Maven users + +Add this dependency to your project's POM: + +```xml + + org.openapitools + openapi-java-client + 1.0.0 + compile + +``` + +### Gradle users + +Add this dependency to your project's build file: + +```groovy +compile "org.openapitools:openapi-java-client:1.0.0" +``` + +### Others + +At first generate the JAR by executing: + +```shell +mvn clean package +``` + +Then manually install the following JARs: + +- `target/openapi-java-client-1.0.0.jar` +- `target/lib/*.jar` + +## Getting Started + +Please follow the [installation](#installation) instruction and execute the following Java code: + +```java + +import org.openapitools.client.*; +import org.openapitools.client.model.*; +import org.openapitools.client.api.PetApi; + +public class PetApiExample { + + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + // Configure clients using the `defaultClient` object, such as + // overriding the host and port, timeout, etc. + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + Pet result = apiInstance.addPet(pet); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store +*PetApi* | [**addPetWithHttpInfo**](docs/PetApi.md#addPetWithHttpInfo) | **POST** /pet | Add a new pet to the store +*PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**deletePetWithHttpInfo**](docs/PetApi.md#deletePetWithHttpInfo) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status +*PetApi* | [**findPetsByStatusWithHttpInfo**](docs/PetApi.md#findPetsByStatusWithHttpInfo) | **GET** /pet/findByStatus | Finds Pets by status +*PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags +*PetApi* | [**findPetsByTagsWithHttpInfo**](docs/PetApi.md#findPetsByTagsWithHttpInfo) | **GET** /pet/findByTags | Finds Pets by tags +*PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**getPetByIdWithHttpInfo**](docs/PetApi.md#getPetByIdWithHttpInfo) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**updatePet**](docs/PetApi.md#updatePet) | **PUT** /pet | Update an existing pet +*PetApi* | [**updatePetWithHttpInfo**](docs/PetApi.md#updatePetWithHttpInfo) | **PUT** /pet | Update an existing pet +*PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data +*PetApi* | [**updatePetWithFormWithHttpInfo**](docs/PetApi.md#updatePetWithFormWithHttpInfo) | **POST** /pet/{petId} | Updates a pet in the store with form data +*PetApi* | [**uploadFile**](docs/PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image +*PetApi* | [**uploadFileWithHttpInfo**](docs/PetApi.md#uploadFileWithHttpInfo) | **POST** /pet/{petId}/uploadImage | uploads an image +*StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID +*StoreApi* | [**deleteOrderWithHttpInfo**](docs/StoreApi.md#deleteOrderWithHttpInfo) | **DELETE** /store/order/{orderId} | Delete purchase order by ID +*StoreApi* | [**getInventory**](docs/StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status +*StoreApi* | [**getInventoryWithHttpInfo**](docs/StoreApi.md#getInventoryWithHttpInfo) | **GET** /store/inventory | Returns pet inventories by status +*StoreApi* | [**getOrderById**](docs/StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID +*StoreApi* | [**getOrderByIdWithHttpInfo**](docs/StoreApi.md#getOrderByIdWithHttpInfo) | **GET** /store/order/{orderId} | Find purchase order by ID +*StoreApi* | [**placeOrder**](docs/StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet +*StoreApi* | [**placeOrderWithHttpInfo**](docs/StoreApi.md#placeOrderWithHttpInfo) | **POST** /store/order | Place an order for a pet +*UserApi* | [**createUser**](docs/UserApi.md#createUser) | **POST** /user | Create user +*UserApi* | [**createUserWithHttpInfo**](docs/UserApi.md#createUserWithHttpInfo) | **POST** /user | Create user +*UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**createUsersWithArrayInputWithHttpInfo**](docs/UserApi.md#createUsersWithArrayInputWithHttpInfo) | **POST** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**createUsersWithListInput**](docs/UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array +*UserApi* | [**createUsersWithListInputWithHttpInfo**](docs/UserApi.md#createUsersWithListInputWithHttpInfo) | **POST** /user/createWithList | Creates list of users with given input array +*UserApi* | [**deleteUser**](docs/UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user +*UserApi* | [**deleteUserWithHttpInfo**](docs/UserApi.md#deleteUserWithHttpInfo) | **DELETE** /user/{username} | Delete user +*UserApi* | [**getUserByName**](docs/UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name +*UserApi* | [**getUserByNameWithHttpInfo**](docs/UserApi.md#getUserByNameWithHttpInfo) | **GET** /user/{username} | Get user by user name +*UserApi* | [**loginUser**](docs/UserApi.md#loginUser) | **GET** /user/login | Logs user into the system +*UserApi* | [**loginUserWithHttpInfo**](docs/UserApi.md#loginUserWithHttpInfo) | **GET** /user/login | Logs user into the system +*UserApi* | [**logoutUser**](docs/UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session +*UserApi* | [**logoutUserWithHttpInfo**](docs/UserApi.md#logoutUserWithHttpInfo) | **GET** /user/logout | Logs out current logged in user session +*UserApi* | [**updateUser**](docs/UserApi.md#updateUser) | **PUT** /user/{username} | Updated user +*UserApi* | [**updateUserWithHttpInfo**](docs/UserApi.md#updateUserWithHttpInfo) | **PUT** /user/{username} | Updated user + + +## Documentation for Models + + - [Category](docs/Category.md) + - [ModelApiResponse](docs/ModelApiResponse.md) + - [Order](docs/Order.md) + - [Pet](docs/Pet.md) + - [Tag](docs/Tag.md) + - [User](docs/User.md) + + + +## Documentation for Authorization + + +Authentication schemes defined for the API: + +### petstore_auth + + +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - write:pets: modify pets in your account + - read:pets: read your pets + + +### api_key + + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + + +## Recommendation + +It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. +However, the instances of the api clients created from the `ApiClient` are thread-safe and can be re-used. + +## Author + + + diff --git a/samples/client/petstore/java/native/test-regenerated/api/openapi.yaml b/samples/client/petstore/java/native/test-regenerated/api/openapi.yaml new file mode 100644 index 000000000000..9b1b54b9454b --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/api/openapi.yaml @@ -0,0 +1,865 @@ +openapi: 3.0.0 +info: + description: "This is a sample server Petstore server. For this sample, you can\ + \ use the api key `special-key` to test the authorization filters." + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user +paths: + /pet: + post: + description: "" + operationId: addPet + requestBody: + $ref: "#/components/requestBodies/Pet" + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Pet" + application/json: + schema: + $ref: "#/components/schemas/Pet" + description: successful operation + "405": + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + x-content-type: application/json + x-accepts: + - application/json + - application/xml + put: + description: "" + operationId: updatePet + requestBody: + $ref: "#/components/requestBodies/Pet" + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Pet" + application/json: + schema: + $ref: "#/components/schemas/Pet" + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Pet not found + "405": + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + x-content-type: application/json + x-accepts: + - application/json + - application/xml + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + "200": + content: + application/xml: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + application/json: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + description: successful operation + "400": + description: Invalid status value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by status + tags: + - pet + x-accepts: + - application/json + - application/xml + /pet/findByTags: + get: + deprecated: true + description: "Multiple tags can be provided with comma separated strings. Use\ + \ tag1, tag2, tag3 for testing." + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + "200": + content: + application/xml: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + application/json: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + description: successful operation + "400": + description: Invalid tag value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by tags + tags: + - pet + x-accepts: + - application/json + - application/xml + /pet/{petId}: + delete: + description: "" + operationId: deletePet + parameters: + - explode: false + in: header + name: api_key + required: false + schema: + type: string + style: simple + - description: Pet id to delete + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "400": + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + x-accepts: + - application/json + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Pet" + application/json: + schema: + $ref: "#/components/schemas/Pet" + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + x-accepts: + - application/json + - application/xml + post: + description: "" + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/updatePetWithForm_request" + responses: + "405": + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + /pet/{petId}/uploadImage: + post: + description: "" + operationId: uploadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/uploadFile_request" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/ApiResponse" + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + x-content-type: multipart/form-data + x-accepts: + - application/json + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + "200": + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + x-accepts: + - application/json + /store/order: + post: + description: "" + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Order" + description: order placed for purchasing the pet + required: true + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Order" + application/json: + schema: + $ref: "#/components/schemas/Order" + description: successful operation + "400": + description: Invalid Order + summary: Place an order for a pet + tags: + - store + x-content-type: application/json + x-accepts: + - application/json + - application/xml + /store/order/{orderId}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + explode: false + in: path + name: orderId + required: true + schema: + type: string + style: simple + responses: + "400": + description: Invalid ID supplied + "404": + description: Order not found + summary: Delete purchase order by ID + tags: + - store + x-accepts: + - application/json + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + explode: false + in: path + name: orderId + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Order" + application/json: + schema: + $ref: "#/components/schemas/Order" + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Order not found + summary: Find purchase order by ID + tags: + - store + x-accepts: + - application/json + - application/xml + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/User" + description: Created user object + required: true + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Create user + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + /user/createWithArray: + post: + description: "" + operationId: createUsersWithArrayInput + requestBody: + $ref: "#/components/requestBodies/UserArray" + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + /user/createWithList: + post: + description: "" + operationId: createUsersWithListInput + requestBody: + $ref: "#/components/requestBodies/UserArray" + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + /user/login: + get: + description: "" + operationId: loginUser + parameters: + - description: The user name for login + explode: true + in: query + name: username + required: true + schema: + pattern: "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$" + type: string + style: form + - description: The password for login in clear text + explode: true + in: query + name: password + required: true + schema: + type: string + style: form + responses: + "200": + content: + application/xml: + schema: + type: string + application/json: + schema: + type: string + description: successful operation + headers: + Set-Cookie: + description: Cookie authentication key for use with the `api_key` apiKey + authentication. + explode: false + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + style: simple + X-Rate-Limit: + description: calls per hour allowed by the user + explode: false + schema: + format: int32 + type: integer + style: simple + X-Expires-After: + description: date in UTC when token expires + explode: false + schema: + format: date-time + type: string + style: simple + "400": + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + x-accepts: + - application/json + - application/xml + /user/logout: + get: + description: "" + operationId: logoutUser + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Logs out current logged in user session + tags: + - user + x-accepts: + - application/json + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + "400": + description: Invalid username supplied + "404": + description: User not found + security: + - api_key: [] + summary: Delete user + tags: + - user + x-accepts: + - application/json + get: + description: "" + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/User" + application/json: + schema: + $ref: "#/components/schemas/User" + description: successful operation + "400": + description: Invalid username supplied + "404": + description: User not found + summary: Get user by user name + tags: + - user + x-accepts: + - application/json + - application/xml + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/User" + description: Updated user object + required: true + responses: + "400": + description: Invalid user supplied + "404": + description: User not found + security: + - api_key: [] + summary: Updated user + tags: + - user + x-content-type: application/json + x-accepts: + - application/json +components: + requestBodies: + UserArray: + content: + application/json: + schema: + items: + $ref: "#/components/schemas/User" + type: array + description: List of user object + required: true + Pet: + content: + application/json: + schema: + $ref: "#/components/schemas/Pet" + application/xml: + schema: + $ref: "#/components/schemas/Pet" + description: Pet object that needs to be added to the store + required: true + schemas: + ApiResponse: + description: Describes the result of uploading an image resource + example: + code: 0 + type: type + message: message + properties: + code: + format: int32 + type: integer + type: + type: string + message: + type: string + title: An uploaded response + type: object + Pet: + description: A pet for sale in the pet store + example: + photoUrls: + - photoUrls + - photoUrls + name: doggie + id: 0 + category: + name: name + id: 6 + tags: + - name: name + id: 1 + - name: name + id: 1 + status: available + properties: + id: + format: int64 + type: integer + category: + $ref: "#/components/schemas/Category" + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + tags: + items: + $ref: "#/components/schemas/Tag" + type: array + xml: + name: tag + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + Order: + description: An order for a pets from the pet store + example: + petId: 6 + quantity: 1 + id: 0 + shipDate: 2000-01-23T04:56:07.000+00:00 + complete: false + status: placed + properties: + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + complete: + default: false + type: boolean + title: Pet Order + type: object + xml: + name: Order + User: + description: A User who is purchasing from the pet store + example: + firstName: firstName + lastName: lastName + password: password + userStatus: 6 + phone: phone + id: 0 + email: email + username: username + properties: + id: + format: int64 + type: integer + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + title: a User + type: object + xml: + name: User + Category: + description: A category for a pet + example: + name: name + id: 6 + properties: + id: + format: int64 + type: integer + name: + pattern: "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$" + type: string + title: Pet category + type: object + xml: + name: Category + Tag: + description: A tag for a pet + example: + name: name + id: 1 + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + updatePetWithForm_request: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + uploadFile_request: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + securitySchemes: + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 + api_key: + in: header + name: api_key + type: apiKey + diff --git a/samples/client/petstore/java/native/test-regenerated/build.gradle b/samples/client/petstore/java/native/test-regenerated/build.gradle new file mode 100644 index 000000000000..56fa470fb767 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/build.gradle @@ -0,0 +1,109 @@ +apply plugin: 'idea' +apply plugin: 'eclipse' +apply plugin: 'com.diffplug.spotless' + +group = 'org.openapitools' +version = '1.0.0' + +buildscript { + repositories { + mavenCentral() + } + dependencies { + classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.11.0' + } +} + +repositories { + mavenCentral() +} + +apply plugin: 'java' +apply plugin: 'maven-publish' + +sourceCompatibility = JavaVersion.VERSION_11 +targetCompatibility = JavaVersion.VERSION_11 + +// Some text from the schema is copy pasted into the source files as UTF-8 +// but the default still seems to be to use platform encoding +tasks.withType(JavaCompile) { + configure(options) { + options.encoding = 'UTF-8' + } +} +javadoc { + options.encoding = 'UTF-8' +} + +publishing { + publications { + maven(MavenPublication) { + artifactId = 'openapi-java-client' + from components.java + } + } +} + +task execute(type:JavaExec) { + main = System.getProperty('mainClass') + classpath = sourceSets.main.runtimeClasspath +} + +task sourcesJar(type: Jar, dependsOn: classes) { + archiveClassifier = 'sources' + from sourceSets.main.allSource +} + +task javadocJar(type: Jar, dependsOn: javadoc) { + archiveClassifier = 'javadoc' + from javadoc.destinationDir +} + +artifacts { + archives sourcesJar + archives javadocJar +} + + +ext { + jackson_version = "2.17.1" + jakarta_annotation_version = "1.3.5" + beanvalidation_version = "2.0.2" + junit_version = "5.10.2" + httpmime_version = "4.5.13" +} + +dependencies { + implementation "com.google.code.findbugs:jsr305:3.0.2" + implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version" + implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" + implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_version" + implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" + implementation "org.openapitools:jackson-databind-nullable:0.2.1" + implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" + implementation "org.apache.httpcomponents:httpmime:$httpmime_version" + testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version" +} + +// Use spotless plugin to automatically format code, remove unused import, etc +// To apply changes directly to the file, run `gradlew spotlessApply` +// Ref: https://github.com/diffplug/spotless/tree/main/plugin-gradle +spotless { + // comment out below to run spotless as part of the `check` task + enforceCheck false + format 'misc', { + // define the files (e.g. '*.gradle', '*.md') to apply `misc` to + target '.gitignore' + // define the steps to apply to those files + trimTrailingWhitespace() + indentWithSpaces() // Takes an integer argument if you don't like 4 + endWithNewline() + } + java { + // don't need to set target, it is inferred from java + // apply a specific flavor of google-java-format + googleJavaFormat('1.8').aosp().reflowLongStrings() + removeUnusedImports() + importOrder() + } +} diff --git a/samples/client/petstore/java/native/test-regenerated/build.sbt b/samples/client/petstore/java/native/test-regenerated/build.sbt new file mode 100644 index 000000000000..464090415c47 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/build.sbt @@ -0,0 +1 @@ +# TODO diff --git a/samples/client/petstore/java/native/test-regenerated/docs/Category.md b/samples/client/petstore/java/native/test-regenerated/docs/Category.md new file mode 100644 index 000000000000..a7fc939d252e --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/docs/Category.md @@ -0,0 +1,15 @@ + + +# Category + +A category for a pet + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/native/test-regenerated/docs/ModelApiResponse.md b/samples/client/petstore/java/native/test-regenerated/docs/ModelApiResponse.md new file mode 100644 index 000000000000..cd7e3c400be6 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/docs/ModelApiResponse.md @@ -0,0 +1,16 @@ + + +# ModelApiResponse + +Describes the result of uploading an image resource + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**code** | **Integer** | | [optional] | +|**type** | **String** | | [optional] | +|**message** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/native/test-regenerated/docs/Order.md b/samples/client/petstore/java/native/test-regenerated/docs/Order.md new file mode 100644 index 000000000000..0c33059b8b6a --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/docs/Order.md @@ -0,0 +1,29 @@ + + +# Order + +An order for a pets from the pet store + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**petId** | **Long** | | [optional] | +|**quantity** | **Integer** | | [optional] | +|**shipDate** | **OffsetDateTime** | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional] | +|**complete** | **Boolean** | | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| PLACED | "placed" | +| APPROVED | "approved" | +| DELIVERED | "delivered" | + + + diff --git a/samples/client/petstore/java/native/test-regenerated/docs/Pet.md b/samples/client/petstore/java/native/test-regenerated/docs/Pet.md new file mode 100644 index 000000000000..8bb363301232 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/docs/Pet.md @@ -0,0 +1,29 @@ + + +# Pet + +A pet for sale in the pet store + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**category** | [**Category**](Category.md) | | [optional] | +|**name** | **String** | | | +|**photoUrls** | **List<String>** | | | +|**tags** | [**List<Tag>**](Tag.md) | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| AVAILABLE | "available" | +| PENDING | "pending" | +| SOLD | "sold" | + + + diff --git a/samples/client/petstore/java/native/test-regenerated/docs/PetApi.md b/samples/client/petstore/java/native/test-regenerated/docs/PetApi.md new file mode 100644 index 000000000000..51f089e85389 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/docs/PetApi.md @@ -0,0 +1,1212 @@ +# PetApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | +| [**addPetWithHttpInfo**](PetApi.md#addPetWithHttpInfo) | **POST** /pet | Add a new pet to the store | +| [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | +| [**deletePetWithHttpInfo**](PetApi.md#deletePetWithHttpInfo) | **DELETE** /pet/{petId} | Deletes a pet | +| [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | +| [**findPetsByStatusWithHttpInfo**](PetApi.md#findPetsByStatusWithHttpInfo) | **GET** /pet/findByStatus | Finds Pets by status | +| [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | +| [**findPetsByTagsWithHttpInfo**](PetApi.md#findPetsByTagsWithHttpInfo) | **GET** /pet/findByTags | Finds Pets by tags | +| [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | +| [**getPetByIdWithHttpInfo**](PetApi.md#getPetByIdWithHttpInfo) | **GET** /pet/{petId} | Find pet by ID | +| [**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet | +| [**updatePetWithHttpInfo**](PetApi.md#updatePetWithHttpInfo) | **PUT** /pet | Update an existing pet | +| [**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data | +| [**updatePetWithFormWithHttpInfo**](PetApi.md#updatePetWithFormWithHttpInfo) | **POST** /pet/{petId} | Updates a pet in the store with form data | +| [**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image | +| [**uploadFileWithHttpInfo**](PetApi.md#uploadFileWithHttpInfo) | **POST** /pet/{petId}/uploadImage | uploads an image | + + + +## addPet + +> Pet addPet(pet) + +Add a new pet to the store + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + Pet result = apiInstance.addPet(pet); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | + +### Return type + +[**Pet**](Pet.md) + + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: application/json, application/xml +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **405** | Invalid input | - | + +## addPetWithHttpInfo + +> ApiResponse addPet addPetWithHttpInfo(pet) + +Add a new pet to the store + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + ApiResponse response = apiInstance.addPetWithHttpInfo(pet); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | + +### Return type + +ApiResponse<[**Pet**](Pet.md)> + + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: application/json, application/xml +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **405** | Invalid input | - | + + +## deletePet + +> void deletePet(petId, apiKey) + +Deletes a pet + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | Pet id to delete + String apiKey = "apiKey_example"; // String | + try { + apiInstance.deletePet(petId, apiKey); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#deletePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| Pet id to delete | | +| **apiKey** | **String**| | [optional] | + +### Return type + + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid pet value | - | + +## deletePetWithHttpInfo + +> ApiResponse deletePet deletePetWithHttpInfo(petId, apiKey) + +Deletes a pet + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | Pet id to delete + String apiKey = "apiKey_example"; // String | + try { + ApiResponse response = apiInstance.deletePetWithHttpInfo(petId, apiKey); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#deletePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| Pet id to delete | | +| **apiKey** | **String**| | [optional] | + +### Return type + + +ApiResponse + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid pet value | - | + + +## findPetsByStatus + +> List findPetsByStatus(status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + List status = Arrays.asList("available"); // List | Status values that need to be considered for filter + try { + List result = apiInstance.findPetsByStatus(status); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByStatus"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [enum: available, pending, sold] | + +### Return type + +[**List<Pet>**](Pet.md) + + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid status value | - | + +## findPetsByStatusWithHttpInfo + +> ApiResponse> findPetsByStatus findPetsByStatusWithHttpInfo(status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + List status = Arrays.asList("available"); // List | Status values that need to be considered for filter + try { + ApiResponse> response = apiInstance.findPetsByStatusWithHttpInfo(status); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByStatus"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [enum: available, pending, sold] | + +### Return type + +ApiResponse<[**List<Pet>**](Pet.md)> + + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid status value | - | + + +## findPetsByTags + +> List findPetsByTags(tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + List tags = Arrays.asList(); // List | Tags to filter by + try { + List result = apiInstance.findPetsByTags(tags); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **tags** | [**List<String>**](String.md)| Tags to filter by | | + +### Return type + +[**List<Pet>**](Pet.md) + + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid tag value | - | + +## findPetsByTagsWithHttpInfo + +> ApiResponse> findPetsByTags findPetsByTagsWithHttpInfo(tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + List tags = Arrays.asList(); // List | Tags to filter by + try { + ApiResponse> response = apiInstance.findPetsByTagsWithHttpInfo(tags); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **tags** | [**List<String>**](String.md)| Tags to filter by | | + +### Return type + +ApiResponse<[**List<Pet>**](Pet.md)> + + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid tag value | - | + + +## getPetById + +> Pet getPetById(petId) + +Find pet by ID + +Returns a single pet + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to return + try { + Pet result = apiInstance.getPetById(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#getPetById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to return | | + +### Return type + +[**Pet**](Pet.md) + + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | + +## getPetByIdWithHttpInfo + +> ApiResponse getPetById getPetByIdWithHttpInfo(petId) + +Find pet by ID + +Returns a single pet + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to return + try { + ApiResponse response = apiInstance.getPetByIdWithHttpInfo(petId); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#getPetById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to return | | + +### Return type + +ApiResponse<[**Pet**](Pet.md)> + + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | + + +## updatePet + +> Pet updatePet(pet) + +Update an existing pet + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + Pet result = apiInstance.updatePet(pet); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | + +### Return type + +[**Pet**](Pet.md) + + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: application/json, application/xml +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | +| **405** | Validation exception | - | + +## updatePetWithHttpInfo + +> ApiResponse updatePet updatePetWithHttpInfo(pet) + +Update an existing pet + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + ApiResponse response = apiInstance.updatePetWithHttpInfo(pet); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | + +### Return type + +ApiResponse<[**Pet**](Pet.md)> + + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: application/json, application/xml +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | +| **405** | Validation exception | - | + + +## updatePetWithForm + +> void updatePetWithForm(petId, name, status) + +Updates a pet in the store with form data + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet that needs to be updated + String name = "name_example"; // String | Updated name of the pet + String status = "status_example"; // String | Updated status of the pet + try { + apiInstance.updatePetWithForm(petId, name, status); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePetWithForm"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet that needs to be updated | | +| **name** | **String**| Updated name of the pet | [optional] | +| **status** | **String**| Updated status of the pet | [optional] | + +### Return type + + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + +## updatePetWithFormWithHttpInfo + +> ApiResponse updatePetWithForm updatePetWithFormWithHttpInfo(petId, name, status) + +Updates a pet in the store with form data + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet that needs to be updated + String name = "name_example"; // String | Updated name of the pet + String status = "status_example"; // String | Updated status of the pet + try { + ApiResponse response = apiInstance.updatePetWithFormWithHttpInfo(petId, name, status); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePetWithForm"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet that needs to be updated | | +| **name** | **String**| Updated name of the pet | [optional] | +| **status** | **String**| Updated status of the pet | [optional] | + +### Return type + + +ApiResponse + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + + +## uploadFile + +> ModelApiResponse uploadFile(petId, additionalMetadata, _file) + +uploads an image + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + File _file = new File("/path/to/file"); // File | file to upload + try { + ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, _file); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | +| **additionalMetadata** | **String**| Additional data to pass to server | [optional] | +| **_file** | **File**| file to upload | [optional] | + +### Return type + +[**ModelApiResponse**](ModelApiResponse.md) + + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: multipart/form-data +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + +## uploadFileWithHttpInfo + +> ApiResponse uploadFile uploadFileWithHttpInfo(petId, additionalMetadata, _file) + +uploads an image + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + File _file = new File("/path/to/file"); // File | file to upload + try { + ApiResponse response = apiInstance.uploadFileWithHttpInfo(petId, additionalMetadata, _file); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | +| **additionalMetadata** | **String**| Additional data to pass to server | [optional] | +| **_file** | **File**| file to upload | [optional] | + +### Return type + +ApiResponse<[**ModelApiResponse**](ModelApiResponse.md)> + + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: multipart/form-data +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/native/test-regenerated/docs/StoreApi.md b/samples/client/petstore/java/native/test-regenerated/docs/StoreApi.md new file mode 100644 index 000000000000..7dfbbe315c11 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/docs/StoreApi.md @@ -0,0 +1,564 @@ +# StoreApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID | +| [**deleteOrderWithHttpInfo**](StoreApi.md#deleteOrderWithHttpInfo) | **DELETE** /store/order/{orderId} | Delete purchase order by ID | +| [**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status | +| [**getInventoryWithHttpInfo**](StoreApi.md#getInventoryWithHttpInfo) | **GET** /store/inventory | Returns pet inventories by status | +| [**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID | +| [**getOrderByIdWithHttpInfo**](StoreApi.md#getOrderByIdWithHttpInfo) | **GET** /store/order/{orderId} | Find purchase order by ID | +| [**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet | +| [**placeOrderWithHttpInfo**](StoreApi.md#placeOrderWithHttpInfo) | **POST** /store/order | Place an order for a pet | + + + +## deleteOrder + +> void deleteOrder(orderId) + +Delete purchase order by ID + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + String orderId = "orderId_example"; // String | ID of the order that needs to be deleted + try { + apiInstance.deleteOrder(orderId); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#deleteOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **orderId** | **String**| ID of the order that needs to be deleted | | + +### Return type + + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + +## deleteOrderWithHttpInfo + +> ApiResponse deleteOrder deleteOrderWithHttpInfo(orderId) + +Delete purchase order by ID + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + String orderId = "orderId_example"; // String | ID of the order that needs to be deleted + try { + ApiResponse response = apiInstance.deleteOrderWithHttpInfo(orderId); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#deleteOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **orderId** | **String**| ID of the order that needs to be deleted | | + +### Return type + + +ApiResponse + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + + +## getInventory + +> Map getInventory() + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + StoreApi apiInstance = new StoreApi(defaultClient); + try { + Map result = apiInstance.getInventory(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getInventory"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +**Map<String, Integer>** + + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + +## getInventoryWithHttpInfo + +> ApiResponse> getInventory getInventoryWithHttpInfo() + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + StoreApi apiInstance = new StoreApi(defaultClient); + try { + ApiResponse> response = apiInstance.getInventoryWithHttpInfo(); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getInventory"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +ApiResponse<**Map<String, Integer>**> + + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +## getOrderById + +> Order getOrderById(orderId) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + Long orderId = 56L; // Long | ID of pet that needs to be fetched + try { + Order result = apiInstance.getOrderById(orderId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getOrderById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **orderId** | **Long**| ID of pet that needs to be fetched | | + +### Return type + +[**Order**](Order.md) + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + +## getOrderByIdWithHttpInfo + +> ApiResponse getOrderById getOrderByIdWithHttpInfo(orderId) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + Long orderId = 56L; // Long | ID of pet that needs to be fetched + try { + ApiResponse response = apiInstance.getOrderByIdWithHttpInfo(orderId); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getOrderById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **orderId** | **Long**| ID of pet that needs to be fetched | | + +### Return type + +ApiResponse<[**Order**](Order.md)> + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + + +## placeOrder + +> Order placeOrder(order) + +Place an order for a pet + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + Order order = new Order(); // Order | order placed for purchasing the pet + try { + Order result = apiInstance.placeOrder(order); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#placeOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **order** | [**Order**](Order.md)| order placed for purchasing the pet | | + +### Return type + +[**Order**](Order.md) + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid Order | - | + +## placeOrderWithHttpInfo + +> ApiResponse placeOrder placeOrderWithHttpInfo(order) + +Place an order for a pet + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + Order order = new Order(); // Order | order placed for purchasing the pet + try { + ApiResponse response = apiInstance.placeOrderWithHttpInfo(order); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#placeOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **order** | [**Order**](Order.md)| order placed for purchasing the pet | | + +### Return type + +ApiResponse<[**Order**](Order.md)> + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid Order | - | + diff --git a/samples/client/petstore/java/native/test-regenerated/docs/Tag.md b/samples/client/petstore/java/native/test-regenerated/docs/Tag.md new file mode 100644 index 000000000000..abfde4afb501 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/docs/Tag.md @@ -0,0 +1,15 @@ + + +# Tag + +A tag for a pet + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/native/test-regenerated/docs/User.md b/samples/client/petstore/java/native/test-regenerated/docs/User.md new file mode 100644 index 000000000000..426845227bd3 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/docs/User.md @@ -0,0 +1,21 @@ + + +# User + +A User who is purchasing from the pet store + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**username** | **String** | | [optional] | +|**firstName** | **String** | | [optional] | +|**lastName** | **String** | | [optional] | +|**email** | **String** | | [optional] | +|**password** | **String** | | [optional] | +|**phone** | **String** | | [optional] | +|**userStatus** | **Integer** | User Status | [optional] | + + + diff --git a/samples/client/petstore/java/native/test-regenerated/docs/UserApi.md b/samples/client/petstore/java/native/test-regenerated/docs/UserApi.md new file mode 100644 index 000000000000..da72405c908b --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/docs/UserApi.md @@ -0,0 +1,1178 @@ +# UserApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**createUser**](UserApi.md#createUser) | **POST** /user | Create user | +| [**createUserWithHttpInfo**](UserApi.md#createUserWithHttpInfo) | **POST** /user | Create user | +| [**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array | +| [**createUsersWithArrayInputWithHttpInfo**](UserApi.md#createUsersWithArrayInputWithHttpInfo) | **POST** /user/createWithArray | Creates list of users with given input array | +| [**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array | +| [**createUsersWithListInputWithHttpInfo**](UserApi.md#createUsersWithListInputWithHttpInfo) | **POST** /user/createWithList | Creates list of users with given input array | +| [**deleteUser**](UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user | +| [**deleteUserWithHttpInfo**](UserApi.md#deleteUserWithHttpInfo) | **DELETE** /user/{username} | Delete user | +| [**getUserByName**](UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name | +| [**getUserByNameWithHttpInfo**](UserApi.md#getUserByNameWithHttpInfo) | **GET** /user/{username} | Get user by user name | +| [**loginUser**](UserApi.md#loginUser) | **GET** /user/login | Logs user into the system | +| [**loginUserWithHttpInfo**](UserApi.md#loginUserWithHttpInfo) | **GET** /user/login | Logs user into the system | +| [**logoutUser**](UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session | +| [**logoutUserWithHttpInfo**](UserApi.md#logoutUserWithHttpInfo) | **GET** /user/logout | Logs out current logged in user session | +| [**updateUser**](UserApi.md#updateUser) | **PUT** /user/{username} | Updated user | +| [**updateUserWithHttpInfo**](UserApi.md#updateUserWithHttpInfo) | **PUT** /user/{username} | Updated user | + + + +## createUser + +> void createUser(user) + +Create user + +This can only be done by the logged in user. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + User user = new User(); // User | Created user object + try { + apiInstance.createUser(user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**User**](User.md)| Created user object | | + +### Return type + + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + +## createUserWithHttpInfo + +> ApiResponse createUser createUserWithHttpInfo(user) + +Create user + +This can only be done by the logged in user. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + User user = new User(); // User | Created user object + try { + ApiResponse response = apiInstance.createUserWithHttpInfo(user); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**User**](User.md)| Created user object | | + +### Return type + + +ApiResponse + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +## createUsersWithArrayInput + +> void createUsersWithArrayInput(user) + +Creates list of users with given input array + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + List user = Arrays.asList(); // List | List of user object + try { + apiInstance.createUsersWithArrayInput(user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**List<User>**](User.md)| List of user object | | + +### Return type + + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + +## createUsersWithArrayInputWithHttpInfo + +> ApiResponse createUsersWithArrayInput createUsersWithArrayInputWithHttpInfo(user) + +Creates list of users with given input array + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + List user = Arrays.asList(); // List | List of user object + try { + ApiResponse response = apiInstance.createUsersWithArrayInputWithHttpInfo(user); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**List<User>**](User.md)| List of user object | | + +### Return type + + +ApiResponse + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +## createUsersWithListInput + +> void createUsersWithListInput(user) + +Creates list of users with given input array + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + List user = Arrays.asList(); // List | List of user object + try { + apiInstance.createUsersWithListInput(user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithListInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**List<User>**](User.md)| List of user object | | + +### Return type + + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + +## createUsersWithListInputWithHttpInfo + +> ApiResponse createUsersWithListInput createUsersWithListInputWithHttpInfo(user) + +Creates list of users with given input array + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + List user = Arrays.asList(); // List | List of user object + try { + ApiResponse response = apiInstance.createUsersWithListInputWithHttpInfo(user); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithListInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**List<User>**](User.md)| List of user object | | + +### Return type + + +ApiResponse + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +## deleteUser + +> void deleteUser(username) + +Delete user + +This can only be done by the logged in user. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be deleted + try { + apiInstance.deleteUser(username); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#deleteUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The name that needs to be deleted | | + +### Return type + + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + +## deleteUserWithHttpInfo + +> ApiResponse deleteUser deleteUserWithHttpInfo(username) + +Delete user + +This can only be done by the logged in user. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be deleted + try { + ApiResponse response = apiInstance.deleteUserWithHttpInfo(username); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#deleteUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The name that needs to be deleted | | + +### Return type + + +ApiResponse + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + + +## getUserByName + +> User getUserByName(username) + +Get user by user name + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. + try { + User result = apiInstance.getUserByName(username); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#getUserByName"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The name that needs to be fetched. Use user1 for testing. | | + +### Return type + +[**User**](User.md) + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + +## getUserByNameWithHttpInfo + +> ApiResponse getUserByName getUserByNameWithHttpInfo(username) + +Get user by user name + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. + try { + ApiResponse response = apiInstance.getUserByNameWithHttpInfo(username); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#getUserByName"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The name that needs to be fetched. Use user1 for testing. | | + +### Return type + +ApiResponse<[**User**](User.md)> + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + + +## loginUser + +> String loginUser(username, password) + +Logs user into the system + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The user name for login + String password = "password_example"; // String | The password for login in clear text + try { + String result = apiInstance.loginUser(username, password); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#loginUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The user name for login | | +| **password** | **String**| The password for login in clear text | | + +### Return type + +**String** + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +| **400** | Invalid username/password supplied | - | + +## loginUserWithHttpInfo + +> ApiResponse loginUser loginUserWithHttpInfo(username, password) + +Logs user into the system + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The user name for login + String password = "password_example"; // String | The password for login in clear text + try { + ApiResponse response = apiInstance.loginUserWithHttpInfo(username, password); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#loginUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The user name for login | | +| **password** | **String**| The password for login in clear text | | + +### Return type + +ApiResponse<**String**> + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +| **400** | Invalid username/password supplied | - | + + +## logoutUser + +> void logoutUser() + +Logs out current logged in user session + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + try { + apiInstance.logoutUser(); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#logoutUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + +## logoutUserWithHttpInfo + +> ApiResponse logoutUser logoutUserWithHttpInfo() + +Logs out current logged in user session + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + try { + ApiResponse response = apiInstance.logoutUserWithHttpInfo(); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#logoutUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + + +ApiResponse + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +## updateUser + +> void updateUser(username, user) + +Updated user + +This can only be done by the logged in user. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | name that need to be deleted + User user = new User(); // User | Updated user object + try { + apiInstance.updateUser(username, user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#updateUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| name that need to be deleted | | +| **user** | [**User**](User.md)| Updated user object | | + +### Return type + + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid user supplied | - | +| **404** | User not found | - | + +## updateUserWithHttpInfo + +> ApiResponse updateUser updateUserWithHttpInfo(username, user) + +Updated user + +This can only be done by the logged in user. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | name that need to be deleted + User user = new User(); // User | Updated user object + try { + ApiResponse response = apiInstance.updateUserWithHttpInfo(username, user); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#updateUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| name that need to be deleted | | +| **user** | [**User**](User.md)| Updated user object | | + +### Return type + + +ApiResponse + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid user supplied | - | +| **404** | User not found | - | + diff --git a/samples/client/petstore/java/native/test-regenerated/git_push.sh b/samples/client/petstore/java/native/test-regenerated/git_push.sh new file mode 100644 index 000000000000..f53a75d4fabe --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/git_push.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=$(git remote) +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/samples/client/petstore/java/native/test-regenerated/gradle.properties b/samples/client/petstore/java/native/test-regenerated/gradle.properties new file mode 100644 index 000000000000..a3408578278a --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/gradle.properties @@ -0,0 +1,6 @@ +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/petstore/java/native/test-regenerated/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/native/test-regenerated/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..e6441136f3d4ba8a0da8d277868979cfbc8ad796 GIT binary patch literal 43453 zcma&N1CXTcmMvW9vTb(Rwr$&4wr$(C?dmSu>@vG-+vuvg^_??!{yS%8zW-#zn-LkA z5&1^$^{lnmUON?}LBF8_K|(?T0Ra(xUH{($5eN!MR#ZihR#HxkUPe+_R8Cn`RRs(P z_^*#_XlXmGv7!4;*Y%p4nw?{bNp@UZHv1?Um8r6)Fei3p@ClJn0ECfg1hkeuUU@Or zDaPa;U3fE=3L}DooL;8f;P0ipPt0Z~9P0)lbStMS)ag54=uL9ia-Lm3nh|@(Y?B`; zx_#arJIpXH!U{fbCbI^17}6Ri*H<>OLR%c|^mh8+)*h~K8Z!9)DPf zR2h?lbDZQ`p9P;&DQ4F0sur@TMa!Y}S8irn(%d-gi0*WxxCSk*A?3lGh=gcYN?FGl z7D=Js!i~0=u3rox^eO3i@$0=n{K1lPNU zwmfjRVmLOCRfe=seV&P*1Iq=^i`502keY8Uy-WNPwVNNtJFx?IwAyRPZo2Wo1+S(xF37LJZ~%i)kpFQ3Fw=mXfd@>%+)RpYQLnr}B~~zoof(JVm^^&f zxKV^+3D3$A1G;qh4gPVjhrC8e(VYUHv#dy^)(RoUFM?o%W-EHxufuWf(l*@-l+7vt z=l`qmR56K~F|v<^Pd*p~1_y^P0P^aPC##d8+HqX4IR1gu+7w#~TBFphJxF)T$2WEa zxa?H&6=Qe7d(#tha?_1uQys2KtHQ{)Qco)qwGjrdNL7thd^G5i8Os)CHqc>iOidS} z%nFEDdm=GXBw=yXe1W-ShHHFb?Cc70+$W~z_+}nAoHFYI1MV1wZegw*0y^tC*s%3h zhD3tN8b=Gv&rj}!SUM6|ajSPp*58KR7MPpI{oAJCtY~JECm)*m_x>AZEu>DFgUcby z1Qaw8lU4jZpQ_$;*7RME+gq1KySGG#Wql>aL~k9tLrSO()LWn*q&YxHEuzmwd1?aAtI zBJ>P=&$=l1efe1CDU;`Fd+_;&wI07?V0aAIgc(!{a z0Jg6Y=inXc3^n!U0Atk`iCFIQooHqcWhO(qrieUOW8X(x?(RD}iYDLMjSwffH2~tB z)oDgNBLB^AJBM1M^c5HdRx6fBfka`(LD-qrlh5jqH~);#nw|iyp)()xVYak3;Ybik z0j`(+69aK*B>)e_p%=wu8XC&9e{AO4c~O1U`5X9}?0mrd*m$_EUek{R?DNSh(=br# z#Q61gBzEpmy`$pA*6!87 zSDD+=@fTY7<4A?GLqpA?Pb2z$pbCc4B4zL{BeZ?F-8`s$?>*lXXtn*NC61>|*w7J* z$?!iB{6R-0=KFmyp1nnEmLsA-H0a6l+1uaH^g%c(p{iT&YFrbQ$&PRb8Up#X3@Zsk zD^^&LK~111%cqlP%!_gFNa^dTYT?rhkGl}5=fL{a`UViaXWI$k-UcHJwmaH1s=S$4 z%4)PdWJX;hh5UoK?6aWoyLxX&NhNRqKam7tcOkLh{%j3K^4Mgx1@i|Pi&}<^5>hs5 zm8?uOS>%)NzT(%PjVPGa?X%`N2TQCKbeH2l;cTnHiHppPSJ<7y-yEIiC!P*ikl&!B z%+?>VttCOQM@ShFguHVjxX^?mHX^hSaO_;pnyh^v9EumqSZTi+#f&_Vaija0Q-e*| z7ulQj6Fs*bbmsWp{`auM04gGwsYYdNNZcg|ph0OgD>7O}Asn7^Z=eI>`$2*v78;sj-}oMoEj&@)9+ycEOo92xSyY344^ z11Hb8^kdOvbf^GNAK++bYioknrpdN>+u8R?JxG=!2Kd9r=YWCOJYXYuM0cOq^FhEd zBg2puKy__7VT3-r*dG4c62Wgxi52EMCQ`bKgf*#*ou(D4-ZN$+mg&7$u!! z-^+Z%;-3IDwqZ|K=ah85OLwkO zKxNBh+4QHh)u9D?MFtpbl)us}9+V!D%w9jfAMYEb>%$A;u)rrI zuBudh;5PN}_6J_}l55P3l_)&RMlH{m!)ai-i$g)&*M`eN$XQMw{v^r@-125^RRCF0 z^2>|DxhQw(mtNEI2Kj(;KblC7x=JlK$@78`O~>V!`|1Lm-^JR$-5pUANAnb(5}B}JGjBsliK4& zk6y(;$e&h)lh2)L=bvZKbvh@>vLlreBdH8No2>$#%_Wp1U0N7Ank!6$dFSi#xzh|( zRi{Uw%-4W!{IXZ)fWx@XX6;&(m_F%c6~X8hx=BN1&q}*( zoaNjWabE{oUPb!Bt$eyd#$5j9rItB-h*5JiNi(v^e|XKAj*8(k<5-2$&ZBR5fF|JA z9&m4fbzNQnAU}r8ab>fFV%J0z5awe#UZ|bz?Ur)U9bCIKWEzi2%A+5CLqh?}K4JHi z4vtM;+uPsVz{Lfr;78W78gC;z*yTch~4YkLr&m-7%-xc ztw6Mh2d>_iO*$Rd8(-Cr1_V8EO1f*^@wRoSozS) zy1UoC@pruAaC8Z_7~_w4Q6n*&B0AjOmMWa;sIav&gu z|J5&|{=a@vR!~k-OjKEgPFCzcJ>#A1uL&7xTDn;{XBdeM}V=l3B8fE1--DHjSaxoSjNKEM9|U9#m2<3>n{Iuo`r3UZp;>GkT2YBNAh|b z^jTq-hJp(ebZh#Lk8hVBP%qXwv-@vbvoREX$TqRGTgEi$%_F9tZES@z8Bx}$#5eeG zk^UsLBH{bc2VBW)*EdS({yw=?qmevwi?BL6*=12k9zM5gJv1>y#ML4!)iiPzVaH9% zgSImetD@dam~e>{LvVh!phhzpW+iFvWpGT#CVE5TQ40n%F|p(sP5mXxna+Ev7PDwA zamaV4m*^~*xV+&p;W749xhb_X=$|LD;FHuB&JL5?*Y2-oIT(wYY2;73<^#46S~Gx| z^cez%V7x$81}UWqS13Gz80379Rj;6~WdiXWOSsdmzY39L;Hg3MH43o*y8ibNBBH`(av4|u;YPq%{R;IuYow<+GEsf@R?=@tT@!}?#>zIIn0CoyV!hq3mw zHj>OOjfJM3F{RG#6ujzo?y32m^tgSXf@v=J$ELdJ+=5j|=F-~hP$G&}tDZsZE?5rX ztGj`!S>)CFmdkccxM9eGIcGnS2AfK#gXwj%esuIBNJQP1WV~b~+D7PJTmWGTSDrR` zEAu4B8l>NPuhsk5a`rReSya2nfV1EK01+G!x8aBdTs3Io$u5!6n6KX%uv@DxAp3F@{4UYg4SWJtQ-W~0MDb|j-$lwVn znAm*Pl!?Ps&3wO=R115RWKb*JKoexo*)uhhHBncEDMSVa_PyA>k{Zm2(wMQ(5NM3# z)jkza|GoWEQo4^s*wE(gHz?Xsg4`}HUAcs42cM1-qq_=+=!Gk^y710j=66(cSWqUe zklbm8+zB_syQv5A2rj!Vbw8;|$@C!vfNmNV!yJIWDQ>{+2x zKjuFX`~~HKG~^6h5FntRpnnHt=D&rq0>IJ9#F0eM)Y-)GpRjiN7gkA8wvnG#K=q{q z9dBn8_~wm4J<3J_vl|9H{7q6u2A!cW{bp#r*-f{gOV^e=8S{nc1DxMHFwuM$;aVI^ zz6A*}m8N-&x8;aunp1w7_vtB*pa+OYBw=TMc6QK=mbA-|Cf* zvyh8D4LRJImooUaSb7t*fVfih<97Gf@VE0|z>NcBwBQze);Rh!k3K_sfunToZY;f2 z^HmC4KjHRVg+eKYj;PRN^|E0>Gj_zagfRbrki68I^#~6-HaHg3BUW%+clM1xQEdPYt_g<2K+z!$>*$9nQ>; zf9Bei{?zY^-e{q_*|W#2rJG`2fy@{%6u0i_VEWTq$*(ZN37|8lFFFt)nCG({r!q#9 z5VK_kkSJ3?zOH)OezMT{!YkCuSSn!K#-Rhl$uUM(bq*jY? zi1xbMVthJ`E>d>(f3)~fozjg^@eheMF6<)I`oeJYx4*+M&%c9VArn(OM-wp%M<-`x z7sLP1&3^%Nld9Dhm@$3f2}87!quhI@nwd@3~fZl_3LYW-B?Ia>ui`ELg z&Qfe!7m6ze=mZ`Ia9$z|ARSw|IdMpooY4YiPN8K z4B(ts3p%2i(Td=tgEHX z0UQ_>URBtG+-?0E;E7Ld^dyZ;jjw0}XZ(}-QzC6+NN=40oDb2^v!L1g9xRvE#@IBR zO!b-2N7wVfLV;mhEaXQ9XAU+>=XVA6f&T4Z-@AX!leJ8obP^P^wP0aICND?~w&NykJ#54x3_@r7IDMdRNy4Hh;h*!u(Ol(#0bJdwEo$5437-UBjQ+j=Ic>Q2z` zJNDf0yO6@mr6y1#n3)s(W|$iE_i8r@Gd@!DWDqZ7J&~gAm1#~maIGJ1sls^gxL9LLG_NhU!pTGty!TbhzQnu)I*S^54U6Yu%ZeCg`R>Q zhBv$n5j0v%O_j{QYWG!R9W?5_b&67KB$t}&e2LdMvd(PxN6Ir!H4>PNlerpBL>Zvyy!yw z-SOo8caEpDt(}|gKPBd$qND5#a5nju^O>V&;f890?yEOfkSG^HQVmEbM3Ugzu+UtH zC(INPDdraBN?P%kE;*Ae%Wto&sgw(crfZ#Qy(<4nk;S|hD3j{IQRI6Yq|f^basLY; z-HB&Je%Gg}Jt@={_C{L$!RM;$$|iD6vu#3w?v?*;&()uB|I-XqEKqZPS!reW9JkLewLb!70T7n`i!gNtb1%vN- zySZj{8-1>6E%H&=V}LM#xmt`J3XQoaD|@XygXjdZ1+P77-=;=eYpoEQ01B@L*a(uW zrZeZz?HJsw_4g0vhUgkg@VF8<-X$B8pOqCuWAl28uB|@r`19DTUQQsb^pfqB6QtiT z*`_UZ`fT}vtUY#%sq2{rchyfu*pCg;uec2$-$N_xgjZcoumE5vSI{+s@iLWoz^Mf; zuI8kDP{!XY6OP~q5}%1&L}CtfH^N<3o4L@J@zg1-mt{9L`s^z$Vgb|mr{@WiwAqKg zp#t-lhrU>F8o0s1q_9y`gQNf~Vb!F%70f}$>i7o4ho$`uciNf=xgJ>&!gSt0g;M>*x4-`U)ysFW&Vs^Vk6m%?iuWU+o&m(2Jm26Y(3%TL; zA7T)BP{WS!&xmxNw%J=$MPfn(9*^*TV;$JwRy8Zl*yUZi8jWYF>==j~&S|Xinsb%c z2?B+kpet*muEW7@AzjBA^wAJBY8i|#C{WtO_or&Nj2{=6JTTX05}|H>N2B|Wf!*3_ z7hW*j6p3TvpghEc6-wufFiY!%-GvOx*bZrhZu+7?iSrZL5q9}igiF^*R3%DE4aCHZ zqu>xS8LkW+Auv%z-<1Xs92u23R$nk@Pk}MU5!gT|c7vGlEA%G^2th&Q*zfg%-D^=f z&J_}jskj|Q;73NP4<4k*Y%pXPU2Thoqr+5uH1yEYM|VtBPW6lXaetokD0u z9qVek6Q&wk)tFbQ8(^HGf3Wp16gKmr>G;#G(HRBx?F`9AIRboK+;OfHaLJ(P>IP0w zyTbTkx_THEOs%Q&aPrxbZrJlio+hCC_HK<4%f3ZoSAyG7Dn`=X=&h@m*|UYO-4Hq0 z-Bq&+Ie!S##4A6OGoC~>ZW`Y5J)*ouaFl_e9GA*VSL!O_@xGiBw!AF}1{tB)z(w%c zS1Hmrb9OC8>0a_$BzeiN?rkPLc9%&;1CZW*4}CDDNr2gcl_3z+WC15&H1Zc2{o~i) z)LLW=WQ{?ricmC`G1GfJ0Yp4Dy~Ba;j6ZV4r{8xRs`13{dD!xXmr^Aga|C=iSmor% z8hi|pTXH)5Yf&v~exp3o+sY4B^^b*eYkkCYl*T{*=-0HniSA_1F53eCb{x~1k3*`W zr~};p1A`k{1DV9=UPnLDgz{aJH=-LQo<5%+Em!DNN252xwIf*wF_zS^!(XSm(9eoj z=*dXG&n0>)_)N5oc6v!>-bd(2ragD8O=M|wGW z!xJQS<)u70m&6OmrF0WSsr@I%T*c#Qo#Ha4d3COcX+9}hM5!7JIGF>7<~C(Ear^Sn zm^ZFkV6~Ula6+8S?oOROOA6$C&q&dp`>oR-2Ym3(HT@O7Sd5c~+kjrmM)YmgPH*tL zX+znN>`tv;5eOfX?h{AuX^LK~V#gPCu=)Tigtq9&?7Xh$qN|%A$?V*v=&-2F$zTUv z`C#WyIrChS5|Kgm_GeudCFf;)!WH7FI60j^0o#65o6`w*S7R@)88n$1nrgU(oU0M9 zx+EuMkC>(4j1;m6NoGqEkpJYJ?vc|B zOlwT3t&UgL!pX_P*6g36`ZXQ; z9~Cv}ANFnJGp(;ZhS(@FT;3e)0)Kp;h^x;$*xZn*k0U6-&FwI=uOGaODdrsp-!K$Ac32^c{+FhI-HkYd5v=`PGsg%6I`4d9Jy)uW0y%) zm&j^9WBAp*P8#kGJUhB!L?a%h$hJgQrx!6KCB_TRo%9{t0J7KW8!o1B!NC)VGLM5! zpZy5Jc{`r{1e(jd%jsG7k%I+m#CGS*BPA65ZVW~fLYw0dA-H_}O zrkGFL&P1PG9p2(%QiEWm6x;U-U&I#;Em$nx-_I^wtgw3xUPVVu zqSuKnx&dIT-XT+T10p;yjo1Y)z(x1fb8Dzfn8e yu?e%!_ptzGB|8GrCfu%p?(_ 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

NnX)EH+Nua)3Y(c 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 '} +case $link in #( +/*) app_path=$link ;; #( +*) app_path=$APP_HOME$link ;; +esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { +echo "$*" +} >&2 + +die () { +echo +echo "$*" +echo +exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( +CYGWIN* ) cygwin=true ;; #( +Darwin* ) darwin=true ;; #( +MSYS* | MINGW* ) msys=true ;; #( +NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then +if [ -x "$JAVA_HOME/jre/sh/java" ] ; then +# IBM's JDK on AIX uses strange locations for the executables +JAVACMD=$JAVA_HOME/jre/sh/java +else +JAVACMD=$JAVA_HOME/bin/java +fi +if [ ! -x "$JAVACMD" ] ; then +die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +else +JAVACMD=java +if ! command -v java >/dev/null 2>&1 +then +die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then +case $MAX_FD in #( +max*) +# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +MAX_FD=$( ulimit -H -n ) || +warn "Could not query maximum file descriptor limit" +esac +case $MAX_FD in #( +'' | soft) :;; #( +*) +# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +ulimit -n "$MAX_FD" || +warn "Could not set maximum file descriptor limit to $MAX_FD" +esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then +APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) +CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + +JAVACMD=$( cygpath --unix "$JAVACMD" ) + +# Now convert the arguments - kludge to limit ourselves to /bin/sh +for arg do +if +case $arg in #( +-*) false ;; # don't mess with options #( +/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath +[ -e "$t" ] ;; #( +*) false ;; +esac +then +arg=$( cygpath --path --ignore --mixed "$arg" ) +fi +# Roll the args list around exactly as many times as the number of +# args, so each arg winds up back in the position where it started, but +# possibly modified. +# +# NB: a `for` loop captures its iteration list before it begins, so +# changing the positional parameters here affects neither the number of +# iterations, nor the values presented in `arg`. +shift # remove old arg +set -- "$@" "$arg" # push replacement arg +done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ +"-Dorg.gradle.appname=$APP_BASE_NAME" \ +-classpath "$CLASSPATH" \ +org.gradle.wrapper.GradleWrapperMain \ +"$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then +die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( +printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | +xargs -n1 | +sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | +tr '\n' ' ' +)" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/java/native/test-regenerated/gradlew.bat b/samples/client/petstore/java/native/test-regenerated/gradlew.bat new file mode 100644 index 000000000000..25da30dbdeee --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/client/petstore/java/native/test-regenerated/pom.xml b/samples/client/petstore/java/native/test-regenerated/pom.xml new file mode 100644 index 000000000000..10a3beca26fb --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/pom.xml @@ -0,0 +1,264 @@ + + 4.0.0 + org.openapitools + openapi-java-client + jar + openapi-java-client + 1.0.0 + https://github.com/openapitools/openapi-generator + OpenAPI Java + + scm:git:git@github.com:openapitools/openapi-generator.git + scm:git:git@github.com:openapitools/openapi-generator.git + https://github.com/openapitools/openapi-generator + + + + + Unlicense + https://www.apache.org/licenses/LICENSE-2.0.html + repo + + + + + + OpenAPI-Generator Contributors + team@openapitools.org + OpenAPITools.org + http://openapitools.org + + + + + + + maven-enforcer-plugin + 3.1.0 + + + enforce-maven + + enforce + + + + + 3 + + + 11 + + + + + + + + maven-surefire-plugin + 3.2.5 + + + conf/log4j.properties + + -Xms512m -Xmx1500m + methods + 10 + + + + maven-dependency-plugin + 3.3.0 + + + package + + copy-dependencies + + + ${project.build.directory}/lib + + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.3.0 + + + + test-jar + + + + + + + + maven-compiler-plugin + 3.10.1 + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.4.1 + + + attach-javadocs + + jar + + + + + + maven-source-plugin + 3.2.1 + + + attach-sources + + jar-no-fork + + + + + + + com.diffplug.spotless + spotless-maven-plugin + ${spotless.version} + + + + + + + .gitignore + + + + + + true + 4 + + + + + + + + + + 1.8 + + true + + + + + + + + + + + + sign-artifacts + + + + maven-gpg-plugin + 3.0.1 + + + sign-artifacts + verify + + sign + + + + + + + + + + + + + + com.fasterxml.jackson.core + jackson-core + ${jackson-version} + + + com.fasterxml.jackson.core + jackson-annotations + ${jackson-version} + + + com.fasterxml.jackson.core + jackson-databind + ${jackson-version} + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson-version} + + + org.openapitools + jackson-databind-nullable + ${jackson-databind-nullable-version} + + + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + jakarta.annotation + jakarta.annotation-api + ${jakarta-annotation-version} + provided + + + org.apache.httpcomponents + httpmime + ${httpmime-version} + + + + + org.junit.jupiter + junit-jupiter-api + ${junit-version} + test + + + + + UTF-8 + 11 + 11 + 2.17.1 + 0.2.6 + 1.3.5 + 2.0.2 + 4.5.14 + 5.10.2 + 2.27.2 + + diff --git a/samples/client/petstore/java/native/test-regenerated/settings.gradle b/samples/client/petstore/java/native/test-regenerated/settings.gradle new file mode 100644 index 000000000000..369ba54a9e06 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/settings.gradle @@ -0,0 +1 @@ +rootProject.name = "openapi-java-client" \ No newline at end of file diff --git a/samples/client/petstore/java/native/test-regenerated/src/main/AndroidManifest.xml b/samples/client/petstore/java/native/test-regenerated/src/main/AndroidManifest.xml new file mode 100644 index 000000000000..54fbcb3da1e8 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/src/main/AndroidManifest.xml @@ -0,0 +1,3 @@ + + + diff --git a/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/ApiClient.java new file mode 100644 index 000000000000..a4138950264a --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/ApiClient.java @@ -0,0 +1,457 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import org.openapitools.jackson.nullable.JsonNullableModule; + +import java.io.InputStream; +import java.net.URI; +import java.net.URLEncoder; +import java.net.http.HttpClient; +import java.net.http.HttpConnectTimeoutException; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.StringJoiner; +import java.util.function.Consumer; +import java.util.stream.Collectors; + +import static java.nio.charset.StandardCharsets.UTF_8; + +/** + * Configuration and utility class for API clients. + * + *

This class can be constructed and modified, then used to instantiate the + * various API classes. The API classes use the settings in this class to + * configure themselves, but otherwise do not store a link to this class.

+ * + *

This class is mutable and not synchronized, so it is not thread-safe. + * The API classes generated from this are immutable and thread-safe.

+ * + *

The setter methods of this class return the current object to facilitate + * a fluent style of configuration.

+ */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:01:56.363494+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class ApiClient { + + protected HttpClient.Builder builder; + protected ObjectMapper mapper; + protected String scheme; + protected String host; + protected int port; + protected String basePath; + protected Consumer interceptor; + protected Consumer> responseInterceptor; + protected Consumer> asyncResponseInterceptor; + protected Duration readTimeout; + protected Duration connectTimeout; + + public static String valueToString(Object value) { + if (value == null) { + return ""; + } + if (value instanceof OffsetDateTime) { + return ((OffsetDateTime) value).format(DateTimeFormatter.ISO_OFFSET_DATE_TIME); + } + return value.toString(); + } + + /** + * URL encode a string in the UTF-8 encoding. + * + * @param s String to encode. + * @return URL-encoded representation of the input string. + */ + public static String urlEncode(String s) { + return URLEncoder.encode(s, UTF_8).replaceAll("\\+", "%20"); + } + + /** + * Convert a URL query name/value parameter to a list of encoded {@link Pair} + * objects. + * + *

The value can be null, in which case an empty list is returned.

+ * + * @param name The query name parameter. + * @param value The query value, which may not be a collection but may be + * null. + * @return A singleton list of the {@link Pair} objects representing the input + * parameters, which is encoded for use in a URL. If the value is null, an + * empty list is returned. + */ + public static List parameterToPairs(String name, Object value) { + if (name == null || name.isEmpty() || value == null) { + return Collections.emptyList(); + } + return Collections.singletonList(new Pair(urlEncode(name), urlEncode(valueToString(value)))); + } + + /** + * Convert a URL query name/collection parameter to a list of encoded + * {@link Pair} objects. + * + * @param collectionFormat The swagger collectionFormat string (csv, tsv, etc). + * @param name The query name parameter. + * @param values A collection of values for the given query name, which may be + * null. + * @return A list of {@link Pair} objects representing the input parameters, + * which is encoded for use in a URL. If the values collection is null, an + * empty list is returned. + */ + public static List parameterToPairs( + String collectionFormat, String name, Collection values) { + if (name == null || name.isEmpty() || values == null || values.isEmpty()) { + return Collections.emptyList(); + } + + // get the collection format (default: csv) + String format = collectionFormat == null || collectionFormat.isEmpty() ? "csv" : collectionFormat; + + // create the params based on the collection format + if ("multi".equals(format)) { + return values.stream() + .map(value -> new Pair(urlEncode(name), urlEncode(valueToString(value)))) + .collect(Collectors.toList()); + } + + String delimiter; + switch(format) { + case "csv": + delimiter = urlEncode(","); + break; + case "ssv": + delimiter = urlEncode(" "); + break; + case "tsv": + delimiter = urlEncode("\t"); + break; + case "pipes": + delimiter = urlEncode("|"); + break; + default: + throw new IllegalArgumentException("Illegal collection format: " + collectionFormat); + } + + StringJoiner joiner = new StringJoiner(delimiter); + for (Object value : values) { + joiner.add(urlEncode(valueToString(value))); + } + + return Collections.singletonList(new Pair(urlEncode(name), joiner.toString())); + } + + /** + * Create an instance of ApiClient. + */ + public ApiClient() { + this.builder = createDefaultHttpClientBuilder(); + this.mapper = createDefaultObjectMapper(); + updateBaseUri(getDefaultBaseUri()); + interceptor = null; + readTimeout = null; + connectTimeout = null; + responseInterceptor = null; + asyncResponseInterceptor = null; + } + + /** + * Create an instance of ApiClient. + * + * @param builder Http client builder. + * @param mapper Object mapper. + * @param baseUri Base URI + */ + public ApiClient(HttpClient.Builder builder, ObjectMapper mapper, String baseUri) { + this.builder = builder; + this.mapper = mapper; + updateBaseUri(baseUri != null ? baseUri : getDefaultBaseUri()); + interceptor = null; + readTimeout = null; + connectTimeout = null; + responseInterceptor = null; + asyncResponseInterceptor = null; + } + + public static ObjectMapper createDefaultObjectMapper() { + ObjectMapper mapper = new ObjectMapper(); + mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, false); + mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); + mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); + mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); + mapper.disable(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE); + mapper.registerModule(new JavaTimeModule()); + mapper.registerModule(new JsonNullableModule()); + mapper.registerModule(new RFC3339JavaTimeModule()); + return mapper; + } + + protected String getDefaultBaseUri() { + return "http://petstore.swagger.io/v2"; + } + + public static HttpClient.Builder createDefaultHttpClientBuilder() { + return HttpClient.newBuilder(); + } + + public final void updateBaseUri(String baseUri) { + URI uri = URI.create(baseUri); + scheme = uri.getScheme(); + host = uri.getHost(); + port = uri.getPort(); + basePath = uri.getRawPath(); + } + + /** + * Set a custom {@link HttpClient.Builder} object to use when creating the + * {@link HttpClient} that is used by the API client. + * + * @param builder Custom client builder. + * @return This object. + */ + public ApiClient setHttpClientBuilder(HttpClient.Builder builder) { + this.builder = builder; + return this; + } + + /** + * Get an {@link HttpClient} based on the current {@link HttpClient.Builder}. + * + *

The returned object is immutable and thread-safe.

+ * + * @return The HTTP client. + */ + public HttpClient getHttpClient() { + return builder.build(); + } + + /** + * Set a custom {@link ObjectMapper} to serialize and deserialize the request + * and response bodies. + * + * @param mapper Custom object mapper. + * @return This object. + */ + public ApiClient setObjectMapper(ObjectMapper mapper) { + this.mapper = mapper; + return this; + } + + /** + * Get a copy of the current {@link ObjectMapper}. + * + * @return A copy of the current object mapper. + */ + public ObjectMapper getObjectMapper() { + return mapper.copy(); + } + + /** + * Set a custom host name for the target service. + * + * @param host The host name of the target service. + * @return This object. + */ + public ApiClient setHost(String host) { + this.host = host; + return this; + } + + /** + * Set a custom port number for the target service. + * + * @param port The port of the target service. Set this to -1 to reset the + * value to the default for the scheme. + * @return This object. + */ + public ApiClient setPort(int port) { + this.port = port; + return this; + } + + /** + * Set a custom base path for the target service, for example '/v2'. + * + * @param basePath The base path against which the rest of the path is + * resolved. + * @return This object. + */ + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + return this; + } + + /** + * Get the base URI to resolve the endpoint paths against. + * + * @return The complete base URI that the rest of the API parameters are + * resolved against. + */ + public String getBaseUri() { + return scheme + "://" + host + (port == -1 ? "" : ":" + port) + basePath; + } + + /** + * Set a custom scheme for the target service, for example 'https'. + * + * @param scheme The scheme of the target service + * @return This object. + */ + public ApiClient setScheme(String scheme){ + this.scheme = scheme; + return this; + } + + /** + * Set a custom request interceptor. + * + *

A request interceptor is a mechanism for altering each request before it + * is sent. After the request has been fully configured but not yet built, the + * request builder is passed into this function for further modification, + * after which it is sent out.

+ * + *

This is useful for altering the requests in a custom manner, such as + * adding headers. It could also be used for logging and monitoring.

+ * + * @param interceptor A function invoked before creating each request. A value + * of null resets the interceptor to a no-op. + * @return This object. + */ + public ApiClient setRequestInterceptor(Consumer interceptor) { + this.interceptor = interceptor; + return this; + } + + /** + * Get the custom interceptor. + * + * @return The custom interceptor that was set, or null if there isn't any. + */ + public Consumer getRequestInterceptor() { + return interceptor; + } + + /** + * Set a custom response interceptor. + * + *

This is useful for logging, monitoring or extraction of header variables

+ * + * @param interceptor A function invoked before creating each request. A value + * of null resets the interceptor to a no-op. + * @return This object. + */ + public ApiClient setResponseInterceptor(Consumer> interceptor) { + this.responseInterceptor = interceptor; + return this; + } + + /** + * Get the custom response interceptor. + * + * @return The custom interceptor that was set, or null if there isn't any. + */ + public Consumer> getResponseInterceptor() { + return responseInterceptor; + } + + /** + * Set a custom async response interceptor. Use this interceptor when asyncNative is set to 'true'. + * + *

This is useful for logging, monitoring or extraction of header variables

+ * + * @param interceptor A function invoked before creating each request. A value + * of null resets the interceptor to a no-op. + * @return This object. + */ + public ApiClient setAsyncResponseInterceptor(Consumer> interceptor) { + this.asyncResponseInterceptor = interceptor; + return this; + } + + /** + * Get the custom async response interceptor. Use this interceptor when asyncNative is set to 'true'. + * + * @return The custom interceptor that was set, or null if there isn't any. + */ + public Consumer> getAsyncResponseInterceptor() { + return asyncResponseInterceptor; + } + + /** + * Set the read timeout for the http client. + * + *

This is the value used by default for each request, though it can be + * overridden on a per-request basis with a request interceptor.

+ * + * @param readTimeout The read timeout used by default by the http client. + * Setting this value to null resets the timeout to an + * effectively infinite value. + * @return This object. + */ + public ApiClient setReadTimeout(Duration readTimeout) { + this.readTimeout = readTimeout; + return this; + } + + /** + * Get the read timeout that was set. + * + * @return The read timeout, or null if no timeout was set. Null represents + * an infinite wait time. + */ + public Duration getReadTimeout() { + return readTimeout; + } + /** + * Sets the connect timeout (in milliseconds) for the http client. + * + *

In the case where a new connection needs to be established, if + * the connection cannot be established within the given {@code + * duration}, then {@link HttpClient#send(HttpRequest,BodyHandler) + * HttpClient::send} throws an {@link HttpConnectTimeoutException}, or + * {@link HttpClient#sendAsync(HttpRequest,BodyHandler) + * HttpClient::sendAsync} completes exceptionally with an + * {@code HttpConnectTimeoutException}. If a new connection does not + * need to be established, for example if a connection can be reused + * from a previous request, then this timeout duration has no effect. + * + * @param connectTimeout connection timeout in milliseconds + * + * @return This object. + */ + public ApiClient setConnectTimeout(Duration connectTimeout) { + this.connectTimeout = connectTimeout; + this.builder.connectTimeout(connectTimeout); + return this; + } + + /** + * Get connection timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public Duration getConnectTimeout() { + return connectTimeout; + } +} diff --git a/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/ApiException.java new file mode 100644 index 000000000000..4193b3153684 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/ApiException.java @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +import java.net.http.HttpHeaders; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:01:56.363494+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class ApiException extends Exception { + private static final long serialVersionUID = 1L; + + private int code = 0; + private HttpHeaders responseHeaders = null; + private String responseBody = null; + + public ApiException() {} + + public ApiException(Throwable throwable) { + super(throwable); + } + + public ApiException(String message) { + super(message); + } + + public ApiException(String message, Throwable throwable, int code, HttpHeaders responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + public ApiException(String message, int code, HttpHeaders responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(String message, Throwable throwable, int code, HttpHeaders responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } + + public ApiException(int code, HttpHeaders responseHeaders, String responseBody) { + this((String) null, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + public ApiException(int code, String message, HttpHeaders responseHeaders, String responseBody) { + this(code, message); + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + /** + * Get the HTTP status code. + * + * @return HTTP status code + */ + public int getCode() { + return code; + } + + /** + * Get the HTTP response headers. + * + * @return Headers as an HttpHeaders object + */ + public HttpHeaders getResponseHeaders() { + return responseHeaders; + } + + /** + * Get the HTTP response body. + * + * @return Response body in the form of string + */ + public String getResponseBody() { + return responseBody; + } +} diff --git a/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/ApiResponse.java b/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/ApiResponse.java new file mode 100644 index 000000000000..56d4eb47c6d8 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/ApiResponse.java @@ -0,0 +1,60 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +import java.util.List; +import java.util.Map; + +/** + * API response returned by API call. + * + * @param The type of data that is deserialized from response body + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:01:56.363494+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class ApiResponse { + final private int statusCode; + final private Map> headers; + final private T data; + + /** + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + */ + public ApiResponse(int statusCode, Map> headers) { + this(statusCode, headers, null); + } + + /** + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + * @param data The object deserialized from response bod + */ + public ApiResponse(int statusCode, Map> headers, T data) { + this.statusCode = statusCode; + this.headers = headers; + this.data = data; + } + + public int getStatusCode() { + return statusCode; + } + + public Map> getHeaders() { + return headers; + } + + public T getData() { + return data; + } +} diff --git a/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/Configuration.java b/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/Configuration.java new file mode 100644 index 000000000000..fd0f5b05dd29 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/Configuration.java @@ -0,0 +1,63 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +import java.util.Objects; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Supplier; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:01:56.363494+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class Configuration { + public static final String VERSION = "1.0.0"; + + private static final AtomicReference defaultApiClient = new AtomicReference<>(); + private static volatile Supplier apiClientFactory = ApiClient::new; + + /** + * Get the default API client, which would be used when creating API instances without providing an API client. + * + * @return Default API client + */ + public static ApiClient getDefaultApiClient() { + ApiClient client = defaultApiClient.get(); + if (client == null) { + client = defaultApiClient.updateAndGet(val -> { + if (val != null) { // changed by another thread + return val; + } + return apiClientFactory.get(); + }); + } + return client; + } + + /** + * Set the default API client, which would be used when creating API instances without providing an API client. + * + * @param apiClient API client + */ + public static void setDefaultApiClient(ApiClient apiClient) { + defaultApiClient.set(apiClient); + } + + /** + * set the callback used to create new ApiClient objects + */ + public static void setApiClientFactory(Supplier factory) { + apiClientFactory = Objects.requireNonNull(factory); + } + + private Configuration() { + } +} \ No newline at end of file diff --git a/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/JSON.java new file mode 100644 index 000000000000..470a66b18d70 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/JSON.java @@ -0,0 +1,264 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.*; +import com.fasterxml.jackson.databind.json.JsonMapper; +import org.openapitools.jackson.nullable.JsonNullableModule; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import org.openapitools.client.model.*; + +import java.text.DateFormat; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:01:56.363494+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class JSON { + private ObjectMapper mapper; + + public JSON() { + mapper = JsonMapper.builder() + .serializationInclusion(JsonInclude.Include.NON_NULL) + .disable(MapperFeature.ALLOW_COERCION_OF_SCALARS) + .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE) + .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) + .enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING) + .enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING) + .defaultDateFormat(new RFC3339DateFormat()) + .addModule(new JavaTimeModule()) + .build(); + JsonNullableModule jnm = new JsonNullableModule(); + mapper.registerModule(jnm); + } + + /** + * Set the date format for JSON (de)serialization with Date properties. + * + * @param dateFormat Date format + */ + public void setDateFormat(DateFormat dateFormat) { + mapper.setDateFormat(dateFormat); + } + + /** + * Get the object mapper + * + * @return object mapper + */ + public ObjectMapper getMapper() { return mapper; } + + /** + * Returns the target model class that should be used to deserialize the input data. + * The discriminator mappings are used to determine the target model class. + * + * @param node The input data. + * @param modelClass The class that contains the discriminator mappings. + * + * @return the target model class. + */ + public static Class getClassForElement(JsonNode node, Class modelClass) { + ClassDiscriminatorMapping cdm = modelDiscriminators.get(modelClass); + if (cdm != null) { + return cdm.getClassForElement(node, new HashSet>()); + } + return null; + } + + /** + * Helper class to register the discriminator mappings. + */ + @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:01:56.363494+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") + private static class ClassDiscriminatorMapping { + // The model class name. + Class modelClass; + // The name of the discriminator property. + String discriminatorName; + // The discriminator mappings for a model class. + Map> discriminatorMappings; + + // Constructs a new class discriminator. + ClassDiscriminatorMapping(Class cls, String propertyName, Map> mappings) { + modelClass = cls; + discriminatorName = propertyName; + discriminatorMappings = new HashMap>(); + if (mappings != null) { + discriminatorMappings.putAll(mappings); + } + } + + // Return the name of the discriminator property for this model class. + String getDiscriminatorPropertyName() { + return discriminatorName; + } + + // Return the discriminator value or null if the discriminator is not + // present in the payload. + String getDiscriminatorValue(JsonNode node) { + // Determine the value of the discriminator property in the input data. + if (discriminatorName != null) { + // Get the value of the discriminator property, if present in the input payload. + node = node.get(discriminatorName); + if (node != null && node.isValueNode()) { + String discrValue = node.asText(); + if (discrValue != null) { + return discrValue; + } + } + } + return null; + } + + /** + * Returns the target model class that should be used to deserialize the input data. + * This function can be invoked for anyOf/oneOf composed models with discriminator mappings. + * The discriminator mappings are used to determine the target model class. + * + * @param node The input data. + * @param visitedClasses The set of classes that have already been visited. + * + * @return the target model class. + */ + Class getClassForElement(JsonNode node, Set> visitedClasses) { + if (visitedClasses.contains(modelClass)) { + // Class has already been visited. + return null; + } + // Determine the value of the discriminator property in the input data. + String discrValue = getDiscriminatorValue(node); + if (discrValue == null) { + return null; + } + Class cls = discriminatorMappings.get(discrValue); + // It may not be sufficient to return this cls directly because that target class + // may itself be a composed schema, possibly with its own discriminator. + visitedClasses.add(modelClass); + for (Class childClass : discriminatorMappings.values()) { + ClassDiscriminatorMapping childCdm = modelDiscriminators.get(childClass); + if (childCdm == null) { + continue; + } + if (!discriminatorName.equals(childCdm.discriminatorName)) { + discrValue = getDiscriminatorValue(node); + if (discrValue == null) { + continue; + } + } + if (childCdm != null) { + // Recursively traverse the discriminator mappings. + Class childDiscr = childCdm.getClassForElement(node, visitedClasses); + if (childDiscr != null) { + return childDiscr; + } + } + } + return cls; + } + } + + /** + * Returns true if inst is an instance of modelClass in the OpenAPI model hierarchy. + * + * The Java class hierarchy is not implemented the same way as the OpenAPI model hierarchy, + * so it's not possible to use the instanceof keyword. + * + * @param modelClass A OpenAPI model class. + * @param inst The instance object. + * @param visitedClasses The set of classes that have already been visited. + * + * @return true if inst is an instance of modelClass in the OpenAPI model hierarchy. + */ + public static boolean isInstanceOf(Class modelClass, Object inst, Set> visitedClasses) { + if (modelClass.isInstance(inst)) { + // This handles the 'allOf' use case with single parent inheritance. + return true; + } + if (visitedClasses.contains(modelClass)) { + // This is to prevent infinite recursion when the composed schemas have + // a circular dependency. + return false; + } + visitedClasses.add(modelClass); + + // Traverse the oneOf/anyOf composed schemas. + Map> descendants = modelDescendants.get(modelClass); + if (descendants != null) { + for (Class childType : descendants.values()) { + if (isInstanceOf(childType, inst, visitedClasses)) { + return true; + } + } + } + return false; + } + + /** + * A map of discriminators for all model classes. + */ + private static Map, ClassDiscriminatorMapping> modelDiscriminators = new HashMap<>(); + + /** + * A map of oneOf/anyOf descendants for each model class. + */ + private static Map, Map>> modelDescendants = new HashMap<>(); + + /** + * Register a model class discriminator. + * + * @param modelClass the model class + * @param discriminatorPropertyName the name of the discriminator property + * @param mappings a map with the discriminator mappings. + */ + public static void registerDiscriminator(Class modelClass, String discriminatorPropertyName, Map> mappings) { + ClassDiscriminatorMapping m = new ClassDiscriminatorMapping(modelClass, discriminatorPropertyName, mappings); + modelDiscriminators.put(modelClass, m); + } + + /** + * Register the oneOf/anyOf descendants of the modelClass. + * + * @param modelClass the model class + * @param descendants a map of oneOf/anyOf descendants. + */ + public static void registerDescendants(Class modelClass, Map> descendants) { + modelDescendants.put(modelClass, descendants); + } + + private static JSON json; + + static { + json = new JSON(); + } + + /** + * Get the default JSON instance. + * + * @return the default JSON instance + */ + public static JSON getDefault() { + return json; + } + + /** + * Set the default JSON instance. + * + * @param json JSON instance to be used + */ + public static void setDefault(JSON json) { + JSON.json = json; + } +} diff --git a/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/Pair.java new file mode 100644 index 000000000000..686212386a91 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/Pair.java @@ -0,0 +1,37 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:01:56.363494+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class Pair { + private final String name; + private final String value; + + public Pair(String name, String value) { + this.name = isValidString(name) ? name : ""; + this.value = isValidString(value) ? value : ""; + } + + public String getName() { + return this.name; + } + + public String getValue() { + return this.value; + } + + private static boolean isValidString(String arg) { + return arg != null; + } +} diff --git a/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/RFC3339DateFormat.java b/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/RFC3339DateFormat.java new file mode 100644 index 000000000000..4a1cc1478c3e --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/RFC3339DateFormat.java @@ -0,0 +1,58 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client; + +import com.fasterxml.jackson.databind.util.StdDateFormat; + +import java.text.DateFormat; +import java.text.FieldPosition; +import java.text.ParsePosition; +import java.util.Date; +import java.text.DecimalFormat; +import java.util.GregorianCalendar; +import java.util.TimeZone; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:01:56.363494+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class RFC3339DateFormat extends DateFormat { + private static final long serialVersionUID = 1L; + private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + + public RFC3339DateFormat() { + this.calendar = new GregorianCalendar(); + this.numberFormat = new DecimalFormat(); + } + + @Override + public Date parse(String source) { + return parse(source, new ParsePosition(0)); + } + + @Override + public Date parse(String source, ParsePosition pos) { + return fmt.parse(source, pos); + } + + @Override + public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { + return fmt.format(date, toAppendTo, fieldPosition); + } + + @Override + public Object clone() { + return super.clone(); + } +} diff --git a/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/RFC3339InstantDeserializer.java b/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/RFC3339InstantDeserializer.java new file mode 100644 index 000000000000..ffbce13c0522 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/RFC3339InstantDeserializer.java @@ -0,0 +1,100 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client; + +import java.io.IOException; +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneId; +import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; +import java.time.temporal.Temporal; +import java.time.temporal.TemporalAccessor; +import java.util.function.BiFunction; +import java.util.function.Function; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeFeature; +import com.fasterxml.jackson.datatype.jsr310.deser.InstantDeserializer; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:01:56.363494+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class RFC3339InstantDeserializer extends InstantDeserializer { + private static final long serialVersionUID = 1L; + private final static boolean DEFAULT_NORMALIZE_ZONE_ID = JavaTimeFeature.NORMALIZE_DESERIALIZED_ZONE_ID.enabledByDefault(); + private final static boolean DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS + = JavaTimeFeature.ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS.enabledByDefault(); + + public static final RFC3339InstantDeserializer INSTANT = new RFC3339InstantDeserializer<>( + Instant.class, DateTimeFormatter.ISO_INSTANT, + Instant::from, + a -> Instant.ofEpochMilli( a.value ), + a -> Instant.ofEpochSecond( a.integer, a.fraction ), + null, + true, // yes, replace zero offset with Z + DEFAULT_NORMALIZE_ZONE_ID, + DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS + ); + + public static final RFC3339InstantDeserializer OFFSET_DATE_TIME = new RFC3339InstantDeserializer<>( + OffsetDateTime.class, DateTimeFormatter.ISO_OFFSET_DATE_TIME, + OffsetDateTime::from, + a -> OffsetDateTime.ofInstant( Instant.ofEpochMilli( a.value ), a.zoneId ), + a -> OffsetDateTime.ofInstant( Instant.ofEpochSecond( a.integer, a.fraction ), a.zoneId ), + (d, z) -> ( d.isEqual( OffsetDateTime.MIN ) || d.isEqual( OffsetDateTime.MAX ) ? + d : + d.withOffsetSameInstant( z.getRules().getOffset( d.toLocalDateTime() ) ) ), + true, // yes, replace zero offset with Z + DEFAULT_NORMALIZE_ZONE_ID, + DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS + ); + + public static final RFC3339InstantDeserializer ZONED_DATE_TIME = new RFC3339InstantDeserializer<>( + ZonedDateTime.class, DateTimeFormatter.ISO_ZONED_DATE_TIME, + ZonedDateTime::from, + a -> ZonedDateTime.ofInstant( Instant.ofEpochMilli( a.value ), a.zoneId ), + a -> ZonedDateTime.ofInstant( Instant.ofEpochSecond( a.integer, a.fraction ), a.zoneId ), + ZonedDateTime::withZoneSameInstant, + false, // keep zero offset and Z separate since zones explicitly supported + DEFAULT_NORMALIZE_ZONE_ID, + DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS + ); + + protected RFC3339InstantDeserializer( + Class supportedType, + DateTimeFormatter formatter, + Function parsedToValue, + Function fromMilliseconds, + Function fromNanoseconds, + BiFunction adjust, + boolean replaceZeroOffsetAsZ, + boolean normalizeZoneId, + boolean readNumericStringsAsTimestamp) { + super( + supportedType, + formatter, + parsedToValue, + fromMilliseconds, + fromNanoseconds, + adjust, + replaceZeroOffsetAsZ, + normalizeZoneId, + readNumericStringsAsTimestamp + ); + } + + @Override + protected T _fromString(JsonParser p, DeserializationContext ctxt, String string0) throws IOException { + return super._fromString(p, ctxt, string0.replace( ' ', 'T' )); + } +} \ No newline at end of file diff --git a/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/RFC3339JavaTimeModule.java b/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/RFC3339JavaTimeModule.java new file mode 100644 index 000000000000..493a16ff9214 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/RFC3339JavaTimeModule.java @@ -0,0 +1,32 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client; + +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZonedDateTime; + +import com.fasterxml.jackson.databind.module.SimpleModule; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:01:56.363494+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class RFC3339JavaTimeModule extends SimpleModule { + private static final long serialVersionUID = 1L; + + public RFC3339JavaTimeModule() { + super("RFC3339JavaTimeModule"); + + addDeserializer(Instant.class, RFC3339InstantDeserializer.INSTANT); + addDeserializer(OffsetDateTime.class, RFC3339InstantDeserializer.OFFSET_DATE_TIME); + addDeserializer(ZonedDateTime.class, RFC3339InstantDeserializer.ZONED_DATE_TIME); + } +} diff --git a/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/ServerConfiguration.java new file mode 100644 index 000000000000..264a86be63ea --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -0,0 +1,72 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +import java.util.Map; + +/** + * Representing a Server configuration. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:01:56.363494+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class ServerConfiguration { + public String URL; + public String description; + public Map variables; + + /** + * @param URL A URL to the target host. + * @param description A description of the host designated by the URL. + * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. + */ + public ServerConfiguration(String URL, String description, Map variables) { + this.URL = URL; + this.description = description; + this.variables = variables; + } + + /** + * Format URL template using given variables. + * + * @param variables A map between a variable name and its value. + * @return Formatted URL. + */ + public String URL(Map variables) { + String url = this.URL; + + // go through variables and replace placeholders + for (Map.Entry variable: this.variables.entrySet()) { + String name = variable.getKey(); + ServerVariable serverVariable = variable.getValue(); + String value = serverVariable.defaultValue; + + if (variables != null && variables.containsKey(name)) { + value = variables.get(name); + if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) { + throw new IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + "."); + } + } + url = url.replace("{" + name + "}", value); + } + return url; + } + + /** + * Format URL template using default server variables. + * + * @return Formatted URL. + */ + public String URL() { + return URL(null); + } +} diff --git a/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/ServerVariable.java new file mode 100644 index 000000000000..fbe910ab7910 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/ServerVariable.java @@ -0,0 +1,37 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +import java.util.HashSet; + +/** + * Representing a Server Variable for server URL template substitution. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:01:56.363494+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class ServerVariable { + public String description; + public String defaultValue; + public HashSet enumValues = null; + + /** + * @param description A description for the server variable. + * @param defaultValue The default value to use for substitution. + * @param enumValues An enumeration of string values to be used if the substitution options are from a limited set. + */ + public ServerVariable(String description, String defaultValue, HashSet enumValues) { + this.description = description; + this.defaultValue = defaultValue; + this.enumValues = enumValues; + } +} diff --git a/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/api/PetApi.java new file mode 100644 index 000000000000..511fb066bd41 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/api/PetApi.java @@ -0,0 +1,1110 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client.api; + +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; + +import java.io.File; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.Pet; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; + +import org.apache.http.HttpEntity; +import org.apache.http.NameValuePair; +import org.apache.http.entity.mime.MultipartEntityBuilder; +import org.apache.http.message.BasicNameValuePair; +import org.apache.http.client.entity.UrlEncodedFormEntity; + +import java.io.InputStream; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.OutputStream; +import java.net.http.HttpRequest; +import java.nio.channels.Channels; +import java.nio.channels.Pipe; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.time.Duration; + +import java.util.ArrayList; +import java.util.StringJoiner; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.function.Consumer; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:01:56.363494+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class PetApi { + private final HttpClient memberVarHttpClient; + private final ObjectMapper memberVarObjectMapper; + private final String memberVarBaseUri; + private final Consumer memberVarInterceptor; + private final Duration memberVarReadTimeout; + private final Consumer> memberVarResponseInterceptor; + private final Consumer> memberVarAsyncResponseInterceptor; + + public PetApi() { + this(Configuration.getDefaultApiClient()); + } + + public PetApi(ApiClient apiClient) { + memberVarHttpClient = apiClient.getHttpClient(); + memberVarObjectMapper = apiClient.getObjectMapper(); + memberVarBaseUri = apiClient.getBaseUri(); + memberVarInterceptor = apiClient.getRequestInterceptor(); + memberVarReadTimeout = apiClient.getReadTimeout(); + memberVarResponseInterceptor = apiClient.getResponseInterceptor(); + memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); + } + + + protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { + String body = response.body() == null ? null : new String(response.body().readAllBytes()); + String message = formatExceptionMessage(operationId, response.statusCode(), body); + return new ApiException(response.statusCode(), message, response.headers(), body); + } + + private String formatExceptionMessage(String operationId, int statusCode, String body) { + if (body == null || body.isEmpty()) { + body = "[no body]"; + } + return operationId + " call failed with: " + statusCode + " - " + body; + } + + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store (required) + * @return Pet + * @throws ApiException if fails to make API call + */ + public Pet addPet(@javax.annotation.Nonnull Pet pet) throws ApiException { + return addPet(pet, null); + } + + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store (required) + * @param headers Optional headers to include in the request + * @return Pet + * @throws ApiException if fails to make API call + */ + public Pet addPet(@javax.annotation.Nonnull Pet pet, Map headers) throws ApiException { + ApiResponse localVarResponse = addPetWithHttpInfo(pet, headers); + return localVarResponse.getData(); + } + + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store (required) + * @return ApiResponse<Pet> + * @throws ApiException if fails to make API call + */ + public ApiResponse addPetWithHttpInfo(@javax.annotation.Nonnull Pet pet) throws ApiException { + return addPetWithHttpInfo(pet, null); + } + + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Pet> + * @throws ApiException if fails to make API call + */ + public ApiResponse addPetWithHttpInfo(@javax.annotation.Nonnull Pet pet, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = addPetRequestBuilder(pet, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("addPet", localVarResponse); + } + if (localVarResponse.body() == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + String responseBody = new String(localVarResponse.body().readAllBytes()); + localVarResponse.body().close(); + + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}) + ); + } finally { + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder addPetRequestBuilder(@javax.annotation.Nonnull Pet pet, Map headers) throws ApiException { + // verify the required parameter 'pet' is set + if (pet == null) { + throw new ApiException(400, "Missing the required parameter 'pet' when calling addPet"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/pet"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/xml, application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(pet); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @throws ApiException if fails to make API call + */ + public void deletePet(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey) throws ApiException { + return deletePet(petId, apiKey, null); + } + + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void deletePet(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, Map headers) throws ApiException { + deletePetWithHttpInfo(petId, apiKey, headers); + } + + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse deletePetWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey) throws ApiException { + return deletePetWithHttpInfo(petId, apiKey, null); + } + + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse deletePetWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = deletePetRequestBuilder(petId, apiKey, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("deletePet", localVarResponse); + } + return new ApiResponse<>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } finally { + // Drain the InputStream + while (localVarResponse.body().read() != -1) { + // Ignore + } + localVarResponse.body().close(); + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder deletePetRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, Map headers) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException(400, "Missing the required parameter 'petId' when calling deletePet"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/pet/{petId}" + .replace("{petId}", ApiClient.urlEncode(petId.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + if (apiKey != null) { + localVarRequestBuilder.header("api_key", apiKey.toString()); + } + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("DELETE", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Finds Pets by status + * Multiple status values can be provided with comma separated strings + * @param status Status values that need to be considered for filter (required) + * @return List<Pet> + * @throws ApiException if fails to make API call + */ + public List findPetsByStatus(@javax.annotation.Nonnull List status) throws ApiException { + return findPetsByStatus(status, null); + } + + /** + * Finds Pets by status + * Multiple status values can be provided with comma separated strings + * @param status Status values that need to be considered for filter (required) + * @param headers Optional headers to include in the request + * @return List<Pet> + * @throws ApiException if fails to make API call + */ + public List findPetsByStatus(@javax.annotation.Nonnull List status, Map headers) throws ApiException { + ApiResponse> localVarResponse = findPetsByStatusWithHttpInfo(status, headers); + return localVarResponse.getData(); + } + + /** + * Finds Pets by status + * Multiple status values can be provided with comma separated strings + * @param status Status values that need to be considered for filter (required) + * @return ApiResponse<List<Pet>> + * @throws ApiException if fails to make API call + */ + public ApiResponse> findPetsByStatusWithHttpInfo(@javax.annotation.Nonnull List status) throws ApiException { + return findPetsByStatusWithHttpInfo(status, null); + } + + /** + * Finds Pets by status + * Multiple status values can be provided with comma separated strings + * @param status Status values that need to be considered for filter (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<List<Pet>> + * @throws ApiException if fails to make API call + */ + public ApiResponse> findPetsByStatusWithHttpInfo(@javax.annotation.Nonnull List status, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = findPetsByStatusRequestBuilder(status, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("findPetsByStatus", localVarResponse); + } + if (localVarResponse.body() == null) { + return new ApiResponse>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + String responseBody = new String(localVarResponse.body().readAllBytes()); + localVarResponse.body().close(); + + return new ApiResponse>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference>() {}) + ); + } finally { + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder findPetsByStatusRequestBuilder(@javax.annotation.Nonnull List status, Map headers) throws ApiException { + // verify the required parameter 'status' is set + if (status == null) { + throw new ApiException(400, "Missing the required parameter 'status' when calling findPetsByStatus"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/pet/findByStatus"; + + List localVarQueryParams = new ArrayList<>(); + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + localVarQueryParameterBaseName = "status"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("csv", "status", status)); + + if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) { + StringJoiner queryJoiner = new StringJoiner("&"); + localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue())); + if (localVarQueryStringJoiner.length() != 0) { + queryJoiner.add(localVarQueryStringJoiner.toString()); + } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } + + localVarRequestBuilder.header("Accept", "application/xml, application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) + * @return List<Pet> + * @throws ApiException if fails to make API call + * @deprecated + */ + @Deprecated + public List findPetsByTags(@javax.annotation.Nonnull List tags) throws ApiException { + return findPetsByTags(tags, null); + } + + /** + * Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) + * @param headers Optional headers to include in the request + * @return List<Pet> + * @throws ApiException if fails to make API call + * @deprecated + */ + @Deprecated + public List findPetsByTags(@javax.annotation.Nonnull List tags, Map headers) throws ApiException { + ApiResponse> localVarResponse = findPetsByTagsWithHttpInfo(tags, headers); + return localVarResponse.getData(); + } + + /** + * Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) + * @return ApiResponse<List<Pet>> + * @throws ApiException if fails to make API call + * @deprecated + */ + @Deprecated + public ApiResponse> findPetsByTagsWithHttpInfo(@javax.annotation.Nonnull List tags) throws ApiException { + return findPetsByTagsWithHttpInfo(tags, null); + } + + /** + * Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<List<Pet>> + * @throws ApiException if fails to make API call + * @deprecated + */ + @Deprecated + public ApiResponse> findPetsByTagsWithHttpInfo(@javax.annotation.Nonnull List tags, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = findPetsByTagsRequestBuilder(tags, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("findPetsByTags", localVarResponse); + } + if (localVarResponse.body() == null) { + return new ApiResponse>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + String responseBody = new String(localVarResponse.body().readAllBytes()); + localVarResponse.body().close(); + + return new ApiResponse>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference>() {}) + ); + } finally { + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder findPetsByTagsRequestBuilder(@javax.annotation.Nonnull List tags, Map headers) throws ApiException { + // verify the required parameter 'tags' is set + if (tags == null) { + throw new ApiException(400, "Missing the required parameter 'tags' when calling findPetsByTags"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/pet/findByTags"; + + List localVarQueryParams = new ArrayList<>(); + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + localVarQueryParameterBaseName = "tags"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("csv", "tags", tags)); + + if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) { + StringJoiner queryJoiner = new StringJoiner("&"); + localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue())); + if (localVarQueryStringJoiner.length() != 0) { + queryJoiner.add(localVarQueryStringJoiner.toString()); + } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } + + localVarRequestBuilder.header("Accept", "application/xml, application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @return Pet + * @throws ApiException if fails to make API call + */ + public Pet getPetById(@javax.annotation.Nonnull Long petId) throws ApiException { + return getPetById(petId, null); + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @param headers Optional headers to include in the request + * @return Pet + * @throws ApiException if fails to make API call + */ + public Pet getPetById(@javax.annotation.Nonnull Long petId, Map headers) throws ApiException { + ApiResponse localVarResponse = getPetByIdWithHttpInfo(petId, headers); + return localVarResponse.getData(); + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @return ApiResponse<Pet> + * @throws ApiException if fails to make API call + */ + public ApiResponse getPetByIdWithHttpInfo(@javax.annotation.Nonnull Long petId) throws ApiException { + return getPetByIdWithHttpInfo(petId, null); + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Pet> + * @throws ApiException if fails to make API call + */ + public ApiResponse getPetByIdWithHttpInfo(@javax.annotation.Nonnull Long petId, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = getPetByIdRequestBuilder(petId, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("getPetById", localVarResponse); + } + if (localVarResponse.body() == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + String responseBody = new String(localVarResponse.body().readAllBytes()); + localVarResponse.body().close(); + + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}) + ); + } finally { + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder getPetByIdRequestBuilder(@javax.annotation.Nonnull Long petId, Map headers) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetById"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/pet/{petId}" + .replace("{petId}", ApiClient.urlEncode(petId.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/xml, application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store (required) + * @return Pet + * @throws ApiException if fails to make API call + */ + public Pet updatePet(@javax.annotation.Nonnull Pet pet) throws ApiException { + return updatePet(pet, null); + } + + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store (required) + * @param headers Optional headers to include in the request + * @return Pet + * @throws ApiException if fails to make API call + */ + public Pet updatePet(@javax.annotation.Nonnull Pet pet, Map headers) throws ApiException { + ApiResponse localVarResponse = updatePetWithHttpInfo(pet, headers); + return localVarResponse.getData(); + } + + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store (required) + * @return ApiResponse<Pet> + * @throws ApiException if fails to make API call + */ + public ApiResponse updatePetWithHttpInfo(@javax.annotation.Nonnull Pet pet) throws ApiException { + return updatePetWithHttpInfo(pet, null); + } + + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Pet> + * @throws ApiException if fails to make API call + */ + public ApiResponse updatePetWithHttpInfo(@javax.annotation.Nonnull Pet pet, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = updatePetRequestBuilder(pet, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("updatePet", localVarResponse); + } + if (localVarResponse.body() == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + String responseBody = new String(localVarResponse.body().readAllBytes()); + localVarResponse.body().close(); + + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}) + ); + } finally { + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder updatePetRequestBuilder(@javax.annotation.Nonnull Pet pet, Map headers) throws ApiException { + // verify the required parameter 'pet' is set + if (pet == null) { + throw new ApiException(400, "Missing the required parameter 'pet' when calling updatePet"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/pet"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/xml, application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(pet); + localVarRequestBuilder.method("PUT", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @throws ApiException if fails to make API call + */ + public void updatePetWithForm(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status) throws ApiException { + return updatePetWithForm(petId, name, status, null); + } + + /** + * Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void updatePetWithForm(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, Map headers) throws ApiException { + updatePetWithFormWithHttpInfo(petId, name, status, headers); + } + + /** + * Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse updatePetWithFormWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status) throws ApiException { + return updatePetWithFormWithHttpInfo(petId, name, status, null); + } + + /** + * Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse updatePetWithFormWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = updatePetWithFormRequestBuilder(petId, name, status, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("updatePetWithForm", localVarResponse); + } + return new ApiResponse<>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } finally { + // Drain the InputStream + while (localVarResponse.body().read() != -1) { + // Ignore + } + localVarResponse.body().close(); + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder updatePetWithFormRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, Map headers) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException(400, "Missing the required parameter 'petId' when calling updatePetWithForm"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/pet/{petId}" + .replace("{petId}", ApiClient.urlEncode(petId.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/json"); + + List formValues = new ArrayList<>(); + if (name != null) { + formValues.add(new BasicNameValuePair("name", name.toString())); + } + if (status != null) { + formValues.add(new BasicNameValuePair("status", status.toString())); + } + HttpEntity entity = new UrlEncodedFormEntity(formValues, java.nio.charset.StandardCharsets.UTF_8); + ByteArrayOutputStream formOutputStream = new ByteArrayOutputStream(); + try { + entity.writeTo(formOutputStream); + } catch (IOException e) { + throw new RuntimeException(e); + } + localVarRequestBuilder + .header("Content-Type", entity.getContentType().getValue()) + .method("POST", HttpRequest.BodyPublishers + .ofInputStream(() -> new ByteArrayInputStream(formOutputStream.toByteArray()))); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @return ModelApiResponse + * @throws ApiException if fails to make API call + */ + public ModelApiResponse uploadFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { + return uploadFile(petId, additionalMetadata, _file, null); + } + + /** + * uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @param headers Optional headers to include in the request + * @return ModelApiResponse + * @throws ApiException if fails to make API call + */ + public ModelApiResponse uploadFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, Map headers) throws ApiException { + ApiResponse localVarResponse = uploadFileWithHttpInfo(petId, additionalMetadata, _file, headers); + return localVarResponse.getData(); + } + + /** + * uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @return ApiResponse<ModelApiResponse> + * @throws ApiException if fails to make API call + */ + public ApiResponse uploadFileWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { + return uploadFileWithHttpInfo(petId, additionalMetadata, _file, null); + } + + /** + * uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<ModelApiResponse> + * @throws ApiException if fails to make API call + */ + public ApiResponse uploadFileWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = uploadFileRequestBuilder(petId, additionalMetadata, _file, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("uploadFile", localVarResponse); + } + if (localVarResponse.body() == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + String responseBody = new String(localVarResponse.body().readAllBytes()); + localVarResponse.body().close(); + + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}) + ); + } finally { + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder uploadFileRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, Map headers) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFile"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/pet/{petId}/uploadImage" + .replace("{petId}", ApiClient.urlEncode(petId.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/json"); + + MultipartEntityBuilder multiPartBuilder = MultipartEntityBuilder.create(); + boolean hasFiles = false; + if (additionalMetadata != null) { + multiPartBuilder.addTextBody("additionalMetadata", additionalMetadata.toString()); + } + multiPartBuilder.addBinaryBody("file", _file); + hasFiles = true; + HttpEntity entity = multiPartBuilder.build(); + HttpRequest.BodyPublisher formDataPublisher; + if (hasFiles) { + Pipe pipe; + try { + pipe = Pipe.open(); + } catch (IOException e) { + throw new RuntimeException(e); + } + new Thread(() -> { + try (OutputStream outputStream = Channels.newOutputStream(pipe.sink())) { + entity.writeTo(outputStream); + } catch (IOException e) { + e.printStackTrace(); + } + }).start(); + formDataPublisher = HttpRequest.BodyPublishers.ofInputStream(() -> Channels.newInputStream(pipe.source())); + } else { + ByteArrayOutputStream formOutputStream = new ByteArrayOutputStream(); + try { + entity.writeTo(formOutputStream); + } catch (IOException e) { + throw new RuntimeException(e); + } + formDataPublisher = HttpRequest.BodyPublishers + .ofInputStream(() -> new ByteArrayInputStream(formOutputStream.toByteArray())); + } + localVarRequestBuilder + .header("Content-Type", entity.getContentType().getValue()) + .method("POST", formDataPublisher); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + +} diff --git a/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/api/StoreApi.java new file mode 100644 index 000000000000..41e4650c8be9 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/api/StoreApi.java @@ -0,0 +1,535 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client.api; + +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; + +import org.openapitools.client.model.Order; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; + +import org.apache.http.HttpEntity; +import org.apache.http.NameValuePair; +import org.apache.http.entity.mime.MultipartEntityBuilder; +import org.apache.http.message.BasicNameValuePair; +import org.apache.http.client.entity.UrlEncodedFormEntity; + +import java.io.InputStream; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.OutputStream; +import java.net.http.HttpRequest; +import java.nio.channels.Channels; +import java.nio.channels.Pipe; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.time.Duration; + +import java.util.ArrayList; +import java.util.StringJoiner; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.function.Consumer; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:01:56.363494+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class StoreApi { + private final HttpClient memberVarHttpClient; + private final ObjectMapper memberVarObjectMapper; + private final String memberVarBaseUri; + private final Consumer memberVarInterceptor; + private final Duration memberVarReadTimeout; + private final Consumer> memberVarResponseInterceptor; + private final Consumer> memberVarAsyncResponseInterceptor; + + public StoreApi() { + this(Configuration.getDefaultApiClient()); + } + + public StoreApi(ApiClient apiClient) { + memberVarHttpClient = apiClient.getHttpClient(); + memberVarObjectMapper = apiClient.getObjectMapper(); + memberVarBaseUri = apiClient.getBaseUri(); + memberVarInterceptor = apiClient.getRequestInterceptor(); + memberVarReadTimeout = apiClient.getReadTimeout(); + memberVarResponseInterceptor = apiClient.getResponseInterceptor(); + memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); + } + + + protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { + String body = response.body() == null ? null : new String(response.body().readAllBytes()); + String message = formatExceptionMessage(operationId, response.statusCode(), body); + return new ApiException(response.statusCode(), message, response.headers(), body); + } + + private String formatExceptionMessage(String operationId, int statusCode, String body) { + if (body == null || body.isEmpty()) { + body = "[no body]"; + } + return operationId + " call failed with: " + statusCode + " - " + body; + } + + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted (required) + * @throws ApiException if fails to make API call + */ + public void deleteOrder(@javax.annotation.Nonnull String orderId) throws ApiException { + return deleteOrder(orderId, null); + } + + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted (required) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void deleteOrder(@javax.annotation.Nonnull String orderId, Map headers) throws ApiException { + deleteOrderWithHttpInfo(orderId, headers); + } + + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse deleteOrderWithHttpInfo(@javax.annotation.Nonnull String orderId) throws ApiException { + return deleteOrderWithHttpInfo(orderId, null); + } + + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse deleteOrderWithHttpInfo(@javax.annotation.Nonnull String orderId, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = deleteOrderRequestBuilder(orderId, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("deleteOrder", localVarResponse); + } + return new ApiResponse<>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } finally { + // Drain the InputStream + while (localVarResponse.body().read() != -1) { + // Ignore + } + localVarResponse.body().close(); + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder deleteOrderRequestBuilder(@javax.annotation.Nonnull String orderId, Map headers) throws ApiException { + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/store/order/{orderId}" + .replace("{orderId}", ApiClient.urlEncode(orderId.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("DELETE", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @return Map<String, Integer> + * @throws ApiException if fails to make API call + */ + public Map getInventory() throws ApiException { + return getInventory(, null); + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @param headers Optional headers to include in the request + * @return Map<String, Integer> + * @throws ApiException if fails to make API call + */ + public Map getInventory(Map headers) throws ApiException { + ApiResponse> localVarResponse = getInventoryWithHttpInfo(headers); + return localVarResponse.getData(); + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @return ApiResponse<Map<String, Integer>> + * @throws ApiException if fails to make API call + */ + public ApiResponse> getInventoryWithHttpInfo() throws ApiException { + return getInventoryWithHttpInfo(, null); + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @param headers Optional headers to include in the request + * @return ApiResponse<Map<String, Integer>> + * @throws ApiException if fails to make API call + */ + public ApiResponse> getInventoryWithHttpInfo(Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = getInventoryRequestBuilder(headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("getInventory", localVarResponse); + } + if (localVarResponse.body() == null) { + return new ApiResponse>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + String responseBody = new String(localVarResponse.body().readAllBytes()); + localVarResponse.body().close(); + + return new ApiResponse>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference>() {}) + ); + } finally { + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder getInventoryRequestBuilder(Map headers) throws ApiException { + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/store/inventory"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @return Order + * @throws ApiException if fails to make API call + */ + public Order getOrderById(@javax.annotation.Nonnull Long orderId) throws ApiException { + return getOrderById(orderId, null); + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @param headers Optional headers to include in the request + * @return Order + * @throws ApiException if fails to make API call + */ + public Order getOrderById(@javax.annotation.Nonnull Long orderId, Map headers) throws ApiException { + ApiResponse localVarResponse = getOrderByIdWithHttpInfo(orderId, headers); + return localVarResponse.getData(); + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @return ApiResponse<Order> + * @throws ApiException if fails to make API call + */ + public ApiResponse getOrderByIdWithHttpInfo(@javax.annotation.Nonnull Long orderId) throws ApiException { + return getOrderByIdWithHttpInfo(orderId, null); + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Order> + * @throws ApiException if fails to make API call + */ + public ApiResponse getOrderByIdWithHttpInfo(@javax.annotation.Nonnull Long orderId, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = getOrderByIdRequestBuilder(orderId, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("getOrderById", localVarResponse); + } + if (localVarResponse.body() == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + String responseBody = new String(localVarResponse.body().readAllBytes()); + localVarResponse.body().close(); + + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}) + ); + } finally { + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder getOrderByIdRequestBuilder(@javax.annotation.Nonnull Long orderId, Map headers) throws ApiException { + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/store/order/{orderId}" + .replace("{orderId}", ApiClient.urlEncode(orderId.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/xml, application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @return Order + * @throws ApiException if fails to make API call + */ + public Order placeOrder(@javax.annotation.Nonnull Order order) throws ApiException { + return placeOrder(order, null); + } + + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @param headers Optional headers to include in the request + * @return Order + * @throws ApiException if fails to make API call + */ + public Order placeOrder(@javax.annotation.Nonnull Order order, Map headers) throws ApiException { + ApiResponse localVarResponse = placeOrderWithHttpInfo(order, headers); + return localVarResponse.getData(); + } + + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @return ApiResponse<Order> + * @throws ApiException if fails to make API call + */ + public ApiResponse placeOrderWithHttpInfo(@javax.annotation.Nonnull Order order) throws ApiException { + return placeOrderWithHttpInfo(order, null); + } + + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Order> + * @throws ApiException if fails to make API call + */ + public ApiResponse placeOrderWithHttpInfo(@javax.annotation.Nonnull Order order, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = placeOrderRequestBuilder(order, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("placeOrder", localVarResponse); + } + if (localVarResponse.body() == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + String responseBody = new String(localVarResponse.body().readAllBytes()); + localVarResponse.body().close(); + + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}) + ); + } finally { + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder placeOrderRequestBuilder(@javax.annotation.Nonnull Order order, Map headers) throws ApiException { + // verify the required parameter 'order' is set + if (order == null) { + throw new ApiException(400, "Missing the required parameter 'order' when calling placeOrder"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/store/order"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/xml, application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(order); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + +} diff --git a/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/api/UserApi.java new file mode 100644 index 000000000000..cb97fa693bd2 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/api/UserApi.java @@ -0,0 +1,995 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client.api; + +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; + +import java.time.OffsetDateTime; +import org.openapitools.client.model.User; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; + +import org.apache.http.HttpEntity; +import org.apache.http.NameValuePair; +import org.apache.http.entity.mime.MultipartEntityBuilder; +import org.apache.http.message.BasicNameValuePair; +import org.apache.http.client.entity.UrlEncodedFormEntity; + +import java.io.InputStream; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.OutputStream; +import java.net.http.HttpRequest; +import java.nio.channels.Channels; +import java.nio.channels.Pipe; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.time.Duration; + +import java.util.ArrayList; +import java.util.StringJoiner; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.function.Consumer; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:01:56.363494+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class UserApi { + private final HttpClient memberVarHttpClient; + private final ObjectMapper memberVarObjectMapper; + private final String memberVarBaseUri; + private final Consumer memberVarInterceptor; + private final Duration memberVarReadTimeout; + private final Consumer> memberVarResponseInterceptor; + private final Consumer> memberVarAsyncResponseInterceptor; + + public UserApi() { + this(Configuration.getDefaultApiClient()); + } + + public UserApi(ApiClient apiClient) { + memberVarHttpClient = apiClient.getHttpClient(); + memberVarObjectMapper = apiClient.getObjectMapper(); + memberVarBaseUri = apiClient.getBaseUri(); + memberVarInterceptor = apiClient.getRequestInterceptor(); + memberVarReadTimeout = apiClient.getReadTimeout(); + memberVarResponseInterceptor = apiClient.getResponseInterceptor(); + memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); + } + + + protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { + String body = response.body() == null ? null : new String(response.body().readAllBytes()); + String message = formatExceptionMessage(operationId, response.statusCode(), body); + return new ApiException(response.statusCode(), message, response.headers(), body); + } + + private String formatExceptionMessage(String operationId, int statusCode, String body) { + if (body == null || body.isEmpty()) { + body = "[no body]"; + } + return operationId + " call failed with: " + statusCode + " - " + body; + } + + /** + * Create user + * This can only be done by the logged in user. + * @param user Created user object (required) + * @throws ApiException if fails to make API call + */ + public void createUser(@javax.annotation.Nonnull User user) throws ApiException { + return createUser(user, null); + } + + /** + * Create user + * This can only be done by the logged in user. + * @param user Created user object (required) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void createUser(@javax.annotation.Nonnull User user, Map headers) throws ApiException { + createUserWithHttpInfo(user, headers); + } + + /** + * Create user + * This can only be done by the logged in user. + * @param user Created user object (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse createUserWithHttpInfo(@javax.annotation.Nonnull User user) throws ApiException { + return createUserWithHttpInfo(user, null); + } + + /** + * Create user + * This can only be done by the logged in user. + * @param user Created user object (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse createUserWithHttpInfo(@javax.annotation.Nonnull User user, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = createUserRequestBuilder(user, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("createUser", localVarResponse); + } + return new ApiResponse<>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } finally { + // Drain the InputStream + while (localVarResponse.body().read() != -1) { + // Ignore + } + localVarResponse.body().close(); + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder createUserRequestBuilder(@javax.annotation.Nonnull User user, Map headers) throws ApiException { + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException(400, "Missing the required parameter 'user' when calling createUser"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/user"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(user); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @throws ApiException if fails to make API call + */ + public void createUsersWithArrayInput(@javax.annotation.Nonnull List user) throws ApiException { + return createUsersWithArrayInput(user, null); + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void createUsersWithArrayInput(@javax.annotation.Nonnull List user, Map headers) throws ApiException { + createUsersWithArrayInputWithHttpInfo(user, headers); + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse createUsersWithArrayInputWithHttpInfo(@javax.annotation.Nonnull List user) throws ApiException { + return createUsersWithArrayInputWithHttpInfo(user, null); + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse createUsersWithArrayInputWithHttpInfo(@javax.annotation.Nonnull List user, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = createUsersWithArrayInputRequestBuilder(user, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("createUsersWithArrayInput", localVarResponse); + } + return new ApiResponse<>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } finally { + // Drain the InputStream + while (localVarResponse.body().read() != -1) { + // Ignore + } + localVarResponse.body().close(); + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder createUsersWithArrayInputRequestBuilder(@javax.annotation.Nonnull List user, Map headers) throws ApiException { + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithArrayInput"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/user/createWithArray"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(user); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @throws ApiException if fails to make API call + */ + public void createUsersWithListInput(@javax.annotation.Nonnull List user) throws ApiException { + return createUsersWithListInput(user, null); + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void createUsersWithListInput(@javax.annotation.Nonnull List user, Map headers) throws ApiException { + createUsersWithListInputWithHttpInfo(user, headers); + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse createUsersWithListInputWithHttpInfo(@javax.annotation.Nonnull List user) throws ApiException { + return createUsersWithListInputWithHttpInfo(user, null); + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse createUsersWithListInputWithHttpInfo(@javax.annotation.Nonnull List user, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = createUsersWithListInputRequestBuilder(user, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("createUsersWithListInput", localVarResponse); + } + return new ApiResponse<>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } finally { + // Drain the InputStream + while (localVarResponse.body().read() != -1) { + // Ignore + } + localVarResponse.body().close(); + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder createUsersWithListInputRequestBuilder(@javax.annotation.Nonnull List user, Map headers) throws ApiException { + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithListInput"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/user/createWithList"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(user); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @throws ApiException if fails to make API call + */ + public void deleteUser(@javax.annotation.Nonnull String username) throws ApiException { + return deleteUser(username, null); + } + + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void deleteUser(@javax.annotation.Nonnull String username, Map headers) throws ApiException { + deleteUserWithHttpInfo(username, headers); + } + + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse deleteUserWithHttpInfo(@javax.annotation.Nonnull String username) throws ApiException { + return deleteUserWithHttpInfo(username, null); + } + + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse deleteUserWithHttpInfo(@javax.annotation.Nonnull String username, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = deleteUserRequestBuilder(username, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("deleteUser", localVarResponse); + } + return new ApiResponse<>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } finally { + // Drain the InputStream + while (localVarResponse.body().read() != -1) { + // Ignore + } + localVarResponse.body().close(); + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder deleteUserRequestBuilder(@javax.annotation.Nonnull String username, Map headers) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException(400, "Missing the required parameter 'username' when calling deleteUser"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/user/{username}" + .replace("{username}", ApiClient.urlEncode(username.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("DELETE", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return User + * @throws ApiException if fails to make API call + */ + public User getUserByName(@javax.annotation.Nonnull String username) throws ApiException { + return getUserByName(username, null); + } + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @param headers Optional headers to include in the request + * @return User + * @throws ApiException if fails to make API call + */ + public User getUserByName(@javax.annotation.Nonnull String username, Map headers) throws ApiException { + ApiResponse localVarResponse = getUserByNameWithHttpInfo(username, headers); + return localVarResponse.getData(); + } + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return ApiResponse<User> + * @throws ApiException if fails to make API call + */ + public ApiResponse getUserByNameWithHttpInfo(@javax.annotation.Nonnull String username) throws ApiException { + return getUserByNameWithHttpInfo(username, null); + } + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<User> + * @throws ApiException if fails to make API call + */ + public ApiResponse getUserByNameWithHttpInfo(@javax.annotation.Nonnull String username, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = getUserByNameRequestBuilder(username, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("getUserByName", localVarResponse); + } + if (localVarResponse.body() == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + String responseBody = new String(localVarResponse.body().readAllBytes()); + localVarResponse.body().close(); + + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}) + ); + } finally { + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder getUserByNameRequestBuilder(@javax.annotation.Nonnull String username, Map headers) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException(400, "Missing the required parameter 'username' when calling getUserByName"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/user/{username}" + .replace("{username}", ApiClient.urlEncode(username.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/xml, application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @return String + * @throws ApiException if fails to make API call + */ + public String loginUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException { + return loginUser(username, password, null); + } + + /** + * Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @param headers Optional headers to include in the request + * @return String + * @throws ApiException if fails to make API call + */ + public String loginUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, Map headers) throws ApiException { + ApiResponse localVarResponse = loginUserWithHttpInfo(username, password, headers); + return localVarResponse.getData(); + } + + /** + * Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @return ApiResponse<String> + * @throws ApiException if fails to make API call + */ + public ApiResponse loginUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException { + return loginUserWithHttpInfo(username, password, null); + } + + /** + * Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<String> + * @throws ApiException if fails to make API call + */ + public ApiResponse loginUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = loginUserRequestBuilder(username, password, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("loginUser", localVarResponse); + } + if (localVarResponse.body() == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + String responseBody = new String(localVarResponse.body().readAllBytes()); + localVarResponse.body().close(); + + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}) + ); + } finally { + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder loginUserRequestBuilder(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, Map headers) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException(400, "Missing the required parameter 'username' when calling loginUser"); + } + // verify the required parameter 'password' is set + if (password == null) { + throw new ApiException(400, "Missing the required parameter 'password' when calling loginUser"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/user/login"; + + List localVarQueryParams = new ArrayList<>(); + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + localVarQueryParameterBaseName = "username"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("username", username)); + localVarQueryParameterBaseName = "password"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("password", password)); + + if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) { + StringJoiner queryJoiner = new StringJoiner("&"); + localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue())); + if (localVarQueryStringJoiner.length() != 0) { + queryJoiner.add(localVarQueryStringJoiner.toString()); + } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } + + localVarRequestBuilder.header("Accept", "application/xml, application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Logs out current logged in user session + * + * @throws ApiException if fails to make API call + */ + public void logoutUser() throws ApiException { + return logoutUser(, null); + } + + /** + * Logs out current logged in user session + * + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void logoutUser(Map headers) throws ApiException { + logoutUserWithHttpInfo(headers); + } + + /** + * Logs out current logged in user session + * + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse logoutUserWithHttpInfo() throws ApiException { + return logoutUserWithHttpInfo(, null); + } + + /** + * Logs out current logged in user session + * + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse logoutUserWithHttpInfo(Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = logoutUserRequestBuilder(headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("logoutUser", localVarResponse); + } + return new ApiResponse<>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } finally { + // Drain the InputStream + while (localVarResponse.body().read() != -1) { + // Ignore + } + localVarResponse.body().close(); + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder logoutUserRequestBuilder(Map headers) throws ApiException { + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/user/logout"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param user Updated user object (required) + * @throws ApiException if fails to make API call + */ + public void updateUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user) throws ApiException { + return updateUser(username, user, null); + } + + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param user Updated user object (required) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void updateUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, Map headers) throws ApiException { + updateUserWithHttpInfo(username, user, headers); + } + + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param user Updated user object (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse updateUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user) throws ApiException { + return updateUserWithHttpInfo(username, user, null); + } + + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param user Updated user object (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse updateUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = updateUserRequestBuilder(username, user, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("updateUser", localVarResponse); + } + return new ApiResponse<>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } finally { + // Drain the InputStream + while (localVarResponse.body().read() != -1) { + // Ignore + } + localVarResponse.body().close(); + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder updateUserRequestBuilder(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, Map headers) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser"); + } + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException(400, "Missing the required parameter 'user' when calling updateUser"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/user/{username}" + .replace("{username}", ApiClient.urlEncode(username.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(user); + localVarRequestBuilder.method("PUT", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + localVarRequestBuilder.header(entry.getKey(), entry.getValue()); + } + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + +} diff --git a/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java new file mode 100644 index 000000000000..501529ca63e6 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java @@ -0,0 +1,147 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.lang.reflect.Type; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:01:56.363494+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public abstract class AbstractOpenApiSchema { + + // store the actual instance of the schema/object + private Object instance; + + // is nullable + private Boolean isNullable; + + // schema type (e.g. oneOf, anyOf) + private final String schemaType; + + public AbstractOpenApiSchema(String schemaType, Boolean isNullable) { + this.schemaType = schemaType; + this.isNullable = isNullable; + } + + /** + * Get the list of oneOf/anyOf composed schemas allowed to be stored in this object + * + * @return an instance of the actual schema/object + */ + public abstract Map> getSchemas(); + + /** + * Get the actual instance + * + * @return an instance of the actual schema/object + */ + @JsonValue + public Object getActualInstance() {return instance;} + + /** + * Set the actual instance + * + * @param instance the actual instance of the schema/object + */ + public void setActualInstance(Object instance) {this.instance = instance;} + + /** + * Get the instant recursively when the schemas defined in oneOf/anyof happen to be oneOf/anyOf schema as well + * + * @return an instance of the actual schema/object + */ + public Object getActualInstanceRecursively() { + return getActualInstanceRecursively(this); + } + + private Object getActualInstanceRecursively(AbstractOpenApiSchema object) { + if (object.getActualInstance() == null) { + return null; + } else if (object.getActualInstance() instanceof AbstractOpenApiSchema) { + return getActualInstanceRecursively((AbstractOpenApiSchema)object.getActualInstance()); + } else { + return object.getActualInstance(); + } + } + + /** + * Get the schema type (e.g. anyOf, oneOf) + * + * @return the schema type + */ + public String getSchemaType() { + return schemaType; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ").append(getClass()).append(" {\n"); + sb.append(" instance: ").append(toIndentedString(instance)).append("\n"); + sb.append(" isNullable: ").append(toIndentedString(isNullable)).append("\n"); + sb.append(" schemaType: ").append(toIndentedString(schemaType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AbstractOpenApiSchema a = (AbstractOpenApiSchema) o; + return Objects.equals(this.instance, a.instance) && + Objects.equals(this.isNullable, a.isNullable) && + Objects.equals(this.schemaType, a.schemaType); + } + + @Override + public int hashCode() { + return Objects.hash(instance, isNullable, schemaType); + } + + /** + * Is nullable + * + * @return true if it's nullable + */ + public Boolean isNullable() { + if (Boolean.TRUE.equals(isNullable)) { + return Boolean.TRUE; + } else { + return Boolean.FALSE; + } + } + + + +} diff --git a/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/model/Category.java new file mode 100644 index 000000000000..ba2fe0b9697b --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/model/Category.java @@ -0,0 +1,187 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import org.openapitools.client.ApiClient; +/** + * A category for a pet + */ +@JsonPropertyOrder({ + Category.JSON_PROPERTY_ID, + Category.JSON_PROPERTY_NAME +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:01:56.363494+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class Category { + public static final String JSON_PROPERTY_ID = "id"; + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_NAME = "name"; + @javax.annotation.Nullable + private String name; + + public Category() { + } + + public Category id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getId() { + return id; + } + + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Category name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getName() { + return name; + } + + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + /** + * Return true if this Category object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Category category = (Category) o; + return Objects.equals(this.id, category.id) && + Objects.equals(this.name, category.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Category {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `id` to the URL query string + if (getId() != null) { + joiner.add(String.format("%sid%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getId())))); + } + + // add `name` to the URL query string + if (getName() != null) { + joiner.add(String.format("%sname%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getName())))); + } + + return joiner.toString(); + } +} + diff --git a/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/model/ModelApiResponse.java new file mode 100644 index 000000000000..c5e83d11778e --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -0,0 +1,223 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import org.openapitools.client.ApiClient; +/** + * Describes the result of uploading an image resource + */ +@JsonPropertyOrder({ + ModelApiResponse.JSON_PROPERTY_CODE, + ModelApiResponse.JSON_PROPERTY_TYPE, + ModelApiResponse.JSON_PROPERTY_MESSAGE +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:01:56.363494+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class ModelApiResponse { + public static final String JSON_PROPERTY_CODE = "code"; + @javax.annotation.Nullable + private Integer code; + + public static final String JSON_PROPERTY_TYPE = "type"; + @javax.annotation.Nullable + private String type; + + public static final String JSON_PROPERTY_MESSAGE = "message"; + @javax.annotation.Nullable + private String message; + + public ModelApiResponse() { + } + + public ModelApiResponse code(@javax.annotation.Nullable Integer code) { + this.code = code; + return this; + } + + /** + * Get code + * @return code + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CODE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getCode() { + return code; + } + + + @JsonProperty(JSON_PROPERTY_CODE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCode(@javax.annotation.Nullable Integer code) { + this.code = code; + } + + + public ModelApiResponse type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getType() { + return type; + } + + + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public ModelApiResponse message(@javax.annotation.Nullable String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getMessage() { + return message; + } + + + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMessage(@javax.annotation.Nullable String message) { + this.message = message; + } + + + /** + * Return true if this ApiResponse object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelApiResponse _apiResponse = (ModelApiResponse) o; + return Objects.equals(this.code, _apiResponse.code) && + Objects.equals(this.type, _apiResponse.type) && + Objects.equals(this.message, _apiResponse.message); + } + + @Override + public int hashCode() { + return Objects.hash(code, type, message); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelApiResponse {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `code` to the URL query string + if (getCode() != null) { + joiner.add(String.format("%scode%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getCode())))); + } + + // add `type` to the URL query string + if (getType() != null) { + joiner.add(String.format("%stype%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getType())))); + } + + // add `message` to the URL query string + if (getMessage() != null) { + joiner.add(String.format("%smessage%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getMessage())))); + } + + return joiner.toString(); + } +} + diff --git a/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/model/Order.java new file mode 100644 index 000000000000..5fb9bc260adf --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/model/Order.java @@ -0,0 +1,369 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.time.OffsetDateTime; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import org.openapitools.client.ApiClient; +/** + * An order for a pets from the pet store + */ +@JsonPropertyOrder({ + Order.JSON_PROPERTY_ID, + Order.JSON_PROPERTY_PET_ID, + Order.JSON_PROPERTY_QUANTITY, + Order.JSON_PROPERTY_SHIP_DATE, + Order.JSON_PROPERTY_STATUS, + Order.JSON_PROPERTY_COMPLETE +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:01:56.363494+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class Order { + public static final String JSON_PROPERTY_ID = "id"; + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_PET_ID = "petId"; + @javax.annotation.Nullable + private Long petId; + + public static final String JSON_PROPERTY_QUANTITY = "quantity"; + @javax.annotation.Nullable + private Integer quantity; + + public static final String JSON_PROPERTY_SHIP_DATE = "shipDate"; + @javax.annotation.Nullable + private OffsetDateTime shipDate; + + /** + * Order Status + */ + public enum StatusEnum { + PLACED(String.valueOf("placed")), + + APPROVED(String.valueOf("approved")), + + DELIVERED(String.valueOf("delivered")); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_STATUS = "status"; + @javax.annotation.Nullable + private StatusEnum status; + + public static final String JSON_PROPERTY_COMPLETE = "complete"; + @javax.annotation.Nullable + private Boolean complete = false; + + public Order() { + } + + public Order id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getId() { + return id; + } + + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Order petId(@javax.annotation.Nullable Long petId) { + this.petId = petId; + return this; + } + + /** + * Get petId + * @return petId + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PET_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getPetId() { + return petId; + } + + + @JsonProperty(JSON_PROPERTY_PET_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPetId(@javax.annotation.Nullable Long petId) { + this.petId = petId; + } + + + public Order quantity(@javax.annotation.Nullable Integer quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get quantity + * @return quantity + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_QUANTITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getQuantity() { + return quantity; + } + + + @JsonProperty(JSON_PROPERTY_QUANTITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setQuantity(@javax.annotation.Nullable Integer quantity) { + this.quantity = quantity; + } + + + public Order shipDate(@javax.annotation.Nullable OffsetDateTime shipDate) { + this.shipDate = shipDate; + return this; + } + + /** + * Get shipDate + * @return shipDate + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SHIP_DATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getShipDate() { + return shipDate; + } + + + @JsonProperty(JSON_PROPERTY_SHIP_DATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setShipDate(@javax.annotation.Nullable OffsetDateTime shipDate) { + this.shipDate = shipDate; + } + + + public Order status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * Order Status + * @return status + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public StatusEnum getStatus() { + return status; + } + + + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + + public Order complete(@javax.annotation.Nullable Boolean complete) { + this.complete = complete; + return this; + } + + /** + * Get complete + * @return complete + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_COMPLETE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getComplete() { + return complete; + } + + + @JsonProperty(JSON_PROPERTY_COMPLETE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setComplete(@javax.annotation.Nullable Boolean complete) { + this.complete = complete; + } + + + /** + * Return true if this Order object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Order order = (Order) o; + return Objects.equals(this.id, order.id) && + Objects.equals(this.petId, order.petId) && + Objects.equals(this.quantity, order.quantity) && + Objects.equals(this.shipDate, order.shipDate) && + Objects.equals(this.status, order.status) && + Objects.equals(this.complete, order.complete); + } + + @Override + public int hashCode() { + return Objects.hash(id, petId, quantity, shipDate, status, complete); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Order {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" petId: ").append(toIndentedString(petId)).append("\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append(" shipDate: ").append(toIndentedString(shipDate)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" complete: ").append(toIndentedString(complete)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `id` to the URL query string + if (getId() != null) { + joiner.add(String.format("%sid%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getId())))); + } + + // add `petId` to the URL query string + if (getPetId() != null) { + joiner.add(String.format("%spetId%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getPetId())))); + } + + // add `quantity` to the URL query string + if (getQuantity() != null) { + joiner.add(String.format("%squantity%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getQuantity())))); + } + + // add `shipDate` to the URL query string + if (getShipDate() != null) { + joiner.add(String.format("%sshipDate%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getShipDate())))); + } + + // add `status` to the URL query string + if (getStatus() != null) { + joiner.add(String.format("%sstatus%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getStatus())))); + } + + // add `complete` to the URL query string + if (getComplete() != null) { + joiner.add(String.format("%scomplete%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getComplete())))); + } + + return joiner.toString(); + } +} + diff --git a/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/model/Pet.java new file mode 100644 index 000000000000..fca9a3f7748c --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/model/Pet.java @@ -0,0 +1,397 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import org.openapitools.client.ApiClient; +/** + * A pet for sale in the pet store + */ +@JsonPropertyOrder({ + Pet.JSON_PROPERTY_ID, + Pet.JSON_PROPERTY_CATEGORY, + Pet.JSON_PROPERTY_NAME, + Pet.JSON_PROPERTY_PHOTO_URLS, + Pet.JSON_PROPERTY_TAGS, + Pet.JSON_PROPERTY_STATUS +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:01:56.363494+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class Pet { + public static final String JSON_PROPERTY_ID = "id"; + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_CATEGORY = "category"; + @javax.annotation.Nullable + private Category category; + + public static final String JSON_PROPERTY_NAME = "name"; + @javax.annotation.Nonnull + private String name; + + public static final String JSON_PROPERTY_PHOTO_URLS = "photoUrls"; + @javax.annotation.Nonnull + private List photoUrls = new ArrayList<>(); + + public static final String JSON_PROPERTY_TAGS = "tags"; + @javax.annotation.Nullable + private List tags = new ArrayList<>(); + + /** + * pet status in the store + */ + public enum StatusEnum { + AVAILABLE(String.valueOf("available")), + + PENDING(String.valueOf("pending")), + + SOLD(String.valueOf("sold")); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_STATUS = "status"; + @javax.annotation.Nullable + private StatusEnum status; + + public Pet() { + } + + public Pet id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getId() { + return id; + } + + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Pet category(@javax.annotation.Nullable Category category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CATEGORY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Category getCategory() { + return category; + } + + + @JsonProperty(JSON_PROPERTY_CATEGORY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCategory(@javax.annotation.Nullable Category category) { + this.category = category; + } + + + public Pet name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public Pet photoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public Pet addPhotoUrlsItem(String photoUrlsItem) { + if (this.photoUrls == null) { + this.photoUrls = new ArrayList<>(); + } + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + */ + @javax.annotation.Nonnull + @JsonProperty(JSON_PROPERTY_PHOTO_URLS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getPhotoUrls() { + return photoUrls; + } + + + @JsonProperty(JSON_PROPERTY_PHOTO_URLS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setPhotoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + } + + + public Pet tags(@javax.annotation.Nullable List tags) { + this.tags = tags; + return this; + } + + public Pet addTagsItem(Tag tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Get tags + * @return tags + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TAGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getTags() { + return tags; + } + + + @JsonProperty(JSON_PROPERTY_TAGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTags(@javax.annotation.Nullable List tags) { + this.tags = tags; + } + + + public Pet status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public StatusEnum getStatus() { + return status; + } + + + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + + /** + * Return true if this Pet object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Pet pet = (Pet) o; + return Objects.equals(this.id, pet.id) && + Objects.equals(this.category, pet.category) && + Objects.equals(this.name, pet.name) && + Objects.equals(this.photoUrls, pet.photoUrls) && + Objects.equals(this.tags, pet.tags) && + Objects.equals(this.status, pet.status); + } + + @Override + public int hashCode() { + return Objects.hash(id, category, name, photoUrls, tags, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Pet {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `id` to the URL query string + if (getId() != null) { + joiner.add(String.format("%sid%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getId())))); + } + + // add `category` to the URL query string + if (getCategory() != null) { + joiner.add(getCategory().toUrlQueryString(prefix + "category" + suffix)); + } + + // add `name` to the URL query string + if (getName() != null) { + joiner.add(String.format("%sname%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getName())))); + } + + // add `photoUrls` to the URL query string + if (getPhotoUrls() != null) { + for (int i = 0; i < getPhotoUrls().size(); i++) { + joiner.add(String.format("%sphotoUrls%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix), + ApiClient.urlEncode(ApiClient.valueToString(getPhotoUrls().get(i))))); + } + } + + // add `tags` to the URL query string + if (getTags() != null) { + for (int i = 0; i < getTags().size(); i++) { + if (getTags().get(i) != null) { + joiner.add(getTags().get(i).toUrlQueryString(String.format("%stags%s%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix)))); + } + } + } + + // add `status` to the URL query string + if (getStatus() != null) { + joiner.add(String.format("%sstatus%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getStatus())))); + } + + return joiner.toString(); + } +} + diff --git a/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/model/Tag.java new file mode 100644 index 000000000000..c0d8663d423e --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/model/Tag.java @@ -0,0 +1,187 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import org.openapitools.client.ApiClient; +/** + * A tag for a pet + */ +@JsonPropertyOrder({ + Tag.JSON_PROPERTY_ID, + Tag.JSON_PROPERTY_NAME +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:01:56.363494+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class Tag { + public static final String JSON_PROPERTY_ID = "id"; + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_NAME = "name"; + @javax.annotation.Nullable + private String name; + + public Tag() { + } + + public Tag id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getId() { + return id; + } + + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Tag name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getName() { + return name; + } + + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + /** + * Return true if this Tag object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Tag tag = (Tag) o; + return Objects.equals(this.id, tag.id) && + Objects.equals(this.name, tag.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Tag {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `id` to the URL query string + if (getId() != null) { + joiner.add(String.format("%sid%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getId())))); + } + + // add `name` to the URL query string + if (getName() != null) { + joiner.add(String.format("%sname%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getName())))); + } + + return joiner.toString(); + } +} + diff --git a/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/model/User.java new file mode 100644 index 000000000000..c2694466621d --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/src/main/java/org/openapitools/client/model/User.java @@ -0,0 +1,403 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import org.openapitools.client.ApiClient; +/** + * A User who is purchasing from the pet store + */ +@JsonPropertyOrder({ + User.JSON_PROPERTY_ID, + User.JSON_PROPERTY_USERNAME, + User.JSON_PROPERTY_FIRST_NAME, + User.JSON_PROPERTY_LAST_NAME, + User.JSON_PROPERTY_EMAIL, + User.JSON_PROPERTY_PASSWORD, + User.JSON_PROPERTY_PHONE, + User.JSON_PROPERTY_USER_STATUS +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:01:56.363494+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT") +public class User { + public static final String JSON_PROPERTY_ID = "id"; + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_USERNAME = "username"; + @javax.annotation.Nullable + private String username; + + public static final String JSON_PROPERTY_FIRST_NAME = "firstName"; + @javax.annotation.Nullable + private String firstName; + + public static final String JSON_PROPERTY_LAST_NAME = "lastName"; + @javax.annotation.Nullable + private String lastName; + + public static final String JSON_PROPERTY_EMAIL = "email"; + @javax.annotation.Nullable + private String email; + + public static final String JSON_PROPERTY_PASSWORD = "password"; + @javax.annotation.Nullable + private String password; + + public static final String JSON_PROPERTY_PHONE = "phone"; + @javax.annotation.Nullable + private String phone; + + public static final String JSON_PROPERTY_USER_STATUS = "userStatus"; + @javax.annotation.Nullable + private Integer userStatus; + + public User() { + } + + public User id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getId() { + return id; + } + + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public User username(@javax.annotation.Nullable String username) { + this.username = username; + return this; + } + + /** + * Get username + * @return username + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_USERNAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getUsername() { + return username; + } + + + @JsonProperty(JSON_PROPERTY_USERNAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setUsername(@javax.annotation.Nullable String username) { + this.username = username; + } + + + public User firstName(@javax.annotation.Nullable String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Get firstName + * @return firstName + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_FIRST_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getFirstName() { + return firstName; + } + + + @JsonProperty(JSON_PROPERTY_FIRST_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setFirstName(@javax.annotation.Nullable String firstName) { + this.firstName = firstName; + } + + + public User lastName(@javax.annotation.Nullable String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Get lastName + * @return lastName + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_LAST_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getLastName() { + return lastName; + } + + + @JsonProperty(JSON_PROPERTY_LAST_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setLastName(@javax.annotation.Nullable String lastName) { + this.lastName = lastName; + } + + + public User email(@javax.annotation.Nullable String email) { + this.email = email; + return this; + } + + /** + * Get email + * @return email + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_EMAIL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getEmail() { + return email; + } + + + @JsonProperty(JSON_PROPERTY_EMAIL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setEmail(@javax.annotation.Nullable String email) { + this.email = email; + } + + + public User password(@javax.annotation.Nullable String password) { + this.password = password; + return this; + } + + /** + * Get password + * @return password + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PASSWORD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getPassword() { + return password; + } + + + @JsonProperty(JSON_PROPERTY_PASSWORD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPassword(@javax.annotation.Nullable String password) { + this.password = password; + } + + + public User phone(@javax.annotation.Nullable String phone) { + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PHONE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getPhone() { + return phone; + } + + + @JsonProperty(JSON_PROPERTY_PHONE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPhone(@javax.annotation.Nullable String phone) { + this.phone = phone; + } + + + public User userStatus(@javax.annotation.Nullable Integer userStatus) { + this.userStatus = userStatus; + return this; + } + + /** + * User Status + * @return userStatus + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_USER_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getUserStatus() { + return userStatus; + } + + + @JsonProperty(JSON_PROPERTY_USER_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setUserStatus(@javax.annotation.Nullable Integer userStatus) { + this.userStatus = userStatus; + } + + + /** + * Return true if this User object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + User user = (User) o; + return Objects.equals(this.id, user.id) && + Objects.equals(this.username, user.username) && + Objects.equals(this.firstName, user.firstName) && + Objects.equals(this.lastName, user.lastName) && + Objects.equals(this.email, user.email) && + Objects.equals(this.password, user.password) && + Objects.equals(this.phone, user.phone) && + Objects.equals(this.userStatus, user.userStatus); + } + + @Override + public int hashCode() { + return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class User {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" username: ").append(toIndentedString(username)).append("\n"); + sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); + sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" userStatus: ").append(toIndentedString(userStatus)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `id` to the URL query string + if (getId() != null) { + joiner.add(String.format("%sid%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getId())))); + } + + // add `username` to the URL query string + if (getUsername() != null) { + joiner.add(String.format("%susername%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getUsername())))); + } + + // add `firstName` to the URL query string + if (getFirstName() != null) { + joiner.add(String.format("%sfirstName%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getFirstName())))); + } + + // add `lastName` to the URL query string + if (getLastName() != null) { + joiner.add(String.format("%slastName%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getLastName())))); + } + + // add `email` to the URL query string + if (getEmail() != null) { + joiner.add(String.format("%semail%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getEmail())))); + } + + // add `password` to the URL query string + if (getPassword() != null) { + joiner.add(String.format("%spassword%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getPassword())))); + } + + // add `phone` to the URL query string + if (getPhone() != null) { + joiner.add(String.format("%sphone%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getPhone())))); + } + + // add `userStatus` to the URL query string + if (getUserStatus() != null) { + joiner.add(String.format("%suserStatus%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getUserStatus())))); + } + + return joiner.toString(); + } +} + diff --git a/samples/client/petstore/java/native/test-regenerated/src/test/java/org/openapitools/client/api/PetApiTest.java b/samples/client/petstore/java/native/test-regenerated/src/test/java/org/openapitools/client/api/PetApiTest.java new file mode 100644 index 000000000000..f725ba246938 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/src/test/java/org/openapitools/client/api/PetApiTest.java @@ -0,0 +1,180 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import java.io.File; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.Pet; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + + +/** + * API tests for PetApi + */ +@Disabled +public class PetApiTest { + + private final PetApi api = new PetApi(); + + + /** + * Add a new pet to the store + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void addPetTest() throws ApiException { + Pet pet = null; + Pet response = + api.addPet(pet); + + // TODO: test validations + } + + /** + * Deletes a pet + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void deletePetTest() throws ApiException { + Long petId = null; + String apiKey = null; + + api.deletePet(petId, apiKey); + + // TODO: test validations + } + + /** + * Finds Pets by status + * + * Multiple status values can be provided with comma separated strings + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void findPetsByStatusTest() throws ApiException { + List status = null; + List response = + api.findPetsByStatus(status); + + // TODO: test validations + } + + /** + * Finds Pets by tags + * + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void findPetsByTagsTest() throws ApiException { + List tags = null; + List response = + api.findPetsByTags(tags); + + // TODO: test validations + } + + /** + * Find pet by ID + * + * Returns a single pet + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void getPetByIdTest() throws ApiException { + Long petId = null; + Pet response = + api.getPetById(petId); + + // TODO: test validations + } + + /** + * Update an existing pet + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void updatePetTest() throws ApiException { + Pet pet = null; + Pet response = + api.updatePet(pet); + + // TODO: test validations + } + + /** + * Updates a pet in the store with form data + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void updatePetWithFormTest() throws ApiException { + Long petId = null; + String name = null; + String status = null; + + api.updatePetWithForm(petId, name, status); + + // TODO: test validations + } + + /** + * uploads an image + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void uploadFileTest() throws ApiException { + Long petId = null; + String additionalMetadata = null; + File _file = null; + ModelApiResponse response = + api.uploadFile(petId, additionalMetadata, _file); + + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/native/test-regenerated/src/test/java/org/openapitools/client/api/StoreApiTest.java b/samples/client/petstore/java/native/test-regenerated/src/test/java/org/openapitools/client/api/StoreApiTest.java new file mode 100644 index 000000000000..be318cab8b1e --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/src/test/java/org/openapitools/client/api/StoreApiTest.java @@ -0,0 +1,104 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.model.Order; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + + +/** + * API tests for StoreApi + */ +@Disabled +public class StoreApiTest { + + private final StoreApi api = new StoreApi(); + + + /** + * Delete purchase order by ID + * + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void deleteOrderTest() throws ApiException { + String orderId = null; + + api.deleteOrder(orderId); + + // TODO: test validations + } + + /** + * Returns pet inventories by status + * + * Returns a map of status codes to quantities + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void getInventoryTest() throws ApiException { + Map response = + api.getInventory(); + + // TODO: test validations + } + + /** + * Find purchase order by ID + * + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void getOrderByIdTest() throws ApiException { + Long orderId = null; + Order response = + api.getOrderById(orderId); + + // TODO: test validations + } + + /** + * Place an order for a pet + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void placeOrderTest() throws ApiException { + Order order = null; + Order response = + api.placeOrder(order); + + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/native/test-regenerated/src/test/java/org/openapitools/client/api/UserApiTest.java b/samples/client/petstore/java/native/test-regenerated/src/test/java/org/openapitools/client/api/UserApiTest.java new file mode 100644 index 000000000000..2b2b7a60fd21 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/src/test/java/org/openapitools/client/api/UserApiTest.java @@ -0,0 +1,175 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import java.time.OffsetDateTime; +import org.openapitools.client.model.User; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + + +/** + * API tests for UserApi + */ +@Disabled +public class UserApiTest { + + private final UserApi api = new UserApi(); + + + /** + * Create user + * + * This can only be done by the logged in user. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void createUserTest() throws ApiException { + User user = null; + + api.createUser(user); + + // TODO: test validations + } + + /** + * Creates list of users with given input array + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void createUsersWithArrayInputTest() throws ApiException { + List user = null; + + api.createUsersWithArrayInput(user); + + // TODO: test validations + } + + /** + * Creates list of users with given input array + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void createUsersWithListInputTest() throws ApiException { + List user = null; + + api.createUsersWithListInput(user); + + // TODO: test validations + } + + /** + * Delete user + * + * This can only be done by the logged in user. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void deleteUserTest() throws ApiException { + String username = null; + + api.deleteUser(username); + + // TODO: test validations + } + + /** + * Get user by user name + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void getUserByNameTest() throws ApiException { + String username = null; + User response = + api.getUserByName(username); + + // TODO: test validations + } + + /** + * Logs user into the system + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void loginUserTest() throws ApiException { + String username = null; + String password = null; + String response = + api.loginUser(username, password); + + // TODO: test validations + } + + /** + * Logs out current logged in user session + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void logoutUserTest() throws ApiException { + + api.logoutUser(); + + // TODO: test validations + } + + /** + * Updated user + * + * This can only be done by the logged in user. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void updateUserTest() throws ApiException { + String username = null; + User user = null; + + api.updateUser(username, user); + + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/native/test-regenerated/src/test/java/org/openapitools/client/model/CategoryTest.java b/samples/client/petstore/java/native/test-regenerated/src/test/java/org/openapitools/client/model/CategoryTest.java new file mode 100644 index 000000000000..ae23ab433a50 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/src/test/java/org/openapitools/client/model/CategoryTest.java @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Category + */ +class CategoryTest { + private final Category model = new Category(); + + /** + * Model tests for Category + */ + @Test + void testCategory() { + // TODO: test Category + } + + /** + * Test the property 'id' + */ + @Test + void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/native/test-regenerated/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java b/samples/client/petstore/java/native/test-regenerated/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java new file mode 100644 index 000000000000..c846563bfe1f --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java @@ -0,0 +1,64 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ModelApiResponse + */ +class ModelApiResponseTest { + private final ModelApiResponse model = new ModelApiResponse(); + + /** + * Model tests for ModelApiResponse + */ + @Test + void testModelApiResponse() { + // TODO: test ModelApiResponse + } + + /** + * Test the property 'code' + */ + @Test + void codeTest() { + // TODO: test code + } + + /** + * Test the property 'type' + */ + @Test + void typeTest() { + // TODO: test type + } + + /** + * Test the property 'message' + */ + @Test + void messageTest() { + // TODO: test message + } + +} diff --git a/samples/client/petstore/java/native/test-regenerated/src/test/java/org/openapitools/client/model/OrderTest.java b/samples/client/petstore/java/native/test-regenerated/src/test/java/org/openapitools/client/model/OrderTest.java new file mode 100644 index 000000000000..4d8d136809eb --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/src/test/java/org/openapitools/client/model/OrderTest.java @@ -0,0 +1,89 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Order + */ +class OrderTest { + private final Order model = new Order(); + + /** + * Model tests for Order + */ + @Test + void testOrder() { + // TODO: test Order + } + + /** + * Test the property 'id' + */ + @Test + void idTest() { + // TODO: test id + } + + /** + * Test the property 'petId' + */ + @Test + void petIdTest() { + // TODO: test petId + } + + /** + * Test the property 'quantity' + */ + @Test + void quantityTest() { + // TODO: test quantity + } + + /** + * Test the property 'shipDate' + */ + @Test + void shipDateTest() { + // TODO: test shipDate + } + + /** + * Test the property 'status' + */ + @Test + void statusTest() { + // TODO: test status + } + + /** + * Test the property 'complete' + */ + @Test + void completeTest() { + // TODO: test complete + } + +} diff --git a/samples/client/petstore/java/native/test-regenerated/src/test/java/org/openapitools/client/model/PetTest.java b/samples/client/petstore/java/native/test-regenerated/src/test/java/org/openapitools/client/model/PetTest.java new file mode 100644 index 000000000000..84aff8adbf96 --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/src/test/java/org/openapitools/client/model/PetTest.java @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Pet + */ +class PetTest { + private final Pet model = new Pet(); + + /** + * Model tests for Pet + */ + @Test + void testPet() { + // TODO: test Pet + } + + /** + * Test the property 'id' + */ + @Test + void idTest() { + // TODO: test id + } + + /** + * Test the property 'category' + */ + @Test + void categoryTest() { + // TODO: test category + } + + /** + * Test the property 'name' + */ + @Test + void nameTest() { + // TODO: test name + } + + /** + * Test the property 'photoUrls' + */ + @Test + void photoUrlsTest() { + // TODO: test photoUrls + } + + /** + * Test the property 'tags' + */ + @Test + void tagsTest() { + // TODO: test tags + } + + /** + * Test the property 'status' + */ + @Test + void statusTest() { + // TODO: test status + } + +} diff --git a/samples/client/petstore/java/native/test-regenerated/src/test/java/org/openapitools/client/model/TagTest.java b/samples/client/petstore/java/native/test-regenerated/src/test/java/org/openapitools/client/model/TagTest.java new file mode 100644 index 000000000000..6bd8b9f5035e --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/src/test/java/org/openapitools/client/model/TagTest.java @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Tag + */ +class TagTest { + private final Tag model = new Tag(); + + /** + * Model tests for Tag + */ + @Test + void testTag() { + // TODO: test Tag + } + + /** + * Test the property 'id' + */ + @Test + void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/native/test-regenerated/src/test/java/org/openapitools/client/model/UserTest.java b/samples/client/petstore/java/native/test-regenerated/src/test/java/org/openapitools/client/model/UserTest.java new file mode 100644 index 000000000000..40f4892264aa --- /dev/null +++ b/samples/client/petstore/java/native/test-regenerated/src/test/java/org/openapitools/client/model/UserTest.java @@ -0,0 +1,104 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for User + */ +class UserTest { + private final User model = new User(); + + /** + * Model tests for User + */ + @Test + void testUser() { + // TODO: test User + } + + /** + * Test the property 'id' + */ + @Test + void idTest() { + // TODO: test id + } + + /** + * Test the property 'username' + */ + @Test + void usernameTest() { + // TODO: test username + } + + /** + * Test the property 'firstName' + */ + @Test + void firstNameTest() { + // TODO: test firstName + } + + /** + * Test the property 'lastName' + */ + @Test + void lastNameTest() { + // TODO: test lastName + } + + /** + * Test the property 'email' + */ + @Test + void emailTest() { + // TODO: test email + } + + /** + * Test the property 'password' + */ + @Test + void passwordTest() { + // TODO: test password + } + + /** + * Test the property 'phone' + */ + @Test + void phoneTest() { + // TODO: test phone + } + + /** + * Test the property 'userStatus' + */ + @Test + void userStatusTest() { + // TODO: test userStatus + } + +} From 605eda68a24d44b71efafee44465fa95a9842e8f Mon Sep 17 00:00:00 2001 From: Ilya Nemtsev Date: Wed, 9 Jul 2025 11:49:46 +0700 Subject: [PATCH 15/17] moved header population to utility method --- .../Java/libraries/native/api.mustache | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/native/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/native/api.mustache index c04904caf697..8cef6d939869 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/native/api.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/native/api.mustache @@ -53,6 +53,17 @@ import java.util.function.Consumer; import java.util.concurrent.CompletableFuture; {{/asyncNative}} +static class HttpRequestBuilderExtensions { + static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map headers) { + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + builder.header(entry.getKey(), entry.getValue()); + } + } + return builder; + } +} + {{>generatedAnnotation}} {{#operations}} public class {{classname}} { @@ -677,11 +688,7 @@ public class {{classname}} { localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } From 2d099fa8453f0d52ccc23e4283592ab9c514db17 Mon Sep 17 00:00:00 2001 From: Ilya Nemtsev Date: Thu, 10 Jul 2025 13:28:50 +0700 Subject: [PATCH 16/17] moved static class inside main class --- .../main/resources/Java/libraries/native/api.mustache | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/native/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/native/api.mustache index 8cef6d939869..3a94f0c6d9fe 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/native/api.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/native/api.mustache @@ -53,7 +53,10 @@ import java.util.function.Consumer; import java.util.concurrent.CompletableFuture; {{/asyncNative}} -static class HttpRequestBuilderExtensions { +{{>generatedAnnotation}} +{{#operations}} +public class {{classname}} { + private static class HttpRequestBuilderExtensions { static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map headers) { if (headers != null) { for (Map.Entry entry : headers.entrySet()) { @@ -62,11 +65,7 @@ static class HttpRequestBuilderExtensions { } return builder; } -} - -{{>generatedAnnotation}} -{{#operations}} -public class {{classname}} { + } private final HttpClient memberVarHttpClient; private final ObjectMapper memberVarObjectMapper; private final String memberVarBaseUri; From 93579fe5151083caaa00202a2f3ab49970b45a21 Mon Sep 17 00:00:00 2001 From: Ilya Nemtsev Date: Thu, 10 Jul 2025 13:41:21 +0700 Subject: [PATCH 17/17] regenerated samples --- .../org/openapitools/client/api/AuthApi.java | 22 +-- .../org/openapitools/client/api/BodyApi.java | 70 +++------- .../org/openapitools/client/api/FormApi.java | 28 ++-- .../openapitools/client/api/HeaderApi.java | 16 ++- .../org/openapitools/client/api/PathApi.java | 16 ++- .../org/openapitools/client/api/QueryApi.java | 70 +++------- .../client/api/AnotherFakeApi.java | 16 ++- .../openapitools/client/api/DefaultApi.java | 16 ++- .../org/openapitools/client/api/FakeApi.java | 130 ++++-------------- .../client/api/FakeClassnameTags123Api.java | 16 ++- .../org/openapitools/client/api/PetApi.java | 64 +++------ .../org/openapitools/client/api/StoreApi.java | 34 ++--- .../org/openapitools/client/api/UserApi.java | 58 +++----- .../org/openapitools/client/api/PetApi.java | 58 +++----- .../org/openapitools/client/api/StoreApi.java | 34 ++--- .../org/openapitools/client/api/UserApi.java | 58 +++----- .../client/api/AnotherFakeApi.java | 16 ++- .../openapitools/client/api/DefaultApi.java | 16 ++- .../org/openapitools/client/api/FakeApi.java | 130 ++++-------------- .../client/api/FakeClassnameTags123Api.java | 16 ++- .../org/openapitools/client/api/PetApi.java | 64 +++------ .../org/openapitools/client/api/StoreApi.java | 34 ++--- .../org/openapitools/client/api/UserApi.java | 58 +++----- 23 files changed, 365 insertions(+), 675 deletions(-) diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/AuthApi.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/AuthApi.java index 69a5917dfb3d..7435a3145523 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/AuthApi.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/AuthApi.java @@ -46,6 +46,16 @@ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT") public class AuthApi { + private static class HttpRequestBuilderExtensions { + static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map headers) { + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + builder.header(entry.getKey(), entry.getValue()); + } + } + return builder; + } + } private final HttpClient memberVarHttpClient; private final ObjectMapper memberVarObjectMapper; private final String memberVarBaseUri; @@ -173,11 +183,7 @@ private HttpRequest.Builder testAuthHttpBasicRequestBuilder(Map localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -275,11 +281,7 @@ private HttpRequest.Builder testAuthHttpBearerRequestBuilder(Map localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/BodyApi.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/BodyApi.java index 705b528ca1c3..e455da193d3a 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/BodyApi.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/BodyApi.java @@ -56,6 +56,16 @@ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT") public class BodyApi { + private static class HttpRequestBuilderExtensions { + static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map headers) { + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + builder.header(entry.getKey(), entry.getValue()); + } + } + return builder; + } + } private final HttpClient memberVarHttpClient; private final ObjectMapper memberVarObjectMapper; private final String memberVarBaseUri; @@ -186,11 +196,7 @@ private HttpRequest.Builder testBinaryGifRequestBuilder(Map head localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -298,11 +304,7 @@ private HttpRequest.Builder testBodyApplicationOctetstreamBinaryRequestBuilder(@ localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -443,11 +445,7 @@ private HttpRequest.Builder testBodyMultipartFormdataArrayOfBinaryRequestBuilder localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -582,11 +580,7 @@ private HttpRequest.Builder testBodyMultipartFormdataSingleBinaryRequestBuilder( localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -697,11 +691,7 @@ private HttpRequest.Builder testEchoBodyAllOfPetRequestBuilder(@javax.annotation localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -809,11 +799,7 @@ private HttpRequest.Builder testEchoBodyFreeFormObjectResponseStringRequestBuild localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -924,11 +910,7 @@ private HttpRequest.Builder testEchoBodyPetRequestBuilder(@javax.annotation.Null localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1036,11 +1018,7 @@ private HttpRequest.Builder testEchoBodyPetResponseStringRequestBuilder(@javax.a localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1151,11 +1129,7 @@ private HttpRequest.Builder testEchoBodyStringEnumRequestBuilder(@javax.annotati localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1263,11 +1237,7 @@ private HttpRequest.Builder testEchoBodyTagResponseStringRequestBuilder(@javax.a localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/FormApi.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/FormApi.java index 630492693f20..545a2133ecb6 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/FormApi.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/FormApi.java @@ -53,6 +53,16 @@ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT") public class FormApi { + private static class HttpRequestBuilderExtensions { + static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map headers) { + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + builder.header(entry.getKey(), entry.getValue()); + } + } + return builder; + } + } private final HttpClient memberVarHttpClient; private final ObjectMapper memberVarObjectMapper; private final String memberVarBaseUri; @@ -212,11 +222,7 @@ private HttpRequest.Builder testFormIntegerBooleanStringRequestBuilder(@javax.an localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -356,11 +362,7 @@ private HttpRequest.Builder testFormObjectMultipartRequestBuilder(@javax.annotat localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -511,11 +513,7 @@ private HttpRequest.Builder testFormOneofRequestBuilder(@javax.annotation.Nullab localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/HeaderApi.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/HeaderApi.java index d8c89229c4e5..204b13411777 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/HeaderApi.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/HeaderApi.java @@ -53,6 +53,16 @@ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT") public class HeaderApi { + private static class HttpRequestBuilderExtensions { + static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map headers) { + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + builder.header(entry.getKey(), entry.getValue()); + } + } + return builder; + } + } private final HttpClient memberVarHttpClient; private final ObjectMapper memberVarObjectMapper; private final String memberVarBaseUri; @@ -215,11 +225,7 @@ private HttpRequest.Builder testHeaderIntegerBooleanStringEnumsRequestBuilder(@j localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/PathApi.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/PathApi.java index 34cd0356503a..fd0d90787a51 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/PathApi.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/PathApi.java @@ -53,6 +53,16 @@ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT") public class PathApi { + private static class HttpRequestBuilderExtensions { + static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map headers) { + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + builder.header(entry.getKey(), entry.getValue()); + } + } + return builder; + } + } private final HttpClient memberVarHttpClient; private final ObjectMapper memberVarObjectMapper; private final String memberVarBaseUri; @@ -216,11 +226,7 @@ private HttpRequest.Builder testsPathStringPathStringIntegerPathIntegerEnumNonre localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/QueryApi.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/QueryApi.java index 939771491b04..d196e933d358 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/QueryApi.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/QueryApi.java @@ -59,6 +59,16 @@ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT") public class QueryApi { + private static class HttpRequestBuilderExtensions { + static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map headers) { + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + builder.header(entry.getKey(), entry.getValue()); + } + } + return builder; + } + } private final HttpClient memberVarHttpClient; private final ObjectMapper memberVarObjectMapper; private final String memberVarBaseUri; @@ -211,11 +221,7 @@ private HttpRequest.Builder testEnumRefStringRequestBuilder(@javax.annotation.Nu localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -344,11 +350,7 @@ private HttpRequest.Builder testQueryDatetimeDateStringRequestBuilder(@javax.ann localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -477,11 +479,7 @@ private HttpRequest.Builder testQueryIntegerBooleanStringRequestBuilder(@javax.a localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -603,11 +601,7 @@ private HttpRequest.Builder testQueryStyleDeepObjectExplodeTrueObjectRequestBuil localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -729,11 +723,7 @@ private HttpRequest.Builder testQueryStyleDeepObjectExplodeTrueObjectAllOfReques localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -850,11 +840,7 @@ private HttpRequest.Builder testQueryStyleFormExplodeFalseArrayIntegerRequestBui localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -971,11 +957,7 @@ private HttpRequest.Builder testQueryStyleFormExplodeFalseArrayStringRequestBuil localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1092,11 +1074,7 @@ private HttpRequest.Builder testQueryStyleFormExplodeTrueArrayStringRequestBuild localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1218,11 +1196,7 @@ private HttpRequest.Builder testQueryStyleFormExplodeTrueObjectRequestBuilder(@j localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1339,11 +1313,7 @@ private HttpRequest.Builder testQueryStyleFormExplodeTrueObjectAllOfRequestBuild localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/AnotherFakeApi.java index ca763e49e1a6..b3a206650a1f 100644 --- a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/AnotherFakeApi.java +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -49,6 +49,16 @@ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT") public class AnotherFakeApi { + private static class HttpRequestBuilderExtensions { + static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map headers) { + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + builder.header(entry.getKey(), entry.getValue()); + } + } + return builder; + } + } private final HttpClient memberVarHttpClient; private final ObjectMapper memberVarObjectMapper; private final String memberVarBaseUri; @@ -202,11 +212,7 @@ private HttpRequest.Builder call123testSpecialTagsRequestBuilder(@javax.annotati localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/DefaultApi.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/DefaultApi.java index 294544f24be8..2c29e4ee6d65 100644 --- a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/DefaultApi.java +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/DefaultApi.java @@ -49,6 +49,16 @@ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT") public class DefaultApi { + private static class HttpRequestBuilderExtensions { + static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map headers) { + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + builder.header(entry.getKey(), entry.getValue()); + } + } + return builder; + } + } private final HttpClient memberVarHttpClient; private final ObjectMapper memberVarObjectMapper; private final String memberVarBaseUri; @@ -188,11 +198,7 @@ private HttpRequest.Builder fooGetRequestBuilder(Map headers) th localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeApi.java index 51ef28f219cf..770168b2fa80 100644 --- a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeApi.java @@ -66,6 +66,16 @@ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT") public class FakeApi { + private static class HttpRequestBuilderExtensions { + static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map headers) { + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + builder.header(entry.getKey(), entry.getValue()); + } + } + return builder; + } + } private final HttpClient memberVarHttpClient; private final ObjectMapper memberVarObjectMapper; private final String memberVarBaseUri; @@ -205,11 +215,7 @@ private HttpRequest.Builder fakeBigDecimalMapRequestBuilder(Map localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -320,11 +326,7 @@ private HttpRequest.Builder fakeHealthGetRequestBuilder(Map head localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -445,11 +447,7 @@ private HttpRequest.Builder fakeOuterBooleanSerializeRequestBuilder(@javax.annot localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -570,11 +568,7 @@ private HttpRequest.Builder fakeOuterCompositeSerializeRequestBuilder(@javax.ann localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -695,11 +689,7 @@ private HttpRequest.Builder fakeOuterNumberSerializeRequestBuilder(@javax.annota localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -815,11 +805,7 @@ private HttpRequest.Builder fakeOuterStringSerializeRequestBuilder(@javax.annota localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -930,11 +916,7 @@ private HttpRequest.Builder getApplicationJsonUtf8RequestBuilder(Map entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1045,11 +1027,7 @@ private HttpRequest.Builder getArrayOfEnumsRequestBuilder(Map he localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1159,11 +1137,7 @@ private HttpRequest.Builder testAdditionalPropertiesReferenceRequestBuilder(@jav localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1273,11 +1247,7 @@ private HttpRequest.Builder testBodyWithFileSchemaRequestBuilder(@javax.annotati localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1410,11 +1380,7 @@ private HttpRequest.Builder testBodyWithQueryParamsRequestBuilder(@javax.annotat localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1539,11 +1505,7 @@ private HttpRequest.Builder testClientModelRequestBuilder(@javax.annotation.Nonn localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1764,11 +1726,7 @@ private HttpRequest.Builder testEndpointParametersRequestBuilder(@javax.annotati localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1942,11 +1900,7 @@ private HttpRequest.Builder testEnumParametersRequestBuilder(@javax.annotation.N localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -2169,11 +2123,7 @@ private HttpRequest.Builder testGroupParametersRequestBuilder(@javax.annotation. localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -2372,11 +2322,7 @@ private HttpRequest.Builder testInlineAdditionalPropertiesRequestBuilder(@javax. localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -2486,11 +2432,7 @@ private HttpRequest.Builder testInlineFreeformAdditionalPropertiesRequestBuilder localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -2619,11 +2561,7 @@ private HttpRequest.Builder testJsonFormDataRequestBuilder(@javax.annotation.Non localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -2782,11 +2720,7 @@ private HttpRequest.Builder testQueryParameterCollectionFormatRequestBuilder(@ja localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -2896,11 +2830,7 @@ private HttpRequest.Builder testStringMapReferenceRequestBuilder(@javax.annotati localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java index 30b50325620d..aca344a8a134 100644 --- a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -55,6 +55,16 @@ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT") public class FakeClassnameTags123Api { + private static class HttpRequestBuilderExtensions { + static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map headers) { + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + builder.header(entry.getKey(), entry.getValue()); + } + } + return builder; + } + } private final HttpClient memberVarHttpClient; private final ObjectMapper memberVarObjectMapper; private final String memberVarBaseUri; @@ -208,11 +218,7 @@ private HttpRequest.Builder testClassnameRequestBuilder(@javax.annotation.Nonnul localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/PetApi.java index 617d6d2d060b..4182c186e608 100644 --- a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/PetApi.java @@ -57,6 +57,16 @@ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT") public class PetApi { + private static class HttpRequestBuilderExtensions { + static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map headers) { + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + builder.header(entry.getKey(), entry.getValue()); + } + } + return builder; + } + } private final HttpClient memberVarHttpClient; private final ObjectMapper memberVarObjectMapper; private final String memberVarBaseUri; @@ -195,11 +205,7 @@ private HttpRequest.Builder addPetRequestBuilder(@javax.annotation.Nonnull Pet p localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -311,11 +317,7 @@ private HttpRequest.Builder deletePetRequestBuilder(@javax.annotation.Nonnull Lo localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -449,11 +451,7 @@ private HttpRequest.Builder findPetsByStatusRequestBuilder(@javax.annotation.Non localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -595,11 +593,7 @@ private HttpRequest.Builder findPetsByTagsRequestBuilder(@javax.annotation.Nonnu localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -719,11 +713,7 @@ private HttpRequest.Builder getPetByIdRequestBuilder(@javax.annotation.Nonnull L localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -833,11 +823,7 @@ private HttpRequest.Builder updatePetRequestBuilder(@javax.annotation.Nonnull Pe localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -967,11 +953,7 @@ private HttpRequest.Builder updatePetWithFormRequestBuilder(@javax.annotation.No localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1135,11 +1117,7 @@ private HttpRequest.Builder uploadFileRequestBuilder(@javax.annotation.Nonnull L localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1307,11 +1285,7 @@ private HttpRequest.Builder uploadFileWithRequiredFileRequestBuilder(@javax.anno localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/StoreApi.java index 629fc865607c..65f4fb0aef45 100644 --- a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/StoreApi.java @@ -55,6 +55,16 @@ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT") public class StoreApi { + private static class HttpRequestBuilderExtensions { + static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map headers) { + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + builder.header(entry.getKey(), entry.getValue()); + } + } + return builder; + } + } private final HttpClient memberVarHttpClient; private final ObjectMapper memberVarObjectMapper; private final String memberVarBaseUri; @@ -188,11 +198,7 @@ private HttpRequest.Builder deleteOrderRequestBuilder(@javax.annotation.Nonnull localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -303,11 +309,7 @@ private HttpRequest.Builder getInventoryRequestBuilder(Map heade localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -427,11 +429,7 @@ private HttpRequest.Builder getOrderByIdRequestBuilder(@javax.annotation.Nonnull localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -556,11 +554,7 @@ private HttpRequest.Builder placeOrderRequestBuilder(@javax.annotation.Nonnull O localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/UserApi.java index 143e6ecc4a26..9798f11648e5 100644 --- a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/UserApi.java @@ -56,6 +56,16 @@ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT") public class UserApi { + private static class HttpRequestBuilderExtensions { + static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map headers) { + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + builder.header(entry.getKey(), entry.getValue()); + } + } + return builder; + } + } private final HttpClient memberVarHttpClient; private final ObjectMapper memberVarObjectMapper; private final String memberVarBaseUri; @@ -194,11 +204,7 @@ private HttpRequest.Builder createUserRequestBuilder(@javax.annotation.Nonnull U localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -308,11 +314,7 @@ private HttpRequest.Builder createUsersWithArrayInputRequestBuilder(@javax.annot localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -422,11 +424,7 @@ private HttpRequest.Builder createUsersWithListInputRequestBuilder(@javax.annota localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -531,11 +529,7 @@ private HttpRequest.Builder deleteUserRequestBuilder(@javax.annotation.Nonnull S localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -655,11 +649,7 @@ private HttpRequest.Builder getUserByNameRequestBuilder(@javax.annotation.Nonnul localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -803,11 +793,7 @@ private HttpRequest.Builder loginUserRequestBuilder(@javax.annotation.Nonnull St localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -903,11 +889,7 @@ private HttpRequest.Builder logoutUserRequestBuilder(Map headers localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1026,11 +1008,7 @@ private HttpRequest.Builder updateUserRequestBuilder(@javax.annotation.Nonnull S localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/PetApi.java index 422ee1b164b6..444fd255de3b 100644 --- a/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/PetApi.java @@ -55,6 +55,16 @@ @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT") public class PetApi { + private static class HttpRequestBuilderExtensions { + static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map headers) { + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + builder.header(entry.getKey(), entry.getValue()); + } + } + return builder; + } + } private final HttpClient memberVarHttpClient; private final ObjectMapper memberVarObjectMapper; private final String memberVarBaseUri; @@ -199,11 +209,7 @@ private HttpRequest.Builder addPetRequestBuilder(@jakarta.annotation.Nonnull Pet localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -311,11 +317,7 @@ private HttpRequest.Builder deletePetRequestBuilder(@jakarta.annotation.Nonnull localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -439,11 +441,7 @@ private HttpRequest.Builder findPetsByStatusRequestBuilder(@jakarta.annotation.N localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -575,11 +573,7 @@ private HttpRequest.Builder findPetsByTagsRequestBuilder(@jakarta.annotation.Non localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -689,11 +683,7 @@ private HttpRequest.Builder getPetByIdRequestBuilder(@jakarta.annotation.Nonnull localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -816,11 +806,7 @@ private HttpRequest.Builder updatePetRequestBuilder(@jakarta.annotation.Nonnull localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -946,11 +932,7 @@ private HttpRequest.Builder updatePetWithFormRequestBuilder(@jakarta.annotation. localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1104,11 +1086,7 @@ private HttpRequest.Builder uploadFileRequestBuilder(@jakarta.annotation.Nonnull localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/StoreApi.java index 7a050448bd8c..bf39d5c45641 100644 --- a/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/StoreApi.java @@ -53,6 +53,16 @@ @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT") public class StoreApi { + private static class HttpRequestBuilderExtensions { + static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map headers) { + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + builder.header(entry.getKey(), entry.getValue()); + } + } + return builder; + } + } private final HttpClient memberVarHttpClient; private final ObjectMapper memberVarObjectMapper; private final String memberVarBaseUri; @@ -183,11 +193,7 @@ private HttpRequest.Builder deleteOrderRequestBuilder(@jakarta.annotation.Nonnul localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -288,11 +294,7 @@ private HttpRequest.Builder getInventoryRequestBuilder(Map heade localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -402,11 +404,7 @@ private HttpRequest.Builder getOrderByIdRequestBuilder(@jakarta.annotation.Nonnu localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -521,11 +519,7 @@ private HttpRequest.Builder placeOrderRequestBuilder(@jakarta.annotation.Nonnull localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/UserApi.java index 519f01df4cd9..69865abf3acd 100644 --- a/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/api/UserApi.java @@ -54,6 +54,16 @@ @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT") public class UserApi { + private static class HttpRequestBuilderExtensions { + static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map headers) { + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + builder.header(entry.getKey(), entry.getValue()); + } + } + return builder; + } + } private final HttpClient memberVarHttpClient; private final ObjectMapper memberVarObjectMapper; private final String memberVarBaseUri; @@ -189,11 +199,7 @@ private HttpRequest.Builder createUserRequestBuilder(@jakarta.annotation.Nonnull localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -299,11 +305,7 @@ private HttpRequest.Builder createUsersWithArrayInputRequestBuilder(@jakarta.ann localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -409,11 +411,7 @@ private HttpRequest.Builder createUsersWithListInputRequestBuilder(@jakarta.anno localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -514,11 +512,7 @@ private HttpRequest.Builder deleteUserRequestBuilder(@jakarta.annotation.Nonnull localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -628,11 +622,7 @@ private HttpRequest.Builder getUserByNameRequestBuilder(@jakarta.annotation.Nonn localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -766,11 +756,7 @@ private HttpRequest.Builder loginUserRequestBuilder(@jakarta.annotation.Nonnull localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -862,11 +848,7 @@ private HttpRequest.Builder logoutUserRequestBuilder(Map headers localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -981,11 +963,7 @@ private HttpRequest.Builder updateUserRequestBuilder(@jakarta.annotation.Nonnull localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/AnotherFakeApi.java index ff2da74a5a5a..14ca8ecad778 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/AnotherFakeApi.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -47,6 +47,16 @@ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT") public class AnotherFakeApi { + private static class HttpRequestBuilderExtensions { + static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map headers) { + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + builder.header(entry.getKey(), entry.getValue()); + } + } + return builder; + } + } private final HttpClient memberVarHttpClient; private final ObjectMapper memberVarObjectMapper; private final String memberVarBaseUri; @@ -191,11 +201,7 @@ private HttpRequest.Builder call123testSpecialTagsRequestBuilder(@javax.annotati localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/DefaultApi.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/DefaultApi.java index 4b72f2ad1639..00ef1d05bd21 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/DefaultApi.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/DefaultApi.java @@ -47,6 +47,16 @@ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT") public class DefaultApi { + private static class HttpRequestBuilderExtensions { + static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map headers) { + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + builder.header(entry.getKey(), entry.getValue()); + } + } + return builder; + } + } private final HttpClient memberVarHttpClient; private final ObjectMapper memberVarObjectMapper; private final String memberVarBaseUri; @@ -177,11 +187,7 @@ private HttpRequest.Builder fooGetRequestBuilder(Map headers) th localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeApi.java index dca421cef972..b3b2b4dc278a 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeApi.java @@ -64,6 +64,16 @@ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT") public class FakeApi { + private static class HttpRequestBuilderExtensions { + static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map headers) { + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + builder.header(entry.getKey(), entry.getValue()); + } + } + return builder; + } + } private final HttpClient memberVarHttpClient; private final ObjectMapper memberVarObjectMapper; private final String memberVarBaseUri; @@ -194,11 +204,7 @@ private HttpRequest.Builder fakeBigDecimalMapRequestBuilder(Map localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -299,11 +305,7 @@ private HttpRequest.Builder fakeHealthGetRequestBuilder(Map head localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -414,11 +416,7 @@ private HttpRequest.Builder fakeOuterBooleanSerializeRequestBuilder(@javax.annot localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -529,11 +527,7 @@ private HttpRequest.Builder fakeOuterCompositeSerializeRequestBuilder(@javax.ann localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -644,11 +638,7 @@ private HttpRequest.Builder fakeOuterNumberSerializeRequestBuilder(@javax.annota localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -754,11 +744,7 @@ private HttpRequest.Builder fakeOuterStringSerializeRequestBuilder(@javax.annota localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -859,11 +845,7 @@ private HttpRequest.Builder getApplicationJsonUtf8RequestBuilder(Map entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -964,11 +946,7 @@ private HttpRequest.Builder getArrayOfEnumsRequestBuilder(Map he localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1074,11 +1052,7 @@ private HttpRequest.Builder testAdditionalPropertiesReferenceRequestBuilder(@jav localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1184,11 +1158,7 @@ private HttpRequest.Builder testBodyWithFileSchemaRequestBuilder(@javax.annotati localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1317,11 +1287,7 @@ private HttpRequest.Builder testBodyWithQueryParamsRequestBuilder(@javax.annotat localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1436,11 +1402,7 @@ private HttpRequest.Builder testClientModelRequestBuilder(@javax.annotation.Nonn localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1657,11 +1619,7 @@ private HttpRequest.Builder testEndpointParametersRequestBuilder(@javax.annotati localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1831,11 +1789,7 @@ private HttpRequest.Builder testEnumParametersRequestBuilder(@javax.annotation.N localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -2052,11 +2006,7 @@ private HttpRequest.Builder testGroupParametersRequestBuilder(@javax.annotation. localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -2251,11 +2201,7 @@ private HttpRequest.Builder testInlineAdditionalPropertiesRequestBuilder(@javax. localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -2361,11 +2307,7 @@ private HttpRequest.Builder testInlineFreeformAdditionalPropertiesRequestBuilder localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -2490,11 +2432,7 @@ private HttpRequest.Builder testJsonFormDataRequestBuilder(@javax.annotation.Non localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -2649,11 +2587,7 @@ private HttpRequest.Builder testQueryParameterCollectionFormatRequestBuilder(@ja localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -2759,11 +2693,7 @@ private HttpRequest.Builder testStringMapReferenceRequestBuilder(@javax.annotati localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java index db5f2a655ccf..702a7a3a7bb0 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -53,6 +53,16 @@ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT") public class FakeClassnameTags123Api { + private static class HttpRequestBuilderExtensions { + static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map headers) { + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + builder.header(entry.getKey(), entry.getValue()); + } + } + return builder; + } + } private final HttpClient memberVarHttpClient; private final ObjectMapper memberVarObjectMapper; private final String memberVarBaseUri; @@ -197,11 +207,7 @@ private HttpRequest.Builder testClassnameRequestBuilder(@javax.annotation.Nonnul localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/PetApi.java index ebd93e058533..48c3f9ea413d 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/PetApi.java @@ -55,6 +55,16 @@ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT") public class PetApi { + private static class HttpRequestBuilderExtensions { + static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map headers) { + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + builder.header(entry.getKey(), entry.getValue()); + } + } + return builder; + } + } private final HttpClient memberVarHttpClient; private final ObjectMapper memberVarObjectMapper; private final String memberVarBaseUri; @@ -190,11 +200,7 @@ private HttpRequest.Builder addPetRequestBuilder(@javax.annotation.Nonnull Pet p localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -302,11 +308,7 @@ private HttpRequest.Builder deletePetRequestBuilder(@javax.annotation.Nonnull Lo localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -430,11 +432,7 @@ private HttpRequest.Builder findPetsByStatusRequestBuilder(@javax.annotation.Non localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -566,11 +564,7 @@ private HttpRequest.Builder findPetsByTagsRequestBuilder(@javax.annotation.Nonnu localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -680,11 +674,7 @@ private HttpRequest.Builder getPetByIdRequestBuilder(@javax.annotation.Nonnull L localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -790,11 +780,7 @@ private HttpRequest.Builder updatePetRequestBuilder(@javax.annotation.Nonnull Pe localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -920,11 +906,7 @@ private HttpRequest.Builder updatePetWithFormRequestBuilder(@javax.annotation.No localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1078,11 +1060,7 @@ private HttpRequest.Builder uploadFileRequestBuilder(@javax.annotation.Nonnull L localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -1240,11 +1218,7 @@ private HttpRequest.Builder uploadFileWithRequiredFileRequestBuilder(@javax.anno localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/StoreApi.java index a18b18a4aa3d..0c0c6f44053d 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/StoreApi.java @@ -53,6 +53,16 @@ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT") public class StoreApi { + private static class HttpRequestBuilderExtensions { + static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map headers) { + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + builder.header(entry.getKey(), entry.getValue()); + } + } + return builder; + } + } private final HttpClient memberVarHttpClient; private final ObjectMapper memberVarObjectMapper; private final String memberVarBaseUri; @@ -183,11 +193,7 @@ private HttpRequest.Builder deleteOrderRequestBuilder(@javax.annotation.Nonnull localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -288,11 +294,7 @@ private HttpRequest.Builder getInventoryRequestBuilder(Map heade localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -402,11 +404,7 @@ private HttpRequest.Builder getOrderByIdRequestBuilder(@javax.annotation.Nonnull localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -521,11 +519,7 @@ private HttpRequest.Builder placeOrderRequestBuilder(@javax.annotation.Nonnull O localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/UserApi.java index 1b5fdef81caf..ad5b8382f32d 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/UserApi.java @@ -54,6 +54,16 @@ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT") public class UserApi { + private static class HttpRequestBuilderExtensions { + static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map headers) { + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + builder.header(entry.getKey(), entry.getValue()); + } + } + return builder; + } + } private final HttpClient memberVarHttpClient; private final ObjectMapper memberVarObjectMapper; private final String memberVarBaseUri; @@ -189,11 +199,7 @@ private HttpRequest.Builder createUserRequestBuilder(@javax.annotation.Nonnull U localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -299,11 +305,7 @@ private HttpRequest.Builder createUsersWithArrayInputRequestBuilder(@javax.annot localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -409,11 +411,7 @@ private HttpRequest.Builder createUsersWithListInputRequestBuilder(@javax.annota localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -514,11 +512,7 @@ private HttpRequest.Builder deleteUserRequestBuilder(@javax.annotation.Nonnull S localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -628,11 +622,7 @@ private HttpRequest.Builder getUserByNameRequestBuilder(@javax.annotation.Nonnul localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -766,11 +756,7 @@ private HttpRequest.Builder loginUserRequestBuilder(@javax.annotation.Nonnull St localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -862,11 +848,7 @@ private HttpRequest.Builder logoutUserRequestBuilder(Map headers localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } @@ -981,11 +963,7 @@ private HttpRequest.Builder updateUserRequestBuilder(@javax.annotation.Nonnull S localVarRequestBuilder.timeout(memberVarReadTimeout); } // Add custom headers if provided - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - localVarRequestBuilder.header(entry.getKey(), entry.getValue()); - } - } + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); }