forked from loafle/openapi-generator-original
[Java][google-api-client] Fix bug with empty POST request not sending content-type (#7787)
* Add overloaded method to take an InputStream for the request body, and fix a bug with collections * Use fully qualified name for InputStream to avoid potential conflicts * Add support for Input Stream choosing content type, and fix a bug * Ensure GET requests send an empty request body!
This commit is contained in:
parent
cf8d8d56fb
commit
4eeb974cb6
@ -8,8 +8,10 @@ import {{invokerPackage}}.ApiClient;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.google.api.client.http.GenericUrl;
|
||||
import com.google.api.client.http.HttpContent;
|
||||
import com.google.api.client.http.InputStreamContent;
|
||||
import com.google.api.client.http.HttpMethods;
|
||||
import com.google.api.client.http.HttpResponse;
|
||||
import com.google.api.client.json.Json;
|
||||
|
||||
import javax.ws.rs.core.UriBuilder;
|
||||
import java.io.IOException;
|
||||
@ -91,15 +93,56 @@ public class {{classname}} {
|
||||
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "{{{path}}}");{{#hasQueryParams}}
|
||||
{{#queryParams}}
|
||||
if ({{paramName}} != null) {
|
||||
uriBuilder = uriBuilder.queryParam("{{baseName}}", {{paramName}});
|
||||
String key = "{{baseName}}";
|
||||
Object value = {{paramName}};
|
||||
if (value instanceof Collection) {
|
||||
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
|
||||
} else if (value instanceof Object[]) {
|
||||
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
|
||||
} else {
|
||||
uriBuilder = uriBuilder.queryParam(key, value);
|
||||
}
|
||||
}{{/queryParams}}{{/hasQueryParams}}
|
||||
|
||||
String url = uriBuilder{{#hasPathParams}}.buildFromMap(uriVariables).toString();{{/hasPathParams}}{{^hasPathParams}}.build().toString();{{/hasPathParams}}
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = {{#bodyParam}}{{paramName}} == null ? null : apiClient.new JacksonJsonHttpContent({{paramName}}){{/bodyParam}}{{^bodyParam}}null{{/bodyParam}};
|
||||
HttpContent content = {{#isBodyAllowed}}apiClient.new JacksonJsonHttpContent({{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}){{/isBodyAllowed}}{{^isBodyAllowed}}null{{/isBodyAllowed}};
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.{{httpMethod}}, genericUrl, content).execute();
|
||||
}
|
||||
}{{#bodyParam}}
|
||||
|
||||
public HttpResponse {{operationId}}ForHttpResponse({{#allParams}}{{#isBodyParam}}java.io.InputStream {{paramName}}{{/isBodyParam}}{{^isBodyParam}}{{{dataType}}} {{paramName}}{{/isBodyParam}}{{#hasMore}}, {{/hasMore}}{{/allParams}}, String mediaType) throws IOException {
|
||||
{{#allParams}}{{#required}}// verify the required parameter '{{paramName}}' is set
|
||||
if ({{paramName}} == null) {
|
||||
throw new IllegalArgumentException("Missing the required parameter '{{paramName}}' when calling {{operationId}}");
|
||||
}{{/required}}{{/allParams}}
|
||||
{{#hasPathParams}}
|
||||
// create a map of path variables
|
||||
final Map<String, Object> uriVariables = new HashMap<String, Object>();{{#pathParams}}
|
||||
uriVariables.put("{{baseName}}", {{{paramName}}});{{/pathParams}}
|
||||
{{/hasPathParams}}
|
||||
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "{{{path}}}");{{#hasQueryParams}}
|
||||
{{#queryParams}}
|
||||
if ({{paramName}} != null) {
|
||||
String key = "{{baseName}}";
|
||||
Object value = {{paramName}};
|
||||
if (value instanceof Collection) {
|
||||
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
|
||||
} else if (value instanceof Object[]) {
|
||||
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
|
||||
} else {
|
||||
uriBuilder = uriBuilder.queryParam(key, value);
|
||||
}
|
||||
}{{/queryParams}}{{/hasQueryParams}}
|
||||
|
||||
String url = uriBuilder{{#hasPathParams}}.buildFromMap(uriVariables).toString();{{/hasPathParams}}{{^hasPathParams}}.build().toString();{{/hasPathParams}}
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = {{#bodyParam}}{{paramName}} == null ?
|
||||
apiClient.new JacksonJsonHttpContent(null) :
|
||||
new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, {{paramName}}){{/bodyParam}};
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.{{httpMethod}}, genericUrl, content).execute();
|
||||
}{{/bodyParam}}
|
||||
|
||||
public HttpResponse {{operationId}}ForHttpResponse({{#bodyParam}}{{^required}}{{{dataType}}} {{paramName}}, {{/required}}{{/bodyParam}}{{#requiredParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/requiredParams}}{{#hasRequiredParams}}, {{/hasRequiredParams}}Map<String, Object> params) throws IOException {
|
||||
{{#allParams}}{{#required}}// verify the required parameter '{{paramName}}' is set
|
||||
@ -125,6 +168,8 @@ public class {{classname}} {
|
||||
if (key != null && value != null) {
|
||||
if (value instanceof Collection) {
|
||||
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
|
||||
} else if (value instanceof Object[]) {
|
||||
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
|
||||
} else {
|
||||
uriBuilder = uriBuilder.queryParam(key, value);
|
||||
}
|
||||
@ -134,7 +179,7 @@ public class {{classname}} {
|
||||
String url = uriBuilder{{#hasPathParams}}.buildFromMap(uriVariables).toString();{{/hasPathParams}}{{^hasPathParams}}.build().toString();{{/hasPathParams}}
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = {{#bodyParam}}{{paramName}} == null ? null : apiClient.new JacksonJsonHttpContent({{paramName}}){{/bodyParam}}{{^bodyParam}}null{{/bodyParam}};
|
||||
HttpContent content = {{#isBodyAllowed}}apiClient.new JacksonJsonHttpContent({{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}){{/isBodyAllowed}}{{^isBodyAllowed}}null{{/isBodyAllowed}};
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.{{httpMethod}}, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
|
@ -7,8 +7,10 @@ import io.swagger.client.model.Client;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.google.api.client.http.GenericUrl;
|
||||
import com.google.api.client.http.HttpContent;
|
||||
import com.google.api.client.http.InputStreamContent;
|
||||
import com.google.api.client.http.HttpMethods;
|
||||
import com.google.api.client.http.HttpResponse;
|
||||
import com.google.api.client.json.Json;
|
||||
|
||||
import javax.ws.rs.core.UriBuilder;
|
||||
import java.io.IOException;
|
||||
@ -77,10 +79,26 @@ public class AnotherFakeApi {
|
||||
String url = uriBuilder.build().toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
|
||||
HttpContent content = apiClient.new JacksonJsonHttpContent(body);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PATCH, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
public HttpResponse testSpecialTagsForHttpResponse(java.io.InputStream body, String mediaType) throws IOException {
|
||||
// verify the required parameter 'body' is set
|
||||
if (body == null) {
|
||||
throw new IllegalArgumentException("Missing the required parameter 'body' when calling testSpecialTags");
|
||||
}
|
||||
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/another-fake/dummy");
|
||||
|
||||
String url = uriBuilder.build().toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = body == null ?
|
||||
apiClient.new JacksonJsonHttpContent(null) :
|
||||
new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PATCH, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
public HttpResponse testSpecialTagsForHttpResponse(Client body, Map<String, Object> params) throws IOException {
|
||||
// verify the required parameter 'body' is set
|
||||
if (body == null) {
|
||||
@ -98,6 +116,8 @@ public class AnotherFakeApi {
|
||||
if (key != null && value != null) {
|
||||
if (value instanceof Collection) {
|
||||
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
|
||||
} else if (value instanceof Object[]) {
|
||||
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
|
||||
} else {
|
||||
uriBuilder = uriBuilder.queryParam(key, value);
|
||||
}
|
||||
@ -107,7 +127,7 @@ public class AnotherFakeApi {
|
||||
String url = uriBuilder.build().toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
|
||||
HttpContent content = apiClient.new JacksonJsonHttpContent(body);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PATCH, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
|
@ -11,8 +11,10 @@ import io.swagger.client.model.OuterComposite;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.google.api.client.http.GenericUrl;
|
||||
import com.google.api.client.http.HttpContent;
|
||||
import com.google.api.client.http.InputStreamContent;
|
||||
import com.google.api.client.http.HttpMethods;
|
||||
import com.google.api.client.http.HttpResponse;
|
||||
import com.google.api.client.json.Json;
|
||||
|
||||
import javax.ws.rs.core.UriBuilder;
|
||||
import java.io.IOException;
|
||||
@ -75,10 +77,23 @@ public class FakeApi {
|
||||
String url = uriBuilder.build().toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
|
||||
HttpContent content = apiClient.new JacksonJsonHttpContent(body);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
public HttpResponse fakeOuterBooleanSerializeForHttpResponse(java.io.InputStream body, String mediaType) throws IOException {
|
||||
|
||||
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/outer/boolean");
|
||||
|
||||
String url = uriBuilder.build().toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = body == null ?
|
||||
apiClient.new JacksonJsonHttpContent(null) :
|
||||
new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
public HttpResponse fakeOuterBooleanSerializeForHttpResponse(Boolean body, Map<String, Object> params) throws IOException {
|
||||
|
||||
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/outer/boolean");
|
||||
@ -93,6 +108,8 @@ public class FakeApi {
|
||||
if (key != null && value != null) {
|
||||
if (value instanceof Collection) {
|
||||
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
|
||||
} else if (value instanceof Object[]) {
|
||||
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
|
||||
} else {
|
||||
uriBuilder = uriBuilder.queryParam(key, value);
|
||||
}
|
||||
@ -102,7 +119,7 @@ public class FakeApi {
|
||||
String url = uriBuilder.build().toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
|
||||
HttpContent content = apiClient.new JacksonJsonHttpContent(body);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
@ -140,10 +157,23 @@ public class FakeApi {
|
||||
String url = uriBuilder.build().toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
|
||||
HttpContent content = apiClient.new JacksonJsonHttpContent(body);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
public HttpResponse fakeOuterCompositeSerializeForHttpResponse(java.io.InputStream body, String mediaType) throws IOException {
|
||||
|
||||
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/outer/composite");
|
||||
|
||||
String url = uriBuilder.build().toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = body == null ?
|
||||
apiClient.new JacksonJsonHttpContent(null) :
|
||||
new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
public HttpResponse fakeOuterCompositeSerializeForHttpResponse(OuterComposite body, Map<String, Object> params) throws IOException {
|
||||
|
||||
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/outer/composite");
|
||||
@ -158,6 +188,8 @@ public class FakeApi {
|
||||
if (key != null && value != null) {
|
||||
if (value instanceof Collection) {
|
||||
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
|
||||
} else if (value instanceof Object[]) {
|
||||
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
|
||||
} else {
|
||||
uriBuilder = uriBuilder.queryParam(key, value);
|
||||
}
|
||||
@ -167,7 +199,7 @@ public class FakeApi {
|
||||
String url = uriBuilder.build().toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
|
||||
HttpContent content = apiClient.new JacksonJsonHttpContent(body);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
@ -205,10 +237,23 @@ public class FakeApi {
|
||||
String url = uriBuilder.build().toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
|
||||
HttpContent content = apiClient.new JacksonJsonHttpContent(body);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
public HttpResponse fakeOuterNumberSerializeForHttpResponse(java.io.InputStream body, String mediaType) throws IOException {
|
||||
|
||||
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/outer/number");
|
||||
|
||||
String url = uriBuilder.build().toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = body == null ?
|
||||
apiClient.new JacksonJsonHttpContent(null) :
|
||||
new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
public HttpResponse fakeOuterNumberSerializeForHttpResponse(BigDecimal body, Map<String, Object> params) throws IOException {
|
||||
|
||||
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/outer/number");
|
||||
@ -223,6 +268,8 @@ public class FakeApi {
|
||||
if (key != null && value != null) {
|
||||
if (value instanceof Collection) {
|
||||
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
|
||||
} else if (value instanceof Object[]) {
|
||||
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
|
||||
} else {
|
||||
uriBuilder = uriBuilder.queryParam(key, value);
|
||||
}
|
||||
@ -232,7 +279,7 @@ public class FakeApi {
|
||||
String url = uriBuilder.build().toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
|
||||
HttpContent content = apiClient.new JacksonJsonHttpContent(body);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
@ -270,10 +317,23 @@ public class FakeApi {
|
||||
String url = uriBuilder.build().toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
|
||||
HttpContent content = apiClient.new JacksonJsonHttpContent(body);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
public HttpResponse fakeOuterStringSerializeForHttpResponse(java.io.InputStream body, String mediaType) throws IOException {
|
||||
|
||||
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/outer/string");
|
||||
|
||||
String url = uriBuilder.build().toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = body == null ?
|
||||
apiClient.new JacksonJsonHttpContent(null) :
|
||||
new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
public HttpResponse fakeOuterStringSerializeForHttpResponse(String body, Map<String, Object> params) throws IOException {
|
||||
|
||||
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/outer/string");
|
||||
@ -288,6 +348,8 @@ public class FakeApi {
|
||||
if (key != null && value != null) {
|
||||
if (value instanceof Collection) {
|
||||
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
|
||||
} else if (value instanceof Object[]) {
|
||||
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
|
||||
} else {
|
||||
uriBuilder = uriBuilder.queryParam(key, value);
|
||||
}
|
||||
@ -297,7 +359,7 @@ public class FakeApi {
|
||||
String url = uriBuilder.build().toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
|
||||
HttpContent content = apiClient.new JacksonJsonHttpContent(body);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
@ -341,10 +403,26 @@ public class FakeApi {
|
||||
String url = uriBuilder.build().toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
|
||||
HttpContent content = apiClient.new JacksonJsonHttpContent(body);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PATCH, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
public HttpResponse testClientModelForHttpResponse(java.io.InputStream body, String mediaType) throws IOException {
|
||||
// verify the required parameter 'body' is set
|
||||
if (body == null) {
|
||||
throw new IllegalArgumentException("Missing the required parameter 'body' when calling testClientModel");
|
||||
}
|
||||
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake");
|
||||
|
||||
String url = uriBuilder.build().toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = body == null ?
|
||||
apiClient.new JacksonJsonHttpContent(null) :
|
||||
new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PATCH, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
public HttpResponse testClientModelForHttpResponse(Client body, Map<String, Object> params) throws IOException {
|
||||
// verify the required parameter 'body' is set
|
||||
if (body == null) {
|
||||
@ -362,6 +440,8 @@ public class FakeApi {
|
||||
if (key != null && value != null) {
|
||||
if (value instanceof Collection) {
|
||||
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
|
||||
} else if (value instanceof Object[]) {
|
||||
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
|
||||
} else {
|
||||
uriBuilder = uriBuilder.queryParam(key, value);
|
||||
}
|
||||
@ -371,7 +451,7 @@ public class FakeApi {
|
||||
String url = uriBuilder.build().toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
|
||||
HttpContent content = apiClient.new JacksonJsonHttpContent(body);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PATCH, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
@ -436,7 +516,7 @@ public class FakeApi {
|
||||
String url = uriBuilder.build().toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = null;
|
||||
HttpContent content = apiClient.new JacksonJsonHttpContent(null);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
@ -466,6 +546,8 @@ public class FakeApi {
|
||||
if (key != null && value != null) {
|
||||
if (value instanceof Collection) {
|
||||
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
|
||||
} else if (value instanceof Object[]) {
|
||||
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
|
||||
} else {
|
||||
uriBuilder = uriBuilder.queryParam(key, value);
|
||||
}
|
||||
@ -475,7 +557,7 @@ public class FakeApi {
|
||||
String url = uriBuilder.build().toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = null;
|
||||
HttpContent content = apiClient.new JacksonJsonHttpContent(null);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
@ -515,11 +597,35 @@ public class FakeApi {
|
||||
|
||||
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake");
|
||||
if (enumQueryStringArray != null) {
|
||||
uriBuilder = uriBuilder.queryParam("enum_query_string_array", enumQueryStringArray);
|
||||
String key = "enum_query_string_array";
|
||||
Object value = enumQueryStringArray;
|
||||
if (value instanceof Collection) {
|
||||
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
|
||||
} else if (value instanceof Object[]) {
|
||||
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
|
||||
} else {
|
||||
uriBuilder = uriBuilder.queryParam(key, value);
|
||||
}
|
||||
} if (enumQueryString != null) {
|
||||
uriBuilder = uriBuilder.queryParam("enum_query_string", enumQueryString);
|
||||
String key = "enum_query_string";
|
||||
Object value = enumQueryString;
|
||||
if (value instanceof Collection) {
|
||||
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
|
||||
} else if (value instanceof Object[]) {
|
||||
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
|
||||
} else {
|
||||
uriBuilder = uriBuilder.queryParam(key, value);
|
||||
}
|
||||
} if (enumQueryInteger != null) {
|
||||
uriBuilder = uriBuilder.queryParam("enum_query_integer", enumQueryInteger);
|
||||
String key = "enum_query_integer";
|
||||
Object value = enumQueryInteger;
|
||||
if (value instanceof Collection) {
|
||||
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
|
||||
} else if (value instanceof Object[]) {
|
||||
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
|
||||
} else {
|
||||
uriBuilder = uriBuilder.queryParam(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
String url = uriBuilder.build().toString();
|
||||
@ -543,6 +649,8 @@ public class FakeApi {
|
||||
if (key != null && value != null) {
|
||||
if (value instanceof Collection) {
|
||||
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
|
||||
} else if (value instanceof Object[]) {
|
||||
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
|
||||
} else {
|
||||
uriBuilder = uriBuilder.queryParam(key, value);
|
||||
}
|
||||
@ -590,10 +698,26 @@ public class FakeApi {
|
||||
String url = uriBuilder.build().toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = param == null ? null : apiClient.new JacksonJsonHttpContent(param);
|
||||
HttpContent content = apiClient.new JacksonJsonHttpContent(param);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
public HttpResponse testInlineAdditionalPropertiesForHttpResponse(java.io.InputStream param, String mediaType) throws IOException {
|
||||
// verify the required parameter 'param' is set
|
||||
if (param == null) {
|
||||
throw new IllegalArgumentException("Missing the required parameter 'param' when calling testInlineAdditionalProperties");
|
||||
}
|
||||
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/inline-additionalProperties");
|
||||
|
||||
String url = uriBuilder.build().toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = param == null ?
|
||||
apiClient.new JacksonJsonHttpContent(null) :
|
||||
new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, param);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
public HttpResponse testInlineAdditionalPropertiesForHttpResponse(Object param, Map<String, Object> params) throws IOException {
|
||||
// verify the required parameter 'param' is set
|
||||
if (param == null) {
|
||||
@ -611,6 +735,8 @@ public class FakeApi {
|
||||
if (key != null && value != null) {
|
||||
if (value instanceof Collection) {
|
||||
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
|
||||
} else if (value instanceof Object[]) {
|
||||
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
|
||||
} else {
|
||||
uriBuilder = uriBuilder.queryParam(key, value);
|
||||
}
|
||||
@ -620,7 +746,7 @@ public class FakeApi {
|
||||
String url = uriBuilder.build().toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = param == null ? null : apiClient.new JacksonJsonHttpContent(param);
|
||||
HttpContent content = apiClient.new JacksonJsonHttpContent(param);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
@ -687,6 +813,8 @@ public class FakeApi {
|
||||
if (key != null && value != null) {
|
||||
if (value instanceof Collection) {
|
||||
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
|
||||
} else if (value instanceof Object[]) {
|
||||
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
|
||||
} else {
|
||||
uriBuilder = uriBuilder.queryParam(key, value);
|
||||
}
|
||||
|
@ -7,8 +7,10 @@ import io.swagger.client.model.Client;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.google.api.client.http.GenericUrl;
|
||||
import com.google.api.client.http.HttpContent;
|
||||
import com.google.api.client.http.InputStreamContent;
|
||||
import com.google.api.client.http.HttpMethods;
|
||||
import com.google.api.client.http.HttpResponse;
|
||||
import com.google.api.client.json.Json;
|
||||
|
||||
import javax.ws.rs.core.UriBuilder;
|
||||
import java.io.IOException;
|
||||
@ -77,10 +79,26 @@ public class FakeClassnameTags123Api {
|
||||
String url = uriBuilder.build().toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
|
||||
HttpContent content = apiClient.new JacksonJsonHttpContent(body);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PATCH, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
public HttpResponse testClassnameForHttpResponse(java.io.InputStream body, String mediaType) throws IOException {
|
||||
// verify the required parameter 'body' is set
|
||||
if (body == null) {
|
||||
throw new IllegalArgumentException("Missing the required parameter 'body' when calling testClassname");
|
||||
}
|
||||
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake_classname_test");
|
||||
|
||||
String url = uriBuilder.build().toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = body == null ?
|
||||
apiClient.new JacksonJsonHttpContent(null) :
|
||||
new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PATCH, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
public HttpResponse testClassnameForHttpResponse(Client body, Map<String, Object> params) throws IOException {
|
||||
// verify the required parameter 'body' is set
|
||||
if (body == null) {
|
||||
@ -98,6 +116,8 @@ public class FakeClassnameTags123Api {
|
||||
if (key != null && value != null) {
|
||||
if (value instanceof Collection) {
|
||||
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
|
||||
} else if (value instanceof Object[]) {
|
||||
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
|
||||
} else {
|
||||
uriBuilder = uriBuilder.queryParam(key, value);
|
||||
}
|
||||
@ -107,7 +127,7 @@ public class FakeClassnameTags123Api {
|
||||
String url = uriBuilder.build().toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
|
||||
HttpContent content = apiClient.new JacksonJsonHttpContent(body);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PATCH, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
|
@ -9,8 +9,10 @@ import io.swagger.client.model.Pet;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.google.api.client.http.GenericUrl;
|
||||
import com.google.api.client.http.HttpContent;
|
||||
import com.google.api.client.http.InputStreamContent;
|
||||
import com.google.api.client.http.HttpMethods;
|
||||
import com.google.api.client.http.HttpResponse;
|
||||
import com.google.api.client.json.Json;
|
||||
|
||||
import javax.ws.rs.core.UriBuilder;
|
||||
import java.io.IOException;
|
||||
@ -73,10 +75,26 @@ public class PetApi {
|
||||
String url = uriBuilder.build().toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
|
||||
HttpContent content = apiClient.new JacksonJsonHttpContent(body);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
public HttpResponse addPetForHttpResponse(java.io.InputStream body, String mediaType) throws IOException {
|
||||
// verify the required parameter 'body' is set
|
||||
if (body == null) {
|
||||
throw new IllegalArgumentException("Missing the required parameter 'body' when calling addPet");
|
||||
}
|
||||
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/pet");
|
||||
|
||||
String url = uriBuilder.build().toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = body == null ?
|
||||
apiClient.new JacksonJsonHttpContent(null) :
|
||||
new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
public HttpResponse addPetForHttpResponse(Pet body, Map<String, Object> params) throws IOException {
|
||||
// verify the required parameter 'body' is set
|
||||
if (body == null) {
|
||||
@ -94,6 +112,8 @@ public class PetApi {
|
||||
if (key != null && value != null) {
|
||||
if (value instanceof Collection) {
|
||||
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
|
||||
} else if (value instanceof Object[]) {
|
||||
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
|
||||
} else {
|
||||
uriBuilder = uriBuilder.queryParam(key, value);
|
||||
}
|
||||
@ -103,7 +123,7 @@ public class PetApi {
|
||||
String url = uriBuilder.build().toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
|
||||
HttpContent content = apiClient.new JacksonJsonHttpContent(body);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
@ -169,6 +189,8 @@ public class PetApi {
|
||||
if (key != null && value != null) {
|
||||
if (value instanceof Collection) {
|
||||
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
|
||||
} else if (value instanceof Object[]) {
|
||||
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
|
||||
} else {
|
||||
uriBuilder = uriBuilder.queryParam(key, value);
|
||||
}
|
||||
@ -221,7 +243,15 @@ public class PetApi {
|
||||
}
|
||||
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/pet/findByStatus");
|
||||
if (status != null) {
|
||||
uriBuilder = uriBuilder.queryParam("status", status);
|
||||
String key = "status";
|
||||
Object value = status;
|
||||
if (value instanceof Collection) {
|
||||
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
|
||||
} else if (value instanceof Object[]) {
|
||||
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
|
||||
} else {
|
||||
uriBuilder = uriBuilder.queryParam(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
String url = uriBuilder.build().toString();
|
||||
@ -250,6 +280,8 @@ public class PetApi {
|
||||
if (key != null && value != null) {
|
||||
if (value instanceof Collection) {
|
||||
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
|
||||
} else if (value instanceof Object[]) {
|
||||
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
|
||||
} else {
|
||||
uriBuilder = uriBuilder.queryParam(key, value);
|
||||
}
|
||||
@ -302,7 +334,15 @@ public class PetApi {
|
||||
}
|
||||
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/pet/findByTags");
|
||||
if (tags != null) {
|
||||
uriBuilder = uriBuilder.queryParam("tags", tags);
|
||||
String key = "tags";
|
||||
Object value = tags;
|
||||
if (value instanceof Collection) {
|
||||
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
|
||||
} else if (value instanceof Object[]) {
|
||||
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
|
||||
} else {
|
||||
uriBuilder = uriBuilder.queryParam(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
String url = uriBuilder.build().toString();
|
||||
@ -331,6 +371,8 @@ public class PetApi {
|
||||
if (key != null && value != null) {
|
||||
if (value instanceof Collection) {
|
||||
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
|
||||
} else if (value instanceof Object[]) {
|
||||
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
|
||||
} else {
|
||||
uriBuilder = uriBuilder.queryParam(key, value);
|
||||
}
|
||||
@ -415,6 +457,8 @@ public class PetApi {
|
||||
if (key != null && value != null) {
|
||||
if (value instanceof Collection) {
|
||||
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
|
||||
} else if (value instanceof Object[]) {
|
||||
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
|
||||
} else {
|
||||
uriBuilder = uriBuilder.queryParam(key, value);
|
||||
}
|
||||
@ -466,10 +510,26 @@ public class PetApi {
|
||||
String url = uriBuilder.build().toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
|
||||
HttpContent content = apiClient.new JacksonJsonHttpContent(body);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
public HttpResponse updatePetForHttpResponse(java.io.InputStream body, String mediaType) throws IOException {
|
||||
// verify the required parameter 'body' is set
|
||||
if (body == null) {
|
||||
throw new IllegalArgumentException("Missing the required parameter 'body' when calling updatePet");
|
||||
}
|
||||
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/pet");
|
||||
|
||||
String url = uriBuilder.build().toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = body == null ?
|
||||
apiClient.new JacksonJsonHttpContent(null) :
|
||||
new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
public HttpResponse updatePetForHttpResponse(Pet body, Map<String, Object> params) throws IOException {
|
||||
// verify the required parameter 'body' is set
|
||||
if (body == null) {
|
||||
@ -487,6 +547,8 @@ public class PetApi {
|
||||
if (key != null && value != null) {
|
||||
if (value instanceof Collection) {
|
||||
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
|
||||
} else if (value instanceof Object[]) {
|
||||
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
|
||||
} else {
|
||||
uriBuilder = uriBuilder.queryParam(key, value);
|
||||
}
|
||||
@ -496,7 +558,7 @@ public class PetApi {
|
||||
String url = uriBuilder.build().toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
|
||||
HttpContent content = apiClient.new JacksonJsonHttpContent(body);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
@ -539,7 +601,7 @@ public class PetApi {
|
||||
String url = uriBuilder.buildFromMap(uriVariables).toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = null;
|
||||
HttpContent content = apiClient.new JacksonJsonHttpContent(null);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
@ -563,6 +625,8 @@ public class PetApi {
|
||||
if (key != null && value != null) {
|
||||
if (value instanceof Collection) {
|
||||
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
|
||||
} else if (value instanceof Object[]) {
|
||||
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
|
||||
} else {
|
||||
uriBuilder = uriBuilder.queryParam(key, value);
|
||||
}
|
||||
@ -572,7 +636,7 @@ public class PetApi {
|
||||
String url = uriBuilder.buildFromMap(uriVariables).toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = null;
|
||||
HttpContent content = apiClient.new JacksonJsonHttpContent(null);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
@ -621,7 +685,7 @@ public class PetApi {
|
||||
String url = uriBuilder.buildFromMap(uriVariables).toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = null;
|
||||
HttpContent content = apiClient.new JacksonJsonHttpContent(null);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
@ -645,6 +709,8 @@ public class PetApi {
|
||||
if (key != null && value != null) {
|
||||
if (value instanceof Collection) {
|
||||
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
|
||||
} else if (value instanceof Object[]) {
|
||||
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
|
||||
} else {
|
||||
uriBuilder = uriBuilder.queryParam(key, value);
|
||||
}
|
||||
@ -654,7 +720,7 @@ public class PetApi {
|
||||
String url = uriBuilder.buildFromMap(uriVariables).toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = null;
|
||||
HttpContent content = apiClient.new JacksonJsonHttpContent(null);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
|
@ -7,8 +7,10 @@ import io.swagger.client.model.Order;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.google.api.client.http.GenericUrl;
|
||||
import com.google.api.client.http.HttpContent;
|
||||
import com.google.api.client.http.InputStreamContent;
|
||||
import com.google.api.client.http.HttpMethods;
|
||||
import com.google.api.client.http.HttpResponse;
|
||||
import com.google.api.client.json.Json;
|
||||
|
||||
import javax.ws.rs.core.UriBuilder;
|
||||
import java.io.IOException;
|
||||
@ -100,6 +102,8 @@ public class StoreApi {
|
||||
if (key != null && value != null) {
|
||||
if (value instanceof Collection) {
|
||||
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
|
||||
} else if (value instanceof Object[]) {
|
||||
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
|
||||
} else {
|
||||
uriBuilder = uriBuilder.queryParam(key, value);
|
||||
}
|
||||
@ -166,6 +170,8 @@ public class StoreApi {
|
||||
if (key != null && value != null) {
|
||||
if (value instanceof Collection) {
|
||||
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
|
||||
} else if (value instanceof Object[]) {
|
||||
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
|
||||
} else {
|
||||
uriBuilder = uriBuilder.queryParam(key, value);
|
||||
}
|
||||
@ -250,6 +256,8 @@ public class StoreApi {
|
||||
if (key != null && value != null) {
|
||||
if (value instanceof Collection) {
|
||||
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
|
||||
} else if (value instanceof Object[]) {
|
||||
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
|
||||
} else {
|
||||
uriBuilder = uriBuilder.queryParam(key, value);
|
||||
}
|
||||
@ -305,10 +313,26 @@ public class StoreApi {
|
||||
String url = uriBuilder.build().toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
|
||||
HttpContent content = apiClient.new JacksonJsonHttpContent(body);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
public HttpResponse placeOrderForHttpResponse(java.io.InputStream body, String mediaType) throws IOException {
|
||||
// verify the required parameter 'body' is set
|
||||
if (body == null) {
|
||||
throw new IllegalArgumentException("Missing the required parameter 'body' when calling placeOrder");
|
||||
}
|
||||
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/store/order");
|
||||
|
||||
String url = uriBuilder.build().toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = body == null ?
|
||||
apiClient.new JacksonJsonHttpContent(null) :
|
||||
new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
public HttpResponse placeOrderForHttpResponse(Order body, Map<String, Object> params) throws IOException {
|
||||
// verify the required parameter 'body' is set
|
||||
if (body == null) {
|
||||
@ -326,6 +350,8 @@ public class StoreApi {
|
||||
if (key != null && value != null) {
|
||||
if (value instanceof Collection) {
|
||||
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
|
||||
} else if (value instanceof Object[]) {
|
||||
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
|
||||
} else {
|
||||
uriBuilder = uriBuilder.queryParam(key, value);
|
||||
}
|
||||
@ -335,7 +361,7 @@ public class StoreApi {
|
||||
String url = uriBuilder.build().toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
|
||||
HttpContent content = apiClient.new JacksonJsonHttpContent(body);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
|
@ -7,8 +7,10 @@ import io.swagger.client.model.User;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.google.api.client.http.GenericUrl;
|
||||
import com.google.api.client.http.HttpContent;
|
||||
import com.google.api.client.http.InputStreamContent;
|
||||
import com.google.api.client.http.HttpMethods;
|
||||
import com.google.api.client.http.HttpResponse;
|
||||
import com.google.api.client.json.Json;
|
||||
|
||||
import javax.ws.rs.core.UriBuilder;
|
||||
import java.io.IOException;
|
||||
@ -71,10 +73,26 @@ public class UserApi {
|
||||
String url = uriBuilder.build().toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
|
||||
HttpContent content = apiClient.new JacksonJsonHttpContent(body);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
public HttpResponse createUserForHttpResponse(java.io.InputStream body, String mediaType) throws IOException {
|
||||
// verify the required parameter 'body' is set
|
||||
if (body == null) {
|
||||
throw new IllegalArgumentException("Missing the required parameter 'body' when calling createUser");
|
||||
}
|
||||
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/user");
|
||||
|
||||
String url = uriBuilder.build().toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = body == null ?
|
||||
apiClient.new JacksonJsonHttpContent(null) :
|
||||
new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
public HttpResponse createUserForHttpResponse(User body, Map<String, Object> params) throws IOException {
|
||||
// verify the required parameter 'body' is set
|
||||
if (body == null) {
|
||||
@ -92,6 +110,8 @@ public class UserApi {
|
||||
if (key != null && value != null) {
|
||||
if (value instanceof Collection) {
|
||||
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
|
||||
} else if (value instanceof Object[]) {
|
||||
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
|
||||
} else {
|
||||
uriBuilder = uriBuilder.queryParam(key, value);
|
||||
}
|
||||
@ -101,7 +121,7 @@ public class UserApi {
|
||||
String url = uriBuilder.build().toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
|
||||
HttpContent content = apiClient.new JacksonJsonHttpContent(body);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
@ -139,10 +159,26 @@ public class UserApi {
|
||||
String url = uriBuilder.build().toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
|
||||
HttpContent content = apiClient.new JacksonJsonHttpContent(body);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
public HttpResponse createUsersWithArrayInputForHttpResponse(java.io.InputStream body, String mediaType) throws IOException {
|
||||
// verify the required parameter 'body' is set
|
||||
if (body == null) {
|
||||
throw new IllegalArgumentException("Missing the required parameter 'body' when calling createUsersWithArrayInput");
|
||||
}
|
||||
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/user/createWithArray");
|
||||
|
||||
String url = uriBuilder.build().toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = body == null ?
|
||||
apiClient.new JacksonJsonHttpContent(null) :
|
||||
new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
public HttpResponse createUsersWithArrayInputForHttpResponse(List<User> body, Map<String, Object> params) throws IOException {
|
||||
// verify the required parameter 'body' is set
|
||||
if (body == null) {
|
||||
@ -160,6 +196,8 @@ public class UserApi {
|
||||
if (key != null && value != null) {
|
||||
if (value instanceof Collection) {
|
||||
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
|
||||
} else if (value instanceof Object[]) {
|
||||
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
|
||||
} else {
|
||||
uriBuilder = uriBuilder.queryParam(key, value);
|
||||
}
|
||||
@ -169,7 +207,7 @@ public class UserApi {
|
||||
String url = uriBuilder.build().toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
|
||||
HttpContent content = apiClient.new JacksonJsonHttpContent(body);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
@ -207,10 +245,26 @@ public class UserApi {
|
||||
String url = uriBuilder.build().toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
|
||||
HttpContent content = apiClient.new JacksonJsonHttpContent(body);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
public HttpResponse createUsersWithListInputForHttpResponse(java.io.InputStream body, String mediaType) throws IOException {
|
||||
// verify the required parameter 'body' is set
|
||||
if (body == null) {
|
||||
throw new IllegalArgumentException("Missing the required parameter 'body' when calling createUsersWithListInput");
|
||||
}
|
||||
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/user/createWithList");
|
||||
|
||||
String url = uriBuilder.build().toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = body == null ?
|
||||
apiClient.new JacksonJsonHttpContent(null) :
|
||||
new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
public HttpResponse createUsersWithListInputForHttpResponse(List<User> body, Map<String, Object> params) throws IOException {
|
||||
// verify the required parameter 'body' is set
|
||||
if (body == null) {
|
||||
@ -228,6 +282,8 @@ public class UserApi {
|
||||
if (key != null && value != null) {
|
||||
if (value instanceof Collection) {
|
||||
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
|
||||
} else if (value instanceof Object[]) {
|
||||
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
|
||||
} else {
|
||||
uriBuilder = uriBuilder.queryParam(key, value);
|
||||
}
|
||||
@ -237,7 +293,7 @@ public class UserApi {
|
||||
String url = uriBuilder.build().toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
|
||||
HttpContent content = apiClient.new JacksonJsonHttpContent(body);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
@ -304,6 +360,8 @@ public class UserApi {
|
||||
if (key != null && value != null) {
|
||||
if (value instanceof Collection) {
|
||||
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
|
||||
} else if (value instanceof Object[]) {
|
||||
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
|
||||
} else {
|
||||
uriBuilder = uriBuilder.queryParam(key, value);
|
||||
}
|
||||
@ -388,6 +446,8 @@ public class UserApi {
|
||||
if (key != null && value != null) {
|
||||
if (value instanceof Collection) {
|
||||
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
|
||||
} else if (value instanceof Object[]) {
|
||||
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
|
||||
} else {
|
||||
uriBuilder = uriBuilder.queryParam(key, value);
|
||||
}
|
||||
@ -445,9 +505,25 @@ public class UserApi {
|
||||
}
|
||||
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/user/login");
|
||||
if (username != null) {
|
||||
uriBuilder = uriBuilder.queryParam("username", username);
|
||||
String key = "username";
|
||||
Object value = username;
|
||||
if (value instanceof Collection) {
|
||||
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
|
||||
} else if (value instanceof Object[]) {
|
||||
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
|
||||
} else {
|
||||
uriBuilder = uriBuilder.queryParam(key, value);
|
||||
}
|
||||
} if (password != null) {
|
||||
uriBuilder = uriBuilder.queryParam("password", password);
|
||||
String key = "password";
|
||||
Object value = password;
|
||||
if (value instanceof Collection) {
|
||||
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
|
||||
} else if (value instanceof Object[]) {
|
||||
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
|
||||
} else {
|
||||
uriBuilder = uriBuilder.queryParam(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
String url = uriBuilder.build().toString();
|
||||
@ -481,6 +557,8 @@ public class UserApi {
|
||||
if (key != null && value != null) {
|
||||
if (value instanceof Collection) {
|
||||
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
|
||||
} else if (value instanceof Object[]) {
|
||||
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
|
||||
} else {
|
||||
uriBuilder = uriBuilder.queryParam(key, value);
|
||||
}
|
||||
@ -541,6 +619,8 @@ public class UserApi {
|
||||
if (key != null && value != null) {
|
||||
if (value instanceof Collection) {
|
||||
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
|
||||
} else if (value instanceof Object[]) {
|
||||
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
|
||||
} else {
|
||||
uriBuilder = uriBuilder.queryParam(key, value);
|
||||
}
|
||||
@ -598,10 +678,32 @@ public class UserApi {
|
||||
String url = uriBuilder.buildFromMap(uriVariables).toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
|
||||
HttpContent content = apiClient.new JacksonJsonHttpContent(body);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
public HttpResponse updateUserForHttpResponse(String username, java.io.InputStream body, String mediaType) throws IOException {
|
||||
// verify the required parameter 'username' is set
|
||||
if (username == null) {
|
||||
throw new IllegalArgumentException("Missing the required parameter 'username' when calling updateUser");
|
||||
}// verify the required parameter 'body' is set
|
||||
if (body == null) {
|
||||
throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateUser");
|
||||
}
|
||||
// create a map of path variables
|
||||
final Map<String, Object> uriVariables = new HashMap<String, Object>();
|
||||
uriVariables.put("username", username);
|
||||
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/user/{username}");
|
||||
|
||||
String url = uriBuilder.buildFromMap(uriVariables).toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = body == null ?
|
||||
apiClient.new JacksonJsonHttpContent(null) :
|
||||
new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
public HttpResponse updateUserForHttpResponse(String username, User body, Map<String, Object> params) throws IOException {
|
||||
// verify the required parameter 'username' is set
|
||||
if (username == null) {
|
||||
@ -625,6 +727,8 @@ public class UserApi {
|
||||
if (key != null && value != null) {
|
||||
if (value instanceof Collection) {
|
||||
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
|
||||
} else if (value instanceof Object[]) {
|
||||
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
|
||||
} else {
|
||||
uriBuilder = uriBuilder.queryParam(key, value);
|
||||
}
|
||||
@ -634,7 +738,7 @@ public class UserApi {
|
||||
String url = uriBuilder.buildFromMap(uriVariables).toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
|
||||
HttpContent content = apiClient.new JacksonJsonHttpContent(body);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user