Improve Apache Httpclient support (#10624)

* Move apache-httpclient templates to proper dir

* Add template for Gradle

* Fix few JavaDoc compile warnings

* Add properly generated samples

* Empty just trigger PR checks rebuild
This commit is contained in:
Maciej Sitarz
2021-10-23 08:57:32 +02:00
committed by GitHub
parent 27459b5003
commit 2875c7e14d
17 changed files with 1100 additions and 293 deletions

View File

@@ -280,6 +280,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
/** /**
* Helper method to set access token for the first Bearer authentication. * Helper method to set access token for the first Bearer authentication.
* @param bearerToken Bearer token * @param bearerToken Bearer token
* @return API client
*/ */
public void setBearerToken(String bearerToken) { public void setBearerToken(String bearerToken) {
for (Authentication auth : authentications.values()) { for (Authentication auth : authentications.values()) {

View File

@@ -199,6 +199,9 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
return objectMapper; return objectMapper;
} }
/**
* @return API client
*/
public ApiClient setObjectMapper(ObjectMapper objectMapper) { public ApiClient setObjectMapper(ObjectMapper objectMapper) {
this.objectMapper = objectMapper; this.objectMapper = objectMapper;
return this; return this;
@@ -208,6 +211,9 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
return httpClient; return httpClient;
} }
/**
* @return API client
*/
public ApiClient setHttpClient(CloseableHttpClient httpClient) { public ApiClient setHttpClient(CloseableHttpClient httpClient) {
this.httpClient = httpClient; this.httpClient = httpClient;
return this; return this;
@@ -217,6 +223,9 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
return basePath; return basePath;
} }
/**
* @return API client
*/
public ApiClient setBasePath(String basePath) { public ApiClient setBasePath(String basePath) {
this.basePath = basePath; this.basePath = basePath;
return this; return this;
@@ -226,6 +235,9 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
return servers; return servers;
} }
/**
* @return API client
*/
public ApiClient setServers(List<ServerConfiguration> servers) { public ApiClient setServers(List<ServerConfiguration> servers) {
this.servers = servers; this.servers = servers;
return this; return this;
@@ -235,6 +247,9 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
return serverIndex; return serverIndex;
} }
/**
* @return API client
*/
public ApiClient setServerIndex(Integer serverIndex) { public ApiClient setServerIndex(Integer serverIndex) {
this.serverIndex = serverIndex; this.serverIndex = serverIndex;
return this; return this;
@@ -244,6 +259,9 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
return serverVariables; return serverVariables;
} }
/**
* @return API client
*/
public ApiClient setServerVariables(Map<String, String> serverVariables) { public ApiClient setServerVariables(Map<String, String> serverVariables) {
this.serverVariables = serverVariables; this.serverVariables = serverVariables;
return this; return this;
@@ -298,6 +316,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
/** /**
* Helper method to set access token for the first Bearer authentication. * Helper method to set access token for the first Bearer authentication.
* @param bearerToken Bearer token * @param bearerToken Bearer token
* @return API client
*/ */
public ApiClient setBearerToken(String bearerToken) { public ApiClient setBearerToken(String bearerToken) {
for (Authentication auth : authentications.values()) { 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. * Helper method to set username for the first HTTP basic authentication.
* @param username Username * @param username Username
* @return API client
*/ */
public ApiClient setUsername(String username) { public ApiClient setUsername(String username) {
for (Authentication auth : authentications.values()) { 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. * Helper method to set password for the first HTTP basic authentication.
* @param password Password * @param password Password
* @return API client
*/ */
public ApiClient setPassword(String password) { public ApiClient setPassword(String password) {
for (Authentication auth : authentications.values()) { 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. * Helper method to set API key value for the first API key authentication.
* @param apiKey the API key * @param apiKey the API key
* @return API client
*/ */
public ApiClient setApiKey(String apiKey) { public ApiClient setApiKey(String apiKey) {
for (Authentication auth : authentications.values()) { 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. * Helper method to set API key prefix for the first API key authentication.
* @param apiKeyPrefix API key prefix * @param apiKeyPrefix API key prefix
* @return API client
*/ */
public ApiClient setApiKeyPrefix(String apiKeyPrefix) { public ApiClient setApiKeyPrefix(String apiKeyPrefix) {
for (Authentication auth : authentications.values()) { 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. * Helper method to set access token for the first OAuth2 authentication.
* @param accessToken Access token * @param accessToken Access token
* @return API client
*/ */
public ApiClient setAccessToken(String accessToken) { public ApiClient setAccessToken(String accessToken) {
for (Authentication auth : authentications.values()) { for (Authentication auth : authentications.values()) {
@@ -948,6 +972,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
* @param accept The request's Accept header * @param accept The request's Accept header
* @param contentType The request's Content-Type header * @param contentType The request's Content-Type header
* @param authNames The authentications to apply * @param authNames The authentications to apply
* @param returnType Return type
* @return The response body in type of string * @return The response body in type of string
* @throws ApiException API exception * @throws ApiException API exception
*/ */

View File

@@ -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"
}

View File

@@ -50,14 +50,7 @@ Add this dependency to your project's POM:
Add this dependency to your project's build file: Add this dependency to your project's build file:
```groovy ```groovy
repositories { compile "org.openapitools:petstore-apache-httpclient:1.0.0"
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"
}
``` ```
### Others ### Others

View File

@@ -119,7 +119,7 @@ ext {
jackson_databind_nullable_version = "0.2.1" jackson_databind_nullable_version = "0.2.1"
jakarta_annotation_version = "1.3.5" jakarta_annotation_version = "1.3.5"
jackson_threetenbp_version = "2.9.10" jackson_threetenbp_version = "2.9.10"
jersey_version = "1.19.4" httpclient_version = "4.5.13"
jodatime_version = "2.9.9" jodatime_version = "2.9.9"
junit_version = "4.13.1" junit_version = "4.13.1"
} }
@@ -127,8 +127,8 @@ ext {
dependencies { dependencies {
implementation "io.swagger:swagger-annotations:$swagger_annotations_version" implementation "io.swagger:swagger-annotations:$swagger_annotations_version"
implementation "com.google.code.findbugs:jsr305:3.0.2" implementation "com.google.code.findbugs:jsr305:3.0.2"
implementation "com.sun.jersey:jersey-client:$jersey_version" implementation "org.apache.httpcomponents:httpclient:$httpclient_version"
implementation "com.sun.jersey.contribs:jersey-multipart:$jersey_version" implementation "org.apache.httpcomponents:httpmime:$httpclient_version"
implementation "com.fasterxml.jackson.core:jackson-core:$jackson_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-annotations:$jackson_version"
implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version"

View File

@@ -228,16 +228,16 @@
</dependency> </dependency>
<!-- HTTP client: jersey-client --> <!-- HTTP client: apache client -->
<dependency> <dependency>
<groupId>com.sun.jersey</groupId> <groupId>org.apache.httpcomponents</groupId>
<artifactId>jersey-client</artifactId> <artifactId>httpclient</artifactId>
<version>${jersey-version}</version> <version>${httpclient-version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.sun.jersey.contribs</groupId> <groupId>org.apache.httpcomponents</groupId>
<artifactId>jersey-multipart</artifactId> <artifactId>httpmime</artifactId>
<version>${jersey-version}</version> <version>${httpclient-version}</version>
</dependency> </dependency>
<!-- JSON processing: jackson --> <!-- JSON processing: jackson -->
@@ -288,7 +288,7 @@
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<swagger-annotations-version>1.5.21</swagger-annotations-version> <swagger-annotations-version>1.5.21</swagger-annotations-version>
<jersey-version>1.19.4</jersey-version> <httpclient-version>4.5.13</httpclient-version>
<jackson-version>2.12.1</jackson-version> <jackson-version>2.12.1</jackson-version>
<jackson-threetenbp-version>2.9.10</jackson-threetenbp-version> <jackson-threetenbp-version>2.9.10</jackson-threetenbp-version>
<jakarta-annotation-version>1.3.5</jakarta-annotation-version> <jakarta-annotation-version>1.3.5</jakarta-annotation-version>

View File

@@ -19,21 +19,33 @@ import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule; import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule;
import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JavaType;
import com.sun.jersey.api.client.Client; import org.apache.http.Header;
import com.sun.jersey.api.client.ClientResponse; import org.apache.http.HttpEntity;
import com.sun.jersey.api.client.GenericType; import org.apache.http.HttpResponse;
import com.sun.jersey.api.client.config.DefaultClientConfig; import org.apache.http.HttpStatus;
import com.sun.jersey.api.client.filter.GZIPContentEncodingFilter; import org.apache.http.NameValuePair;
import com.sun.jersey.api.client.filter.LoggingFilter; import org.apache.http.ParseException;
import com.sun.jersey.api.client.WebResource.Builder; import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import com.sun.jersey.multipart.FormDataMultiPart; import org.apache.http.client.methods.CloseableHttpResponse;
import com.sun.jersey.multipart.file.FileDataBodyPart; import org.apache.http.client.methods.RequestBuilder;
import org.apache.http.client.protocol.HttpClientContext;
import javax.ws.rs.core.Cookie; import org.apache.http.entity.ByteArrayEntity;
import javax.ws.rs.core.Response.Status.Family; import org.apache.http.entity.ContentType;
import javax.ws.rs.core.MediaType; 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.Collection;
import java.util.Collections; import java.util.Collections;
@@ -46,11 +58,20 @@ import java.util.Arrays;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.TimeZone; import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.io.File; import java.io.File;
import java.io.InputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException; 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; import java.text.DateFormat;
@@ -76,8 +97,9 @@ public class ApiClient extends JavaTimeFormatter {
private boolean debugging = false; private boolean debugging = false;
private int connectionTimeout = 0; private int connectionTimeout = 0;
private Client httpClient; private CloseableHttpClient httpClient;
private ObjectMapper objectMapper; private ObjectMapper objectMapper;
protected String tempFolderPath = null;
private Map<String, Authentication> authentications; private Map<String, Authentication> authentications;
@@ -86,7 +108,10 @@ public class ApiClient extends JavaTimeFormatter {
private DateFormat dateFormat; private DateFormat dateFormat;
public ApiClient() { // Methods that can have a request body
private static List<String> bodyMethods = Arrays.asList("POST", "PUT", "DELETE", "PATCH");
public ApiClient(CloseableHttpClient httpClient) {
objectMapper = new ObjectMapper(); objectMapper = new ObjectMapper();
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@@ -116,33 +141,17 @@ public class ApiClient extends JavaTimeFormatter {
// Prevent the authentications from being modified. // Prevent the authentications from being modified.
authentications = Collections.unmodifiableMap(authentications); authentications = Collections.unmodifiableMap(authentications);
rebuildHttpClient(); this.httpClient = httpClient;
}
public ApiClient() {
this(HttpClients.createDefault());
} }
public static DateFormat buildDefaultDateFormat() { public static DateFormat buildDefaultDateFormat() {
return new RFC3339DateFormat(); return new RFC3339DateFormat();
} }
/**
* 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;
}
/** /**
* Returns the current object mapper used for JSON serialization/deserialization. * Returns the current object mapper used for JSON serialization/deserialization.
* <p> * <p>
@@ -155,18 +164,22 @@ public class ApiClient extends JavaTimeFormatter {
return objectMapper; return objectMapper;
} }
/**
* @return API client
*/
public ApiClient setObjectMapper(ObjectMapper objectMapper) { public ApiClient setObjectMapper(ObjectMapper objectMapper) {
this.objectMapper = objectMapper; this.objectMapper = objectMapper;
// Need to rebuild the Client as it depends on object mapper.
rebuildHttpClient();
return this; return this;
} }
public Client getHttpClient() { public CloseableHttpClient getHttpClient() {
return httpClient; return httpClient;
} }
public ApiClient setHttpClient(Client httpClient) { /**
* @return API client
*/
public ApiClient setHttpClient(CloseableHttpClient httpClient) {
this.httpClient = httpClient; this.httpClient = httpClient;
return this; return this;
} }
@@ -175,6 +188,9 @@ public class ApiClient extends JavaTimeFormatter {
return basePath; return basePath;
} }
/**
* @return API client
*/
public ApiClient setBasePath(String basePath) { public ApiClient setBasePath(String basePath) {
this.basePath = basePath; this.basePath = basePath;
return this; return this;
@@ -184,6 +200,9 @@ public class ApiClient extends JavaTimeFormatter {
return servers; return servers;
} }
/**
* @return API client
*/
public ApiClient setServers(List<ServerConfiguration> servers) { public ApiClient setServers(List<ServerConfiguration> servers) {
this.servers = servers; this.servers = servers;
return this; return this;
@@ -193,6 +212,9 @@ public class ApiClient extends JavaTimeFormatter {
return serverIndex; return serverIndex;
} }
/**
* @return API client
*/
public ApiClient setServerIndex(Integer serverIndex) { public ApiClient setServerIndex(Integer serverIndex) {
this.serverIndex = serverIndex; this.serverIndex = serverIndex;
return this; return this;
@@ -202,6 +224,9 @@ public class ApiClient extends JavaTimeFormatter {
return serverVariables; return serverVariables;
} }
/**
* @return API client
*/
public ApiClient setServerVariables(Map<String, String> serverVariables) { public ApiClient setServerVariables(Map<String, String> serverVariables) {
this.serverVariables = serverVariables; this.serverVariables = serverVariables;
return this; return this;
@@ -241,16 +266,28 @@ public class ApiClient extends JavaTimeFormatter {
return authentications.get(authName); return authentications.get(authName);
} }
/**
* The path of temporary folder used to store downloaded files from endpoints
* with file response. The default value is <code>null</code>, 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. * Helper method to set username for the first HTTP basic authentication.
* @param username Username * @param username Username
* @return API client
*/ */
public void setUsername(String username) { public ApiClient setUsername(String username) {
for (Authentication auth : authentications.values()) { for (Authentication auth : authentications.values()) {
if (auth instanceof HttpBasicAuth) { if (auth instanceof HttpBasicAuth) {
((HttpBasicAuth) auth).setUsername(username); ((HttpBasicAuth) auth).setUsername(username);
return; return this;
} }
} }
throw new RuntimeException("No HTTP basic authentication configured!"); throw new RuntimeException("No HTTP basic authentication configured!");
@@ -259,12 +296,13 @@ public class ApiClient extends JavaTimeFormatter {
/** /**
* Helper method to set password for the first HTTP basic authentication. * Helper method to set password for the first HTTP basic authentication.
* @param password Password * @param password Password
* @return API client
*/ */
public void setPassword(String password) { public ApiClient setPassword(String password) {
for (Authentication auth : authentications.values()) { for (Authentication auth : authentications.values()) {
if (auth instanceof HttpBasicAuth) { if (auth instanceof HttpBasicAuth) {
((HttpBasicAuth) auth).setPassword(password); ((HttpBasicAuth) auth).setPassword(password);
return; return this;
} }
} }
throw new RuntimeException("No HTTP basic authentication configured!"); throw new RuntimeException("No HTTP basic authentication configured!");
@@ -274,12 +312,13 @@ public class ApiClient extends JavaTimeFormatter {
/** /**
* Helper method to set API key value for the first API key authentication. * Helper method to set API key value for the first API key authentication.
* @param apiKey the API key * @param apiKey the API key
* @return API client
*/ */
public void setApiKey(String apiKey) { public ApiClient setApiKey(String apiKey) {
for (Authentication auth : authentications.values()) { for (Authentication auth : authentications.values()) {
if (auth instanceof ApiKeyAuth) { if (auth instanceof ApiKeyAuth) {
((ApiKeyAuth) auth).setApiKey(apiKey); ((ApiKeyAuth) auth).setApiKey(apiKey);
return; return this;
} }
} }
throw new RuntimeException("No API key authentication configured!"); throw new RuntimeException("No API key authentication configured!");
@@ -288,12 +327,13 @@ public class ApiClient extends JavaTimeFormatter {
/** /**
* Helper method to set API key prefix for the first API key authentication. * Helper method to set API key prefix for the first API key authentication.
* @param apiKeyPrefix API key prefix * @param apiKeyPrefix API key prefix
* @return API client
*/ */
public void setApiKeyPrefix(String apiKeyPrefix) { public ApiClient setApiKeyPrefix(String apiKeyPrefix) {
for (Authentication auth : authentications.values()) { for (Authentication auth : authentications.values()) {
if (auth instanceof ApiKeyAuth) { if (auth instanceof ApiKeyAuth) {
((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix);
return; return this;
} }
} }
throw new RuntimeException("No API key authentication configured!"); throw new RuntimeException("No API key authentication configured!");
@@ -303,12 +343,13 @@ public class ApiClient extends JavaTimeFormatter {
/** /**
* Helper method to set access token for the first OAuth2 authentication. * Helper method to set access token for the first OAuth2 authentication.
* @param accessToken Access token * @param accessToken Access token
* @return API client
*/ */
public void setAccessToken(String accessToken) { public ApiClient setAccessToken(String accessToken) {
for (Authentication auth : authentications.values()) { for (Authentication auth : authentications.values()) {
if (auth instanceof OAuth) { if (auth instanceof OAuth) {
((OAuth) auth).setAccessToken(accessToken); ((OAuth) auth).setAccessToken(accessToken);
return; return this;
} }
} }
throw new RuntimeException("No OAuth2 authentication configured!"); throw new RuntimeException("No OAuth2 authentication configured!");
@@ -325,6 +366,16 @@ public class ApiClient extends JavaTimeFormatter {
return this; 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. * Add a default header.
* *
@@ -364,9 +415,8 @@ public class ApiClient extends JavaTimeFormatter {
* @return API client * @return API client
*/ */
public ApiClient setDebugging(boolean debugging) { public ApiClient setDebugging(boolean debugging) {
// TODO: implement debugging mode
this.debugging = debugging; this.debugging = debugging;
// Need to rebuild the Client as it depends on the value of debugging.
rebuildHttpClient();
return this; return this;
} }
@@ -387,7 +437,6 @@ public class ApiClient extends JavaTimeFormatter {
*/ */
public ApiClient setConnectTimeout(int connectionTimeout) { public ApiClient setConnectTimeout(int connectionTimeout) {
this.connectionTimeout = connectionTimeout; this.connectionTimeout = connectionTimeout;
httpClient.setConnectTimeout(connectionTimeout);
return this; return this;
} }
@@ -408,8 +457,6 @@ public class ApiClient extends JavaTimeFormatter {
this.dateFormat = dateFormat; this.dateFormat = dateFormat;
// Also set the date format for model (de)serialization with Date properties. // Also set the date format for model (de)serialization with Date properties.
this.objectMapper.setDateFormat((DateFormat) dateFormat.clone()); this.objectMapper.setDateFormat((DateFormat) dateFormat.clone());
// Need to rebuild the Client as objectMapper changes.
rebuildHttpClient();
return this; return this;
} }
@@ -600,6 +647,46 @@ public class ApiClient extends JavaTimeFormatter {
} }
} }
/**
* Transform response headers into map
*/
protected Map<String, List<String>> transformResponseHeaders(Header[] headers) {
Map<String, List<String>> headersMap = new HashMap<>();
for (Header header : headers) {
List<String> 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 * Serialize the given Java object into string according the given
* Content-Type (only JSON is supported for now). * Content-Type (only JSON is supported for now).
@@ -609,33 +696,118 @@ public class ApiClient extends JavaTimeFormatter {
* @return Object * @return Object
* @throws ApiException API exception * @throws ApiException API exception
*/ */
public Object serialize(Object obj, String contentType, Map<String, Object> formParams) throws ApiException { public HttpEntity serialize(Object obj, Map<String, Object> formParams, ContentType contentType) throws ApiException {
if (contentType.startsWith("multipart/form-data")) { String mimeType = contentType.getMimeType();
FormDataMultiPart mp = new FormDataMultiPart(); if (isJsonMime(mimeType)) {
for (Entry<String, Object> param: formParams.entrySet()) { try {
if( param.getValue() instanceof List && !( ( List ) param.getValue() ).isEmpty() return new StringEntity(objectMapper.writeValueAsString(obj), contentType);
&& ( ( List ) param.getValue() ).get( 0 ) instanceof File ) { } catch (JsonProcessingException e) {
@SuppressWarnings( "unchecked" ) throw new ApiException(e);
List<File> files = ( List<File> ) param.getValue(); }
for( File file : files ) { } else if (mimeType.equals(ContentType.MULTIPART_FORM_DATA.getMimeType())) {
mp.bodyPart( new FileDataBodyPart( param.getKey(), file, MediaType.APPLICATION_OCTET_STREAM_TYPE ) ); MultipartEntityBuilder multiPartBuilder = MultipartEntityBuilder.create();
} for (Entry<String, Object> paramEntry : formParams.entrySet()) {
} else if (param.getValue() instanceof File) { Object value = paramEntry.getValue();
File file = (File) param.getValue(); if (value instanceof File) {
mp.bodyPart(new FileDataBodyPart(param.getKey(), file, MediaType.APPLICATION_OCTET_STREAM_TYPE)); multiPartBuilder.addBinaryBody(paramEntry.getKey(), (File) value);
} else if (value instanceof byte[]) {
multiPartBuilder.addBinaryBody(paramEntry.getKey(), (byte[]) value);
} else { } else {
mp.field(param.getKey(), parameterToString(param.getValue()), MediaType.MULTIPART_FORM_DATA_TYPE); multiPartBuilder.addTextBody(paramEntry.getKey(), parameterToString(paramEntry.getValue()));
} }
} }
return mp; return multiPartBuilder.build();
} else if (contentType.startsWith("application/x-www-form-urlencoded")) { } else if (mimeType.equals(ContentType.APPLICATION_FORM_URLENCODED.getMimeType())) {
return this.getXWWWFormUrlencodedParams(formParams); List<NameValuePair> formValues = new ArrayList<>();
for (Entry<String, Object> 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 { } else {
// We let Jersey attempt to serialize the body // Handle files with unknown content type
return obj; 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> T deserialize(HttpResponse response, TypeReference<T> 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 {
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. * Build full URL by concatenating base path, the given sub path and query parameters.
* *
@@ -697,57 +869,34 @@ public class ApiClient extends JavaTimeFormatter {
return url.toString(); return url.toString();
} }
private ClientResponse getAPIResponse(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String accept, String contentType, String[] authNames) throws ApiException { protected boolean isSuccessfulStatus(int statusCode) {
if (body != null && !formParams.isEmpty()) { return statusCode >= 200 && statusCode < 300;
throw new ApiException(500, "Cannot have body and form params"); }
protected boolean isBodyAllowed(String method) {
return bodyMethods.contains(method);
}
protected Cookie buildCookie(String key, String value, URI uri) {
BasicClientCookie cookie = new BasicClientCookie(key, value);
cookie.setDomain(uri.getHost());
cookie.setPath("/");
return cookie;
}
protected <T> T processResponse(CloseableHttpResponse response, TypeReference<T> returnType) throws ApiException, IOException {
statusCode = response.getStatusLine().getStatusCode();
if (statusCode == HttpStatus.SC_NO_CONTENT) {
return null;
} }
updateParamsForAuth(authNames, queryParams, headerParams, cookieParams); responseHeaders = transformResponseHeaders(response.getAllHeaders());
if (isSuccessfulStatus(statusCode)) {
final String url = buildUrl(path, queryParams, collectionQueryParams); return this.deserialize(response, returnType);
Builder builder;
if (accept == null) {
builder = httpClient.resource(url).getRequestBuilder();
} else { } else {
builder = httpClient.resource(url).accept(accept); String message = EntityUtils.toString(response.getEntity());
throw new ApiException(message, statusCode, responseHeaders, message);
} }
for (Entry<String, String> keyValue : headerParams.entrySet()) {
builder = builder.header(keyValue.getKey(), keyValue.getValue());
}
for (Map.Entry<String,String> keyValue : defaultHeaderMap.entrySet()) {
if (!headerParams.containsKey(keyValue.getKey())) {
builder = builder.header(keyValue.getKey(), keyValue.getValue());
}
}
for (Entry<String, String> keyValue : cookieParams.entrySet()) {
builder = builder.cookie(new Cookie(keyValue.getKey(), keyValue.getValue()));
}
for (Map.Entry<String,String> keyValue : defaultCookieMap.entrySet()) {
if (!cookieParams.containsKey(keyValue.getKey())) {
builder = builder.cookie(new Cookie(keyValue.getKey(), keyValue.getValue()));
}
}
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();
} else {
throw new ApiException(500, "unknown method type " + method);
}
return response;
} }
/** /**
@@ -769,36 +918,73 @@ public class ApiClient extends JavaTimeFormatter {
* @return The response body in type of string * @return The response body in type of string
* @throws ApiException API exception * @throws ApiException API exception
*/ */
public <T> T invokeAPI(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String accept, String contentType, String[] authNames, GenericType<T> returnType) throws ApiException { public <T> T invokeAPI(
String path,
String method,
List<Pair> queryParams,
List<Pair> collectionQueryParams,
Object body,
Map<String, String> headerParams,
Map<String, String> cookieParams,
Map<String, Object> formParams,
String accept,
String contentType,
String[] authNames,
TypeReference<T> 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(); RequestBuilder builder = RequestBuilder.create(method);
responseHeaders = response.getHeaders(); builder.setUri(url);
if(response.getStatusInfo().getStatusCode() == ClientResponse.Status.NO_CONTENT.getStatusCode()) { RequestConfig config = RequestConfig.custom()
return null; .setConnectionRequestTimeout(connectionTimeout)
} else if (response.getStatusInfo().getFamily() == Family.SUCCESSFUL) { .build();
if (returnType == null) builder.setConfig(config);
return null;
else if (accept != null) {
return response.getEntity(returnType); builder.addHeader("Accept", accept);
} else { }
String message = "error"; for (Entry<String, String> keyValue : headerParams.entrySet()) {
String respBody = null; builder.addHeader(keyValue.getKey(), keyValue.getValue());
if (response.hasEntity()) { }
try { for (Map.Entry<String,String> keyValue : defaultHeaderMap.entrySet()) {
respBody = response.getEntity(String.class); if (!headerParams.containsKey(keyValue.getKey())) {
message = respBody; builder.addHeader(keyValue.getKey(), keyValue.getValue());
} catch (RuntimeException e) {
// e.printStackTrace();
}
} }
throw new ApiException( }
response.getStatusInfo().getStatusCode(),
message, BasicCookieStore store = new BasicCookieStore();
response.getHeaders(), for (Entry<String, String> keyValue : cookieParams.entrySet()) {
respBody); store.addCookie(buildCookie(keyValue.getKey(), keyValue.getValue(), builder.getUri()));
}
for (Entry<String,String> keyValue : defaultCookieMap.entrySet()) {
if (!cookieParams.containsKey(keyValue.getKey())) {
store.addCookie(buildCookie(keyValue.getKey(), keyValue.getValue(), builder.getUri()));
}
}
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 @@ public class ApiClient extends JavaTimeFormatter {
auth.applyToParams(queryParams, headerParams, cookieParams); 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<String, Object> formParams) {
StringBuilder formParamBuilder = new StringBuilder();
for (Entry<String, Object> 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;
}
} }

View File

@@ -12,7 +12,7 @@
package org.openapitools.client.api; 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.ApiException;
import org.openapitools.client.ApiClient; import org.openapitools.client.ApiClient;
@@ -89,7 +89,20 @@ public class AnotherFakeApi {
String[] localVarAuthNames = new String[] { }; String[] localVarAuthNames = new String[] { };
GenericType<Client> localVarReturnType = new GenericType<Client>() {}; TypeReference<Client> localVarReturnType = new TypeReference<Client>() {};
return apiClient.invokeAPI(localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); return apiClient.invokeAPI(
} localVarPath,
"PATCH",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
localVarReturnType
);
}
} }

View File

@@ -12,7 +12,7 @@
package org.openapitools.client.api; 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.ApiException;
import org.openapitools.client.ApiClient; import org.openapitools.client.ApiClient;
@@ -96,8 +96,20 @@ public class FakeApi {
String[] localVarAuthNames = new String[] { }; String[] localVarAuthNames = new String[] { };
apiClient.invokeAPI(
apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); localVarPath,
"POST",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
null
);
} }
/** /**
* *
@@ -135,9 +147,22 @@ public class FakeApi {
String[] localVarAuthNames = new String[] { }; String[] localVarAuthNames = new String[] { };
GenericType<Boolean> localVarReturnType = new GenericType<Boolean>() {}; TypeReference<Boolean> localVarReturnType = new TypeReference<Boolean>() {};
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); return apiClient.invokeAPI(
} localVarPath,
"POST",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
localVarReturnType
);
}
/** /**
* *
* Test serialization of object with outer number type * Test serialization of object with outer number type
@@ -174,9 +199,22 @@ public class FakeApi {
String[] localVarAuthNames = new String[] { }; String[] localVarAuthNames = new String[] { };
GenericType<OuterComposite> localVarReturnType = new GenericType<OuterComposite>() {}; TypeReference<OuterComposite> localVarReturnType = new TypeReference<OuterComposite>() {};
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); return apiClient.invokeAPI(
} localVarPath,
"POST",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
localVarReturnType
);
}
/** /**
* *
* Test serialization of outer number types * Test serialization of outer number types
@@ -213,9 +251,22 @@ public class FakeApi {
String[] localVarAuthNames = new String[] { }; String[] localVarAuthNames = new String[] { };
GenericType<BigDecimal> localVarReturnType = new GenericType<BigDecimal>() {}; TypeReference<BigDecimal> localVarReturnType = new TypeReference<BigDecimal>() {};
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); return apiClient.invokeAPI(
} localVarPath,
"POST",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
localVarReturnType
);
}
/** /**
* *
* Test serialization of outer string types * Test serialization of outer string types
@@ -252,9 +303,22 @@ public class FakeApi {
String[] localVarAuthNames = new String[] { }; String[] localVarAuthNames = new String[] { };
GenericType<String> localVarReturnType = new GenericType<String>() {}; TypeReference<String> localVarReturnType = new TypeReference<String>() {};
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); 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 &#x60;File&#x60;. * For this test, the body for this request much reference a schema named &#x60;File&#x60;.
@@ -295,8 +359,20 @@ public class FakeApi {
String[] localVarAuthNames = new String[] { }; String[] localVarAuthNames = new String[] { };
apiClient.invokeAPI(
apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); localVarPath,
"PUT",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
null
);
} }
/** /**
* *
@@ -345,8 +421,20 @@ public class FakeApi {
String[] localVarAuthNames = new String[] { }; String[] localVarAuthNames = new String[] { };
apiClient.invokeAPI(
apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); localVarPath,
"PUT",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
null
);
} }
/** /**
* To test \&quot;client\&quot; model * To test \&quot;client\&quot; model
@@ -389,9 +477,22 @@ public class FakeApi {
String[] localVarAuthNames = new String[] { }; String[] localVarAuthNames = new String[] { };
GenericType<Client> localVarReturnType = new GenericType<Client>() {}; TypeReference<Client> localVarReturnType = new TypeReference<Client>() {};
return apiClient.invokeAPI(localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); 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 假端點 偽のエンドポイント 가짜 엔드 포인트
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
@@ -488,8 +589,20 @@ if (paramCallback != null)
String[] localVarAuthNames = new String[] { "http_basic_test" }; String[] localVarAuthNames = new String[] { "http_basic_test" };
apiClient.invokeAPI(
apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); localVarPath,
"POST",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
null
);
} }
/** /**
* To test enum parameters * To test enum parameters
@@ -545,8 +658,20 @@ if (enumFormString != null)
String[] localVarAuthNames = new String[] { }; String[] localVarAuthNames = new String[] { };
apiClient.invokeAPI(
apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); localVarPath,
"GET",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
null
);
} }
/** /**
* Fake endpoint to test group parameters (optional) * Fake endpoint to test group parameters (optional)
@@ -611,8 +736,20 @@ if (booleanGroup != null)
String[] localVarAuthNames = new String[] { }; String[] localVarAuthNames = new String[] { };
apiClient.invokeAPI(
apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); localVarPath,
"DELETE",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
null
);
} }
/** /**
* test inline additionalProperties * test inline additionalProperties
@@ -654,8 +791,20 @@ if (booleanGroup != null)
String[] localVarAuthNames = new String[] { }; String[] localVarAuthNames = new String[] { };
apiClient.invokeAPI(
apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); localVarPath,
"POST",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
null
);
} }
/** /**
* test json serialization of form data * test json serialization of form data
@@ -707,8 +856,20 @@ if (param2 != null)
String[] localVarAuthNames = new String[] { }; String[] localVarAuthNames = new String[] { };
apiClient.invokeAPI(
apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); localVarPath,
"GET",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
null
);
} }
/** /**
* *
@@ -779,7 +940,19 @@ if (param2 != null)
String[] localVarAuthNames = new String[] { }; String[] localVarAuthNames = new String[] { };
apiClient.invokeAPI(
apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); localVarPath,
"PUT",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
null
);
} }
} }

View File

@@ -12,7 +12,7 @@
package org.openapitools.client.api; 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.ApiException;
import org.openapitools.client.ApiClient; import org.openapitools.client.ApiClient;
@@ -89,7 +89,20 @@ public class FakeClassnameTags123Api {
String[] localVarAuthNames = new String[] { "api_key_query" }; String[] localVarAuthNames = new String[] { "api_key_query" };
GenericType<Client> localVarReturnType = new GenericType<Client>() {}; TypeReference<Client> localVarReturnType = new TypeReference<Client>() {};
return apiClient.invokeAPI(localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); return apiClient.invokeAPI(
} localVarPath,
"PATCH",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
localVarReturnType
);
}
} }

View File

@@ -12,7 +12,7 @@
package org.openapitools.client.api; 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.ApiException;
import org.openapitools.client.ApiClient; import org.openapitools.client.ApiClient;
@@ -91,8 +91,20 @@ public class PetApi {
String[] localVarAuthNames = new String[] { "petstore_auth" }; String[] localVarAuthNames = new String[] { "petstore_auth" };
apiClient.invokeAPI(
apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); localVarPath,
"POST",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
null
);
} }
/** /**
* Deletes a pet * Deletes a pet
@@ -138,8 +150,20 @@ public class PetApi {
String[] localVarAuthNames = new String[] { "petstore_auth" }; String[] localVarAuthNames = new String[] { "petstore_auth" };
apiClient.invokeAPI(
apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); localVarPath,
"DELETE",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
null
);
} }
/** /**
* Finds Pets by status * Finds Pets by status
@@ -183,9 +207,22 @@ public class PetApi {
String[] localVarAuthNames = new String[] { "petstore_auth" }; String[] localVarAuthNames = new String[] { "petstore_auth" };
GenericType<List<Pet>> localVarReturnType = new GenericType<List<Pet>>() {}; TypeReference<List<Pet>> localVarReturnType = new TypeReference<List<Pet>>() {};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); return apiClient.invokeAPI(
} localVarPath,
"GET",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
localVarReturnType
);
}
/** /**
* Finds Pets by tags * Finds Pets by tags
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
@@ -230,9 +267,22 @@ public class PetApi {
String[] localVarAuthNames = new String[] { "petstore_auth" }; String[] localVarAuthNames = new String[] { "petstore_auth" };
GenericType<Set<Pet>> localVarReturnType = new GenericType<Set<Pet>>() {}; TypeReference<Set<Pet>> localVarReturnType = new TypeReference<Set<Pet>>() {};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); return apiClient.invokeAPI(
} localVarPath,
"GET",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
localVarReturnType
);
}
/** /**
* Find pet by ID * Find pet by ID
* Returns a single pet * Returns a single pet
@@ -275,9 +325,22 @@ public class PetApi {
String[] localVarAuthNames = new String[] { "api_key" }; String[] localVarAuthNames = new String[] { "api_key" };
GenericType<Pet> localVarReturnType = new GenericType<Pet>() {}; TypeReference<Pet> localVarReturnType = new TypeReference<Pet>() {};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); return apiClient.invokeAPI(
} localVarPath,
"GET",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
localVarReturnType
);
}
/** /**
* Update an existing pet * Update an existing pet
* *
@@ -318,8 +381,20 @@ public class PetApi {
String[] localVarAuthNames = new String[] { "petstore_auth" }; String[] localVarAuthNames = new String[] { "petstore_auth" };
apiClient.invokeAPI(
apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); localVarPath,
"PUT",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
null
);
} }
/** /**
* Updates a pet in the store with form data * Updates a pet in the store with form data
@@ -368,8 +443,20 @@ if (status != null)
String[] localVarAuthNames = new String[] { "petstore_auth" }; String[] localVarAuthNames = new String[] { "petstore_auth" };
apiClient.invokeAPI(
apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); localVarPath,
"POST",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
null
);
} }
/** /**
* uploads an image * uploads an image
@@ -419,9 +506,22 @@ if (file != null)
String[] localVarAuthNames = new String[] { "petstore_auth" }; String[] localVarAuthNames = new String[] { "petstore_auth" };
GenericType<ModelApiResponse> localVarReturnType = new GenericType<ModelApiResponse>() {}; TypeReference<ModelApiResponse> localVarReturnType = new TypeReference<ModelApiResponse>() {};
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); return apiClient.invokeAPI(
} localVarPath,
"POST",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
localVarReturnType
);
}
/** /**
* uploads an image (required) * uploads an image (required)
* *
@@ -475,7 +575,20 @@ if (requiredFile != null)
String[] localVarAuthNames = new String[] { "petstore_auth" }; String[] localVarAuthNames = new String[] { "petstore_auth" };
GenericType<ModelApiResponse> localVarReturnType = new GenericType<ModelApiResponse>() {}; TypeReference<ModelApiResponse> localVarReturnType = new TypeReference<ModelApiResponse>() {};
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); return apiClient.invokeAPI(
} localVarPath,
"POST",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
localVarReturnType
);
}
} }

View File

@@ -12,7 +12,7 @@
package org.openapitools.client.api; 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.ApiException;
import org.openapitools.client.ApiClient; import org.openapitools.client.ApiClient;
@@ -89,8 +89,20 @@ public class StoreApi {
String[] localVarAuthNames = new String[] { }; String[] localVarAuthNames = new String[] { };
apiClient.invokeAPI(
apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); localVarPath,
"DELETE",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
null
);
} }
/** /**
* Returns pet inventories by status * Returns pet inventories by status
@@ -127,9 +139,22 @@ public class StoreApi {
String[] localVarAuthNames = new String[] { "api_key" }; String[] localVarAuthNames = new String[] { "api_key" };
GenericType<Map<String, Integer>> localVarReturnType = new GenericType<Map<String, Integer>>() {}; TypeReference<Map<String, Integer>> localVarReturnType = new TypeReference<Map<String, Integer>>() {};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); return apiClient.invokeAPI(
} localVarPath,
"GET",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
localVarReturnType
);
}
/** /**
* Find purchase order by ID * Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions * For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
@@ -172,9 +197,22 @@ public class StoreApi {
String[] localVarAuthNames = new String[] { }; String[] localVarAuthNames = new String[] { };
GenericType<Order> localVarReturnType = new GenericType<Order>() {}; TypeReference<Order> localVarReturnType = new TypeReference<Order>() {};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); return apiClient.invokeAPI(
} localVarPath,
"GET",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
localVarReturnType
);
}
/** /**
* Place an order for a pet * Place an order for a pet
* *
@@ -216,7 +254,20 @@ public class StoreApi {
String[] localVarAuthNames = new String[] { }; String[] localVarAuthNames = new String[] { };
GenericType<Order> localVarReturnType = new GenericType<Order>() {}; TypeReference<Order> localVarReturnType = new TypeReference<Order>() {};
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); return apiClient.invokeAPI(
} localVarPath,
"POST",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
localVarReturnType
);
}
} }

View File

@@ -12,7 +12,7 @@
package org.openapitools.client.api; 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.ApiException;
import org.openapitools.client.ApiClient; import org.openapitools.client.ApiClient;
@@ -88,8 +88,20 @@ public class UserApi {
String[] localVarAuthNames = new String[] { }; String[] localVarAuthNames = new String[] { };
apiClient.invokeAPI(
apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); localVarPath,
"POST",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
null
);
} }
/** /**
* Creates list of users with given input array * Creates list of users with given input array
@@ -131,8 +143,20 @@ public class UserApi {
String[] localVarAuthNames = new String[] { }; String[] localVarAuthNames = new String[] { };
apiClient.invokeAPI(
apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); localVarPath,
"POST",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
null
);
} }
/** /**
* Creates list of users with given input array * Creates list of users with given input array
@@ -174,8 +198,20 @@ public class UserApi {
String[] localVarAuthNames = new String[] { }; String[] localVarAuthNames = new String[] { };
apiClient.invokeAPI(
apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); localVarPath,
"POST",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
null
);
} }
/** /**
* Delete user * Delete user
@@ -218,8 +254,20 @@ public class UserApi {
String[] localVarAuthNames = new String[] { }; String[] localVarAuthNames = new String[] { };
apiClient.invokeAPI(
apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); localVarPath,
"DELETE",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
null
);
} }
/** /**
* Get user by user name * Get user by user name
@@ -263,9 +311,22 @@ public class UserApi {
String[] localVarAuthNames = new String[] { }; String[] localVarAuthNames = new String[] { };
GenericType<User> localVarReturnType = new GenericType<User>() {}; TypeReference<User> localVarReturnType = new TypeReference<User>() {};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); return apiClient.invokeAPI(
} localVarPath,
"GET",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
localVarReturnType
);
}
/** /**
* Logs user into the system * Logs user into the system
* *
@@ -315,9 +376,22 @@ public class UserApi {
String[] localVarAuthNames = new String[] { }; String[] localVarAuthNames = new String[] { };
GenericType<String> localVarReturnType = new GenericType<String>() {}; TypeReference<String> localVarReturnType = new TypeReference<String>() {};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); return apiClient.invokeAPI(
} localVarPath,
"GET",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
localVarReturnType
);
}
/** /**
* Logs out current logged in user session * Logs out current logged in user session
* *
@@ -352,8 +426,20 @@ public class UserApi {
String[] localVarAuthNames = new String[] { }; String[] localVarAuthNames = new String[] { };
apiClient.invokeAPI(
apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); localVarPath,
"GET",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
null
);
} }
/** /**
* Updated user * Updated user
@@ -402,7 +488,19 @@ public class UserApi {
String[] localVarAuthNames = new String[] { }; String[] localVarAuthNames = new String[] { };
apiClient.invokeAPI(
apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); localVarPath,
"PUT",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
null
);
} }
} }