[Java][resttemplate] better code format (#10033)

* java restemplate: better code format

* update samples
This commit is contained in:
William Cheng
2021-07-25 16:07:04 +08:00
committed by GitHub
parent 8eba70dd3d
commit f0ebcd56d1
16 changed files with 414 additions and 353 deletions

View File

@@ -93,6 +93,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null); CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
private final String separator; private final String separator;
private CollectionFormat(String separator) { private CollectionFormat(String separator) {
this.separator = separator; this.separator = separator;
} }
@@ -149,6 +150,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
/** /**
* Get the current base path * Get the current base path
*
* @return String the base path * @return String the base path
*/ */
public String getBasePath() { public String getBasePath() {
@@ -157,6 +159,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
/** /**
* Set the base path, which should include the host * Set the base path, which should include the host
*
* @param basePath the base path * @param basePath the base path
* @return ApiClient this client * @return ApiClient this client
*/ */
@@ -167,6 +170,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
/** /**
* Get authentications (key: authentication name, value: authentication). * Get authentications (key: authentication name, value: authentication).
*
* @return Map the currently configured authentication types * @return Map the currently configured authentication types
*/ */
public Map<String, Authentication> getAuthentications() { public Map<String, Authentication> getAuthentications() {
@@ -183,104 +187,110 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
return authentications.get(authName); return authentications.get(authName);
} }
{{#hasHttpBearerMethods}} {{#hasHttpBearerMethods}}
/** /**
* Helper method to set token for HTTP bearer authentication. * Helper method to set token for HTTP bearer authentication.
* @param bearerToken the token *
*/ * @param bearerToken the token
public void setBearerToken(String bearerToken) { */
for (Authentication auth : authentications.values()) { public void setBearerToken(String bearerToken) {
if (auth instanceof HttpBearerAuth) { for (Authentication auth : authentications.values()) {
((HttpBearerAuth) auth).setBearerToken(bearerToken); if (auth instanceof HttpBearerAuth) {
return; ((HttpBearerAuth) auth).setBearerToken(bearerToken);
} return;
}
}
throw new RuntimeException("No Bearer authentication configured!");
} }
throw new RuntimeException("No Bearer authentication configured!");
}
{{/hasHttpBearerMethods}} {{/hasHttpBearerMethods}}
{{#hasHttpBasicMethods}} {{#hasHttpBasicMethods}}
/** /**
* 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
public void setUsername(String username) { */
for (Authentication auth : authentications.values()) { public void setUsername(String username) {
if (auth instanceof HttpBasicAuth) { for (Authentication auth : authentications.values()) {
((HttpBasicAuth) auth).setUsername(username); if (auth instanceof HttpBasicAuth) {
return; ((HttpBasicAuth) auth).setUsername(username);
} return;
}
}
throw new RuntimeException("No HTTP basic authentication configured!");
} }
throw new RuntimeException("No HTTP basic authentication configured!");
}
/** /**
* 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
*/ */
public void setPassword(String password) { public void 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;
} }
}
throw new RuntimeException("No HTTP basic authentication configured!");
} }
throw new RuntimeException("No HTTP basic authentication configured!");
}
{{/hasHttpBasicMethods}} {{/hasHttpBasicMethods}}
{{#hasApiKeyMethods}} {{#hasApiKeyMethods}}
/** /**
* 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
public void setApiKey(String apiKey) { */
for (Authentication auth : authentications.values()) { public void setApiKey(String apiKey) {
if (auth instanceof ApiKeyAuth) { for (Authentication auth : authentications.values()) {
((ApiKeyAuth) auth).setApiKey(apiKey); if (auth instanceof ApiKeyAuth) {
return; ((ApiKeyAuth) auth).setApiKey(apiKey);
} return;
}
}
throw new RuntimeException("No API key authentication configured!");
} }
throw new RuntimeException("No API key authentication configured!");
}
/** /**
* 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
public void setApiKeyPrefix(String apiKeyPrefix) { */
for (Authentication auth : authentications.values()) { public void setApiKeyPrefix(String apiKeyPrefix) {
if (auth instanceof ApiKeyAuth) { for (Authentication auth : authentications.values()) {
((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); if (auth instanceof ApiKeyAuth) {
return; ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix);
} return;
}
}
throw new RuntimeException("No API key authentication configured!");
} }
throw new RuntimeException("No API key authentication configured!");
}
{{/hasApiKeyMethods}} {{/hasApiKeyMethods}}
{{#hasOAuthMethods}} {{#hasOAuthMethods}}
/** /**
* 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
public void setAccessToken(String accessToken) { */
for (Authentication auth : authentications.values()) { public void setAccessToken(String accessToken) {
if (auth instanceof OAuth) { for (Authentication auth : authentications.values()) {
((OAuth) auth).setAccessToken(accessToken); if (auth instanceof OAuth) {
return; ((OAuth) auth).setAccessToken(accessToken);
} return;
}
}
throw new RuntimeException("No OAuth2 authentication configured!");
} }
throw new RuntimeException("No OAuth2 authentication configured!");
}
{{/hasOAuthMethods}} {{/hasOAuthMethods}}
/** /**
* Set the User-Agent header's value (by adding to the default header map). * Set the User-Agent header's value (by adding to the default header map).
*
* @param userAgent the user agent string * @param userAgent the user agent string
* @return ApiClient this client * @return ApiClient this client
*/ */
@@ -292,7 +302,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
/** /**
* Add a default header. * Add a default header.
* *
* @param name The header's name * @param name The header's name
* @param value The header's value * @param value The header's value
* @return ApiClient this client * @return ApiClient this client
*/ */
@@ -307,7 +317,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
/** /**
* Add a default cookie. * Add a default cookie.
* *
* @param name The cookie's name * @param name The cookie's name
* @param value The cookie's value * @param value The cookie's value
* @return ApiClient this client * @return ApiClient this client
*/ */
@@ -321,7 +331,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
public void setDebugging(boolean debugging) { public void setDebugging(boolean debugging) {
List<ClientHttpRequestInterceptor> currentInterceptors = this.restTemplate.getInterceptors(); List<ClientHttpRequestInterceptor> currentInterceptors = this.restTemplate.getInterceptors();
if(debugging) { if (debugging) {
if (currentInterceptors == null) { if (currentInterceptors == null) {
currentInterceptors = new ArrayList<ClientHttpRequestInterceptor>(); currentInterceptors = new ArrayList<ClientHttpRequestInterceptor>();
} }
@@ -367,9 +377,9 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
public ApiClient setDateFormat(DateFormat dateFormat) { public ApiClient setDateFormat(DateFormat dateFormat) {
this.dateFormat = dateFormat; this.dateFormat = dateFormat;
{{#threetenbp}} {{#threetenbp}}
for(HttpMessageConverter converter:restTemplate.getMessageConverters()){ for (HttpMessageConverter converter : restTemplate.getMessageConverters()) {
if(converter instanceof AbstractJackson2HttpMessageConverter){ if (converter instanceof AbstractJackson2HttpMessageConverter) {
ObjectMapper mapper = ((AbstractJackson2HttpMessageConverter)converter).getObjectMapper(); ObjectMapper mapper = ((AbstractJackson2HttpMessageConverter) converter).getObjectMapper();
mapper.setDateFormat(dateFormat); mapper.setDateFormat(dateFormat);
} }
} }
@@ -379,6 +389,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
/** /**
* Parse the given string into Date object. * Parse the given string into Date object.
*
* @param str the string to parse * @param str the string to parse
* @return the Date parsed from the string * @return the Date parsed from the string
*/ */
@@ -392,6 +403,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
/** /**
* Format the given Date object into string. * Format the given Date object into string.
*
* @param date the date to format * @param date the date to format
* @return the formatted date as string * @return the formatted date as string
*/ */
@@ -401,6 +413,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
/** /**
* Format the given parameter object into string. * Format the given parameter object into string.
*
* @param param the object to convert * @param param the object to convert
* @return String the parameter represented as a String * @return String the parameter represented as a String
*/ */
@@ -413,8 +426,8 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
return formatOffsetDateTime((OffsetDateTime) param); return formatOffsetDateTime((OffsetDateTime) param);
} {{/jsr310}}else if (param instanceof Collection) { } {{/jsr310}}else if (param instanceof Collection) {
StringBuilder b = new StringBuilder(); StringBuilder b = new StringBuilder();
for(Object o : (Collection<?>) param) { for (Object o : (Collection<?>) param) {
if(b.length() > 0) { if (b.length() > 0) {
b.append(","); b.append(",");
} }
b.append(String.valueOf(o)); b.append(String.valueOf(o));
@@ -440,7 +453,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
} }
// collectionFormat is assumed to be "csv" by default // collectionFormat is assumed to be "csv" by default
if(collectionFormat == null) { if (collectionFormat == null) {
collectionFormat = CollectionFormat.CSV; collectionFormat = CollectionFormat.CSV;
} }
@@ -449,6 +462,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
/** /**
* Converts a parameter to a {@link MultiValueMap} for use in REST requests * Converts a parameter to a {@link MultiValueMap} for use in REST requests
*
* @param collectionFormat The format to convert to * @param collectionFormat The format to convert to
* @param name The name of the parameter * @param name The name of the parameter
* @param value The parameter's value * @param value The parameter's value
@@ -461,7 +475,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
return params; return params;
} }
if(collectionFormat == null) { if (collectionFormat == null) {
collectionFormat = CollectionFormat.CSV; collectionFormat = CollectionFormat.CSV;
} }
@@ -473,7 +487,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
return params; return params;
} }
if (valueCollection.isEmpty()){ if (valueCollection.isEmpty()) {
return params; return params;
} }
@@ -485,7 +499,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
} }
List<String> values = new ArrayList<String>(); List<String> values = new ArrayList<String>();
for(Object o : valueCollection) { for (Object o : valueCollection) {
values.add(parameterToString(o)); values.add(parameterToString(o));
} }
params.add(name, collectionFormat.collectionToString(values)); params.add(name, collectionFormat.collectionToString(values));
@@ -493,8 +507,9 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
return params; return params;
} }
/** /**
* Check if the given {@code String} is a JSON MIME. * Check if the given {@code String} is a JSON MIME.
*
* @param mediaType the input MediaType * @param mediaType the input MediaType
* @return boolean true if the MediaType represents JSON, false otherwise * @return boolean true if the MediaType represents JSON, false otherwise
*/ */
@@ -517,6 +532,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
* application/json * application/json
* application/json; charset=UTF8 * application/json; charset=UTF8
* APPLICATION/JSON * APPLICATION/JSON
*
* @param mediaType the input MediaType * @param mediaType the input MediaType
* @return boolean true if the MediaType represents JSON, false otherwise * @return boolean true if the MediaType represents JSON, false otherwise
*/ */
@@ -524,8 +540,9 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
return mediaType != null && (MediaType.APPLICATION_JSON.isCompatibleWith(mediaType) || mediaType.getSubtype().matches("^.*\\+json[;]?\\s*$")); return mediaType != null && (MediaType.APPLICATION_JSON.isCompatibleWith(mediaType) || mediaType.getSubtype().matches("^.*\\+json[;]?\\s*$"));
} }
/** /**
* Check if the given {@code String} is a Problem JSON MIME (RFC-7807). * Check if the given {@code String} is a Problem JSON MIME (RFC-7807).
*
* @param mediaType the input MediaType * @param mediaType the input MediaType
* @return boolean true if the MediaType represents Problem JSON, false otherwise * @return boolean true if the MediaType represents Problem JSON, false otherwise
*/ */
@@ -577,6 +594,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
/** /**
* Select the body to use for the request * Select the body to use for the request
*
* @param obj the body object * @param obj the body object
* @param formParams the form parameters * @param formParams the form parameters
* @param contentType the content type of the request * @param contentType the content type of the request
@@ -589,6 +607,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
/** /**
* Expand path template with variables * Expand path template with variables
*
* @param pathTemplate path template with placeholders * @param pathTemplate path template with placeholders
* @param variables variables to replace * @param variables variables to replace
* @return path with placeholders replaced by variables * @return path with placeholders replaced by variables
@@ -599,6 +618,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
/** /**
* Include queryParams in uriParams taking into account the paramName * Include queryParams in uriParams taking into account the paramName
*
* @param queryParam The query parameters * @param queryParam The query parameters
* @param uriParams The path parameters * @param uriParams The path parameters
* return templatized query string * return templatized query string
@@ -662,21 +682,21 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
//Append to finalUri the templatized query string like "?param1={param1Value}&....... //Append to finalUri the templatized query string like "?param1={param1Value}&.......
finalUri += "?" + queryUri; finalUri += "?" + queryUri;
} }
String expandedPath = this.expandPath(finalUri,uriParams); String expandedPath = this.expandPath(finalUri, uriParams);
final UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(basePath).path(expandedPath); final UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(basePath).path(expandedPath);
URI uri; URI uri;
try { try {
uri = new URI(builder.build().toUriString()); uri = new URI(builder.build().toUriString());
} catch(URISyntaxException ex) { } catch (URISyntaxException ex) {
throw new RestClientException("Could not build URL: " + builder.toUriString(), ex); throw new RestClientException("Could not build URL: " + builder.toUriString(), ex);
} }
final BodyBuilder requestBuilder = RequestEntity.method(method, uri); final BodyBuilder requestBuilder = RequestEntity.method(method, uri);
if(accept != null) { if (accept != null) {
requestBuilder.accept(accept.toArray(new MediaType[accept.size()])); requestBuilder.accept(accept.toArray(new MediaType[accept.size()]));
} }
if(contentType != null) { if (contentType != null) {
requestBuilder.contentType(contentType); requestBuilder.contentType(contentType);
} }
@@ -705,7 +725,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
protected void addHeadersToRequest(HttpHeaders headers, BodyBuilder requestBuilder) { protected void addHeadersToRequest(HttpHeaders headers, BodyBuilder requestBuilder) {
for (Entry<String, List<String>> entry : headers.entrySet()) { for (Entry<String, List<String>> entry : headers.entrySet()) {
List<String> values = entry.getValue(); List<String> values = entry.getValue();
for(String value : values) { for (String value : values) {
if (value != null) { if (value != null) {
requestBuilder.header(entry.getKey(), value); requestBuilder.header(entry.getKey(), value);
} }
@@ -715,7 +735,8 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
/** /**
* Add cookies to the request that is being built * Add cookies to the request that is being built
* @param cookies The cookies to add *
* @param cookies The cookies to add
* @param requestBuilder The current request * @param requestBuilder The current request
*/ */
protected void addCookiesToRequest(MultiValueMap<String, String> cookies, BodyBuilder requestBuilder) { protected void addCookiesToRequest(MultiValueMap<String, String> cookies, BodyBuilder requestBuilder) {
@@ -759,9 +780,9 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
RestTemplate restTemplate = new RestTemplate(messageConverters); RestTemplate restTemplate = new RestTemplate(messageConverters);
{{/withXml}}{{^withXml}}RestTemplate restTemplate = new RestTemplate();{{/withXml}} {{/withXml}}{{^withXml}}RestTemplate restTemplate = new RestTemplate();{{/withXml}}
{{#threetenbp}} {{#threetenbp}}
for(HttpMessageConverter converter:restTemplate.getMessageConverters()){ for (HttpMessageConverter converter : restTemplate.getMessageConverters()) {
if(converter instanceof AbstractJackson2HttpMessageConverter){ if (converter instanceof AbstractJackson2HttpMessageConverter){
ObjectMapper mapper = ((AbstractJackson2HttpMessageConverter)converter).getObjectMapper(); ObjectMapper mapper = ((AbstractJackson2HttpMessageConverter) converter).getObjectMapper();
ThreeTenModule module = new ThreeTenModule(); ThreeTenModule module = new ThreeTenModule();
module.addDeserializer(Instant.class, CustomInstantDeserializer.INSTANT); module.addDeserializer(Instant.class, CustomInstantDeserializer.INSTANT);
module.addDeserializer(OffsetDateTime.class, CustomInstantDeserializer.OFFSET_DATE_TIME); module.addDeserializer(OffsetDateTime.class, CustomInstantDeserializer.OFFSET_DATE_TIME);
@@ -822,9 +843,9 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
private String headersToString(HttpHeaders headers) { private String headersToString(HttpHeaders headers) {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
for(Entry<String, List<String>> entry : headers.entrySet()) { for (Entry<String, List<String>> entry : headers.entrySet()) {
builder.append(entry.getKey()).append("=["); builder.append(entry.getKey()).append("=[");
for(String value : entry.getValue()) { for (String value : entry.getValue()) {
builder.append(value).append(","); builder.append(value).append(",");
} }
builder.setLength(builder.length() - 1); // Get rid of trailing comma builder.setLength(builder.length() - 1); // Get rid of trailing comma

View File

@@ -150,7 +150,7 @@ public class {{classname}} {
{{#returnType}}ParameterizedTypeReference<{{{returnType}}}> returnType = new ParameterizedTypeReference<{{{returnType}}}>() {};{{/returnType}}{{^returnType}}ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};{{/returnType}} {{#returnType}}ParameterizedTypeReference<{{{returnType}}}> returnType = new ParameterizedTypeReference<{{{returnType}}}>() {};{{/returnType}}{{^returnType}}ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};{{/returnType}}
return apiClient.invokeAPI("{{{path}}}", HttpMethod.{{httpMethod}}, {{#hasPathParams}}uriVariables{{/hasPathParams}}{{^hasPathParams}}Collections.<String, Object>emptyMap(){{/hasPathParams}}, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("{{{path}}}", HttpMethod.{{httpMethod}}, {{#hasPathParams}}uriVariables{{/hasPathParams}}{{^hasPathParams}}Collections.<String, Object>emptyMap(){{/hasPathParams}}, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
{{/operation}} {{/operation}}
} }
{{/operations}} {{/operations}}

View File

@@ -74,6 +74,7 @@ public class ApiClient extends JavaTimeFormatter {
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null); CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
private final String separator; private final String separator;
private CollectionFormat(String separator) { private CollectionFormat(String separator) {
this.separator = separator; this.separator = separator;
} }
@@ -130,6 +131,7 @@ public class ApiClient extends JavaTimeFormatter {
/** /**
* Get the current base path * Get the current base path
*
* @return String the base path * @return String the base path
*/ */
public String getBasePath() { public String getBasePath() {
@@ -138,6 +140,7 @@ public class ApiClient extends JavaTimeFormatter {
/** /**
* Set the base path, which should include the host * Set the base path, which should include the host
*
* @param basePath the base path * @param basePath the base path
* @return ApiClient this client * @return ApiClient this client
*/ */
@@ -148,6 +151,7 @@ public class ApiClient extends JavaTimeFormatter {
/** /**
* Get authentications (key: authentication name, value: authentication). * Get authentications (key: authentication name, value: authentication).
*
* @return Map the currently configured authentication types * @return Map the currently configured authentication types
*/ */
public Map<String, Authentication> getAuthentications() { public Map<String, Authentication> getAuthentications() {
@@ -165,81 +169,86 @@ public class ApiClient extends JavaTimeFormatter {
} }
/** /**
* 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
public void setUsername(String username) { */
for (Authentication auth : authentications.values()) { public void setUsername(String username) {
if (auth instanceof HttpBasicAuth) { for (Authentication auth : authentications.values()) {
((HttpBasicAuth) auth).setUsername(username); if (auth instanceof HttpBasicAuth) {
return; ((HttpBasicAuth) auth).setUsername(username);
} return;
}
}
throw new RuntimeException("No HTTP basic authentication configured!");
} }
throw new RuntimeException("No HTTP basic authentication configured!");
}
/** /**
* 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
*/ */
public void setPassword(String password) { public void 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;
} }
}
throw new RuntimeException("No HTTP basic authentication configured!");
} }
throw new RuntimeException("No HTTP basic authentication configured!");
}
/** /**
* 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
public void setApiKey(String apiKey) { */
for (Authentication auth : authentications.values()) { public void setApiKey(String apiKey) {
if (auth instanceof ApiKeyAuth) { for (Authentication auth : authentications.values()) {
((ApiKeyAuth) auth).setApiKey(apiKey); if (auth instanceof ApiKeyAuth) {
return; ((ApiKeyAuth) auth).setApiKey(apiKey);
} return;
}
}
throw new RuntimeException("No API key authentication configured!");
} }
throw new RuntimeException("No API key authentication configured!");
}
/** /**
* 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
public void setApiKeyPrefix(String apiKeyPrefix) { */
for (Authentication auth : authentications.values()) { public void setApiKeyPrefix(String apiKeyPrefix) {
if (auth instanceof ApiKeyAuth) { for (Authentication auth : authentications.values()) {
((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); if (auth instanceof ApiKeyAuth) {
return; ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix);
} return;
}
}
throw new RuntimeException("No API key authentication configured!");
} }
throw new RuntimeException("No API key authentication configured!");
}
/** /**
* 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
public void setAccessToken(String accessToken) { */
for (Authentication auth : authentications.values()) { public void setAccessToken(String accessToken) {
if (auth instanceof OAuth) { for (Authentication auth : authentications.values()) {
((OAuth) auth).setAccessToken(accessToken); if (auth instanceof OAuth) {
return; ((OAuth) auth).setAccessToken(accessToken);
} return;
}
}
throw new RuntimeException("No OAuth2 authentication configured!");
} }
throw new RuntimeException("No OAuth2 authentication configured!");
}
/** /**
* Set the User-Agent header's value (by adding to the default header map). * Set the User-Agent header's value (by adding to the default header map).
*
* @param userAgent the user agent string * @param userAgent the user agent string
* @return ApiClient this client * @return ApiClient this client
*/ */
@@ -251,7 +260,7 @@ public class ApiClient extends JavaTimeFormatter {
/** /**
* Add a default header. * Add a default header.
* *
* @param name The header's name * @param name The header's name
* @param value The header's value * @param value The header's value
* @return ApiClient this client * @return ApiClient this client
*/ */
@@ -266,7 +275,7 @@ public class ApiClient extends JavaTimeFormatter {
/** /**
* Add a default cookie. * Add a default cookie.
* *
* @param name The cookie's name * @param name The cookie's name
* @param value The cookie's value * @param value The cookie's value
* @return ApiClient this client * @return ApiClient this client
*/ */
@@ -280,7 +289,7 @@ public class ApiClient extends JavaTimeFormatter {
public void setDebugging(boolean debugging) { public void setDebugging(boolean debugging) {
List<ClientHttpRequestInterceptor> currentInterceptors = this.restTemplate.getInterceptors(); List<ClientHttpRequestInterceptor> currentInterceptors = this.restTemplate.getInterceptors();
if(debugging) { if (debugging) {
if (currentInterceptors == null) { if (currentInterceptors == null) {
currentInterceptors = new ArrayList<ClientHttpRequestInterceptor>(); currentInterceptors = new ArrayList<ClientHttpRequestInterceptor>();
} }
@@ -325,9 +334,9 @@ public class ApiClient extends JavaTimeFormatter {
*/ */
public ApiClient setDateFormat(DateFormat dateFormat) { public ApiClient setDateFormat(DateFormat dateFormat) {
this.dateFormat = dateFormat; this.dateFormat = dateFormat;
for(HttpMessageConverter converter:restTemplate.getMessageConverters()){ for (HttpMessageConverter converter : restTemplate.getMessageConverters()) {
if(converter instanceof AbstractJackson2HttpMessageConverter){ if (converter instanceof AbstractJackson2HttpMessageConverter) {
ObjectMapper mapper = ((AbstractJackson2HttpMessageConverter)converter).getObjectMapper(); ObjectMapper mapper = ((AbstractJackson2HttpMessageConverter) converter).getObjectMapper();
mapper.setDateFormat(dateFormat); mapper.setDateFormat(dateFormat);
} }
} }
@@ -336,6 +345,7 @@ public class ApiClient extends JavaTimeFormatter {
/** /**
* Parse the given string into Date object. * Parse the given string into Date object.
*
* @param str the string to parse * @param str the string to parse
* @return the Date parsed from the string * @return the Date parsed from the string
*/ */
@@ -349,6 +359,7 @@ public class ApiClient extends JavaTimeFormatter {
/** /**
* Format the given Date object into string. * Format the given Date object into string.
*
* @param date the date to format * @param date the date to format
* @return the formatted date as string * @return the formatted date as string
*/ */
@@ -358,6 +369,7 @@ public class ApiClient extends JavaTimeFormatter {
/** /**
* Format the given parameter object into string. * Format the given parameter object into string.
*
* @param param the object to convert * @param param the object to convert
* @return String the parameter represented as a String * @return String the parameter represented as a String
*/ */
@@ -370,8 +382,8 @@ public class ApiClient extends JavaTimeFormatter {
return formatOffsetDateTime((OffsetDateTime) param); return formatOffsetDateTime((OffsetDateTime) param);
} else if (param instanceof Collection) { } else if (param instanceof Collection) {
StringBuilder b = new StringBuilder(); StringBuilder b = new StringBuilder();
for(Object o : (Collection<?>) param) { for (Object o : (Collection<?>) param) {
if(b.length() > 0) { if (b.length() > 0) {
b.append(","); b.append(",");
} }
b.append(String.valueOf(o)); b.append(String.valueOf(o));
@@ -397,7 +409,7 @@ public class ApiClient extends JavaTimeFormatter {
} }
// collectionFormat is assumed to be "csv" by default // collectionFormat is assumed to be "csv" by default
if(collectionFormat == null) { if (collectionFormat == null) {
collectionFormat = CollectionFormat.CSV; collectionFormat = CollectionFormat.CSV;
} }
@@ -406,6 +418,7 @@ public class ApiClient extends JavaTimeFormatter {
/** /**
* Converts a parameter to a {@link MultiValueMap} for use in REST requests * Converts a parameter to a {@link MultiValueMap} for use in REST requests
*
* @param collectionFormat The format to convert to * @param collectionFormat The format to convert to
* @param name The name of the parameter * @param name The name of the parameter
* @param value The parameter's value * @param value The parameter's value
@@ -418,7 +431,7 @@ public class ApiClient extends JavaTimeFormatter {
return params; return params;
} }
if(collectionFormat == null) { if (collectionFormat == null) {
collectionFormat = CollectionFormat.CSV; collectionFormat = CollectionFormat.CSV;
} }
@@ -430,7 +443,7 @@ public class ApiClient extends JavaTimeFormatter {
return params; return params;
} }
if (valueCollection.isEmpty()){ if (valueCollection.isEmpty()) {
return params; return params;
} }
@@ -442,7 +455,7 @@ public class ApiClient extends JavaTimeFormatter {
} }
List<String> values = new ArrayList<String>(); List<String> values = new ArrayList<String>();
for(Object o : valueCollection) { for (Object o : valueCollection) {
values.add(parameterToString(o)); values.add(parameterToString(o));
} }
params.add(name, collectionFormat.collectionToString(values)); params.add(name, collectionFormat.collectionToString(values));
@@ -450,8 +463,9 @@ public class ApiClient extends JavaTimeFormatter {
return params; return params;
} }
/** /**
* Check if the given {@code String} is a JSON MIME. * Check if the given {@code String} is a JSON MIME.
*
* @param mediaType the input MediaType * @param mediaType the input MediaType
* @return boolean true if the MediaType represents JSON, false otherwise * @return boolean true if the MediaType represents JSON, false otherwise
*/ */
@@ -474,6 +488,7 @@ public class ApiClient extends JavaTimeFormatter {
* application/json * application/json
* application/json; charset=UTF8 * application/json; charset=UTF8
* APPLICATION/JSON * APPLICATION/JSON
*
* @param mediaType the input MediaType * @param mediaType the input MediaType
* @return boolean true if the MediaType represents JSON, false otherwise * @return boolean true if the MediaType represents JSON, false otherwise
*/ */
@@ -481,8 +496,9 @@ public class ApiClient extends JavaTimeFormatter {
return mediaType != null && (MediaType.APPLICATION_JSON.isCompatibleWith(mediaType) || mediaType.getSubtype().matches("^.*\\+json[;]?\\s*$")); return mediaType != null && (MediaType.APPLICATION_JSON.isCompatibleWith(mediaType) || mediaType.getSubtype().matches("^.*\\+json[;]?\\s*$"));
} }
/** /**
* Check if the given {@code String} is a Problem JSON MIME (RFC-7807). * Check if the given {@code String} is a Problem JSON MIME (RFC-7807).
*
* @param mediaType the input MediaType * @param mediaType the input MediaType
* @return boolean true if the MediaType represents Problem JSON, false otherwise * @return boolean true if the MediaType represents Problem JSON, false otherwise
*/ */
@@ -534,6 +550,7 @@ public class ApiClient extends JavaTimeFormatter {
/** /**
* Select the body to use for the request * Select the body to use for the request
*
* @param obj the body object * @param obj the body object
* @param formParams the form parameters * @param formParams the form parameters
* @param contentType the content type of the request * @param contentType the content type of the request
@@ -546,6 +563,7 @@ public class ApiClient extends JavaTimeFormatter {
/** /**
* Expand path template with variables * Expand path template with variables
*
* @param pathTemplate path template with placeholders * @param pathTemplate path template with placeholders
* @param variables variables to replace * @param variables variables to replace
* @return path with placeholders replaced by variables * @return path with placeholders replaced by variables
@@ -556,6 +574,7 @@ public class ApiClient extends JavaTimeFormatter {
/** /**
* Include queryParams in uriParams taking into account the paramName * Include queryParams in uriParams taking into account the paramName
*
* @param queryParam The query parameters * @param queryParam The query parameters
* @param uriParams The path parameters * @param uriParams The path parameters
* return templatized query string * return templatized query string
@@ -619,21 +638,21 @@ public class ApiClient extends JavaTimeFormatter {
//Append to finalUri the templatized query string like "?param1={param1Value}&....... //Append to finalUri the templatized query string like "?param1={param1Value}&.......
finalUri += "?" + queryUri; finalUri += "?" + queryUri;
} }
String expandedPath = this.expandPath(finalUri,uriParams); String expandedPath = this.expandPath(finalUri, uriParams);
final UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(basePath).path(expandedPath); final UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(basePath).path(expandedPath);
URI uri; URI uri;
try { try {
uri = new URI(builder.build().toUriString()); uri = new URI(builder.build().toUriString());
} catch(URISyntaxException ex) { } catch (URISyntaxException ex) {
throw new RestClientException("Could not build URL: " + builder.toUriString(), ex); throw new RestClientException("Could not build URL: " + builder.toUriString(), ex);
} }
final BodyBuilder requestBuilder = RequestEntity.method(method, uri); final BodyBuilder requestBuilder = RequestEntity.method(method, uri);
if(accept != null) { if (accept != null) {
requestBuilder.accept(accept.toArray(new MediaType[accept.size()])); requestBuilder.accept(accept.toArray(new MediaType[accept.size()]));
} }
if(contentType != null) { if (contentType != null) {
requestBuilder.contentType(contentType); requestBuilder.contentType(contentType);
} }
@@ -662,7 +681,7 @@ public class ApiClient extends JavaTimeFormatter {
protected void addHeadersToRequest(HttpHeaders headers, BodyBuilder requestBuilder) { protected void addHeadersToRequest(HttpHeaders headers, BodyBuilder requestBuilder) {
for (Entry<String, List<String>> entry : headers.entrySet()) { for (Entry<String, List<String>> entry : headers.entrySet()) {
List<String> values = entry.getValue(); List<String> values = entry.getValue();
for(String value : values) { for (String value : values) {
if (value != null) { if (value != null) {
requestBuilder.header(entry.getKey(), value); requestBuilder.header(entry.getKey(), value);
} }
@@ -672,7 +691,8 @@ public class ApiClient extends JavaTimeFormatter {
/** /**
* Add cookies to the request that is being built * Add cookies to the request that is being built
* @param cookies The cookies to add *
* @param cookies The cookies to add
* @param requestBuilder The current request * @param requestBuilder The current request
*/ */
protected void addCookiesToRequest(MultiValueMap<String, String> cookies, BodyBuilder requestBuilder) { protected void addCookiesToRequest(MultiValueMap<String, String> cookies, BodyBuilder requestBuilder) {
@@ -713,9 +733,9 @@ public class ApiClient extends JavaTimeFormatter {
RestTemplate restTemplate = new RestTemplate(messageConverters); RestTemplate restTemplate = new RestTemplate(messageConverters);
for(HttpMessageConverter converter:restTemplate.getMessageConverters()){ for (HttpMessageConverter converter : restTemplate.getMessageConverters()) {
if(converter instanceof AbstractJackson2HttpMessageConverter){ if (converter instanceof AbstractJackson2HttpMessageConverter){
ObjectMapper mapper = ((AbstractJackson2HttpMessageConverter)converter).getObjectMapper(); ObjectMapper mapper = ((AbstractJackson2HttpMessageConverter) converter).getObjectMapper();
ThreeTenModule module = new ThreeTenModule(); ThreeTenModule module = new ThreeTenModule();
module.addDeserializer(Instant.class, CustomInstantDeserializer.INSTANT); module.addDeserializer(Instant.class, CustomInstantDeserializer.INSTANT);
module.addDeserializer(OffsetDateTime.class, CustomInstantDeserializer.OFFSET_DATE_TIME); module.addDeserializer(OffsetDateTime.class, CustomInstantDeserializer.OFFSET_DATE_TIME);
@@ -773,9 +793,9 @@ public class ApiClient extends JavaTimeFormatter {
private String headersToString(HttpHeaders headers) { private String headersToString(HttpHeaders headers) {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
for(Entry<String, List<String>> entry : headers.entrySet()) { for (Entry<String, List<String>> entry : headers.entrySet()) {
builder.append(entry.getKey()).append("=["); builder.append(entry.getKey()).append("=[");
for(String value : entry.getValue()) { for (String value : entry.getValue()) {
builder.append(value).append(","); builder.append(value).append(",");
} }
builder.setLength(builder.length() - 1); // Get rid of trailing comma builder.setLength(builder.length() - 1); // Get rid of trailing comma

View File

@@ -94,5 +94,5 @@ public class AnotherFakeApi {
ParameterizedTypeReference<Client> returnType = new ParameterizedTypeReference<Client>() {}; ParameterizedTypeReference<Client> returnType = new ParameterizedTypeReference<Client>() {};
return apiClient.invokeAPI("/another-fake/dummy", HttpMethod.PATCH, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/another-fake/dummy", HttpMethod.PATCH, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
} }

View File

@@ -99,7 +99,7 @@ public class FakeApi {
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {}; ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI("/fake/create_xml_item", HttpMethod.POST, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/fake/create_xml_item", HttpMethod.POST, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* *
* Test serialization of outer boolean types * Test serialization of outer boolean types
@@ -140,7 +140,7 @@ public class FakeApi {
ParameterizedTypeReference<Boolean> returnType = new ParameterizedTypeReference<Boolean>() {}; ParameterizedTypeReference<Boolean> returnType = new ParameterizedTypeReference<Boolean>() {};
return apiClient.invokeAPI("/fake/outer/boolean", HttpMethod.POST, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/fake/outer/boolean", HttpMethod.POST, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* *
* Test serialization of object with outer number type * Test serialization of object with outer number type
@@ -181,7 +181,7 @@ public class FakeApi {
ParameterizedTypeReference<OuterComposite> returnType = new ParameterizedTypeReference<OuterComposite>() {}; ParameterizedTypeReference<OuterComposite> returnType = new ParameterizedTypeReference<OuterComposite>() {};
return apiClient.invokeAPI("/fake/outer/composite", HttpMethod.POST, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/fake/outer/composite", HttpMethod.POST, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* *
* Test serialization of outer number types * Test serialization of outer number types
@@ -222,7 +222,7 @@ public class FakeApi {
ParameterizedTypeReference<BigDecimal> returnType = new ParameterizedTypeReference<BigDecimal>() {}; ParameterizedTypeReference<BigDecimal> returnType = new ParameterizedTypeReference<BigDecimal>() {};
return apiClient.invokeAPI("/fake/outer/number", HttpMethod.POST, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/fake/outer/number", HttpMethod.POST, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* *
* Test serialization of outer string types * Test serialization of outer string types
@@ -263,7 +263,7 @@ public class FakeApi {
ParameterizedTypeReference<String> returnType = new ParameterizedTypeReference<String>() {}; ParameterizedTypeReference<String> returnType = new ParameterizedTypeReference<String>() {};
return apiClient.invokeAPI("/fake/outer/string", HttpMethod.POST, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/fake/outer/string", HttpMethod.POST, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* *
* 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;.
@@ -308,7 +308,7 @@ public class FakeApi {
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {}; ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI("/fake/body-with-file-schema", HttpMethod.PUT, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/fake/body-with-file-schema", HttpMethod.PUT, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* *
* *
@@ -362,7 +362,7 @@ public class FakeApi {
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {}; ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI("/fake/body-with-query-params", HttpMethod.PUT, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/fake/body-with-query-params", HttpMethod.PUT, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* To test \&quot;client\&quot; model * To test \&quot;client\&quot; model
* To test \&quot;client\&quot; model * To test \&quot;client\&quot; model
@@ -410,7 +410,7 @@ public class FakeApi {
ParameterizedTypeReference<Client> returnType = new ParameterizedTypeReference<Client>() {}; ParameterizedTypeReference<Client> returnType = new ParameterizedTypeReference<Client>() {};
return apiClient.invokeAPI("/fake", HttpMethod.PATCH, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/fake", HttpMethod.PATCH, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
@@ -527,7 +527,7 @@ public class FakeApi {
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {}; ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI("/fake", HttpMethod.POST, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/fake", HttpMethod.POST, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* To test enum parameters * To test enum parameters
* To test enum parameters * To test enum parameters
@@ -598,7 +598,7 @@ public class FakeApi {
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {}; ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI("/fake", HttpMethod.GET, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/fake", HttpMethod.GET, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* Fake endpoint to test group parameters (optional) * Fake endpoint to test group parameters (optional)
* Fake endpoint to test group parameters (optional) * Fake endpoint to test group parameters (optional)
@@ -671,7 +671,7 @@ public class FakeApi {
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {}; ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI("/fake", HttpMethod.DELETE, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/fake", HttpMethod.DELETE, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* test inline additionalProperties * test inline additionalProperties
* *
@@ -716,7 +716,7 @@ public class FakeApi {
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {}; ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI("/fake/inline-additionalProperties", HttpMethod.POST, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/fake/inline-additionalProperties", HttpMethod.POST, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* test json serialization of form data * test json serialization of form data
* *
@@ -773,7 +773,7 @@ public class FakeApi {
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {}; ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI("/fake/jsonFormData", HttpMethod.GET, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/fake/jsonFormData", HttpMethod.GET, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* *
* To test the collection format in query parameters * To test the collection format in query parameters
@@ -850,5 +850,5 @@ public class FakeApi {
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {}; ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI("/fake/test-query-paramters", HttpMethod.PUT, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/fake/test-query-paramters", HttpMethod.PUT, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
} }

View File

@@ -94,5 +94,5 @@ public class FakeClassnameTags123Api {
ParameterizedTypeReference<Client> returnType = new ParameterizedTypeReference<Client>() {}; ParameterizedTypeReference<Client> returnType = new ParameterizedTypeReference<Client>() {};
return apiClient.invokeAPI("/fake_classname_test", HttpMethod.PATCH, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/fake_classname_test", HttpMethod.PATCH, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
} }

View File

@@ -96,7 +96,7 @@ public class PetApi {
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {}; ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI("/pet", HttpMethod.POST, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/pet", HttpMethod.POST, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* Deletes a pet * Deletes a pet
* *
@@ -149,7 +149,7 @@ public class PetApi {
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {}; ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI("/pet/{petId}", HttpMethod.DELETE, uriVariables, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/pet/{petId}", HttpMethod.DELETE, uriVariables, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* Finds Pets by status * Finds Pets by status
* Multiple status values can be provided with comma separated strings * Multiple status values can be provided with comma separated strings
@@ -199,7 +199,7 @@ public class PetApi {
ParameterizedTypeReference<List<Pet>> returnType = new ParameterizedTypeReference<List<Pet>>() {}; ParameterizedTypeReference<List<Pet>> returnType = new ParameterizedTypeReference<List<Pet>>() {};
return apiClient.invokeAPI("/pet/findByStatus", HttpMethod.GET, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/pet/findByStatus", HttpMethod.GET, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* 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.
@@ -253,7 +253,7 @@ public class PetApi {
ParameterizedTypeReference<Set<Pet>> returnType = new ParameterizedTypeReference<Set<Pet>>() {}; ParameterizedTypeReference<Set<Pet>> returnType = new ParameterizedTypeReference<Set<Pet>>() {};
return apiClient.invokeAPI("/pet/findByTags", HttpMethod.GET, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/pet/findByTags", HttpMethod.GET, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* Find pet by ID * Find pet by ID
* Returns a single pet * Returns a single pet
@@ -306,7 +306,7 @@ public class PetApi {
ParameterizedTypeReference<Pet> returnType = new ParameterizedTypeReference<Pet>() {}; ParameterizedTypeReference<Pet> returnType = new ParameterizedTypeReference<Pet>() {};
return apiClient.invokeAPI("/pet/{petId}", HttpMethod.GET, uriVariables, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/pet/{petId}", HttpMethod.GET, uriVariables, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* Update an existing pet * Update an existing pet
* *
@@ -357,7 +357,7 @@ public class PetApi {
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {}; ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI("/pet", HttpMethod.PUT, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/pet", HttpMethod.PUT, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* Updates a pet in the store with form data * Updates a pet in the store with form data
* *
@@ -414,7 +414,7 @@ public class PetApi {
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {}; ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI("/pet/{petId}", HttpMethod.POST, uriVariables, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/pet/{petId}", HttpMethod.POST, uriVariables, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* uploads an image * uploads an image
* *
@@ -474,7 +474,7 @@ public class PetApi {
ParameterizedTypeReference<ModelApiResponse> returnType = new ParameterizedTypeReference<ModelApiResponse>() {}; ParameterizedTypeReference<ModelApiResponse> returnType = new ParameterizedTypeReference<ModelApiResponse>() {};
return apiClient.invokeAPI("/pet/{petId}/uploadImage", HttpMethod.POST, uriVariables, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/pet/{petId}/uploadImage", HttpMethod.POST, uriVariables, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* uploads an image (required) * uploads an image (required)
* *
@@ -539,5 +539,5 @@ public class PetApi {
ParameterizedTypeReference<ModelApiResponse> returnType = new ParameterizedTypeReference<ModelApiResponse>() {}; ParameterizedTypeReference<ModelApiResponse> returnType = new ParameterizedTypeReference<ModelApiResponse>() {};
return apiClient.invokeAPI("/fake/{petId}/uploadImageWithRequiredFile", HttpMethod.POST, uriVariables, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/fake/{petId}/uploadImageWithRequiredFile", HttpMethod.POST, uriVariables, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
} }

View File

@@ -94,7 +94,7 @@ public class StoreApi {
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {}; ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI("/store/order/{order_id}", HttpMethod.DELETE, uriVariables, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/store/order/{order_id}", HttpMethod.DELETE, uriVariables, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* Returns pet inventories by status * Returns pet inventories by status
* Returns a map of status codes to quantities * Returns a map of status codes to quantities
@@ -133,7 +133,7 @@ public class StoreApi {
ParameterizedTypeReference<Map<String, Integer>> returnType = new ParameterizedTypeReference<Map<String, Integer>>() {}; ParameterizedTypeReference<Map<String, Integer>> returnType = new ParameterizedTypeReference<Map<String, Integer>>() {};
return apiClient.invokeAPI("/store/inventory", HttpMethod.GET, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/store/inventory", HttpMethod.GET, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* 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
@@ -186,7 +186,7 @@ public class StoreApi {
ParameterizedTypeReference<Order> returnType = new ParameterizedTypeReference<Order>() {}; ParameterizedTypeReference<Order> returnType = new ParameterizedTypeReference<Order>() {};
return apiClient.invokeAPI("/store/order/{order_id}", HttpMethod.GET, uriVariables, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/store/order/{order_id}", HttpMethod.GET, uriVariables, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* Place an order for a pet * Place an order for a pet
* *
@@ -234,5 +234,5 @@ public class StoreApi {
ParameterizedTypeReference<Order> returnType = new ParameterizedTypeReference<Order>() {}; ParameterizedTypeReference<Order> returnType = new ParameterizedTypeReference<Order>() {};
return apiClient.invokeAPI("/store/order", HttpMethod.POST, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/store/order", HttpMethod.POST, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
} }

View File

@@ -89,7 +89,7 @@ public class UserApi {
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {}; ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI("/user", HttpMethod.POST, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/user", HttpMethod.POST, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* Creates list of users with given input array * Creates list of users with given input array
* *
@@ -132,7 +132,7 @@ public class UserApi {
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {}; ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI("/user/createWithArray", HttpMethod.POST, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/user/createWithArray", HttpMethod.POST, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* Creates list of users with given input array * Creates list of users with given input array
* *
@@ -175,7 +175,7 @@ public class UserApi {
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {}; ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI("/user/createWithList", HttpMethod.POST, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/user/createWithList", HttpMethod.POST, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* Delete user * Delete user
* This can only be done by the logged in user. * This can only be done by the logged in user.
@@ -223,7 +223,7 @@ public class UserApi {
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {}; ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI("/user/{username}", HttpMethod.DELETE, uriVariables, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/user/{username}", HttpMethod.DELETE, uriVariables, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* Get user by user name * Get user by user name
* *
@@ -276,7 +276,7 @@ public class UserApi {
ParameterizedTypeReference<User> returnType = new ParameterizedTypeReference<User>() {}; ParameterizedTypeReference<User> returnType = new ParameterizedTypeReference<User>() {};
return apiClient.invokeAPI("/user/{username}", HttpMethod.GET, uriVariables, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/user/{username}", HttpMethod.GET, uriVariables, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* Logs user into the system * Logs user into the system
* *
@@ -334,7 +334,7 @@ public class UserApi {
ParameterizedTypeReference<String> returnType = new ParameterizedTypeReference<String>() {}; ParameterizedTypeReference<String> returnType = new ParameterizedTypeReference<String>() {};
return apiClient.invokeAPI("/user/login", HttpMethod.GET, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/user/login", HttpMethod.GET, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* Logs out current logged in user session * Logs out current logged in user session
* *
@@ -370,7 +370,7 @@ public class UserApi {
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {}; ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI("/user/logout", HttpMethod.GET, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/user/logout", HttpMethod.GET, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* Updated user * Updated user
* This can only be done by the logged in user. * This can only be done by the logged in user.
@@ -425,5 +425,5 @@ public class UserApi {
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {}; ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI("/user/{username}", HttpMethod.PUT, uriVariables, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/user/{username}", HttpMethod.PUT, uriVariables, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
} }

View File

@@ -69,6 +69,7 @@ public class ApiClient extends JavaTimeFormatter {
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null); CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
private final String separator; private final String separator;
private CollectionFormat(String separator) { private CollectionFormat(String separator) {
this.separator = separator; this.separator = separator;
} }
@@ -125,6 +126,7 @@ public class ApiClient extends JavaTimeFormatter {
/** /**
* Get the current base path * Get the current base path
*
* @return String the base path * @return String the base path
*/ */
public String getBasePath() { public String getBasePath() {
@@ -133,6 +135,7 @@ public class ApiClient extends JavaTimeFormatter {
/** /**
* Set the base path, which should include the host * Set the base path, which should include the host
*
* @param basePath the base path * @param basePath the base path
* @return ApiClient this client * @return ApiClient this client
*/ */
@@ -143,6 +146,7 @@ public class ApiClient extends JavaTimeFormatter {
/** /**
* Get authentications (key: authentication name, value: authentication). * Get authentications (key: authentication name, value: authentication).
*
* @return Map the currently configured authentication types * @return Map the currently configured authentication types
*/ */
public Map<String, Authentication> getAuthentications() { public Map<String, Authentication> getAuthentications() {
@@ -160,81 +164,86 @@ public class ApiClient extends JavaTimeFormatter {
} }
/** /**
* 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
public void setUsername(String username) { */
for (Authentication auth : authentications.values()) { public void setUsername(String username) {
if (auth instanceof HttpBasicAuth) { for (Authentication auth : authentications.values()) {
((HttpBasicAuth) auth).setUsername(username); if (auth instanceof HttpBasicAuth) {
return; ((HttpBasicAuth) auth).setUsername(username);
} return;
}
}
throw new RuntimeException("No HTTP basic authentication configured!");
} }
throw new RuntimeException("No HTTP basic authentication configured!");
}
/** /**
* 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
*/ */
public void setPassword(String password) { public void 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;
} }
}
throw new RuntimeException("No HTTP basic authentication configured!");
} }
throw new RuntimeException("No HTTP basic authentication configured!");
}
/** /**
* 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
public void setApiKey(String apiKey) { */
for (Authentication auth : authentications.values()) { public void setApiKey(String apiKey) {
if (auth instanceof ApiKeyAuth) { for (Authentication auth : authentications.values()) {
((ApiKeyAuth) auth).setApiKey(apiKey); if (auth instanceof ApiKeyAuth) {
return; ((ApiKeyAuth) auth).setApiKey(apiKey);
} return;
}
}
throw new RuntimeException("No API key authentication configured!");
} }
throw new RuntimeException("No API key authentication configured!");
}
/** /**
* 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
public void setApiKeyPrefix(String apiKeyPrefix) { */
for (Authentication auth : authentications.values()) { public void setApiKeyPrefix(String apiKeyPrefix) {
if (auth instanceof ApiKeyAuth) { for (Authentication auth : authentications.values()) {
((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); if (auth instanceof ApiKeyAuth) {
return; ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix);
} return;
}
}
throw new RuntimeException("No API key authentication configured!");
} }
throw new RuntimeException("No API key authentication configured!");
}
/** /**
* 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
public void setAccessToken(String accessToken) { */
for (Authentication auth : authentications.values()) { public void setAccessToken(String accessToken) {
if (auth instanceof OAuth) { for (Authentication auth : authentications.values()) {
((OAuth) auth).setAccessToken(accessToken); if (auth instanceof OAuth) {
return; ((OAuth) auth).setAccessToken(accessToken);
} return;
}
}
throw new RuntimeException("No OAuth2 authentication configured!");
} }
throw new RuntimeException("No OAuth2 authentication configured!");
}
/** /**
* Set the User-Agent header's value (by adding to the default header map). * Set the User-Agent header's value (by adding to the default header map).
*
* @param userAgent the user agent string * @param userAgent the user agent string
* @return ApiClient this client * @return ApiClient this client
*/ */
@@ -246,7 +255,7 @@ public class ApiClient extends JavaTimeFormatter {
/** /**
* Add a default header. * Add a default header.
* *
* @param name The header's name * @param name The header's name
* @param value The header's value * @param value The header's value
* @return ApiClient this client * @return ApiClient this client
*/ */
@@ -261,7 +270,7 @@ public class ApiClient extends JavaTimeFormatter {
/** /**
* Add a default cookie. * Add a default cookie.
* *
* @param name The cookie's name * @param name The cookie's name
* @param value The cookie's value * @param value The cookie's value
* @return ApiClient this client * @return ApiClient this client
*/ */
@@ -275,7 +284,7 @@ public class ApiClient extends JavaTimeFormatter {
public void setDebugging(boolean debugging) { public void setDebugging(boolean debugging) {
List<ClientHttpRequestInterceptor> currentInterceptors = this.restTemplate.getInterceptors(); List<ClientHttpRequestInterceptor> currentInterceptors = this.restTemplate.getInterceptors();
if(debugging) { if (debugging) {
if (currentInterceptors == null) { if (currentInterceptors == null) {
currentInterceptors = new ArrayList<ClientHttpRequestInterceptor>(); currentInterceptors = new ArrayList<ClientHttpRequestInterceptor>();
} }
@@ -320,9 +329,9 @@ public class ApiClient extends JavaTimeFormatter {
*/ */
public ApiClient setDateFormat(DateFormat dateFormat) { public ApiClient setDateFormat(DateFormat dateFormat) {
this.dateFormat = dateFormat; this.dateFormat = dateFormat;
for(HttpMessageConverter converter:restTemplate.getMessageConverters()){ for (HttpMessageConverter converter : restTemplate.getMessageConverters()) {
if(converter instanceof AbstractJackson2HttpMessageConverter){ if (converter instanceof AbstractJackson2HttpMessageConverter) {
ObjectMapper mapper = ((AbstractJackson2HttpMessageConverter)converter).getObjectMapper(); ObjectMapper mapper = ((AbstractJackson2HttpMessageConverter) converter).getObjectMapper();
mapper.setDateFormat(dateFormat); mapper.setDateFormat(dateFormat);
} }
} }
@@ -331,6 +340,7 @@ public class ApiClient extends JavaTimeFormatter {
/** /**
* Parse the given string into Date object. * Parse the given string into Date object.
*
* @param str the string to parse * @param str the string to parse
* @return the Date parsed from the string * @return the Date parsed from the string
*/ */
@@ -344,6 +354,7 @@ public class ApiClient extends JavaTimeFormatter {
/** /**
* Format the given Date object into string. * Format the given Date object into string.
*
* @param date the date to format * @param date the date to format
* @return the formatted date as string * @return the formatted date as string
*/ */
@@ -353,6 +364,7 @@ public class ApiClient extends JavaTimeFormatter {
/** /**
* Format the given parameter object into string. * Format the given parameter object into string.
*
* @param param the object to convert * @param param the object to convert
* @return String the parameter represented as a String * @return String the parameter represented as a String
*/ */
@@ -365,8 +377,8 @@ public class ApiClient extends JavaTimeFormatter {
return formatOffsetDateTime((OffsetDateTime) param); return formatOffsetDateTime((OffsetDateTime) param);
} else if (param instanceof Collection) { } else if (param instanceof Collection) {
StringBuilder b = new StringBuilder(); StringBuilder b = new StringBuilder();
for(Object o : (Collection<?>) param) { for (Object o : (Collection<?>) param) {
if(b.length() > 0) { if (b.length() > 0) {
b.append(","); b.append(",");
} }
b.append(String.valueOf(o)); b.append(String.valueOf(o));
@@ -392,7 +404,7 @@ public class ApiClient extends JavaTimeFormatter {
} }
// collectionFormat is assumed to be "csv" by default // collectionFormat is assumed to be "csv" by default
if(collectionFormat == null) { if (collectionFormat == null) {
collectionFormat = CollectionFormat.CSV; collectionFormat = CollectionFormat.CSV;
} }
@@ -401,6 +413,7 @@ public class ApiClient extends JavaTimeFormatter {
/** /**
* Converts a parameter to a {@link MultiValueMap} for use in REST requests * Converts a parameter to a {@link MultiValueMap} for use in REST requests
*
* @param collectionFormat The format to convert to * @param collectionFormat The format to convert to
* @param name The name of the parameter * @param name The name of the parameter
* @param value The parameter's value * @param value The parameter's value
@@ -413,7 +426,7 @@ public class ApiClient extends JavaTimeFormatter {
return params; return params;
} }
if(collectionFormat == null) { if (collectionFormat == null) {
collectionFormat = CollectionFormat.CSV; collectionFormat = CollectionFormat.CSV;
} }
@@ -425,7 +438,7 @@ public class ApiClient extends JavaTimeFormatter {
return params; return params;
} }
if (valueCollection.isEmpty()){ if (valueCollection.isEmpty()) {
return params; return params;
} }
@@ -437,7 +450,7 @@ public class ApiClient extends JavaTimeFormatter {
} }
List<String> values = new ArrayList<String>(); List<String> values = new ArrayList<String>();
for(Object o : valueCollection) { for (Object o : valueCollection) {
values.add(parameterToString(o)); values.add(parameterToString(o));
} }
params.add(name, collectionFormat.collectionToString(values)); params.add(name, collectionFormat.collectionToString(values));
@@ -445,8 +458,9 @@ public class ApiClient extends JavaTimeFormatter {
return params; return params;
} }
/** /**
* Check if the given {@code String} is a JSON MIME. * Check if the given {@code String} is a JSON MIME.
*
* @param mediaType the input MediaType * @param mediaType the input MediaType
* @return boolean true if the MediaType represents JSON, false otherwise * @return boolean true if the MediaType represents JSON, false otherwise
*/ */
@@ -469,6 +483,7 @@ public class ApiClient extends JavaTimeFormatter {
* application/json * application/json
* application/json; charset=UTF8 * application/json; charset=UTF8
* APPLICATION/JSON * APPLICATION/JSON
*
* @param mediaType the input MediaType * @param mediaType the input MediaType
* @return boolean true if the MediaType represents JSON, false otherwise * @return boolean true if the MediaType represents JSON, false otherwise
*/ */
@@ -476,8 +491,9 @@ public class ApiClient extends JavaTimeFormatter {
return mediaType != null && (MediaType.APPLICATION_JSON.isCompatibleWith(mediaType) || mediaType.getSubtype().matches("^.*\\+json[;]?\\s*$")); return mediaType != null && (MediaType.APPLICATION_JSON.isCompatibleWith(mediaType) || mediaType.getSubtype().matches("^.*\\+json[;]?\\s*$"));
} }
/** /**
* Check if the given {@code String} is a Problem JSON MIME (RFC-7807). * Check if the given {@code String} is a Problem JSON MIME (RFC-7807).
*
* @param mediaType the input MediaType * @param mediaType the input MediaType
* @return boolean true if the MediaType represents Problem JSON, false otherwise * @return boolean true if the MediaType represents Problem JSON, false otherwise
*/ */
@@ -529,6 +545,7 @@ public class ApiClient extends JavaTimeFormatter {
/** /**
* Select the body to use for the request * Select the body to use for the request
*
* @param obj the body object * @param obj the body object
* @param formParams the form parameters * @param formParams the form parameters
* @param contentType the content type of the request * @param contentType the content type of the request
@@ -541,6 +558,7 @@ public class ApiClient extends JavaTimeFormatter {
/** /**
* Expand path template with variables * Expand path template with variables
*
* @param pathTemplate path template with placeholders * @param pathTemplate path template with placeholders
* @param variables variables to replace * @param variables variables to replace
* @return path with placeholders replaced by variables * @return path with placeholders replaced by variables
@@ -551,6 +569,7 @@ public class ApiClient extends JavaTimeFormatter {
/** /**
* Include queryParams in uriParams taking into account the paramName * Include queryParams in uriParams taking into account the paramName
*
* @param queryParam The query parameters * @param queryParam The query parameters
* @param uriParams The path parameters * @param uriParams The path parameters
* return templatized query string * return templatized query string
@@ -614,21 +633,21 @@ public class ApiClient extends JavaTimeFormatter {
//Append to finalUri the templatized query string like "?param1={param1Value}&....... //Append to finalUri the templatized query string like "?param1={param1Value}&.......
finalUri += "?" + queryUri; finalUri += "?" + queryUri;
} }
String expandedPath = this.expandPath(finalUri,uriParams); String expandedPath = this.expandPath(finalUri, uriParams);
final UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(basePath).path(expandedPath); final UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(basePath).path(expandedPath);
URI uri; URI uri;
try { try {
uri = new URI(builder.build().toUriString()); uri = new URI(builder.build().toUriString());
} catch(URISyntaxException ex) { } catch (URISyntaxException ex) {
throw new RestClientException("Could not build URL: " + builder.toUriString(), ex); throw new RestClientException("Could not build URL: " + builder.toUriString(), ex);
} }
final BodyBuilder requestBuilder = RequestEntity.method(method, uri); final BodyBuilder requestBuilder = RequestEntity.method(method, uri);
if(accept != null) { if (accept != null) {
requestBuilder.accept(accept.toArray(new MediaType[accept.size()])); requestBuilder.accept(accept.toArray(new MediaType[accept.size()]));
} }
if(contentType != null) { if (contentType != null) {
requestBuilder.contentType(contentType); requestBuilder.contentType(contentType);
} }
@@ -657,7 +676,7 @@ public class ApiClient extends JavaTimeFormatter {
protected void addHeadersToRequest(HttpHeaders headers, BodyBuilder requestBuilder) { protected void addHeadersToRequest(HttpHeaders headers, BodyBuilder requestBuilder) {
for (Entry<String, List<String>> entry : headers.entrySet()) { for (Entry<String, List<String>> entry : headers.entrySet()) {
List<String> values = entry.getValue(); List<String> values = entry.getValue();
for(String value : values) { for (String value : values) {
if (value != null) { if (value != null) {
requestBuilder.header(entry.getKey(), value); requestBuilder.header(entry.getKey(), value);
} }
@@ -667,7 +686,8 @@ public class ApiClient extends JavaTimeFormatter {
/** /**
* Add cookies to the request that is being built * Add cookies to the request that is being built
* @param cookies The cookies to add *
* @param cookies The cookies to add
* @param requestBuilder The current request * @param requestBuilder The current request
*/ */
protected void addCookiesToRequest(MultiValueMap<String, String> cookies, BodyBuilder requestBuilder) { protected void addCookiesToRequest(MultiValueMap<String, String> cookies, BodyBuilder requestBuilder) {
@@ -700,9 +720,9 @@ public class ApiClient extends JavaTimeFormatter {
*/ */
protected RestTemplate buildRestTemplate() { protected RestTemplate buildRestTemplate() {
RestTemplate restTemplate = new RestTemplate(); RestTemplate restTemplate = new RestTemplate();
for(HttpMessageConverter converter:restTemplate.getMessageConverters()){ for (HttpMessageConverter converter : restTemplate.getMessageConverters()) {
if(converter instanceof AbstractJackson2HttpMessageConverter){ if (converter instanceof AbstractJackson2HttpMessageConverter){
ObjectMapper mapper = ((AbstractJackson2HttpMessageConverter)converter).getObjectMapper(); ObjectMapper mapper = ((AbstractJackson2HttpMessageConverter) converter).getObjectMapper();
ThreeTenModule module = new ThreeTenModule(); ThreeTenModule module = new ThreeTenModule();
module.addDeserializer(Instant.class, CustomInstantDeserializer.INSTANT); module.addDeserializer(Instant.class, CustomInstantDeserializer.INSTANT);
module.addDeserializer(OffsetDateTime.class, CustomInstantDeserializer.OFFSET_DATE_TIME); module.addDeserializer(OffsetDateTime.class, CustomInstantDeserializer.OFFSET_DATE_TIME);
@@ -760,9 +780,9 @@ public class ApiClient extends JavaTimeFormatter {
private String headersToString(HttpHeaders headers) { private String headersToString(HttpHeaders headers) {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
for(Entry<String, List<String>> entry : headers.entrySet()) { for (Entry<String, List<String>> entry : headers.entrySet()) {
builder.append(entry.getKey()).append("=["); builder.append(entry.getKey()).append("=[");
for(String value : entry.getValue()) { for (String value : entry.getValue()) {
builder.append(value).append(","); builder.append(value).append(",");
} }
builder.setLength(builder.length() - 1); // Get rid of trailing comma builder.setLength(builder.length() - 1); // Get rid of trailing comma

View File

@@ -94,5 +94,5 @@ public class AnotherFakeApi {
ParameterizedTypeReference<Client> returnType = new ParameterizedTypeReference<Client>() {}; ParameterizedTypeReference<Client> returnType = new ParameterizedTypeReference<Client>() {};
return apiClient.invokeAPI("/another-fake/dummy", HttpMethod.PATCH, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/another-fake/dummy", HttpMethod.PATCH, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
} }

View File

@@ -99,7 +99,7 @@ public class FakeApi {
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {}; ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI("/fake/create_xml_item", HttpMethod.POST, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/fake/create_xml_item", HttpMethod.POST, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* *
* Test serialization of outer boolean types * Test serialization of outer boolean types
@@ -140,7 +140,7 @@ public class FakeApi {
ParameterizedTypeReference<Boolean> returnType = new ParameterizedTypeReference<Boolean>() {}; ParameterizedTypeReference<Boolean> returnType = new ParameterizedTypeReference<Boolean>() {};
return apiClient.invokeAPI("/fake/outer/boolean", HttpMethod.POST, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/fake/outer/boolean", HttpMethod.POST, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* *
* Test serialization of object with outer number type * Test serialization of object with outer number type
@@ -181,7 +181,7 @@ public class FakeApi {
ParameterizedTypeReference<OuterComposite> returnType = new ParameterizedTypeReference<OuterComposite>() {}; ParameterizedTypeReference<OuterComposite> returnType = new ParameterizedTypeReference<OuterComposite>() {};
return apiClient.invokeAPI("/fake/outer/composite", HttpMethod.POST, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/fake/outer/composite", HttpMethod.POST, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* *
* Test serialization of outer number types * Test serialization of outer number types
@@ -222,7 +222,7 @@ public class FakeApi {
ParameterizedTypeReference<BigDecimal> returnType = new ParameterizedTypeReference<BigDecimal>() {}; ParameterizedTypeReference<BigDecimal> returnType = new ParameterizedTypeReference<BigDecimal>() {};
return apiClient.invokeAPI("/fake/outer/number", HttpMethod.POST, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/fake/outer/number", HttpMethod.POST, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* *
* Test serialization of outer string types * Test serialization of outer string types
@@ -263,7 +263,7 @@ public class FakeApi {
ParameterizedTypeReference<String> returnType = new ParameterizedTypeReference<String>() {}; ParameterizedTypeReference<String> returnType = new ParameterizedTypeReference<String>() {};
return apiClient.invokeAPI("/fake/outer/string", HttpMethod.POST, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/fake/outer/string", HttpMethod.POST, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* *
* 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;.
@@ -308,7 +308,7 @@ public class FakeApi {
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {}; ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI("/fake/body-with-file-schema", HttpMethod.PUT, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/fake/body-with-file-schema", HttpMethod.PUT, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* *
* *
@@ -362,7 +362,7 @@ public class FakeApi {
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {}; ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI("/fake/body-with-query-params", HttpMethod.PUT, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/fake/body-with-query-params", HttpMethod.PUT, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* To test \&quot;client\&quot; model * To test \&quot;client\&quot; model
* To test \&quot;client\&quot; model * To test \&quot;client\&quot; model
@@ -410,7 +410,7 @@ public class FakeApi {
ParameterizedTypeReference<Client> returnType = new ParameterizedTypeReference<Client>() {}; ParameterizedTypeReference<Client> returnType = new ParameterizedTypeReference<Client>() {};
return apiClient.invokeAPI("/fake", HttpMethod.PATCH, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/fake", HttpMethod.PATCH, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
@@ -527,7 +527,7 @@ public class FakeApi {
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {}; ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI("/fake", HttpMethod.POST, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/fake", HttpMethod.POST, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* To test enum parameters * To test enum parameters
* To test enum parameters * To test enum parameters
@@ -598,7 +598,7 @@ public class FakeApi {
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {}; ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI("/fake", HttpMethod.GET, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/fake", HttpMethod.GET, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* Fake endpoint to test group parameters (optional) * Fake endpoint to test group parameters (optional)
* Fake endpoint to test group parameters (optional) * Fake endpoint to test group parameters (optional)
@@ -671,7 +671,7 @@ public class FakeApi {
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {}; ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI("/fake", HttpMethod.DELETE, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/fake", HttpMethod.DELETE, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* test inline additionalProperties * test inline additionalProperties
* *
@@ -716,7 +716,7 @@ public class FakeApi {
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {}; ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI("/fake/inline-additionalProperties", HttpMethod.POST, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/fake/inline-additionalProperties", HttpMethod.POST, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* test json serialization of form data * test json serialization of form data
* *
@@ -773,7 +773,7 @@ public class FakeApi {
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {}; ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI("/fake/jsonFormData", HttpMethod.GET, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/fake/jsonFormData", HttpMethod.GET, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* *
* To test the collection format in query parameters * To test the collection format in query parameters
@@ -850,5 +850,5 @@ public class FakeApi {
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {}; ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI("/fake/test-query-paramters", HttpMethod.PUT, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/fake/test-query-paramters", HttpMethod.PUT, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
} }

View File

@@ -94,5 +94,5 @@ public class FakeClassnameTags123Api {
ParameterizedTypeReference<Client> returnType = new ParameterizedTypeReference<Client>() {}; ParameterizedTypeReference<Client> returnType = new ParameterizedTypeReference<Client>() {};
return apiClient.invokeAPI("/fake_classname_test", HttpMethod.PATCH, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/fake_classname_test", HttpMethod.PATCH, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
} }

View File

@@ -96,7 +96,7 @@ public class PetApi {
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {}; ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI("/pet", HttpMethod.POST, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/pet", HttpMethod.POST, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* Deletes a pet * Deletes a pet
* *
@@ -149,7 +149,7 @@ public class PetApi {
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {}; ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI("/pet/{petId}", HttpMethod.DELETE, uriVariables, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/pet/{petId}", HttpMethod.DELETE, uriVariables, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* Finds Pets by status * Finds Pets by status
* Multiple status values can be provided with comma separated strings * Multiple status values can be provided with comma separated strings
@@ -199,7 +199,7 @@ public class PetApi {
ParameterizedTypeReference<List<Pet>> returnType = new ParameterizedTypeReference<List<Pet>>() {}; ParameterizedTypeReference<List<Pet>> returnType = new ParameterizedTypeReference<List<Pet>>() {};
return apiClient.invokeAPI("/pet/findByStatus", HttpMethod.GET, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/pet/findByStatus", HttpMethod.GET, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* 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.
@@ -253,7 +253,7 @@ public class PetApi {
ParameterizedTypeReference<Set<Pet>> returnType = new ParameterizedTypeReference<Set<Pet>>() {}; ParameterizedTypeReference<Set<Pet>> returnType = new ParameterizedTypeReference<Set<Pet>>() {};
return apiClient.invokeAPI("/pet/findByTags", HttpMethod.GET, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/pet/findByTags", HttpMethod.GET, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* Find pet by ID * Find pet by ID
* Returns a single pet * Returns a single pet
@@ -306,7 +306,7 @@ public class PetApi {
ParameterizedTypeReference<Pet> returnType = new ParameterizedTypeReference<Pet>() {}; ParameterizedTypeReference<Pet> returnType = new ParameterizedTypeReference<Pet>() {};
return apiClient.invokeAPI("/pet/{petId}", HttpMethod.GET, uriVariables, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/pet/{petId}", HttpMethod.GET, uriVariables, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* Update an existing pet * Update an existing pet
* *
@@ -357,7 +357,7 @@ public class PetApi {
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {}; ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI("/pet", HttpMethod.PUT, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/pet", HttpMethod.PUT, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* Updates a pet in the store with form data * Updates a pet in the store with form data
* *
@@ -414,7 +414,7 @@ public class PetApi {
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {}; ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI("/pet/{petId}", HttpMethod.POST, uriVariables, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/pet/{petId}", HttpMethod.POST, uriVariables, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* uploads an image * uploads an image
* *
@@ -474,7 +474,7 @@ public class PetApi {
ParameterizedTypeReference<ModelApiResponse> returnType = new ParameterizedTypeReference<ModelApiResponse>() {}; ParameterizedTypeReference<ModelApiResponse> returnType = new ParameterizedTypeReference<ModelApiResponse>() {};
return apiClient.invokeAPI("/pet/{petId}/uploadImage", HttpMethod.POST, uriVariables, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/pet/{petId}/uploadImage", HttpMethod.POST, uriVariables, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* uploads an image (required) * uploads an image (required)
* *
@@ -539,5 +539,5 @@ public class PetApi {
ParameterizedTypeReference<ModelApiResponse> returnType = new ParameterizedTypeReference<ModelApiResponse>() {}; ParameterizedTypeReference<ModelApiResponse> returnType = new ParameterizedTypeReference<ModelApiResponse>() {};
return apiClient.invokeAPI("/fake/{petId}/uploadImageWithRequiredFile", HttpMethod.POST, uriVariables, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/fake/{petId}/uploadImageWithRequiredFile", HttpMethod.POST, uriVariables, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
} }

View File

@@ -94,7 +94,7 @@ public class StoreApi {
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {}; ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI("/store/order/{order_id}", HttpMethod.DELETE, uriVariables, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/store/order/{order_id}", HttpMethod.DELETE, uriVariables, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* Returns pet inventories by status * Returns pet inventories by status
* Returns a map of status codes to quantities * Returns a map of status codes to quantities
@@ -133,7 +133,7 @@ public class StoreApi {
ParameterizedTypeReference<Map<String, Integer>> returnType = new ParameterizedTypeReference<Map<String, Integer>>() {}; ParameterizedTypeReference<Map<String, Integer>> returnType = new ParameterizedTypeReference<Map<String, Integer>>() {};
return apiClient.invokeAPI("/store/inventory", HttpMethod.GET, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/store/inventory", HttpMethod.GET, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* 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
@@ -186,7 +186,7 @@ public class StoreApi {
ParameterizedTypeReference<Order> returnType = new ParameterizedTypeReference<Order>() {}; ParameterizedTypeReference<Order> returnType = new ParameterizedTypeReference<Order>() {};
return apiClient.invokeAPI("/store/order/{order_id}", HttpMethod.GET, uriVariables, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/store/order/{order_id}", HttpMethod.GET, uriVariables, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* Place an order for a pet * Place an order for a pet
* *
@@ -234,5 +234,5 @@ public class StoreApi {
ParameterizedTypeReference<Order> returnType = new ParameterizedTypeReference<Order>() {}; ParameterizedTypeReference<Order> returnType = new ParameterizedTypeReference<Order>() {};
return apiClient.invokeAPI("/store/order", HttpMethod.POST, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/store/order", HttpMethod.POST, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
} }

View File

@@ -89,7 +89,7 @@ public class UserApi {
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {}; ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI("/user", HttpMethod.POST, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/user", HttpMethod.POST, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* Creates list of users with given input array * Creates list of users with given input array
* *
@@ -132,7 +132,7 @@ public class UserApi {
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {}; ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI("/user/createWithArray", HttpMethod.POST, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/user/createWithArray", HttpMethod.POST, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* Creates list of users with given input array * Creates list of users with given input array
* *
@@ -175,7 +175,7 @@ public class UserApi {
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {}; ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI("/user/createWithList", HttpMethod.POST, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/user/createWithList", HttpMethod.POST, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* Delete user * Delete user
* This can only be done by the logged in user. * This can only be done by the logged in user.
@@ -223,7 +223,7 @@ public class UserApi {
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {}; ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI("/user/{username}", HttpMethod.DELETE, uriVariables, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/user/{username}", HttpMethod.DELETE, uriVariables, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* Get user by user name * Get user by user name
* *
@@ -276,7 +276,7 @@ public class UserApi {
ParameterizedTypeReference<User> returnType = new ParameterizedTypeReference<User>() {}; ParameterizedTypeReference<User> returnType = new ParameterizedTypeReference<User>() {};
return apiClient.invokeAPI("/user/{username}", HttpMethod.GET, uriVariables, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/user/{username}", HttpMethod.GET, uriVariables, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* Logs user into the system * Logs user into the system
* *
@@ -334,7 +334,7 @@ public class UserApi {
ParameterizedTypeReference<String> returnType = new ParameterizedTypeReference<String>() {}; ParameterizedTypeReference<String> returnType = new ParameterizedTypeReference<String>() {};
return apiClient.invokeAPI("/user/login", HttpMethod.GET, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/user/login", HttpMethod.GET, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* Logs out current logged in user session * Logs out current logged in user session
* *
@@ -370,7 +370,7 @@ public class UserApi {
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {}; ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI("/user/logout", HttpMethod.GET, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/user/logout", HttpMethod.GET, Collections.<String, Object>emptyMap(), queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
/** /**
* Updated user * Updated user
* This can only be done by the logged in user. * This can only be done by the logged in user.
@@ -425,5 +425,5 @@ public class UserApi {
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {}; ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI("/user/{username}", HttpMethod.PUT, uriVariables, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); return apiClient.invokeAPI("/user/{username}", HttpMethod.PUT, uriVariables, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType);
} }
} }