forked from loafle/openapi-generator-original
[Java] Support cookie-based security schemas in Java clients (#4155)
* Adding cookie support and cookie-based AuthKeys to Java clients * Fix indentation * Revert accidental change * Updating samples * Fixing tests and regenerating samples
This commit is contained in:
@@ -80,6 +80,7 @@ public class ApiClient {
|
||||
}
|
||||
|
||||
private HttpHeaders defaultHeaders = new HttpHeaders();
|
||||
private MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<String, String>();
|
||||
|
||||
private String basePath = "http://petstore.swagger.io:80/v2";
|
||||
|
||||
@@ -294,6 +295,21 @@ public class ApiClient {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a default cookie.
|
||||
*
|
||||
* @param name The cookie's name
|
||||
* @param value The cookie's value
|
||||
* @return ApiClient this client
|
||||
*/
|
||||
public ApiClient addDefaultCookie(String name, String value) {
|
||||
if (defaultCookies.containsKey(name)) {
|
||||
defaultCookies.remove(name);
|
||||
}
|
||||
defaultCookies.add(name, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the date format used to parse/format date parameters.
|
||||
* @return DateFormat format
|
||||
@@ -503,8 +519,8 @@ public class ApiClient {
|
||||
* @param returnType The return type into which to deserialize the response
|
||||
* @return The response body in chosen type
|
||||
*/
|
||||
public <T> Mono<T> invokeAPI(String path, HttpMethod method, MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams, MultiValueMap<String, Object> formParams, List<MediaType> accept, MediaType contentType, String[] authNames, ParameterizedTypeReference<T> returnType) throws RestClientException {
|
||||
final WebClient.RequestBodySpec requestBuilder = prepareRequest(path, method, queryParams, body, headerParams, formParams, accept, contentType, authNames);
|
||||
public <T> Mono<T> invokeAPI(String path, HttpMethod method, MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams, MultiValueMap<String, String> cookieParams, MultiValueMap<String, Object> formParams, List<MediaType> accept, MediaType contentType, String[] authNames, ParameterizedTypeReference<T> returnType) throws RestClientException {
|
||||
final WebClient.RequestBodySpec requestBuilder = prepareRequest(path, method, queryParams, body, headerParams, cookieParams, formParams, accept, contentType, authNames);
|
||||
return requestBuilder.retrieve().bodyToMono(returnType);
|
||||
}
|
||||
|
||||
@@ -524,13 +540,13 @@ public class ApiClient {
|
||||
* @param returnType The return type into which to deserialize the response
|
||||
* @return The response body in chosen type
|
||||
*/
|
||||
public <T> Flux<T> invokeFluxAPI(String path, HttpMethod method, MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams, MultiValueMap<String, Object> formParams, List<MediaType> accept, MediaType contentType, String[] authNames, ParameterizedTypeReference<T> returnType) throws RestClientException {
|
||||
final WebClient.RequestBodySpec requestBuilder = prepareRequest(path, method, queryParams, body, headerParams, formParams, accept, contentType, authNames);
|
||||
public <T> Flux<T> invokeFluxAPI(String path, HttpMethod method, MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams, MultiValueMap<String, String> cookieParams, MultiValueMap<String, Object> formParams, List<MediaType> accept, MediaType contentType, String[] authNames, ParameterizedTypeReference<T> returnType) throws RestClientException {
|
||||
final WebClient.RequestBodySpec requestBuilder = prepareRequest(path, method, queryParams, body, headerParams, cookieParams, formParams, accept, contentType, authNames);
|
||||
return requestBuilder.retrieve().bodyToFlux(returnType);
|
||||
}
|
||||
|
||||
private WebClient.RequestBodySpec prepareRequest(String path, HttpMethod method, MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams, MultiValueMap<String, Object> formParams, List<MediaType> accept, MediaType contentType, String[] authNames) {
|
||||
updateParamsForAuth(authNames, queryParams, headerParams);
|
||||
private WebClient.RequestBodySpec prepareRequest(String path, HttpMethod method, MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams, MultiValueMap<String, String> cookieParams, MultiValueMap<String, Object> formParams, List<MediaType> accept, MediaType contentType, String[] authNames) {
|
||||
updateParamsForAuth(authNames, queryParams, headerParams, cookieParams);
|
||||
|
||||
final UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(basePath).path(path);
|
||||
if (queryParams != null) {
|
||||
@@ -559,6 +575,8 @@ public class ApiClient {
|
||||
|
||||
addHeadersToRequest(headerParams, requestBuilder);
|
||||
addHeadersToRequest(defaultHeaders, requestBuilder);
|
||||
addCookiesToRequest(cookieParams, requestBuilder);
|
||||
addCookiesToRequest(defaultCookies, requestBuilder);
|
||||
|
||||
requestBuilder.body(selectBody(body, formParams, contentType));
|
||||
return requestBuilder;
|
||||
@@ -580,20 +598,37 @@ public class ApiClient {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add cookies to the request that is being built
|
||||
* @param cookies The cookies to add
|
||||
* @param requestBuilder The current request
|
||||
*/
|
||||
protected void addCookiesToRequest(MultiValueMap<String, String> cookies, WebClient.RequestBodySpec requestBuilder) {
|
||||
for (Entry<String, List<String>> entry : cookies.entrySet()) {
|
||||
List<String> values = entry.getValue();
|
||||
for(String value : values) {
|
||||
if (value != null) {
|
||||
requestBuilder.cookie(entry.getKey(), value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update query and header parameters based on authentication settings.
|
||||
*
|
||||
* @param authNames The authentications to apply
|
||||
* @param queryParams The query parameters
|
||||
* @param headerParams The header parameters
|
||||
* @param cookieParams the cookie parameters
|
||||
*/
|
||||
private void updateParamsForAuth(String[] authNames, MultiValueMap<String, String> queryParams, HttpHeaders headerParams) {
|
||||
private void updateParamsForAuth(String[] authNames, MultiValueMap<String, String> queryParams, HttpHeaders headerParams, MultiValueMap<String, String> cookieParams) {
|
||||
for (String authName : authNames) {
|
||||
Authentication auth = authentications.get(authName);
|
||||
if (auth == null) {
|
||||
throw new RestClientException("Authentication undefined: " + authName);
|
||||
}
|
||||
auth.applyToParams(queryParams, headerParams);
|
||||
auth.applyToParams(queryParams, headerParams, cookieParams);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -62,9 +62,10 @@ public class AnotherFakeApi {
|
||||
}
|
||||
|
||||
String path = UriComponentsBuilder.fromPath("/another-fake/dummy").build().toUriString();
|
||||
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = {
|
||||
@@ -79,6 +80,6 @@ public class AnotherFakeApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<Client> returnType = new ParameterizedTypeReference<Client>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.PATCH, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.PATCH, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,9 +69,10 @@ public class FakeApi {
|
||||
}
|
||||
|
||||
String path = UriComponentsBuilder.fromPath("/fake/create_xml_item").build().toUriString();
|
||||
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = { };
|
||||
@@ -84,7 +85,7 @@ public class FakeApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
*
|
||||
@@ -98,9 +99,10 @@ public class FakeApi {
|
||||
Object postBody = body;
|
||||
|
||||
String path = UriComponentsBuilder.fromPath("/fake/outer/boolean").build().toUriString();
|
||||
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = {
|
||||
@@ -113,7 +115,7 @@ public class FakeApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<Boolean> returnType = new ParameterizedTypeReference<Boolean>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
*
|
||||
@@ -127,9 +129,10 @@ public class FakeApi {
|
||||
Object postBody = body;
|
||||
|
||||
String path = UriComponentsBuilder.fromPath("/fake/outer/composite").build().toUriString();
|
||||
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = {
|
||||
@@ -142,7 +145,7 @@ public class FakeApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<OuterComposite> returnType = new ParameterizedTypeReference<OuterComposite>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
*
|
||||
@@ -156,9 +159,10 @@ public class FakeApi {
|
||||
Object postBody = body;
|
||||
|
||||
String path = UriComponentsBuilder.fromPath("/fake/outer/number").build().toUriString();
|
||||
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = {
|
||||
@@ -171,7 +175,7 @@ public class FakeApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<BigDecimal> returnType = new ParameterizedTypeReference<BigDecimal>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
*
|
||||
@@ -185,9 +189,10 @@ public class FakeApi {
|
||||
Object postBody = body;
|
||||
|
||||
String path = UriComponentsBuilder.fromPath("/fake/outer/string").build().toUriString();
|
||||
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = {
|
||||
@@ -200,7 +205,7 @@ public class FakeApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<String> returnType = new ParameterizedTypeReference<String>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
*
|
||||
@@ -218,9 +223,10 @@ public class FakeApi {
|
||||
}
|
||||
|
||||
String path = UriComponentsBuilder.fromPath("/fake/body-with-file-schema").build().toUriString();
|
||||
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = { };
|
||||
@@ -233,7 +239,7 @@ public class FakeApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.PUT, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.PUT, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
*
|
||||
@@ -257,11 +263,12 @@ public class FakeApi {
|
||||
}
|
||||
|
||||
String path = UriComponentsBuilder.fromPath("/fake/body-with-query-params").build().toUriString();
|
||||
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "query", query));
|
||||
|
||||
final String[] accepts = { };
|
||||
@@ -274,7 +281,7 @@ public class FakeApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.PUT, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.PUT, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* To test \"client\" model
|
||||
@@ -293,9 +300,10 @@ public class FakeApi {
|
||||
}
|
||||
|
||||
String path = UriComponentsBuilder.fromPath("/fake").build().toUriString();
|
||||
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = {
|
||||
@@ -310,7 +318,7 @@ public class FakeApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<Client> returnType = new ParameterizedTypeReference<Client>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.PATCH, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.PATCH, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
@@ -357,11 +365,12 @@ public class FakeApi {
|
||||
}
|
||||
|
||||
String path = UriComponentsBuilder.fromPath("/fake").build().toUriString();
|
||||
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
|
||||
if (integer != null)
|
||||
formParams.add("integer", integer);
|
||||
if (int32 != null)
|
||||
@@ -401,7 +410,7 @@ public class FakeApi {
|
||||
String[] authNames = new String[] { "http_basic_test" };
|
||||
|
||||
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* To test enum parameters
|
||||
@@ -422,21 +431,22 @@ public class FakeApi {
|
||||
Object postBody = null;
|
||||
|
||||
String path = UriComponentsBuilder.fromPath("/fake").build().toUriString();
|
||||
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(ApiClient.CollectionFormat.valueOf("csv".toUpperCase(Locale.ROOT)), "enum_query_string_array", enumQueryStringArray));
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "enum_query_string", enumQueryString));
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "enum_query_integer", enumQueryInteger));
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "enum_query_double", enumQueryDouble));
|
||||
|
||||
|
||||
if (enumHeaderStringArray != null)
|
||||
headerParams.add("enum_header_string_array", apiClient.parameterToString(enumHeaderStringArray));
|
||||
if (enumHeaderString != null)
|
||||
headerParams.add("enum_header_string", apiClient.parameterToString(enumHeaderString));
|
||||
|
||||
|
||||
if (enumFormStringArray != null)
|
||||
formParams.add("enum_form_string_array", enumFormStringArray);
|
||||
if (enumFormString != null)
|
||||
@@ -452,7 +462,7 @@ public class FakeApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* Fake endpoint to test group parameters (optional)
|
||||
@@ -485,16 +495,17 @@ public class FakeApi {
|
||||
}
|
||||
|
||||
String path = UriComponentsBuilder.fromPath("/fake").build().toUriString();
|
||||
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "required_string_group", requiredStringGroup));
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "required_int64_group", requiredInt64Group));
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "string_group", stringGroup));
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "int64_group", int64Group));
|
||||
|
||||
|
||||
if (requiredBooleanGroup != null)
|
||||
headerParams.add("required_boolean_group", apiClient.parameterToString(requiredBooleanGroup));
|
||||
if (booleanGroup != null)
|
||||
@@ -508,7 +519,7 @@ public class FakeApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.DELETE, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.DELETE, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* test inline additionalProperties
|
||||
@@ -526,9 +537,10 @@ public class FakeApi {
|
||||
}
|
||||
|
||||
String path = UriComponentsBuilder.fromPath("/fake/inline-additionalProperties").build().toUriString();
|
||||
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = { };
|
||||
@@ -541,7 +553,7 @@ public class FakeApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* test json serialization of form data
|
||||
@@ -565,11 +577,12 @@ public class FakeApi {
|
||||
}
|
||||
|
||||
String path = UriComponentsBuilder.fromPath("/fake/jsonFormData").build().toUriString();
|
||||
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
|
||||
if (param != null)
|
||||
formParams.add("param", param);
|
||||
if (param2 != null)
|
||||
@@ -585,7 +598,7 @@ public class FakeApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
*
|
||||
@@ -627,11 +640,12 @@ public class FakeApi {
|
||||
}
|
||||
|
||||
String path = UriComponentsBuilder.fromPath("/fake/test-query-paramters").build().toUriString();
|
||||
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(ApiClient.CollectionFormat.valueOf("csv".toUpperCase(Locale.ROOT)), "pipe", pipe));
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(ApiClient.CollectionFormat.valueOf("csv".toUpperCase(Locale.ROOT)), "ioutil", ioutil));
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(ApiClient.CollectionFormat.valueOf("space".toUpperCase(Locale.ROOT)), "http", http));
|
||||
@@ -646,6 +660,6 @@ public class FakeApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.PUT, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.PUT, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,9 +62,10 @@ public class FakeClassnameTags123Api {
|
||||
}
|
||||
|
||||
String path = UriComponentsBuilder.fromPath("/fake_classname_test").build().toUriString();
|
||||
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = {
|
||||
@@ -79,6 +80,6 @@ public class FakeClassnameTags123Api {
|
||||
String[] authNames = new String[] { "api_key_query" };
|
||||
|
||||
ParameterizedTypeReference<Client> returnType = new ParameterizedTypeReference<Client>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.PATCH, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.PATCH, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,9 +64,10 @@ public class PetApi {
|
||||
}
|
||||
|
||||
String path = UriComponentsBuilder.fromPath("/pet").build().toUriString();
|
||||
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = { };
|
||||
@@ -79,7 +80,7 @@ public class PetApi {
|
||||
String[] authNames = new String[] { "petstore_auth" };
|
||||
|
||||
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* Deletes a pet
|
||||
@@ -102,11 +103,12 @@ public class PetApi {
|
||||
final Map<String, Object> uriVariables = new HashMap<String, Object>();
|
||||
uriVariables.put("petId", petId);
|
||||
String path = UriComponentsBuilder.fromPath("/pet/{petId}").buildAndExpand(uriVariables).toUriString();
|
||||
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
|
||||
if (apiKey != null)
|
||||
headerParams.add("api_key", apiClient.parameterToString(apiKey));
|
||||
|
||||
@@ -118,7 +120,7 @@ public class PetApi {
|
||||
String[] authNames = new String[] { "petstore_auth" };
|
||||
|
||||
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.DELETE, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.DELETE, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* Finds Pets by status
|
||||
@@ -138,11 +140,12 @@ public class PetApi {
|
||||
}
|
||||
|
||||
String path = UriComponentsBuilder.fromPath("/pet/findByStatus").build().toUriString();
|
||||
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(ApiClient.CollectionFormat.valueOf("csv".toUpperCase(Locale.ROOT)), "status", status));
|
||||
|
||||
final String[] accepts = {
|
||||
@@ -155,7 +158,7 @@ public class PetApi {
|
||||
String[] authNames = new String[] { "petstore_auth" };
|
||||
|
||||
ParameterizedTypeReference<Pet> returnType = new ParameterizedTypeReference<Pet>() {};
|
||||
return apiClient.invokeFluxAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeFluxAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* Finds Pets by tags
|
||||
@@ -175,11 +178,12 @@ public class PetApi {
|
||||
}
|
||||
|
||||
String path = UriComponentsBuilder.fromPath("/pet/findByTags").build().toUriString();
|
||||
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(ApiClient.CollectionFormat.valueOf("csv".toUpperCase(Locale.ROOT)), "tags", tags));
|
||||
|
||||
final String[] accepts = {
|
||||
@@ -192,7 +196,7 @@ public class PetApi {
|
||||
String[] authNames = new String[] { "petstore_auth" };
|
||||
|
||||
ParameterizedTypeReference<Pet> returnType = new ParameterizedTypeReference<Pet>() {};
|
||||
return apiClient.invokeFluxAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeFluxAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* Find pet by ID
|
||||
@@ -216,9 +220,10 @@ public class PetApi {
|
||||
final Map<String, Object> uriVariables = new HashMap<String, Object>();
|
||||
uriVariables.put("petId", petId);
|
||||
String path = UriComponentsBuilder.fromPath("/pet/{petId}").buildAndExpand(uriVariables).toUriString();
|
||||
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = {
|
||||
@@ -231,7 +236,7 @@ public class PetApi {
|
||||
String[] authNames = new String[] { "api_key" };
|
||||
|
||||
ParameterizedTypeReference<Pet> returnType = new ParameterizedTypeReference<Pet>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* Update an existing pet
|
||||
@@ -252,9 +257,10 @@ public class PetApi {
|
||||
}
|
||||
|
||||
String path = UriComponentsBuilder.fromPath("/pet").build().toUriString();
|
||||
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = { };
|
||||
@@ -267,7 +273,7 @@ public class PetApi {
|
||||
String[] authNames = new String[] { "petstore_auth" };
|
||||
|
||||
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.PUT, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.PUT, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* Updates a pet in the store with form data
|
||||
@@ -290,11 +296,12 @@ public class PetApi {
|
||||
final Map<String, Object> uriVariables = new HashMap<String, Object>();
|
||||
uriVariables.put("petId", petId);
|
||||
String path = UriComponentsBuilder.fromPath("/pet/{petId}").buildAndExpand(uriVariables).toUriString();
|
||||
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
|
||||
if (name != null)
|
||||
formParams.add("name", name);
|
||||
if (status != null)
|
||||
@@ -310,7 +317,7 @@ public class PetApi {
|
||||
String[] authNames = new String[] { "petstore_auth" };
|
||||
|
||||
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* uploads an image
|
||||
@@ -334,11 +341,12 @@ public class PetApi {
|
||||
final Map<String, Object> uriVariables = new HashMap<String, Object>();
|
||||
uriVariables.put("petId", petId);
|
||||
String path = UriComponentsBuilder.fromPath("/pet/{petId}/uploadImage").buildAndExpand(uriVariables).toUriString();
|
||||
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
|
||||
if (additionalMetadata != null)
|
||||
formParams.add("additionalMetadata", additionalMetadata);
|
||||
if (file != null)
|
||||
@@ -356,7 +364,7 @@ public class PetApi {
|
||||
String[] authNames = new String[] { "petstore_auth" };
|
||||
|
||||
ParameterizedTypeReference<ModelApiResponse> returnType = new ParameterizedTypeReference<ModelApiResponse>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* uploads an image (required)
|
||||
@@ -385,11 +393,12 @@ public class PetApi {
|
||||
final Map<String, Object> uriVariables = new HashMap<String, Object>();
|
||||
uriVariables.put("petId", petId);
|
||||
String path = UriComponentsBuilder.fromPath("/fake/{petId}/uploadImageWithRequiredFile").buildAndExpand(uriVariables).toUriString();
|
||||
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
|
||||
if (additionalMetadata != null)
|
||||
formParams.add("additionalMetadata", additionalMetadata);
|
||||
if (requiredFile != null)
|
||||
@@ -407,6 +416,6 @@ public class PetApi {
|
||||
String[] authNames = new String[] { "petstore_auth" };
|
||||
|
||||
ParameterizedTypeReference<ModelApiResponse> returnType = new ParameterizedTypeReference<ModelApiResponse>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,9 +65,10 @@ public class StoreApi {
|
||||
final Map<String, Object> uriVariables = new HashMap<String, Object>();
|
||||
uriVariables.put("order_id", orderId);
|
||||
String path = UriComponentsBuilder.fromPath("/store/order/{order_id}").buildAndExpand(uriVariables).toUriString();
|
||||
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = { };
|
||||
@@ -78,7 +79,7 @@ public class StoreApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.DELETE, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.DELETE, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* Returns pet inventories by status
|
||||
@@ -91,9 +92,10 @@ public class StoreApi {
|
||||
Object postBody = null;
|
||||
|
||||
String path = UriComponentsBuilder.fromPath("/store/inventory").build().toUriString();
|
||||
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = {
|
||||
@@ -106,7 +108,7 @@ public class StoreApi {
|
||||
String[] authNames = new String[] { "api_key" };
|
||||
|
||||
ParameterizedTypeReference<Map<String, Integer>> returnType = new ParameterizedTypeReference<Map<String, Integer>>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* Find purchase order by ID
|
||||
@@ -130,9 +132,10 @@ public class StoreApi {
|
||||
final Map<String, Object> uriVariables = new HashMap<String, Object>();
|
||||
uriVariables.put("order_id", orderId);
|
||||
String path = UriComponentsBuilder.fromPath("/store/order/{order_id}").buildAndExpand(uriVariables).toUriString();
|
||||
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = {
|
||||
@@ -145,7 +148,7 @@ public class StoreApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<Order> returnType = new ParameterizedTypeReference<Order>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* Place an order for a pet
|
||||
@@ -165,9 +168,10 @@ public class StoreApi {
|
||||
}
|
||||
|
||||
String path = UriComponentsBuilder.fromPath("/store/order").build().toUriString();
|
||||
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = {
|
||||
@@ -180,6 +184,6 @@ public class StoreApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<Order> returnType = new ParameterizedTypeReference<Order>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,9 +61,10 @@ public class UserApi {
|
||||
}
|
||||
|
||||
String path = UriComponentsBuilder.fromPath("/user").build().toUriString();
|
||||
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = { };
|
||||
@@ -74,7 +75,7 @@ public class UserApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* Creates list of users with given input array
|
||||
@@ -92,9 +93,10 @@ public class UserApi {
|
||||
}
|
||||
|
||||
String path = UriComponentsBuilder.fromPath("/user/createWithArray").build().toUriString();
|
||||
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = { };
|
||||
@@ -105,7 +107,7 @@ public class UserApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* Creates list of users with given input array
|
||||
@@ -123,9 +125,10 @@ public class UserApi {
|
||||
}
|
||||
|
||||
String path = UriComponentsBuilder.fromPath("/user/createWithList").build().toUriString();
|
||||
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = { };
|
||||
@@ -136,7 +139,7 @@ public class UserApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* Delete user
|
||||
@@ -158,9 +161,10 @@ public class UserApi {
|
||||
final Map<String, Object> uriVariables = new HashMap<String, Object>();
|
||||
uriVariables.put("username", username);
|
||||
String path = UriComponentsBuilder.fromPath("/user/{username}").buildAndExpand(uriVariables).toUriString();
|
||||
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = { };
|
||||
@@ -171,7 +175,7 @@ public class UserApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.DELETE, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.DELETE, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* Get user by user name
|
||||
@@ -195,9 +199,10 @@ public class UserApi {
|
||||
final Map<String, Object> uriVariables = new HashMap<String, Object>();
|
||||
uriVariables.put("username", username);
|
||||
String path = UriComponentsBuilder.fromPath("/user/{username}").buildAndExpand(uriVariables).toUriString();
|
||||
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = {
|
||||
@@ -210,7 +215,7 @@ public class UserApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<User> returnType = new ParameterizedTypeReference<User>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* Logs user into the system
|
||||
@@ -236,11 +241,12 @@ public class UserApi {
|
||||
}
|
||||
|
||||
String path = UriComponentsBuilder.fromPath("/user/login").build().toUriString();
|
||||
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "username", username));
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "password", password));
|
||||
|
||||
@@ -254,7 +260,7 @@ public class UserApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<String> returnType = new ParameterizedTypeReference<String>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* Logs out current logged in user session
|
||||
@@ -266,9 +272,10 @@ public class UserApi {
|
||||
Object postBody = null;
|
||||
|
||||
String path = UriComponentsBuilder.fromPath("/user/logout").build().toUriString();
|
||||
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = { };
|
||||
@@ -279,7 +286,7 @@ public class UserApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* Updated user
|
||||
@@ -307,9 +314,10 @@ public class UserApi {
|
||||
final Map<String, Object> uriVariables = new HashMap<String, Object>();
|
||||
uriVariables.put("username", username);
|
||||
String path = UriComponentsBuilder.fromPath("/user/{username}").buildAndExpand(uriVariables).toUriString();
|
||||
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = { };
|
||||
@@ -320,6 +328,6 @@ public class UserApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.PUT, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.PUT, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public class ApiKeyAuth implements Authentication {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyToParams(MultiValueMap<String, String> queryParams, HttpHeaders headerParams) {
|
||||
public void applyToParams(MultiValueMap<String, String> queryParams, HttpHeaders headerParams, MultiValueMap<String, String> cookieParams) {
|
||||
if (apiKey == null) {
|
||||
return;
|
||||
}
|
||||
@@ -55,6 +55,8 @@ public class ApiKeyAuth implements Authentication {
|
||||
queryParams.add(paramName, value);
|
||||
} else if (location.equals("header")) {
|
||||
headerParams.add(paramName, value);
|
||||
}
|
||||
} else if (location.equals("cookie")) {
|
||||
cookieParams.add(paramName, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,10 +4,11 @@ import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
|
||||
public interface Authentication {
|
||||
/**
|
||||
/**
|
||||
* Apply authentication settings to header and / or query parameters.
|
||||
* @param queryParams The query parameters for the request
|
||||
* @param queryParams The query parameters for the request
|
||||
* @param headerParams The header parameters for the request
|
||||
* @param cookieParams The cookie parameters for the request
|
||||
*/
|
||||
public void applyToParams(MultiValueMap<String, String> queryParams, HttpHeaders headerParams);
|
||||
public void applyToParams(MultiValueMap<String, String> queryParams, HttpHeaders headerParams, MultiValueMap<String, String> cookieParams);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ public class HttpBasicAuth implements Authentication {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyToParams(MultiValueMap<String, String> queryParams, HttpHeaders headerParams) {
|
||||
public void applyToParams(MultiValueMap<String, String> queryParams, HttpHeaders headerParams, MultiValueMap<String, String> cookieParams) {
|
||||
if (username == null && password == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ public class HttpBearerAuth implements Authentication {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyToParams(MultiValueMap<String, String> queryParams, HttpHeaders headerParams) {
|
||||
public void applyToParams(MultiValueMap<String, String> queryParams, HttpHeaders headerParams, MultiValueMap<String, String> cookieParams) {
|
||||
if (bearerToken == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ public class OAuth implements Authentication {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyToParams(MultiValueMap<String, String> queryParams, HttpHeaders headerParams) {
|
||||
public void applyToParams(MultiValueMap<String, String> queryParams, HttpHeaders headerParams, MultiValueMap<String, String> cookieParams) {
|
||||
if (accessToken != null) {
|
||||
headerParams.add(HttpHeaders.AUTHORIZATION, "Bearer " + accessToken);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user