mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-03 00:43:46 +00:00
Allow Java apache-httpclient users to supply additional HTTP headers per call, updated (#14929)
* Allow Java apache-httpclient users to supply additional HTTP headers per API call
* fix 'unexpected return value' problem
* make "fullJavaUtil" work
* Revert 'make "fullJavaUtil" work'
This reverts commit 60c8846.
---------
Co-authored-by: Jigar Joshi <jigarjm@gmail.com>
This commit is contained in:
@@ -24,6 +24,7 @@ import org.openapitools.client.model.Pet;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -31,6 +32,8 @@ import java.util.StringJoiner;
|
||||
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||
public class BodyApi {
|
||||
|
||||
|
||||
private ApiClient apiClient;
|
||||
|
||||
public BodyApi() {
|
||||
@@ -57,6 +60,19 @@ public class BodyApi {
|
||||
* @throws ApiException if fails to make API call
|
||||
*/
|
||||
public Pet testEchoBodyPet(Pet pet) throws ApiException {
|
||||
return this.testEchoBodyPet(pet, Collections.emptyMap());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test body parameter(s)
|
||||
* Test body parameter(s)
|
||||
* @param pet Pet object that needs to be added to the store (optional)
|
||||
* @param additionalHeaders additionalHeaders for this call
|
||||
* @return Pet
|
||||
* @throws ApiException if fails to make API call
|
||||
*/
|
||||
public Pet testEchoBodyPet(Pet pet, Map<String, String> additionalHeaders) throws ApiException {
|
||||
Object localVarPostBody = pet;
|
||||
|
||||
// create path and map variables
|
||||
@@ -71,6 +87,8 @@ public class BodyApi {
|
||||
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
|
||||
|
||||
|
||||
localVarHeaderParams.putAll(additionalHeaders);
|
||||
|
||||
|
||||
|
||||
final String[] localVarAccepts = {
|
||||
@@ -102,6 +120,7 @@ public class BodyApi {
|
||||
localVarReturnType
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test empty response body
|
||||
* Test empty response body
|
||||
@@ -110,6 +129,19 @@ public class BodyApi {
|
||||
* @throws ApiException if fails to make API call
|
||||
*/
|
||||
public String testEchoBodyPetResponseString(Pet pet) throws ApiException {
|
||||
return this.testEchoBodyPetResponseString(pet, Collections.emptyMap());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test empty response body
|
||||
* Test empty response body
|
||||
* @param pet Pet object that needs to be added to the store (optional)
|
||||
* @param additionalHeaders additionalHeaders for this call
|
||||
* @return String
|
||||
* @throws ApiException if fails to make API call
|
||||
*/
|
||||
public String testEchoBodyPetResponseString(Pet pet, Map<String, String> additionalHeaders) throws ApiException {
|
||||
Object localVarPostBody = pet;
|
||||
|
||||
// create path and map variables
|
||||
@@ -124,6 +156,8 @@ public class BodyApi {
|
||||
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
|
||||
|
||||
|
||||
localVarHeaderParams.putAll(additionalHeaders);
|
||||
|
||||
|
||||
|
||||
final String[] localVarAccepts = {
|
||||
@@ -155,4 +189,5 @@ public class BodyApi {
|
||||
localVarReturnType
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import org.openapitools.client.Pair;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -30,6 +31,8 @@ import java.util.StringJoiner;
|
||||
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||
public class FormApi {
|
||||
|
||||
|
||||
private ApiClient apiClient;
|
||||
|
||||
public FormApi() {
|
||||
@@ -58,6 +61,21 @@ public class FormApi {
|
||||
* @throws ApiException if fails to make API call
|
||||
*/
|
||||
public String testFormIntegerBooleanString(Integer integerForm, Boolean booleanForm, String stringForm) throws ApiException {
|
||||
return this.testFormIntegerBooleanString(integerForm, booleanForm, stringForm, Collections.emptyMap());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test form parameter(s)
|
||||
* Test form parameter(s)
|
||||
* @param integerForm (optional)
|
||||
* @param booleanForm (optional)
|
||||
* @param stringForm (optional)
|
||||
* @param additionalHeaders additionalHeaders for this call
|
||||
* @return String
|
||||
* @throws ApiException if fails to make API call
|
||||
*/
|
||||
public String testFormIntegerBooleanString(Integer integerForm, Boolean booleanForm, String stringForm, Map<String, String> additionalHeaders) throws ApiException {
|
||||
Object localVarPostBody = null;
|
||||
|
||||
// create path and map variables
|
||||
@@ -72,6 +90,8 @@ public class FormApi {
|
||||
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
|
||||
|
||||
|
||||
localVarHeaderParams.putAll(additionalHeaders);
|
||||
|
||||
|
||||
if (integerForm != null)
|
||||
localVarFormParams.put("integer_form", integerForm);
|
||||
@@ -109,4 +129,5 @@ if (stringForm != null)
|
||||
localVarReturnType
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import org.openapitools.client.Pair;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -30,6 +31,8 @@ import java.util.StringJoiner;
|
||||
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||
public class HeaderApi {
|
||||
|
||||
|
||||
private ApiClient apiClient;
|
||||
|
||||
public HeaderApi() {
|
||||
@@ -58,6 +61,21 @@ public class HeaderApi {
|
||||
* @throws ApiException if fails to make API call
|
||||
*/
|
||||
public String testHeaderIntegerBooleanString(Integer integerHeader, Boolean booleanHeader, String stringHeader) throws ApiException {
|
||||
return this.testHeaderIntegerBooleanString(integerHeader, booleanHeader, stringHeader, Collections.emptyMap());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test header parameter(s)
|
||||
* Test header parameter(s)
|
||||
* @param integerHeader (optional)
|
||||
* @param booleanHeader (optional)
|
||||
* @param stringHeader (optional)
|
||||
* @param additionalHeaders additionalHeaders for this call
|
||||
* @return String
|
||||
* @throws ApiException if fails to make API call
|
||||
*/
|
||||
public String testHeaderIntegerBooleanString(Integer integerHeader, Boolean booleanHeader, String stringHeader, Map<String, String> additionalHeaders) throws ApiException {
|
||||
Object localVarPostBody = null;
|
||||
|
||||
// create path and map variables
|
||||
@@ -78,6 +96,8 @@ if (booleanHeader != null)
|
||||
if (stringHeader != null)
|
||||
localVarHeaderParams.put("string_header", apiClient.parameterToString(stringHeader));
|
||||
|
||||
localVarHeaderParams.putAll(additionalHeaders);
|
||||
|
||||
|
||||
|
||||
final String[] localVarAccepts = {
|
||||
@@ -109,4 +129,5 @@ if (stringHeader != null)
|
||||
localVarReturnType
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import org.openapitools.client.Pair;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -30,6 +31,8 @@ import java.util.StringJoiner;
|
||||
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||
public class PathApi {
|
||||
|
||||
|
||||
private ApiClient apiClient;
|
||||
|
||||
public PathApi() {
|
||||
@@ -57,6 +60,20 @@ public class PathApi {
|
||||
* @throws ApiException if fails to make API call
|
||||
*/
|
||||
public String testsPathStringPathStringIntegerPathInteger(String pathString, Integer pathInteger) throws ApiException {
|
||||
return this.testsPathStringPathStringIntegerPathInteger(pathString, pathInteger, Collections.emptyMap());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test path parameter(s)
|
||||
* Test path parameter(s)
|
||||
* @param pathString (required)
|
||||
* @param pathInteger (required)
|
||||
* @param additionalHeaders additionalHeaders for this call
|
||||
* @return String
|
||||
* @throws ApiException if fails to make API call
|
||||
*/
|
||||
public String testsPathStringPathStringIntegerPathInteger(String pathString, Integer pathInteger, Map<String, String> additionalHeaders) throws ApiException {
|
||||
Object localVarPostBody = null;
|
||||
|
||||
// verify the required parameter 'pathString' is set
|
||||
@@ -83,6 +100,8 @@ public class PathApi {
|
||||
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
|
||||
|
||||
|
||||
localVarHeaderParams.putAll(additionalHeaders);
|
||||
|
||||
|
||||
|
||||
final String[] localVarAccepts = {
|
||||
@@ -114,4 +133,5 @@ public class PathApi {
|
||||
localVarReturnType
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.openapitools.client.model.TestQueryStyleFormExplodeTrueArrayStringQue
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -36,6 +37,8 @@ import java.util.StringJoiner;
|
||||
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||
public class QueryApi {
|
||||
|
||||
|
||||
private ApiClient apiClient;
|
||||
|
||||
public QueryApi() {
|
||||
@@ -64,6 +67,21 @@ public class QueryApi {
|
||||
* @throws ApiException if fails to make API call
|
||||
*/
|
||||
public String testQueryDatetimeDateString(OffsetDateTime datetimeQuery, LocalDate dateQuery, String stringQuery) throws ApiException {
|
||||
return this.testQueryDatetimeDateString(datetimeQuery, dateQuery, stringQuery, Collections.emptyMap());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* @param datetimeQuery (optional)
|
||||
* @param dateQuery (optional)
|
||||
* @param stringQuery (optional)
|
||||
* @param additionalHeaders additionalHeaders for this call
|
||||
* @return String
|
||||
* @throws ApiException if fails to make API call
|
||||
*/
|
||||
public String testQueryDatetimeDateString(OffsetDateTime datetimeQuery, LocalDate dateQuery, String stringQuery, Map<String, String> additionalHeaders) throws ApiException {
|
||||
Object localVarPostBody = null;
|
||||
|
||||
// create path and map variables
|
||||
@@ -81,6 +99,8 @@ public class QueryApi {
|
||||
localVarQueryParams.addAll(apiClient.parameterToPair("date_query", dateQuery));
|
||||
localVarQueryParams.addAll(apiClient.parameterToPair("string_query", stringQuery));
|
||||
|
||||
localVarHeaderParams.putAll(additionalHeaders);
|
||||
|
||||
|
||||
|
||||
final String[] localVarAccepts = {
|
||||
@@ -112,6 +132,7 @@ public class QueryApi {
|
||||
localVarReturnType
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
@@ -122,6 +143,21 @@ public class QueryApi {
|
||||
* @throws ApiException if fails to make API call
|
||||
*/
|
||||
public String testQueryIntegerBooleanString(Integer integerQuery, Boolean booleanQuery, String stringQuery) throws ApiException {
|
||||
return this.testQueryIntegerBooleanString(integerQuery, booleanQuery, stringQuery, Collections.emptyMap());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* @param integerQuery (optional)
|
||||
* @param booleanQuery (optional)
|
||||
* @param stringQuery (optional)
|
||||
* @param additionalHeaders additionalHeaders for this call
|
||||
* @return String
|
||||
* @throws ApiException if fails to make API call
|
||||
*/
|
||||
public String testQueryIntegerBooleanString(Integer integerQuery, Boolean booleanQuery, String stringQuery, Map<String, String> additionalHeaders) throws ApiException {
|
||||
Object localVarPostBody = null;
|
||||
|
||||
// create path and map variables
|
||||
@@ -139,6 +175,8 @@ public class QueryApi {
|
||||
localVarQueryParams.addAll(apiClient.parameterToPair("boolean_query", booleanQuery));
|
||||
localVarQueryParams.addAll(apiClient.parameterToPair("string_query", stringQuery));
|
||||
|
||||
localVarHeaderParams.putAll(additionalHeaders);
|
||||
|
||||
|
||||
|
||||
final String[] localVarAccepts = {
|
||||
@@ -170,6 +208,7 @@ public class QueryApi {
|
||||
localVarReturnType
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
@@ -178,6 +217,19 @@ public class QueryApi {
|
||||
* @throws ApiException if fails to make API call
|
||||
*/
|
||||
public String testQueryStyleDeepObjectExplodeTrueObject(Pet queryObject) throws ApiException {
|
||||
return this.testQueryStyleDeepObjectExplodeTrueObject(queryObject, Collections.emptyMap());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* @param queryObject (optional)
|
||||
* @param additionalHeaders additionalHeaders for this call
|
||||
* @return String
|
||||
* @throws ApiException if fails to make API call
|
||||
*/
|
||||
public String testQueryStyleDeepObjectExplodeTrueObject(Pet queryObject, Map<String, String> additionalHeaders) throws ApiException {
|
||||
Object localVarPostBody = null;
|
||||
|
||||
// create path and map variables
|
||||
@@ -194,6 +246,8 @@ public class QueryApi {
|
||||
localVarQueryParameterBaseName = "query_object";
|
||||
localVarQueryStringJoiner.add(queryObject.toUrlQueryString("query_object"));
|
||||
|
||||
localVarHeaderParams.putAll(additionalHeaders);
|
||||
|
||||
|
||||
|
||||
final String[] localVarAccepts = {
|
||||
@@ -225,6 +279,7 @@ public class QueryApi {
|
||||
localVarReturnType
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
@@ -233,6 +288,19 @@ public class QueryApi {
|
||||
* @throws ApiException if fails to make API call
|
||||
*/
|
||||
public String testQueryStyleDeepObjectExplodeTrueObjectAllOf(TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter queryObject) throws ApiException {
|
||||
return this.testQueryStyleDeepObjectExplodeTrueObjectAllOf(queryObject, Collections.emptyMap());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* @param queryObject (optional)
|
||||
* @param additionalHeaders additionalHeaders for this call
|
||||
* @return String
|
||||
* @throws ApiException if fails to make API call
|
||||
*/
|
||||
public String testQueryStyleDeepObjectExplodeTrueObjectAllOf(TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter queryObject, Map<String, String> additionalHeaders) throws ApiException {
|
||||
Object localVarPostBody = null;
|
||||
|
||||
// create path and map variables
|
||||
@@ -249,6 +317,8 @@ public class QueryApi {
|
||||
localVarQueryParameterBaseName = "query_object";
|
||||
localVarQueryStringJoiner.add(queryObject.toUrlQueryString("query_object"));
|
||||
|
||||
localVarHeaderParams.putAll(additionalHeaders);
|
||||
|
||||
|
||||
|
||||
final String[] localVarAccepts = {
|
||||
@@ -280,6 +350,7 @@ public class QueryApi {
|
||||
localVarReturnType
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
@@ -288,6 +359,19 @@ public class QueryApi {
|
||||
* @throws ApiException if fails to make API call
|
||||
*/
|
||||
public String testQueryStyleFormExplodeTrueArrayString(TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter queryObject) throws ApiException {
|
||||
return this.testQueryStyleFormExplodeTrueArrayString(queryObject, Collections.emptyMap());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* @param queryObject (optional)
|
||||
* @param additionalHeaders additionalHeaders for this call
|
||||
* @return String
|
||||
* @throws ApiException if fails to make API call
|
||||
*/
|
||||
public String testQueryStyleFormExplodeTrueArrayString(TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter queryObject, Map<String, String> additionalHeaders) throws ApiException {
|
||||
Object localVarPostBody = null;
|
||||
|
||||
// create path and map variables
|
||||
@@ -303,6 +387,8 @@ public class QueryApi {
|
||||
|
||||
localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "values", queryObject.getValues()));
|
||||
|
||||
localVarHeaderParams.putAll(additionalHeaders);
|
||||
|
||||
|
||||
|
||||
final String[] localVarAccepts = {
|
||||
@@ -334,6 +420,7 @@ public class QueryApi {
|
||||
localVarReturnType
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
@@ -342,6 +429,19 @@ public class QueryApi {
|
||||
* @throws ApiException if fails to make API call
|
||||
*/
|
||||
public String testQueryStyleFormExplodeTrueObject(Pet queryObject) throws ApiException {
|
||||
return this.testQueryStyleFormExplodeTrueObject(queryObject, Collections.emptyMap());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* @param queryObject (optional)
|
||||
* @param additionalHeaders additionalHeaders for this call
|
||||
* @return String
|
||||
* @throws ApiException if fails to make API call
|
||||
*/
|
||||
public String testQueryStyleFormExplodeTrueObject(Pet queryObject, Map<String, String> additionalHeaders) throws ApiException {
|
||||
Object localVarPostBody = null;
|
||||
|
||||
// create path and map variables
|
||||
@@ -362,6 +462,8 @@ public class QueryApi {
|
||||
localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "tags", queryObject.getTags()));
|
||||
localVarQueryParams.addAll(apiClient.parameterToPair("status", queryObject.getStatus()));
|
||||
|
||||
localVarHeaderParams.putAll(additionalHeaders);
|
||||
|
||||
|
||||
|
||||
final String[] localVarAccepts = {
|
||||
@@ -393,6 +495,7 @@ public class QueryApi {
|
||||
localVarReturnType
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
@@ -401,6 +504,19 @@ public class QueryApi {
|
||||
* @throws ApiException if fails to make API call
|
||||
*/
|
||||
public String testQueryStyleFormExplodeTrueObjectAllOf(DataQuery queryObject) throws ApiException {
|
||||
return this.testQueryStyleFormExplodeTrueObjectAllOf(queryObject, Collections.emptyMap());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* @param queryObject (optional)
|
||||
* @param additionalHeaders additionalHeaders for this call
|
||||
* @return String
|
||||
* @throws ApiException if fails to make API call
|
||||
*/
|
||||
public String testQueryStyleFormExplodeTrueObjectAllOf(DataQuery queryObject, Map<String, String> additionalHeaders) throws ApiException {
|
||||
Object localVarPostBody = null;
|
||||
|
||||
// create path and map variables
|
||||
@@ -416,6 +532,8 @@ public class QueryApi {
|
||||
|
||||
localVarQueryStringJoiner.add(queryObject.toUrlQueryString());
|
||||
|
||||
localVarHeaderParams.putAll(additionalHeaders);
|
||||
|
||||
|
||||
|
||||
final String[] localVarAccepts = {
|
||||
@@ -447,4 +565,5 @@ public class QueryApi {
|
||||
localVarReturnType
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user