From fecef63ad9f10bb5a8623a9e45863470bf4d4a23 Mon Sep 17 00:00:00 2001 From: Maciej Sitarz Date: Mon, 18 Oct 2021 15:15:22 +0200 Subject: [PATCH 1/5] Move apache-httpclient templates to proper dir --- .../libraries/{apache => apache-httpclient}/ApiClient.mustache | 0 .../Java/libraries/{apache => apache-httpclient}/README.mustache | 0 .../Java/libraries/{apache => apache-httpclient}/api.mustache | 0 .../libraries/{apache => apache-httpclient}/api_test.mustache | 0 .../Java/libraries/{apache => apache-httpclient}/pom.mustache | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename modules/openapi-generator/src/main/resources/Java/libraries/{apache => apache-httpclient}/ApiClient.mustache (100%) rename modules/openapi-generator/src/main/resources/Java/libraries/{apache => apache-httpclient}/README.mustache (100%) rename modules/openapi-generator/src/main/resources/Java/libraries/{apache => apache-httpclient}/api.mustache (100%) rename modules/openapi-generator/src/main/resources/Java/libraries/{apache => apache-httpclient}/api_test.mustache (100%) rename modules/openapi-generator/src/main/resources/Java/libraries/{apache => apache-httpclient}/pom.mustache (100%) diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/apache/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/apache-httpclient/ApiClient.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/Java/libraries/apache/ApiClient.mustache rename to modules/openapi-generator/src/main/resources/Java/libraries/apache-httpclient/ApiClient.mustache diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/apache/README.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/apache-httpclient/README.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/Java/libraries/apache/README.mustache rename to modules/openapi-generator/src/main/resources/Java/libraries/apache-httpclient/README.mustache diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/apache/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/apache-httpclient/api.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/Java/libraries/apache/api.mustache rename to modules/openapi-generator/src/main/resources/Java/libraries/apache-httpclient/api.mustache diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/apache/api_test.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/apache-httpclient/api_test.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/Java/libraries/apache/api_test.mustache rename to modules/openapi-generator/src/main/resources/Java/libraries/apache-httpclient/api_test.mustache diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/apache/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/apache-httpclient/pom.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/Java/libraries/apache/pom.mustache rename to modules/openapi-generator/src/main/resources/Java/libraries/apache-httpclient/pom.mustache From ae4c2ece3ba6fe72fb0fdc8d70b172cb2a1c7c22 Mon Sep 17 00:00:00 2001 From: Maciej Sitarz Date: Mon, 18 Oct 2021 15:15:47 +0200 Subject: [PATCH 2/5] Add template for Gradle --- .../apache-httpclient/build.gradle.mustache | 169 ++++++++++++++++++ 1 file changed, 169 insertions(+) create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/apache-httpclient/build.gradle.mustache diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/apache-httpclient/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/apache-httpclient/build.gradle.mustache new file mode 100644 index 000000000000..2c1de17903a5 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/apache-httpclient/build.gradle.mustache @@ -0,0 +1,169 @@ +apply plugin: 'idea' +apply plugin: 'eclipse' + +group = '{{groupId}}' +version = '{{artifactVersion}}' + +buildscript { + repositories { + mavenCentral() + } + dependencies { + classpath 'com.android.tools.build:gradle:2.3.+' + classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' + } +} + +repositories { + mavenCentral() +} + +if(hasProperty('target') && target == 'android') { + + apply plugin: 'com.android.library' + apply plugin: 'com.github.dcendents.android-maven' + + android { + compileSdkVersion 25 + buildToolsVersion '25.0.2' + defaultConfig { + minSdkVersion 14 + targetSdkVersion 25 + } + + compileOptions { + {{#java8}} + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + {{/java8}} + {{^java8}} + sourceCompatibility JavaVersion.VERSION_1_7 + targetCompatibility JavaVersion.VERSION_1_7 + {{/java8}} + } + + // Rename the aar correctly + libraryVariants.all { variant -> + variant.outputs.each { output -> + def outputFile = output.outputFile + if (outputFile != null && outputFile.name.endsWith('.aar')) { + def fileName = "${project.name}-${variant.baseName}-${version}.aar" + output.outputFile = new File(outputFile.parent, fileName) + } + } + } + + dependencies { + provided "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" + } + } + + afterEvaluate { + android.libraryVariants.all { variant -> + def task = project.tasks.create "jar${variant.name.capitalize()}", Jar + task.description = "Create jar artifact for ${variant.name}" + task.dependsOn variant.javaCompile + task.from variant.javaCompile.destinationDir + task.destinationDir = project.file("${project.buildDir}/outputs/jar") + task.archiveName = "${project.name}-${variant.baseName}-${version}.jar" + artifacts.add('archives', task); + } + } + + task sourcesJar(type: Jar) { + from android.sourceSets.main.java.srcDirs + classifier = 'sources' + } + + artifacts { + archives sourcesJar + } + +} else { + + apply plugin: 'java' + apply plugin: 'maven-publish' + + {{#java8}} + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + {{/java8}} + {{^java8}} + sourceCompatibility = JavaVersion.VERSION_1_7 + targetCompatibility = JavaVersion.VERSION_1_7 + {{/java8}} + + publishing { + publications { + maven(MavenPublication) { + artifactId = '{{artifactId}}' + + from components.java + } + } + } + + task execute(type:JavaExec) { + main = System.getProperty('mainClass') + classpath = sourceSets.main.runtimeClasspath + } + + task sourcesJar(type: Jar, dependsOn: classes) { + classifier = 'sources' + from sourceSets.main.allSource + } + + task javadocJar(type: Jar, dependsOn: javadoc) { + classifier = 'javadoc' + from javadoc.destinationDir + } + + artifacts { + archives sourcesJar + archives javadocJar + } +} + +ext { + swagger_annotations_version = "1.5.22" + jackson_version = "2.12.1" + jackson_databind_version = "2.10.5.1" + {{#openApiNullable}} + jackson_databind_nullable_version = "0.2.1" + {{/openApiNullable}} + jakarta_annotation_version = "1.3.5" + {{#threetenbp}} + jackson_threetenbp_version = "2.9.10" + {{/threetenbp}} + httpclient_version = "4.5.13" + jodatime_version = "2.9.9" + junit_version = "4.13.1" +} + +dependencies { + implementation "io.swagger:swagger-annotations:$swagger_annotations_version" + implementation "com.google.code.findbugs:jsr305:3.0.2" + implementation "org.apache.httpcomponents:httpclient:$httpclient_version" + implementation "org.apache.httpcomponents:httpmime:$httpclient_version" + 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_databind_version" + implementation "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:$jackson_version" + {{#openApiNullable}} + implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version" + {{/openApiNullable}} + {{#joda}} + implementation "com.fasterxml.jackson.datatype:jackson-datatype-joda:$jackson_version" + {{/joda}} + {{#java8}} + implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" + {{/java8}} + {{#threetenbp}} + implementation "com.github.joschi.jackson:jackson-datatype-threetenbp:$jackson_threetenbp_version" + {{/threetenbp}} + {{^java8}} + implementation "com.brsanthu:migbase64:2.2" + {{/java8}} + implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" + testImplementation "junit:junit:$junit_version" +} From b9a4581a37fd0efb25983ab04d2799b9477b0bbc Mon Sep 17 00:00:00 2001 From: Maciej Sitarz Date: Mon, 18 Oct 2021 15:16:50 +0200 Subject: [PATCH 3/5] Fix few JavaDoc compile warnings --- .../main/resources/Java/ApiClient.mustache | 1 + .../apache-httpclient/ApiClient.mustache | 25 +++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/modules/openapi-generator/src/main/resources/Java/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/ApiClient.mustache index d00284aff9a5..5191e6214f3d 100644 --- a/modules/openapi-generator/src/main/resources/Java/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/Java/ApiClient.mustache @@ -280,6 +280,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { /** * Helper method to set access token for the first Bearer authentication. * @param bearerToken Bearer token + * @return API client */ public void setBearerToken(String bearerToken) { for (Authentication auth : authentications.values()) { diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/apache-httpclient/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/apache-httpclient/ApiClient.mustache index 3115aafeb0d1..dadec3c2ccee 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/apache-httpclient/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/apache-httpclient/ApiClient.mustache @@ -199,6 +199,9 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { return objectMapper; } + /** + * @return API client + */ public ApiClient setObjectMapper(ObjectMapper objectMapper) { this.objectMapper = objectMapper; return this; @@ -208,6 +211,9 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { return httpClient; } + /** + * @return API client + */ public ApiClient setHttpClient(CloseableHttpClient httpClient) { this.httpClient = httpClient; return this; @@ -217,6 +223,9 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { return basePath; } + /** + * @return API client + */ public ApiClient setBasePath(String basePath) { this.basePath = basePath; return this; @@ -226,6 +235,9 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { return servers; } + /** + * @return API client + */ public ApiClient setServers(List servers) { this.servers = servers; return this; @@ -235,6 +247,9 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { return serverIndex; } + /** + * @return API client + */ public ApiClient setServerIndex(Integer serverIndex) { this.serverIndex = serverIndex; return this; @@ -244,6 +259,9 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { return serverVariables; } + /** + * @return API client + */ public ApiClient setServerVariables(Map serverVariables) { this.serverVariables = serverVariables; return this; @@ -298,6 +316,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { /** * Helper method to set access token for the first Bearer authentication. * @param bearerToken Bearer token + * @return API client */ public ApiClient setBearerToken(String bearerToken) { for (Authentication auth : authentications.values()) { @@ -315,6 +334,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { /** * Helper method to set username for the first HTTP basic authentication. * @param username Username + * @return API client */ public ApiClient setUsername(String username) { for (Authentication auth : authentications.values()) { @@ -329,6 +349,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { /** * Helper method to set password for the first HTTP basic authentication. * @param password Password + * @return API client */ public ApiClient setPassword(String password) { for (Authentication auth : authentications.values()) { @@ -346,6 +367,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { /** * Helper method to set API key value for the first API key authentication. * @param apiKey the API key + * @return API client */ public ApiClient setApiKey(String apiKey) { for (Authentication auth : authentications.values()) { @@ -360,6 +382,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { /** * Helper method to set API key prefix for the first API key authentication. * @param apiKeyPrefix API key prefix + * @return API client */ public ApiClient setApiKeyPrefix(String apiKeyPrefix) { for (Authentication auth : authentications.values()) { @@ -377,6 +400,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { /** * Helper method to set access token for the first OAuth2 authentication. * @param accessToken Access token + * @return API client */ public ApiClient setAccessToken(String accessToken) { for (Authentication auth : authentications.values()) { @@ -948,6 +972,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { * @param accept The request's Accept header * @param contentType The request's Content-Type header * @param authNames The authentications to apply + * @param returnType Return type * @return The response body in type of string * @throws ApiException API exception */ From ceca6697945c911a1d94d2e1b60e80023dcdd4a1 Mon Sep 17 00:00:00 2001 From: Maciej Sitarz Date: Mon, 18 Oct 2021 15:53:45 +0200 Subject: [PATCH 4/5] Add properly generated samples --- .../petstore/java/apache-httpclient/README.md | 9 +- .../java/apache-httpclient/build.gradle | 6 +- .../petstore/java/apache-httpclient/pom.xml | 16 +- .../org/openapitools/client/ApiClient.java | 508 ++++++++++++------ .../client/api/AnotherFakeApi.java | 21 +- .../org/openapitools/client/api/FakeApi.java | 241 +++++++-- .../client/api/FakeClassnameTags123Api.java | 21 +- .../org/openapitools/client/api/PetApi.java | 161 +++++- .../org/openapitools/client/api/StoreApi.java | 75 ++- .../org/openapitools/client/api/UserApi.java | 136 ++++- 10 files changed, 903 insertions(+), 291 deletions(-) diff --git a/samples/client/petstore/java/apache-httpclient/README.md b/samples/client/petstore/java/apache-httpclient/README.md index 0b6925ac759a..e02a1831a5a3 100644 --- a/samples/client/petstore/java/apache-httpclient/README.md +++ b/samples/client/petstore/java/apache-httpclient/README.md @@ -50,14 +50,7 @@ Add this dependency to your project's POM: Add this dependency to your project's build file: ```groovy - repositories { - mavenCentral() // Needed if the 'petstore-apache-httpclient' jar has been published to maven central. - mavenLocal() // Needed if the 'petstore-apache-httpclient' jar has been published to the local maven repo. - } - - dependencies { - implementation "org.openapitools:petstore-apache-httpclient:1.0.0" - } +compile "org.openapitools:petstore-apache-httpclient:1.0.0" ``` ### Others diff --git a/samples/client/petstore/java/apache-httpclient/build.gradle b/samples/client/petstore/java/apache-httpclient/build.gradle index 6352fc775c28..8aec91e0bc07 100644 --- a/samples/client/petstore/java/apache-httpclient/build.gradle +++ b/samples/client/petstore/java/apache-httpclient/build.gradle @@ -119,7 +119,7 @@ ext { jackson_databind_nullable_version = "0.2.1" jakarta_annotation_version = "1.3.5" jackson_threetenbp_version = "2.9.10" - jersey_version = "1.19.4" + httpclient_version = "4.5.13" jodatime_version = "2.9.9" junit_version = "4.13.1" } @@ -127,8 +127,8 @@ ext { dependencies { implementation "io.swagger:swagger-annotations:$swagger_annotations_version" implementation "com.google.code.findbugs:jsr305:3.0.2" - implementation "com.sun.jersey:jersey-client:$jersey_version" - implementation "com.sun.jersey.contribs:jersey-multipart:$jersey_version" + implementation "org.apache.httpcomponents:httpclient:$httpclient_version" + implementation "org.apache.httpcomponents:httpmime:$httpclient_version" 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_databind_version" diff --git a/samples/client/petstore/java/apache-httpclient/pom.xml b/samples/client/petstore/java/apache-httpclient/pom.xml index 24ca1bbbc190..642d88706cd6 100644 --- a/samples/client/petstore/java/apache-httpclient/pom.xml +++ b/samples/client/petstore/java/apache-httpclient/pom.xml @@ -228,16 +228,16 @@ - + - com.sun.jersey - jersey-client - ${jersey-version} + org.apache.httpcomponents + httpclient + ${httpclient-version} - com.sun.jersey.contribs - jersey-multipart - ${jersey-version} + org.apache.httpcomponents + httpmime + ${httpclient-version} @@ -288,7 +288,7 @@ UTF-8 1.5.21 - 1.19.4 + 4.5.13 2.12.1 2.9.10 1.3.5 diff --git a/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/ApiClient.java index 37bab86d4591..686ad20b9512 100644 --- a/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/ApiClient.java @@ -19,21 +19,33 @@ import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule; import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; - -import com.sun.jersey.api.client.Client; -import com.sun.jersey.api.client.ClientResponse; -import com.sun.jersey.api.client.GenericType; -import com.sun.jersey.api.client.config.DefaultClientConfig; -import com.sun.jersey.api.client.filter.GZIPContentEncodingFilter; -import com.sun.jersey.api.client.filter.LoggingFilter; -import com.sun.jersey.api.client.WebResource.Builder; - -import com.sun.jersey.multipart.FormDataMultiPart; -import com.sun.jersey.multipart.file.FileDataBodyPart; - -import javax.ws.rs.core.Cookie; -import javax.ws.rs.core.Response.Status.Family; -import javax.ws.rs.core.MediaType; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JavaType; + +import org.apache.http.Header; +import org.apache.http.HttpEntity; +import org.apache.http.HttpResponse; +import org.apache.http.HttpStatus; +import org.apache.http.NameValuePair; +import org.apache.http.ParseException; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.entity.UrlEncodedFormEntity; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.RequestBuilder; +import org.apache.http.client.protocol.HttpClientContext; +import org.apache.http.entity.ByteArrayEntity; +import org.apache.http.entity.ContentType; +import org.apache.http.entity.FileEntity; +import org.apache.http.entity.StringEntity; +import org.apache.http.entity.mime.MultipartEntityBuilder; +import org.apache.http.impl.client.BasicCookieStore; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.impl.cookie.BasicClientCookie; +import org.apache.http.message.BasicNameValuePair; +import org.apache.http.util.EntityUtils; +import org.apache.http.cookie.Cookie; import java.util.Collection; import java.util.Collections; @@ -46,11 +58,20 @@ import java.util.ArrayList; import java.util.Date; import java.util.TimeZone; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import java.net.URLEncoder; import java.io.File; +import java.io.InputStream; +import java.io.IOException; import java.io.UnsupportedEncodingException; +import java.nio.file.Files; +import java.nio.file.StandardCopyOption; +import java.nio.file.Paths; +import java.lang.reflect.Type; +import java.net.URI; import java.text.DateFormat; @@ -76,8 +97,9 @@ public class ApiClient extends JavaTimeFormatter { private boolean debugging = false; private int connectionTimeout = 0; - private Client httpClient; + private CloseableHttpClient httpClient; private ObjectMapper objectMapper; + protected String tempFolderPath = null; private Map authentications; @@ -86,7 +108,10 @@ public class ApiClient extends JavaTimeFormatter { private DateFormat dateFormat; - public ApiClient() { + // Methods that can have a request body + private static List bodyMethods = Arrays.asList("POST", "PUT", "DELETE", "PATCH"); + + public ApiClient(CloseableHttpClient httpClient) { objectMapper = new ObjectMapper(); objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); @@ -116,31 +141,15 @@ public ApiClient() { // Prevent the authentications from being modified. authentications = Collections.unmodifiableMap(authentications); - rebuildHttpClient(); + this.httpClient = httpClient; } - public static DateFormat buildDefaultDateFormat() { - return new RFC3339DateFormat(); + public ApiClient() { + this(HttpClients.createDefault()); } - /** - * Build the Client used to make HTTP requests with the latest settings, - * i.e. objectMapper and debugging. - * TODO: better to use the Builder Pattern? - * @return API client - */ - public ApiClient rebuildHttpClient() { - // Add the JSON serialization support to Jersey - JacksonJsonProvider jsonProvider = new JacksonJsonProvider(objectMapper); - DefaultClientConfig conf = new DefaultClientConfig(); - conf.getSingletons().add(jsonProvider); - Client client = Client.create(conf); - client.addFilter(new GZIPContentEncodingFilter(false)); - if (debugging) { - client.addFilter(new LoggingFilter()); - } - this.httpClient = client; - return this; + public static DateFormat buildDefaultDateFormat() { + return new RFC3339DateFormat(); } /** @@ -155,18 +164,22 @@ public ObjectMapper getObjectMapper() { return objectMapper; } + /** + * @return API client + */ public ApiClient setObjectMapper(ObjectMapper objectMapper) { this.objectMapper = objectMapper; - // Need to rebuild the Client as it depends on object mapper. - rebuildHttpClient(); return this; } - public Client getHttpClient() { + public CloseableHttpClient getHttpClient() { return httpClient; } - public ApiClient setHttpClient(Client httpClient) { + /** + * @return API client + */ + public ApiClient setHttpClient(CloseableHttpClient httpClient) { this.httpClient = httpClient; return this; } @@ -175,6 +188,9 @@ public String getBasePath() { return basePath; } + /** + * @return API client + */ public ApiClient setBasePath(String basePath) { this.basePath = basePath; return this; @@ -184,6 +200,9 @@ public List getServers() { return servers; } + /** + * @return API client + */ public ApiClient setServers(List servers) { this.servers = servers; return this; @@ -193,6 +212,9 @@ public Integer getServerIndex() { return serverIndex; } + /** + * @return API client + */ public ApiClient setServerIndex(Integer serverIndex) { this.serverIndex = serverIndex; return this; @@ -202,6 +224,9 @@ public Map getServerVariables() { return serverVariables; } + /** + * @return API client + */ public ApiClient setServerVariables(Map serverVariables) { this.serverVariables = serverVariables; return this; @@ -241,16 +266,28 @@ public Authentication getAuthentication(String authName) { return authentications.get(authName); } + /** + * The path of temporary folder used to store downloaded files from endpoints + * with file response. The default value is null, i.e. using + * the system's default temporary folder. + * + * @return Temp folder path + */ + public String getTempFolderPath() { + return tempFolderPath; + } + /** * Helper method to set username for the first HTTP basic authentication. * @param username Username + * @return API client */ - public void setUsername(String username) { + public ApiClient setUsername(String username) { for (Authentication auth : authentications.values()) { if (auth instanceof HttpBasicAuth) { ((HttpBasicAuth) auth).setUsername(username); - return; + return this; } } throw new RuntimeException("No HTTP basic authentication configured!"); @@ -259,12 +296,13 @@ public void setUsername(String username) { /** * Helper method to set password for the first HTTP basic authentication. * @param password Password + * @return API client */ - public void setPassword(String password) { + public ApiClient setPassword(String password) { for (Authentication auth : authentications.values()) { if (auth instanceof HttpBasicAuth) { ((HttpBasicAuth) auth).setPassword(password); - return; + return this; } } throw new RuntimeException("No HTTP basic authentication configured!"); @@ -274,12 +312,13 @@ public void setPassword(String password) { /** * Helper method to set API key value for the first API key authentication. * @param apiKey the API key + * @return API client */ - public void setApiKey(String apiKey) { + public ApiClient setApiKey(String apiKey) { for (Authentication auth : authentications.values()) { if (auth instanceof ApiKeyAuth) { ((ApiKeyAuth) auth).setApiKey(apiKey); - return; + return this; } } throw new RuntimeException("No API key authentication configured!"); @@ -288,12 +327,13 @@ public void setApiKey(String apiKey) { /** * Helper method to set API key prefix for the first API key authentication. * @param apiKeyPrefix API key prefix + * @return API client */ - public void setApiKeyPrefix(String apiKeyPrefix) { + public ApiClient setApiKeyPrefix(String apiKeyPrefix) { for (Authentication auth : authentications.values()) { if (auth instanceof ApiKeyAuth) { ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); - return; + return this; } } throw new RuntimeException("No API key authentication configured!"); @@ -303,12 +343,13 @@ public void setApiKeyPrefix(String apiKeyPrefix) { /** * Helper method to set access token for the first OAuth2 authentication. * @param accessToken Access token + * @return API client */ - public void setAccessToken(String accessToken) { + public ApiClient setAccessToken(String accessToken) { for (Authentication auth : authentications.values()) { if (auth instanceof OAuth) { ((OAuth) auth).setAccessToken(accessToken); - return; + return this; } } throw new RuntimeException("No OAuth2 authentication configured!"); @@ -325,6 +366,16 @@ public ApiClient setUserAgent(String userAgent) { return this; } + /** + * Set temp folder path + * @param tempFolderPath Temp folder path + * @return API client + */ + public ApiClient setTempFolderPath(String tempFolderPath) { + this.tempFolderPath = tempFolderPath; + return this; + } + /** * Add a default header. * @@ -364,9 +415,8 @@ public boolean isDebugging() { * @return API client */ public ApiClient setDebugging(boolean debugging) { + // TODO: implement debugging mode this.debugging = debugging; - // Need to rebuild the Client as it depends on the value of debugging. - rebuildHttpClient(); return this; } @@ -387,7 +437,6 @@ public int getConnectTimeout() { */ public ApiClient setConnectTimeout(int connectionTimeout) { this.connectionTimeout = connectionTimeout; - httpClient.setConnectTimeout(connectionTimeout); return this; } @@ -408,8 +457,6 @@ public ApiClient setDateFormat(DateFormat dateFormat) { this.dateFormat = dateFormat; // Also set the date format for model (de)serialization with Date properties. this.objectMapper.setDateFormat((DateFormat) dateFormat.clone()); - // Need to rebuild the Client as objectMapper changes. - rebuildHttpClient(); return this; } @@ -600,6 +647,46 @@ public String escapeString(String str) { } } + /** + * Transform response headers into map + */ + protected Map> transformResponseHeaders(Header[] headers) { + Map> headersMap = new HashMap<>(); + for (Header header : headers) { + List valuesList = headersMap.get(header.getName()); + if (valuesList != null) { + valuesList.add(header.getValue()); + } else { + valuesList = new ArrayList<>(); + valuesList.add(header.getValue()); + headersMap.put(header.getName(), valuesList); + } + } + return headersMap; + } + + /** + * Parse content type object from header value + */ + private ContentType getContentType(String headerValue) throws ApiException { + try { + return ContentType.parse(headerValue); + } catch (ParseException e) { + throw new ApiException("Could not parse content type " + headerValue); + } + } + + /** + * Get content type of a response or null if one was not provided + */ + private String getResponseMimeType(HttpResponse response) throws ApiException { + Header contentTypeHeader = response.getFirstHeader("Content-Type"); + if (contentTypeHeader != null) { + return getContentType(contentTypeHeader.getValue()).getMimeType(); + } + return null; + } + /** * Serialize the given Java object into string according the given * Content-Type (only JSON is supported for now). @@ -609,33 +696,118 @@ public String escapeString(String str) { * @return Object * @throws ApiException API exception */ - public Object serialize(Object obj, String contentType, Map formParams) throws ApiException { - if (contentType.startsWith("multipart/form-data")) { - FormDataMultiPart mp = new FormDataMultiPart(); - for (Entry param: formParams.entrySet()) { - if( param.getValue() instanceof List && !( ( List ) param.getValue() ).isEmpty() - && ( ( List ) param.getValue() ).get( 0 ) instanceof File ) { - @SuppressWarnings( "unchecked" ) - List files = ( List ) param.getValue(); - for( File file : files ) { - mp.bodyPart( new FileDataBodyPart( param.getKey(), file, MediaType.APPLICATION_OCTET_STREAM_TYPE ) ); - } - } else if (param.getValue() instanceof File) { - File file = (File) param.getValue(); - mp.bodyPart(new FileDataBodyPart(param.getKey(), file, MediaType.APPLICATION_OCTET_STREAM_TYPE)); + public HttpEntity serialize(Object obj, Map formParams, ContentType contentType) throws ApiException { + String mimeType = contentType.getMimeType(); + if (isJsonMime(mimeType)) { + try { + return new StringEntity(objectMapper.writeValueAsString(obj), contentType); + } catch (JsonProcessingException e) { + throw new ApiException(e); + } + } else if (mimeType.equals(ContentType.MULTIPART_FORM_DATA.getMimeType())) { + MultipartEntityBuilder multiPartBuilder = MultipartEntityBuilder.create(); + for (Entry paramEntry : formParams.entrySet()) { + Object value = paramEntry.getValue(); + if (value instanceof File) { + multiPartBuilder.addBinaryBody(paramEntry.getKey(), (File) value); + } else if (value instanceof byte[]) { + multiPartBuilder.addBinaryBody(paramEntry.getKey(), (byte[]) value); } else { - mp.field(param.getKey(), parameterToString(param.getValue()), MediaType.MULTIPART_FORM_DATA_TYPE); + multiPartBuilder.addTextBody(paramEntry.getKey(), parameterToString(paramEntry.getValue())); } } - return mp; - } else if (contentType.startsWith("application/x-www-form-urlencoded")) { - return this.getXWWWFormUrlencodedParams(formParams); + return multiPartBuilder.build(); + } else if (mimeType.equals(ContentType.APPLICATION_FORM_URLENCODED.getMimeType())) { + List formValues = new ArrayList<>(); + for (Entry paramEntry : formParams.entrySet()) { + formValues.add(new BasicNameValuePair(paramEntry.getKey(), parameterToString(paramEntry.getValue()))); + } + try { + return new UrlEncodedFormEntity(formValues); + } catch (UnsupportedEncodingException e) { + throw new ApiException(e); + } + } else { + // Handle files with unknown content type + if (obj instanceof File) { + return new FileEntity((File) obj, contentType); + } else if (obj instanceof byte[]) { + return new ByteArrayEntity((byte[]) obj, contentType); + } + throw new ApiException("Serialization for content type '" + contentType + "' not supported"); + } + } + + /** + * Deserialize response content + */ + public T deserialize(HttpResponse response, TypeReference valueType) throws ApiException, IOException { + if (valueType == null) { + return null; + } + HttpEntity entity = response.getEntity(); + Type valueRawType = valueType.getType(); + if (valueRawType.equals(byte[].class)) { + return (T) EntityUtils.toByteArray(entity); + } else if (valueRawType.equals(File.class)) { + return (T) downloadFileFromResponse(response); + } + String mimeType = getResponseMimeType(response); + if (mimeType == null || isJsonMime(mimeType)) { + // Assume json if no mime type + return objectMapper.readValue(entity.getContent(), valueType); } else { - // We let Jersey attempt to serialize the body - return obj; + throw new ApiException( + "Deserialization for content type '" + mimeType + "' not supported for type '" + valueType + "'", + response.getStatusLine().getStatusCode(), + responseHeaders, + EntityUtils.toString(entity) + ); } } + private File downloadFileFromResponse(HttpResponse response) throws IOException { + Header contentDispositionHeader = response.getFirstHeader("Content-Disposition"); + String contentDisposition = contentDispositionHeader == null ? null : contentDispositionHeader.getValue(); + File file = prepareDownloadFile(contentDisposition); + Files.copy(response.getEntity().getContent(), file.toPath(), StandardCopyOption.REPLACE_EXISTING); + return file; + } + + protected File prepareDownloadFile(String contentDisposition) throws IOException { + String filename = null; + if (contentDisposition != null && !"".equals(contentDisposition)) { + // Get filename from the Content-Disposition header. + Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); + Matcher matcher = pattern.matcher(contentDisposition); + if (matcher.find()) + filename = matcher.group(1); + } + + String prefix; + String suffix = null; + if (filename == null) { + prefix = "download-"; + suffix = ""; + } else { + int pos = filename.lastIndexOf('.'); + if (pos == -1) { + prefix = filename + "-"; + } else { + prefix = filename.substring(0, pos) + "-"; + suffix = filename.substring(pos); + } + // Files.createTempFile requires the prefix to be at least three characters long + if (prefix.length() < 3) + prefix = "download-"; + } + + if (tempFolderPath == null) + return Files.createTempFile(prefix, suffix).toFile(); + else + return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); + } + /** * Build full URL by concatenating base path, the given sub path and query parameters. * @@ -697,57 +869,34 @@ private String buildUrl(String path, List queryParams, List collecti return url.toString(); } - private ClientResponse getAPIResponse(String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String accept, String contentType, String[] authNames) throws ApiException { - if (body != null && !formParams.isEmpty()) { - throw new ApiException(500, "Cannot have body and form params"); - } - - updateParamsForAuth(authNames, queryParams, headerParams, cookieParams); + protected boolean isSuccessfulStatus(int statusCode) { + return statusCode >= 200 && statusCode < 300; + } - final String url = buildUrl(path, queryParams, collectionQueryParams); - Builder builder; - if (accept == null) { - builder = httpClient.resource(url).getRequestBuilder(); - } else { - builder = httpClient.resource(url).accept(accept); - } + protected boolean isBodyAllowed(String method) { + return bodyMethods.contains(method); + } - for (Entry keyValue : headerParams.entrySet()) { - builder = builder.header(keyValue.getKey(), keyValue.getValue()); - } - for (Map.Entry keyValue : defaultHeaderMap.entrySet()) { - if (!headerParams.containsKey(keyValue.getKey())) { - builder = builder.header(keyValue.getKey(), keyValue.getValue()); - } - } + protected Cookie buildCookie(String key, String value, URI uri) { + BasicClientCookie cookie = new BasicClientCookie(key, value); + cookie.setDomain(uri.getHost()); + cookie.setPath("/"); + return cookie; + } - for (Entry keyValue : cookieParams.entrySet()) { - builder = builder.cookie(new Cookie(keyValue.getKey(), keyValue.getValue())); - } - for (Map.Entry keyValue : defaultCookieMap.entrySet()) { - if (!cookieParams.containsKey(keyValue.getKey())) { - builder = builder.cookie(new Cookie(keyValue.getKey(), keyValue.getValue())); - } + protected T processResponse(CloseableHttpResponse response, TypeReference returnType) throws ApiException, IOException { + statusCode = response.getStatusLine().getStatusCode(); + if (statusCode == HttpStatus.SC_NO_CONTENT) { + return null; } - ClientResponse response = null; - - if ("GET".equals(method)) { - response = (ClientResponse) builder.get(ClientResponse.class); - } else if ("POST".equals(method)) { - response = builder.type(contentType).post(ClientResponse.class, serialize(body, contentType, formParams)); - } else if ("PUT".equals(method)) { - response = builder.type(contentType).put(ClientResponse.class, serialize(body, contentType, formParams)); - } else if ("DELETE".equals(method)) { - response = builder.type(contentType).delete(ClientResponse.class, serialize(body, contentType, formParams)); - } else if ("PATCH".equals(method)) { - response = builder.type(contentType).header("X-HTTP-Method-Override", "PATCH").post(ClientResponse.class, serialize(body, contentType, formParams)); - } else if ("HEAD".equals(method)) { - response = builder.head(); + responseHeaders = transformResponseHeaders(response.getAllHeaders()); + if (isSuccessfulStatus(statusCode)) { + return this.deserialize(response, returnType); } else { - throw new ApiException(500, "unknown method type " + method); + String message = EntityUtils.toString(response.getEntity()); + throw new ApiException(message, statusCode, responseHeaders, message); } - return response; } /** @@ -769,36 +918,73 @@ private ClientResponse getAPIResponse(String path, String method, List que * @return The response body in type of string * @throws ApiException API exception */ - public T invokeAPI(String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String accept, String contentType, String[] authNames, GenericType returnType) throws ApiException { + public T invokeAPI( + String path, + String method, + List queryParams, + List collectionQueryParams, + Object body, + Map headerParams, + Map cookieParams, + Map formParams, + String accept, + String contentType, + String[] authNames, + TypeReference returnType) throws ApiException { + if (body != null && !formParams.isEmpty()) { + throw new ApiException("Cannot have body and form params"); + } - ClientResponse response = getAPIResponse(path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, accept, contentType, authNames); + updateParamsForAuth(authNames, queryParams, headerParams, cookieParams); + final String url = buildUrl(path, queryParams, collectionQueryParams); - statusCode = response.getStatusInfo().getStatusCode(); - responseHeaders = response.getHeaders(); + RequestBuilder builder = RequestBuilder.create(method); + builder.setUri(url); - if(response.getStatusInfo().getStatusCode() == ClientResponse.Status.NO_CONTENT.getStatusCode()) { - return null; - } else if (response.getStatusInfo().getFamily() == Family.SUCCESSFUL) { - if (returnType == null) - return null; - else - return response.getEntity(returnType); - } else { - String message = "error"; - String respBody = null; - if (response.hasEntity()) { - try { - respBody = response.getEntity(String.class); - message = respBody; - } catch (RuntimeException e) { - // e.printStackTrace(); - } + RequestConfig config = RequestConfig.custom() + .setConnectionRequestTimeout(connectionTimeout) + .build(); + builder.setConfig(config); + + if (accept != null) { + builder.addHeader("Accept", accept); + } + for (Entry keyValue : headerParams.entrySet()) { + builder.addHeader(keyValue.getKey(), keyValue.getValue()); + } + for (Map.Entry keyValue : defaultHeaderMap.entrySet()) { + if (!headerParams.containsKey(keyValue.getKey())) { + builder.addHeader(keyValue.getKey(), keyValue.getValue()); + } + } + + BasicCookieStore store = new BasicCookieStore(); + for (Entry keyValue : cookieParams.entrySet()) { + store.addCookie(buildCookie(keyValue.getKey(), keyValue.getValue(), builder.getUri())); + } + for (Entry keyValue : defaultCookieMap.entrySet()) { + if (!cookieParams.containsKey(keyValue.getKey())) { + store.addCookie(buildCookie(keyValue.getKey(), keyValue.getValue(), builder.getUri())); } - throw new ApiException( - response.getStatusInfo().getStatusCode(), - message, - response.getHeaders(), - respBody); + } + + HttpClientContext context = HttpClientContext.create(); + context.setCookieStore(store); + + ContentType contentTypeObj = getContentType(contentType); + if (body != null || !formParams.isEmpty()) { + if (isBodyAllowed(method)) { + // Add entity if we have content and a valid method + builder.setEntity(serialize(body, formParams, contentTypeObj)); + } else { + throw new ApiException("method " + method + " does not support a request body"); + } + } + + try (CloseableHttpResponse response = httpClient.execute(builder.build(), context)) { + return processResponse(response, returnType); + } catch (IOException e) { + throw new ApiException(e); } } @@ -817,32 +1003,4 @@ private void updateParamsForAuth(String[] authNames, List queryParams, Map auth.applyToParams(queryParams, headerParams, cookieParams); } } - - /** - * Encode the given form parameters as request body. - * @param formParams Form parameters - * @return HTTP form encoded parameters - */ - private String getXWWWFormUrlencodedParams(Map formParams) { - StringBuilder formParamBuilder = new StringBuilder(); - - for (Entry param : formParams.entrySet()) { - String valueStr = parameterToString(param.getValue()); - try { - formParamBuilder.append(URLEncoder.encode(param.getKey(), "utf8")) - .append("=") - .append(URLEncoder.encode(valueStr, "utf8")); - formParamBuilder.append("&"); - } catch (UnsupportedEncodingException e) { - // move on to next - } - } - - String encodedFormParams = formParamBuilder.toString(); - if (encodedFormParams.endsWith("&")) { - encodedFormParams = encodedFormParams.substring(0, encodedFormParams.length() - 1); - } - - return encodedFormParams; - } } diff --git a/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/api/AnotherFakeApi.java index 2cc17cbcbed5..ff037abf4ae5 100644 --- a/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/api/AnotherFakeApi.java +++ b/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -12,7 +12,7 @@ package org.openapitools.client.api; -import com.sun.jersey.api.client.GenericType; +import com.fasterxml.jackson.core.type.TypeReference; import org.openapitools.client.ApiException; import org.openapitools.client.ApiClient; @@ -89,7 +89,20 @@ public Client call123testSpecialTags(Client body) throws ApiException { String[] localVarAuthNames = new String[] { }; - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } + TypeReference localVarReturnType = new TypeReference() {}; + return apiClient.invokeAPI( + localVarPath, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType + ); + } } diff --git a/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/api/FakeApi.java index e44804bc382e..0dcbbd21c280 100644 --- a/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/api/FakeApi.java @@ -12,7 +12,7 @@ package org.openapitools.client.api; -import com.sun.jersey.api.client.GenericType; +import com.fasterxml.jackson.core.type.TypeReference; import org.openapitools.client.ApiException; import org.openapitools.client.ApiClient; @@ -96,8 +96,20 @@ public void createXmlItem(XmlItem xmlItem) throws ApiException { String[] localVarAuthNames = new String[] { }; - - apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + apiClient.invokeAPI( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + null + ); } /** * @@ -135,9 +147,22 @@ public Boolean fakeOuterBooleanSerialize(Boolean body) throws ApiException { String[] localVarAuthNames = new String[] { }; - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } + TypeReference localVarReturnType = new TypeReference() {}; + return apiClient.invokeAPI( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType + ); + } /** * * Test serialization of object with outer number type @@ -174,9 +199,22 @@ public OuterComposite fakeOuterCompositeSerialize(OuterComposite body) throws Ap String[] localVarAuthNames = new String[] { }; - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } + TypeReference localVarReturnType = new TypeReference() {}; + return apiClient.invokeAPI( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType + ); + } /** * * Test serialization of outer number types @@ -213,9 +251,22 @@ public BigDecimal fakeOuterNumberSerialize(BigDecimal body) throws ApiException String[] localVarAuthNames = new String[] { }; - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } + TypeReference localVarReturnType = new TypeReference() {}; + return apiClient.invokeAPI( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType + ); + } /** * * Test serialization of outer string types @@ -252,9 +303,22 @@ public String fakeOuterStringSerialize(String body) throws ApiException { String[] localVarAuthNames = new String[] { }; - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } + TypeReference localVarReturnType = new TypeReference() {}; + return apiClient.invokeAPI( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType + ); + } /** * * For this test, the body for this request much reference a schema named `File`. @@ -295,8 +359,20 @@ public void testBodyWithFileSchema(FileSchemaTestClass body) throws ApiException String[] localVarAuthNames = new String[] { }; - - apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + apiClient.invokeAPI( + localVarPath, + "PUT", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + null + ); } /** * @@ -345,8 +421,20 @@ public void testBodyWithQueryParams(String query, User body) throws ApiException String[] localVarAuthNames = new String[] { }; - - apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + apiClient.invokeAPI( + localVarPath, + "PUT", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + null + ); } /** * To test \"client\" model @@ -389,9 +477,22 @@ public Client testClientModel(Client body) throws ApiException { String[] localVarAuthNames = new String[] { }; - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } + TypeReference localVarReturnType = new TypeReference() {}; + return apiClient.invokeAPI( + localVarPath, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType + ); + } /** * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -488,8 +589,20 @@ public void testEndpointParameters(BigDecimal number, Double _double, String pat String[] localVarAuthNames = new String[] { "http_basic_test" }; - - apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + apiClient.invokeAPI( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + null + ); } /** * To test enum parameters @@ -545,8 +658,20 @@ public void testEnumParameters(List enumHeaderStringArray, String enumHe String[] localVarAuthNames = new String[] { }; - - apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + apiClient.invokeAPI( + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + null + ); } /** * Fake endpoint to test group parameters (optional) @@ -611,8 +736,20 @@ public void testGroupParameters(Integer requiredStringGroup, Boolean requiredBoo String[] localVarAuthNames = new String[] { }; - - apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + apiClient.invokeAPI( + localVarPath, + "DELETE", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + null + ); } /** * test inline additionalProperties @@ -654,8 +791,20 @@ public void testInlineAdditionalProperties(Map param) throws Api String[] localVarAuthNames = new String[] { }; - - apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + apiClient.invokeAPI( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + null + ); } /** * test json serialization of form data @@ -707,8 +856,20 @@ public void testJsonFormData(String param, String param2) throws ApiException { String[] localVarAuthNames = new String[] { }; - - apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + apiClient.invokeAPI( + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + null + ); } /** * @@ -779,7 +940,19 @@ public void testQueryParameterCollectionFormat(List pipe, List i String[] localVarAuthNames = new String[] { }; - - apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + apiClient.invokeAPI( + localVarPath, + "PUT", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + null + ); } } diff --git a/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java index 4bb24b6c29d2..26c7960f5c79 100644 --- a/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java +++ b/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -12,7 +12,7 @@ package org.openapitools.client.api; -import com.sun.jersey.api.client.GenericType; +import com.fasterxml.jackson.core.type.TypeReference; import org.openapitools.client.ApiException; import org.openapitools.client.ApiClient; @@ -89,7 +89,20 @@ public Client testClassname(Client body) throws ApiException { String[] localVarAuthNames = new String[] { "api_key_query" }; - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } + TypeReference localVarReturnType = new TypeReference() {}; + return apiClient.invokeAPI( + localVarPath, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType + ); + } } diff --git a/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/api/PetApi.java index a95b34eeb0ea..2123d32949d8 100644 --- a/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/api/PetApi.java @@ -12,7 +12,7 @@ package org.openapitools.client.api; -import com.sun.jersey.api.client.GenericType; +import com.fasterxml.jackson.core.type.TypeReference; import org.openapitools.client.ApiException; import org.openapitools.client.ApiClient; @@ -91,8 +91,20 @@ public void addPet(Pet body) throws ApiException { String[] localVarAuthNames = new String[] { "petstore_auth" }; - - apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + apiClient.invokeAPI( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + null + ); } /** * Deletes a pet @@ -138,8 +150,20 @@ public void deletePet(Long petId, String apiKey) throws ApiException { String[] localVarAuthNames = new String[] { "petstore_auth" }; - - apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + apiClient.invokeAPI( + localVarPath, + "DELETE", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + null + ); } /** * Finds Pets by status @@ -183,9 +207,22 @@ public List findPetsByStatus(List status) throws ApiException { String[] localVarAuthNames = new String[] { "petstore_auth" }; - GenericType> localVarReturnType = new GenericType>() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } + TypeReference> localVarReturnType = new TypeReference>() {}; + return apiClient.invokeAPI( + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType + ); + } /** * Finds Pets by tags * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. @@ -230,9 +267,22 @@ public Set findPetsByTags(Set tags) throws ApiException { String[] localVarAuthNames = new String[] { "petstore_auth" }; - GenericType> localVarReturnType = new GenericType>() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } + TypeReference> localVarReturnType = new TypeReference>() {}; + return apiClient.invokeAPI( + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType + ); + } /** * Find pet by ID * Returns a single pet @@ -275,9 +325,22 @@ public Pet getPetById(Long petId) throws ApiException { String[] localVarAuthNames = new String[] { "api_key" }; - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } + TypeReference localVarReturnType = new TypeReference() {}; + return apiClient.invokeAPI( + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType + ); + } /** * Update an existing pet * @@ -318,8 +381,20 @@ public void updatePet(Pet body) throws ApiException { String[] localVarAuthNames = new String[] { "petstore_auth" }; - - apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + apiClient.invokeAPI( + localVarPath, + "PUT", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + null + ); } /** * Updates a pet in the store with form data @@ -368,8 +443,20 @@ public void updatePetWithForm(Long petId, String name, String status) throws Api String[] localVarAuthNames = new String[] { "petstore_auth" }; - - apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + apiClient.invokeAPI( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + null + ); } /** * uploads an image @@ -419,9 +506,22 @@ public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File f String[] localVarAuthNames = new String[] { "petstore_auth" }; - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } + TypeReference localVarReturnType = new TypeReference() {}; + return apiClient.invokeAPI( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType + ); + } /** * uploads an image (required) * @@ -475,7 +575,20 @@ public ModelApiResponse uploadFileWithRequiredFile(Long petId, File requiredFile String[] localVarAuthNames = new String[] { "petstore_auth" }; - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } + TypeReference localVarReturnType = new TypeReference() {}; + return apiClient.invokeAPI( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType + ); + } } diff --git a/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/api/StoreApi.java index bc68e36d8b4c..82a77bb2217b 100644 --- a/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/api/StoreApi.java @@ -12,7 +12,7 @@ package org.openapitools.client.api; -import com.sun.jersey.api.client.GenericType; +import com.fasterxml.jackson.core.type.TypeReference; import org.openapitools.client.ApiException; import org.openapitools.client.ApiClient; @@ -89,8 +89,20 @@ public void deleteOrder(String orderId) throws ApiException { String[] localVarAuthNames = new String[] { }; - - apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + apiClient.invokeAPI( + localVarPath, + "DELETE", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + null + ); } /** * Returns pet inventories by status @@ -127,9 +139,22 @@ public Map getInventory() throws ApiException { String[] localVarAuthNames = new String[] { "api_key" }; - GenericType> localVarReturnType = new GenericType>() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } + TypeReference> localVarReturnType = new TypeReference>() {}; + return apiClient.invokeAPI( + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType + ); + } /** * Find purchase order by ID * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions @@ -172,9 +197,22 @@ public Order getOrderById(Long orderId) throws ApiException { String[] localVarAuthNames = new String[] { }; - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } + TypeReference localVarReturnType = new TypeReference() {}; + return apiClient.invokeAPI( + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType + ); + } /** * Place an order for a pet * @@ -216,7 +254,20 @@ public Order placeOrder(Order body) throws ApiException { String[] localVarAuthNames = new String[] { }; - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } + TypeReference localVarReturnType = new TypeReference() {}; + return apiClient.invokeAPI( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType + ); + } } diff --git a/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/api/UserApi.java index 1c6ce952c316..f2bc445ff228 100644 --- a/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/api/UserApi.java @@ -12,7 +12,7 @@ package org.openapitools.client.api; -import com.sun.jersey.api.client.GenericType; +import com.fasterxml.jackson.core.type.TypeReference; import org.openapitools.client.ApiException; import org.openapitools.client.ApiClient; @@ -88,8 +88,20 @@ public void createUser(User body) throws ApiException { String[] localVarAuthNames = new String[] { }; - - apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + apiClient.invokeAPI( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + null + ); } /** * Creates list of users with given input array @@ -131,8 +143,20 @@ public void createUsersWithArrayInput(List body) throws ApiException { String[] localVarAuthNames = new String[] { }; - - apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + apiClient.invokeAPI( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + null + ); } /** * Creates list of users with given input array @@ -174,8 +198,20 @@ public void createUsersWithListInput(List body) throws ApiException { String[] localVarAuthNames = new String[] { }; - - apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + apiClient.invokeAPI( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + null + ); } /** * Delete user @@ -218,8 +254,20 @@ public void deleteUser(String username) throws ApiException { String[] localVarAuthNames = new String[] { }; - - apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + apiClient.invokeAPI( + localVarPath, + "DELETE", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + null + ); } /** * Get user by user name @@ -263,9 +311,22 @@ public User getUserByName(String username) throws ApiException { String[] localVarAuthNames = new String[] { }; - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } + TypeReference localVarReturnType = new TypeReference() {}; + return apiClient.invokeAPI( + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType + ); + } /** * Logs user into the system * @@ -315,9 +376,22 @@ public String loginUser(String username, String password) throws ApiException { String[] localVarAuthNames = new String[] { }; - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } + TypeReference localVarReturnType = new TypeReference() {}; + return apiClient.invokeAPI( + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType + ); + } /** * Logs out current logged in user session * @@ -352,8 +426,20 @@ public void logoutUser() throws ApiException { String[] localVarAuthNames = new String[] { }; - - apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + apiClient.invokeAPI( + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + null + ); } /** * Updated user @@ -402,7 +488,19 @@ public void updateUser(String username, User body) throws ApiException { String[] localVarAuthNames = new String[] { }; - - apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + apiClient.invokeAPI( + localVarPath, + "PUT", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + null + ); } } From 945c3d9792046efe7678e8ca7d512f1038acf3b4 Mon Sep 17 00:00:00 2001 From: Maciej Sitarz Date: Fri, 22 Oct 2021 23:04:03 +0200 Subject: [PATCH 5/5] Empty just trigger PR checks rebuild