diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/api.mustache index 757ee73e9261..2b4365bbfa2a 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/api.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/api.mustache @@ -123,7 +123,13 @@ public class {{classname}} { GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = {{#isBodyAllowed}}{{#bodyParam}}apiClient.new JacksonJsonHttpContent({{paramName}}){{/bodyParam}}{{^bodyParam}}new EmptyContent(){{/bodyParam}}{{/isBodyAllowed}}{{^isBodyAllowed}}null{{/isBodyAllowed}}; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.{{httpMethod}}, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.{{httpMethod}}, genericUrl, content); + {{#headerParams}} + if ({{paramName}} != null) { + httpRequest.getHeaders().set("{{baseName}}", {{paramName}}); + } + {{/headerParams}} + return httpRequest.execute(); }{{#bodyParam}} {{#isDeprecated}} @@ -159,7 +165,13 @@ public class {{classname}} { 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(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.{{httpMethod}}, genericUrl, content); + {{#headerParams}} + if ({{paramName}} != null) { + httpRequest.getHeaders().set("{{baseName}}", {{paramName}}); + } + {{/headerParams}} + return httpRequest.execute(); }{{/bodyParam}} {{#isDeprecated}} @@ -201,7 +213,21 @@ public class {{classname}} { GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = {{#isBodyAllowed}}{{#bodyParam}}apiClient.new JacksonJsonHttpContent({{paramName}}){{/bodyParam}}{{^bodyParam}}new EmptyContent(){{/bodyParam}}{{/isBodyAllowed}}{{^isBodyAllowed}}null{{/isBodyAllowed}}; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.{{httpMethod}}, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.{{httpMethod}}, genericUrl, content); + {{#hasHeaderParams}} + // Note: Header params passed via 'params' map are handled below + for (Map.Entry entry: params.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + // Check if this is a header parameter by name + {{#headerParams}} + if ("{{baseName}}".equals(key) && value != null) { + httpRequest.getHeaders().set(key, value); + } + {{/headerParams}} + } + {{/hasHeaderParams}} + return httpRequest.execute(); } diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/api/AnotherFakeApi.java index 89f412c47760..22f651ee1550 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/api/AnotherFakeApi.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -87,7 +87,11 @@ public HttpResponse call123testSpecialTagsForHttpResponse(@javax.annotation.Nonn GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PATCH, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PATCH, genericUrl, content); + if (uuidTest != null) { + httpRequest.getHeaders().set("uuid_test", uuidTest); + } + return httpRequest.execute(); } public HttpResponse call123testSpecialTagsForHttpResponse(@javax.annotation.Nonnull UUID uuidTest, java.io.InputStream body, String mediaType) throws IOException { @@ -106,7 +110,11 @@ public HttpResponse call123testSpecialTagsForHttpResponse(@javax.annotation.Nonn 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(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PATCH, genericUrl, content); + if (uuidTest != null) { + httpRequest.getHeaders().set("uuid_test", uuidTest); + } + return httpRequest.execute(); } public HttpResponse call123testSpecialTagsForHttpResponse(@javax.annotation.Nonnull UUID uuidTest, @javax.annotation.Nonnull Client body, Map params) throws IOException { @@ -141,7 +149,17 @@ public HttpResponse call123testSpecialTagsForHttpResponse(@javax.annotation.Nonn GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PATCH, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PATCH, genericUrl, content); + // Note: Header params passed via 'params' map are handled below + for (Map.Entry entry: params.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + // Check if this is a header parameter by name + if ("uuid_test".equals(key) && value != null) { + httpRequest.getHeaders().set(key, value); + } + } + return httpRequest.execute(); } diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/api/FakeApi.java index a3061d476aae..7ac7c4d4172a 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/api/FakeApi.java @@ -83,7 +83,8 @@ public HttpResponse createXmlItemForHttpResponse(@javax.annotation.Nonnull XmlIt GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = apiClient.new JacksonJsonHttpContent(xmlItem); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + return httpRequest.execute(); } public HttpResponse createXmlItemForHttpResponse(java.io.InputStream xmlItem, String mediaType) throws IOException { @@ -99,7 +100,8 @@ public HttpResponse createXmlItemForHttpResponse(java.io.InputStream xmlItem, St HttpContent content = xmlItem == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, xmlItem); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + return httpRequest.execute(); } public HttpResponse createXmlItemForHttpResponse(@javax.annotation.Nonnull XmlItem xmlItem, Map params) throws IOException { @@ -131,7 +133,8 @@ public HttpResponse createXmlItemForHttpResponse(@javax.annotation.Nonnull XmlIt GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = apiClient.new JacksonJsonHttpContent(xmlItem); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + return httpRequest.execute(); } @@ -169,7 +172,8 @@ public HttpResponse fakeOuterBooleanSerializeForHttpResponse(@javax.annotation.N GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + return httpRequest.execute(); } public HttpResponse fakeOuterBooleanSerializeForHttpResponse(java.io.InputStream body, String mediaType) throws IOException { @@ -182,7 +186,8 @@ public HttpResponse fakeOuterBooleanSerializeForHttpResponse(java.io.InputStream 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(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + return httpRequest.execute(); } public HttpResponse fakeOuterBooleanSerializeForHttpResponse(@javax.annotation.Nullable Boolean body, Map params) throws IOException { @@ -211,7 +216,8 @@ public HttpResponse fakeOuterBooleanSerializeForHttpResponse(@javax.annotation.N GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + return httpRequest.execute(); } @@ -249,7 +255,8 @@ public HttpResponse fakeOuterCompositeSerializeForHttpResponse(@javax.annotation GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + return httpRequest.execute(); } public HttpResponse fakeOuterCompositeSerializeForHttpResponse(java.io.InputStream body, String mediaType) throws IOException { @@ -262,7 +269,8 @@ public HttpResponse fakeOuterCompositeSerializeForHttpResponse(java.io.InputStre 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(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + return httpRequest.execute(); } public HttpResponse fakeOuterCompositeSerializeForHttpResponse(@javax.annotation.Nullable OuterComposite body, Map params) throws IOException { @@ -291,7 +299,8 @@ public HttpResponse fakeOuterCompositeSerializeForHttpResponse(@javax.annotation GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + return httpRequest.execute(); } @@ -329,7 +338,8 @@ public HttpResponse fakeOuterNumberSerializeForHttpResponse(@javax.annotation.Nu GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + return httpRequest.execute(); } public HttpResponse fakeOuterNumberSerializeForHttpResponse(java.io.InputStream body, String mediaType) throws IOException { @@ -342,7 +352,8 @@ public HttpResponse fakeOuterNumberSerializeForHttpResponse(java.io.InputStream 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(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + return httpRequest.execute(); } public HttpResponse fakeOuterNumberSerializeForHttpResponse(@javax.annotation.Nullable BigDecimal body, Map params) throws IOException { @@ -371,7 +382,8 @@ public HttpResponse fakeOuterNumberSerializeForHttpResponse(@javax.annotation.Nu GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + return httpRequest.execute(); } @@ -409,7 +421,8 @@ public HttpResponse fakeOuterStringSerializeForHttpResponse(@javax.annotation.Nu GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + return httpRequest.execute(); } public HttpResponse fakeOuterStringSerializeForHttpResponse(java.io.InputStream body, String mediaType) throws IOException { @@ -422,7 +435,8 @@ public HttpResponse fakeOuterStringSerializeForHttpResponse(java.io.InputStream 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(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + return httpRequest.execute(); } public HttpResponse fakeOuterStringSerializeForHttpResponse(@javax.annotation.Nullable String body, Map params) throws IOException { @@ -451,7 +465,8 @@ public HttpResponse fakeOuterStringSerializeForHttpResponse(@javax.annotation.Nu GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + return httpRequest.execute(); } @@ -487,7 +502,8 @@ public HttpResponse testBodyWithFileSchemaForHttpResponse(@javax.annotation.Nonn GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content); + return httpRequest.execute(); } public HttpResponse testBodyWithFileSchemaForHttpResponse(java.io.InputStream body, String mediaType) throws IOException { @@ -503,7 +519,8 @@ public HttpResponse testBodyWithFileSchemaForHttpResponse(java.io.InputStream bo 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(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content); + return httpRequest.execute(); } public HttpResponse testBodyWithFileSchemaForHttpResponse(@javax.annotation.Nonnull FileSchemaTestClass body, Map params) throws IOException { @@ -535,7 +552,8 @@ public HttpResponse testBodyWithFileSchemaForHttpResponse(@javax.annotation.Nonn GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content); + return httpRequest.execute(); } @@ -585,7 +603,8 @@ public HttpResponse testBodyWithQueryParamsForHttpResponse(@javax.annotation.Non GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content); + return httpRequest.execute(); } public HttpResponse testBodyWithQueryParamsForHttpResponse(@javax.annotation.Nonnull String query, java.io.InputStream body, String mediaType) throws IOException { @@ -615,7 +634,8 @@ public HttpResponse testBodyWithQueryParamsForHttpResponse(@javax.annotation.Non 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(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content); + return httpRequest.execute(); } public HttpResponse testBodyWithQueryParamsForHttpResponse(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull User body, Map params) throws IOException { @@ -652,7 +672,8 @@ public HttpResponse testBodyWithQueryParamsForHttpResponse(@javax.annotation.Non GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content); + return httpRequest.execute(); } @@ -696,7 +717,8 @@ public HttpResponse testClientModelForHttpResponse(@javax.annotation.Nonnull Cli GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PATCH, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PATCH, genericUrl, content); + return httpRequest.execute(); } public HttpResponse testClientModelForHttpResponse(java.io.InputStream body, String mediaType) throws IOException { @@ -712,7 +734,8 @@ public HttpResponse testClientModelForHttpResponse(java.io.InputStream body, Str 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(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PATCH, genericUrl, content); + return httpRequest.execute(); } public HttpResponse testClientModelForHttpResponse(@javax.annotation.Nonnull Client body, Map params) throws IOException { @@ -744,7 +767,8 @@ public HttpResponse testClientModelForHttpResponse(@javax.annotation.Nonnull Cli GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PATCH, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PATCH, genericUrl, content); + return httpRequest.execute(); } @@ -809,7 +833,8 @@ public HttpResponse testEndpointParametersForHttpResponse(@javax.annotation.Nonn GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = new EmptyContent(); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + return httpRequest.execute(); } public HttpResponse testEndpointParametersForHttpResponse(@javax.annotation.Nonnull BigDecimal number, @javax.annotation.Nonnull Double _double, @javax.annotation.Nonnull String patternWithoutDelimiter, @javax.annotation.Nonnull byte[] _byte, Map params) throws IOException { @@ -850,7 +875,8 @@ public HttpResponse testEndpointParametersForHttpResponse(@javax.annotation.Nonn GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = new EmptyContent(); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + return httpRequest.execute(); } @@ -934,7 +960,14 @@ public HttpResponse testEnumParametersForHttpResponse(@javax.annotation.Nullable GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content); + if (enumHeaderStringArray != null) { + httpRequest.getHeaders().set("enum_header_string_array", enumHeaderStringArray); + } + if (enumHeaderString != null) { + httpRequest.getHeaders().set("enum_header_string", enumHeaderString); + } + return httpRequest.execute(); } public HttpResponse testEnumParametersForHttpResponse(Map params) throws IOException { @@ -963,7 +996,20 @@ public HttpResponse testEnumParametersForHttpResponse(Map params GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content); + // Note: Header params passed via 'params' map are handled below + for (Map.Entry entry: params.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + // Check if this is a header parameter by name + if ("enum_header_string_array".equals(key) && value != null) { + httpRequest.getHeaders().set(key, value); + } + if ("enum_header_string".equals(key) && value != null) { + httpRequest.getHeaders().set(key, value); + } + } + return httpRequest.execute(); } @@ -1055,7 +1101,14 @@ public HttpResponse testGroupParametersForHttpResponse(@javax.annotation.Nonnull GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content); + if (requiredBooleanGroup != null) { + httpRequest.getHeaders().set("required_boolean_group", requiredBooleanGroup); + } + if (booleanGroup != null) { + httpRequest.getHeaders().set("boolean_group", booleanGroup); + } + return httpRequest.execute(); } public HttpResponse testGroupParametersForHttpResponse(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group, Map params) throws IOException { @@ -1097,7 +1150,20 @@ public HttpResponse testGroupParametersForHttpResponse(@javax.annotation.Nonnull GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content); + // Note: Header params passed via 'params' map are handled below + for (Map.Entry entry: params.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + // Check if this is a header parameter by name + if ("required_boolean_group".equals(key) && value != null) { + httpRequest.getHeaders().set(key, value); + } + if ("boolean_group".equals(key) && value != null) { + httpRequest.getHeaders().set(key, value); + } + } + return httpRequest.execute(); } @@ -1133,7 +1199,8 @@ public HttpResponse testInlineAdditionalPropertiesForHttpResponse(@javax.annotat GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = apiClient.new JacksonJsonHttpContent(param); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + return httpRequest.execute(); } public HttpResponse testInlineAdditionalPropertiesForHttpResponse(java.io.InputStream param, String mediaType) throws IOException { @@ -1149,7 +1216,8 @@ public HttpResponse testInlineAdditionalPropertiesForHttpResponse(java.io.InputS 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(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + return httpRequest.execute(); } public HttpResponse testInlineAdditionalPropertiesForHttpResponse(@javax.annotation.Nonnull Map param, Map params) throws IOException { @@ -1181,7 +1249,8 @@ public HttpResponse testInlineAdditionalPropertiesForHttpResponse(@javax.annotat GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = apiClient.new JacksonJsonHttpContent(param); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + return httpRequest.execute(); } @@ -1222,7 +1291,8 @@ public HttpResponse testJsonFormDataForHttpResponse(@javax.annotation.Nonnull St GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content); + return httpRequest.execute(); } public HttpResponse testJsonFormDataForHttpResponse(@javax.annotation.Nonnull String param, @javax.annotation.Nonnull String param2, Map params) throws IOException { @@ -1257,7 +1327,8 @@ public HttpResponse testJsonFormDataForHttpResponse(@javax.annotation.Nonnull St GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content); + return httpRequest.execute(); } @@ -1364,7 +1435,8 @@ public HttpResponse testQueryParameterCollectionFormatForHttpResponse(@javax.ann GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = new EmptyContent(); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content); + return httpRequest.execute(); } public HttpResponse testQueryParameterCollectionFormatForHttpResponse(@javax.annotation.Nonnull List pipe, @javax.annotation.Nonnull List ioutil, @javax.annotation.Nonnull List http, @javax.annotation.Nonnull List url, @javax.annotation.Nonnull List context, Map params) throws IOException { @@ -1418,7 +1490,8 @@ public HttpResponse testQueryParameterCollectionFormatForHttpResponse(@javax.ann GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = new EmptyContent(); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content); + return httpRequest.execute(); } diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java index 3e918fd103a4..171f8392839f 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -81,7 +81,8 @@ public HttpResponse testClassnameForHttpResponse(@javax.annotation.Nonnull Clien GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PATCH, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PATCH, genericUrl, content); + return httpRequest.execute(); } public HttpResponse testClassnameForHttpResponse(java.io.InputStream body, String mediaType) throws IOException { @@ -97,7 +98,8 @@ public HttpResponse testClassnameForHttpResponse(java.io.InputStream body, Strin 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(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PATCH, genericUrl, content); + return httpRequest.execute(); } public HttpResponse testClassnameForHttpResponse(@javax.annotation.Nonnull Client body, Map params) throws IOException { @@ -129,7 +131,8 @@ public HttpResponse testClassnameForHttpResponse(@javax.annotation.Nonnull Clien GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PATCH, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PATCH, genericUrl, content); + return httpRequest.execute(); } diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/api/PetApi.java index 750d187510ed..fc749592d437 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/api/PetApi.java @@ -78,7 +78,8 @@ public HttpResponse addPetForHttpResponse(@javax.annotation.Nonnull Pet body) th GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + return httpRequest.execute(); } public HttpResponse addPetForHttpResponse(java.io.InputStream body, String mediaType) throws IOException { @@ -94,7 +95,8 @@ public HttpResponse addPetForHttpResponse(java.io.InputStream body, String media 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(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + return httpRequest.execute(); } public HttpResponse addPetForHttpResponse(@javax.annotation.Nonnull Pet body, Map params) throws IOException { @@ -126,7 +128,8 @@ public HttpResponse addPetForHttpResponse(@javax.annotation.Nonnull Pet body, Ma GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + return httpRequest.execute(); } @@ -168,7 +171,11 @@ public HttpResponse deletePetForHttpResponse(@javax.annotation.Nonnull Long petI GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content); + if (apiKey != null) { + httpRequest.getHeaders().set("api_key", apiKey); + } + return httpRequest.execute(); } public HttpResponse deletePetForHttpResponse(@javax.annotation.Nonnull Long petId, Map params) throws IOException { @@ -203,7 +210,17 @@ public HttpResponse deletePetForHttpResponse(@javax.annotation.Nonnull Long petI GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content); + // Note: Header params passed via 'params' map are handled below + for (Map.Entry entry: params.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + // Check if this is a header parameter by name + if ("api_key".equals(key) && value != null) { + httpRequest.getHeaders().set(key, value); + } + } + return httpRequest.execute(); } @@ -260,7 +277,8 @@ public HttpResponse findPetsByStatusForHttpResponse(@javax.annotation.Nonnull Li GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content); + return httpRequest.execute(); } public HttpResponse findPetsByStatusForHttpResponse(@javax.annotation.Nonnull List status, Map params) throws IOException { @@ -294,7 +312,8 @@ public HttpResponse findPetsByStatusForHttpResponse(@javax.annotation.Nonnull Li GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content); + return httpRequest.execute(); } @@ -358,7 +377,8 @@ public HttpResponse findPetsByTagsForHttpResponse(@javax.annotation.Nonnull Set< GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content); + return httpRequest.execute(); } @Deprecated @@ -393,7 +413,8 @@ public HttpResponse findPetsByTagsForHttpResponse(@javax.annotation.Nonnull Set< GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content); + return httpRequest.execute(); } @@ -444,7 +465,8 @@ public HttpResponse getPetByIdForHttpResponse(@javax.annotation.Nonnull Long pet GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content); + return httpRequest.execute(); } public HttpResponse getPetByIdForHttpResponse(@javax.annotation.Nonnull Long petId, Map params) throws IOException { @@ -479,7 +501,8 @@ public HttpResponse getPetByIdForHttpResponse(@javax.annotation.Nonnull Long pet GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content); + return httpRequest.execute(); } @@ -521,7 +544,8 @@ public HttpResponse updatePetForHttpResponse(@javax.annotation.Nonnull Pet body) GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content); + return httpRequest.execute(); } public HttpResponse updatePetForHttpResponse(java.io.InputStream body, String mediaType) throws IOException { @@ -537,7 +561,8 @@ public HttpResponse updatePetForHttpResponse(java.io.InputStream body, String me 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(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content); + return httpRequest.execute(); } public HttpResponse updatePetForHttpResponse(@javax.annotation.Nonnull Pet body, Map params) throws IOException { @@ -569,7 +594,8 @@ public HttpResponse updatePetForHttpResponse(@javax.annotation.Nonnull Pet body, GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content); + return httpRequest.execute(); } @@ -610,7 +636,8 @@ public HttpResponse updatePetWithFormForHttpResponse(@javax.annotation.Nonnull L GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = new EmptyContent(); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + return httpRequest.execute(); } public HttpResponse updatePetWithFormForHttpResponse(@javax.annotation.Nonnull Long petId, Map params) throws IOException { @@ -645,7 +672,8 @@ public HttpResponse updatePetWithFormForHttpResponse(@javax.annotation.Nonnull L GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = new EmptyContent(); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + return httpRequest.execute(); } @@ -692,7 +720,8 @@ public HttpResponse uploadFileForHttpResponse(@javax.annotation.Nonnull Long pet GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = new EmptyContent(); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + return httpRequest.execute(); } public HttpResponse uploadFileForHttpResponse(@javax.annotation.Nonnull Long petId, Map params) throws IOException { @@ -727,7 +756,8 @@ public HttpResponse uploadFileForHttpResponse(@javax.annotation.Nonnull Long pet GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = new EmptyContent(); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + return httpRequest.execute(); } @@ -778,7 +808,8 @@ public HttpResponse uploadFileWithRequiredFileForHttpResponse(@javax.annotation. GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = new EmptyContent(); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + return httpRequest.execute(); } public HttpResponse uploadFileWithRequiredFileForHttpResponse(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, Map params) throws IOException { @@ -816,7 +847,8 @@ public HttpResponse uploadFileWithRequiredFileForHttpResponse(@javax.annotation. GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = new EmptyContent(); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + return httpRequest.execute(); } diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/api/StoreApi.java index 961d0f550a67..71f2ca5a8411 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/api/StoreApi.java @@ -80,7 +80,8 @@ public HttpResponse deleteOrderForHttpResponse(@javax.annotation.Nonnull String GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content); + return httpRequest.execute(); } public HttpResponse deleteOrderForHttpResponse(@javax.annotation.Nonnull String orderId, Map params) throws IOException { @@ -115,7 +116,8 @@ public HttpResponse deleteOrderForHttpResponse(@javax.annotation.Nonnull String GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content); + return httpRequest.execute(); } @@ -154,7 +156,8 @@ public HttpResponse getInventoryForHttpResponse() throws IOException { GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content); + return httpRequest.execute(); } public HttpResponse getInventoryForHttpResponse(Map params) throws IOException { @@ -183,7 +186,8 @@ public HttpResponse getInventoryForHttpResponse(Map params) thro GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content); + return httpRequest.execute(); } @@ -234,7 +238,8 @@ public HttpResponse getOrderByIdForHttpResponse(@javax.annotation.Nonnull Long o GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content); + return httpRequest.execute(); } public HttpResponse getOrderByIdForHttpResponse(@javax.annotation.Nonnull Long orderId, Map params) throws IOException { @@ -269,7 +274,8 @@ public HttpResponse getOrderByIdForHttpResponse(@javax.annotation.Nonnull Long o GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content); + return httpRequest.execute(); } @@ -313,7 +319,8 @@ public HttpResponse placeOrderForHttpResponse(@javax.annotation.Nonnull Order bo GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + return httpRequest.execute(); } public HttpResponse placeOrderForHttpResponse(java.io.InputStream body, String mediaType) throws IOException { @@ -329,7 +336,8 @@ public HttpResponse placeOrderForHttpResponse(java.io.InputStream body, String m 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(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + return httpRequest.execute(); } public HttpResponse placeOrderForHttpResponse(@javax.annotation.Nonnull Order body, Map params) throws IOException { @@ -361,7 +369,8 @@ public HttpResponse placeOrderForHttpResponse(@javax.annotation.Nonnull Order bo GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + return httpRequest.execute(); } diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/api/UserApi.java index c7601f126d3b..0223f9f5821a 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/api/UserApi.java @@ -76,7 +76,8 @@ public HttpResponse createUserForHttpResponse(@javax.annotation.Nonnull User bod GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + return httpRequest.execute(); } public HttpResponse createUserForHttpResponse(java.io.InputStream body, String mediaType) throws IOException { @@ -92,7 +93,8 @@ public HttpResponse createUserForHttpResponse(java.io.InputStream body, String m 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(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + return httpRequest.execute(); } public HttpResponse createUserForHttpResponse(@javax.annotation.Nonnull User body, Map params) throws IOException { @@ -124,7 +126,8 @@ public HttpResponse createUserForHttpResponse(@javax.annotation.Nonnull User bod GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + return httpRequest.execute(); } @@ -160,7 +163,8 @@ public HttpResponse createUsersWithArrayInputForHttpResponse(@javax.annotation.N GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + return httpRequest.execute(); } public HttpResponse createUsersWithArrayInputForHttpResponse(java.io.InputStream body, String mediaType) throws IOException { @@ -176,7 +180,8 @@ public HttpResponse createUsersWithArrayInputForHttpResponse(java.io.InputStream 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(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + return httpRequest.execute(); } public HttpResponse createUsersWithArrayInputForHttpResponse(@javax.annotation.Nonnull List body, Map params) throws IOException { @@ -208,7 +213,8 @@ public HttpResponse createUsersWithArrayInputForHttpResponse(@javax.annotation.N GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + return httpRequest.execute(); } @@ -244,7 +250,8 @@ public HttpResponse createUsersWithListInputForHttpResponse(@javax.annotation.No GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + return httpRequest.execute(); } public HttpResponse createUsersWithListInputForHttpResponse(java.io.InputStream body, String mediaType) throws IOException { @@ -260,7 +267,8 @@ public HttpResponse createUsersWithListInputForHttpResponse(java.io.InputStream 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(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + return httpRequest.execute(); } public HttpResponse createUsersWithListInputForHttpResponse(@javax.annotation.Nonnull List body, Map params) throws IOException { @@ -292,7 +300,8 @@ public HttpResponse createUsersWithListInputForHttpResponse(@javax.annotation.No GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + return httpRequest.execute(); } @@ -335,7 +344,8 @@ public HttpResponse deleteUserForHttpResponse(@javax.annotation.Nonnull String u GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content); + return httpRequest.execute(); } public HttpResponse deleteUserForHttpResponse(@javax.annotation.Nonnull String username, Map params) throws IOException { @@ -370,7 +380,8 @@ public HttpResponse deleteUserForHttpResponse(@javax.annotation.Nonnull String u GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content); + return httpRequest.execute(); } @@ -419,7 +430,8 @@ public HttpResponse getUserByNameForHttpResponse(@javax.annotation.Nonnull Strin GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content); + return httpRequest.execute(); } public HttpResponse getUserByNameForHttpResponse(@javax.annotation.Nonnull String username, Map params) throws IOException { @@ -454,7 +466,8 @@ public HttpResponse getUserByNameForHttpResponse(@javax.annotation.Nonnull Strin GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content); + return httpRequest.execute(); } @@ -524,7 +537,8 @@ public HttpResponse loginUserForHttpResponse(@javax.annotation.Nonnull String us GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content); + return httpRequest.execute(); } public HttpResponse loginUserForHttpResponse(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, Map params) throws IOException { @@ -563,7 +577,8 @@ public HttpResponse loginUserForHttpResponse(@javax.annotation.Nonnull String us GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content); + return httpRequest.execute(); } @@ -594,7 +609,8 @@ public HttpResponse logoutUserForHttpResponse() throws IOException { GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content); + return httpRequest.execute(); } public HttpResponse logoutUserForHttpResponse(Map params) throws IOException { @@ -623,7 +639,8 @@ public HttpResponse logoutUserForHttpResponse(Map params) throws GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content); + return httpRequest.execute(); } @@ -671,7 +688,8 @@ public HttpResponse updateUserForHttpResponse(@javax.annotation.Nonnull String u GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content); + return httpRequest.execute(); } public HttpResponse updateUserForHttpResponse(@javax.annotation.Nonnull String username, java.io.InputStream body, String mediaType) throws IOException { @@ -693,7 +711,8 @@ public HttpResponse updateUserForHttpResponse(@javax.annotation.Nonnull String u 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(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content); + return httpRequest.execute(); } public HttpResponse updateUserForHttpResponse(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User body, Map params) throws IOException { @@ -731,7 +750,8 @@ public HttpResponse updateUserForHttpResponse(@javax.annotation.Nonnull String u GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content); + return httpRequest.execute(); }