mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-05-12 12:40:53 +00:00
[Java] Make Java ApiClient extendable (#21251)
* Make all Java ApiClients in templates extendable * Make all Java ApiClients in samples extendable * Fix compilation of enum constructor * Fix compilation of enum constructor in templates
This commit is contained in:
parent
be17698320
commit
57bf6925bb
@ -65,9 +65,9 @@ import {{invokerPackage}}.auth.OAuth;
|
|||||||
|
|
||||||
{{>generatedAnnotation}}
|
{{>generatedAnnotation}}
|
||||||
public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
||||||
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
protected Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||||
private Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
protected Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
||||||
private String basePath = "{{{basePath}}}";
|
protected String basePath = "{{{basePath}}}";
|
||||||
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>({{#servers}}{{#-first}}Arrays.asList(
|
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>({{#servers}}{{#-first}}Arrays.asList(
|
||||||
{{/-first}} new ServerConfiguration(
|
{{/-first}} new ServerConfiguration(
|
||||||
"{{{url}}}",
|
"{{{url}}}",
|
||||||
@ -95,18 +95,18 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
){{/-last}}{{/servers}});
|
){{/-last}}{{/servers}});
|
||||||
protected Integer serverIndex = 0;
|
protected Integer serverIndex = 0;
|
||||||
protected Map<String, String> serverVariables = null;
|
protected Map<String, String> serverVariables = null;
|
||||||
private boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
private int connectionTimeout = 0;
|
protected int connectionTimeout = 0;
|
||||||
|
|
||||||
private Client httpClient;
|
protected Client httpClient;
|
||||||
private ObjectMapper objectMapper;
|
protected ObjectMapper objectMapper;
|
||||||
|
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
private int statusCode;
|
protected int statusCode;
|
||||||
private Map<String, List<String>> responseHeaders;
|
protected Map<String, List<String>> responseHeaders;
|
||||||
|
|
||||||
private DateFormat dateFormat;
|
protected DateFormat dateFormat;
|
||||||
|
|
||||||
public ApiClient() {
|
public ApiClient() {
|
||||||
objectMapper = new ObjectMapper();
|
objectMapper = new ObjectMapper();
|
||||||
@ -688,7 +688,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
* @param collectionQueryParams The collection query parameters
|
* @param collectionQueryParams The collection query parameters
|
||||||
* @return The full URL
|
* @return The full URL
|
||||||
*/
|
*/
|
||||||
private String buildUrl(String path, List<Pair> queryParams, List<Pair> collectionQueryParams) {
|
protected String buildUrl(String path, List<Pair> queryParams, List<Pair> collectionQueryParams) {
|
||||||
String baseURL;
|
String baseURL;
|
||||||
if (serverIndex != null) {
|
if (serverIndex != null) {
|
||||||
if (serverIndex < 0 || serverIndex >= servers.size()) {
|
if (serverIndex < 0 || serverIndex >= servers.size()) {
|
||||||
@ -741,7 +741,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
return url.toString();
|
return url.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private ClientResponse getAPIResponse(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String accept, String contentType, String[] authNames) throws ApiException {
|
protected ClientResponse getAPIResponse(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String accept, String contentType, String[] authNames) throws ApiException {
|
||||||
if (body != null && !formParams.isEmpty()) {
|
if (body != null && !formParams.isEmpty()) {
|
||||||
throw new ApiException(500, "Cannot have body and form params");
|
throw new ApiException(500, "Cannot have body and form params");
|
||||||
}
|
}
|
||||||
@ -854,7 +854,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
* @param headerParams Header parameters
|
* @param headerParams Header parameters
|
||||||
* @param cookieParams Cookie parameters
|
* @param cookieParams Cookie parameters
|
||||||
*/
|
*/
|
||||||
private void updateParamsForAuth(String[] authNames, List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams) {
|
protected void updateParamsForAuth(String[] authNames, List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams) {
|
||||||
for (String authName : authNames) {
|
for (String authName : authNames) {
|
||||||
Authentication auth = authentications.get(authName);
|
Authentication auth = authentications.get(authName);
|
||||||
if (auth == null) throw new RuntimeException("Authentication undefined: " + authName);
|
if (auth == null) throw new RuntimeException("Authentication undefined: " + authName);
|
||||||
@ -867,7 +867,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
* @param formParams Form parameters
|
* @param formParams Form parameters
|
||||||
* @return HTTP form encoded parameters
|
* @return HTTP form encoded parameters
|
||||||
*/
|
*/
|
||||||
private String getXWWWFormUrlencodedParams(Map<String, Object> formParams) {
|
protected String getXWWWFormUrlencodedParams(Map<String, Object> formParams) {
|
||||||
StringBuilder formParamBuilder = new StringBuilder();
|
StringBuilder formParamBuilder = new StringBuilder();
|
||||||
|
|
||||||
for (Entry<String, Object> param : formParams.entrySet()) {
|
for (Entry<String, Object> param : formParams.entrySet()) {
|
||||||
|
@ -87,9 +87,9 @@ import {{invokerPackage}}.auth.OAuth;
|
|||||||
|
|
||||||
{{>generatedAnnotation}}
|
{{>generatedAnnotation}}
|
||||||
public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
||||||
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
protected Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||||
private Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
protected Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
||||||
private String basePath = "{{{basePath}}}";
|
protected String basePath = "{{{basePath}}}";
|
||||||
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>({{#servers}}{{#-first}}Arrays.asList(
|
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>({{#servers}}{{#-first}}Arrays.asList(
|
||||||
{{/-first}} new ServerConfiguration(
|
{{/-first}} new ServerConfiguration(
|
||||||
"{{{url}}}",
|
"{{{url}}}",
|
||||||
@ -117,22 +117,22 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
){{/-last}}{{/servers}});
|
){{/-last}}{{/servers}});
|
||||||
protected Integer serverIndex = 0;
|
protected Integer serverIndex = 0;
|
||||||
protected Map<String, String> serverVariables = null;
|
protected Map<String, String> serverVariables = null;
|
||||||
private boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
private int connectionTimeout = 0;
|
protected int connectionTimeout = 0;
|
||||||
|
|
||||||
private CloseableHttpClient httpClient;
|
protected CloseableHttpClient httpClient;
|
||||||
private ObjectMapper objectMapper;
|
protected ObjectMapper objectMapper;
|
||||||
protected String tempFolderPath = null;
|
protected String tempFolderPath = null;
|
||||||
|
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
private Map<Long, Integer> lastStatusCodeByThread = new ConcurrentHashMap<>();
|
protected Map<Long, Integer> lastStatusCodeByThread = new ConcurrentHashMap<>();
|
||||||
private Map<Long, Map<String, List<String>>> lastResponseHeadersByThread = new ConcurrentHashMap<>();
|
protected Map<Long, Map<String, List<String>>> lastResponseHeadersByThread = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
private DateFormat dateFormat;
|
protected DateFormat dateFormat;
|
||||||
|
|
||||||
// Methods that can have a request body
|
// Methods that can have a request body
|
||||||
private static List<String> bodyMethods = Arrays.asList("POST", "PUT", "DELETE", "PATCH");
|
protected static List<String> bodyMethods = Arrays.asList("POST", "PUT", "DELETE", "PATCH");
|
||||||
|
|
||||||
public ApiClient(CloseableHttpClient httpClient) {
|
public ApiClient(CloseableHttpClient httpClient) {
|
||||||
objectMapper = new ObjectMapper();
|
objectMapper = new ObjectMapper();
|
||||||
@ -757,7 +757,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
/**
|
/**
|
||||||
* Parse content type object from header value
|
* Parse content type object from header value
|
||||||
*/
|
*/
|
||||||
private ContentType getContentType(String headerValue) throws ApiException {
|
protected ContentType getContentType(String headerValue) throws ApiException {
|
||||||
try {
|
try {
|
||||||
return ContentType.parse(headerValue);
|
return ContentType.parse(headerValue);
|
||||||
} catch (UnsupportedCharsetException e) {
|
} catch (UnsupportedCharsetException e) {
|
||||||
@ -768,7 +768,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
/**
|
/**
|
||||||
* Get content type of a response or null if one was not provided
|
* Get content type of a response or null if one was not provided
|
||||||
*/
|
*/
|
||||||
private String getResponseMimeType(HttpResponse response) throws ApiException {
|
protected String getResponseMimeType(HttpResponse response) throws ApiException {
|
||||||
Header contentTypeHeader = response.getFirstHeader("Content-Type");
|
Header contentTypeHeader = response.getFirstHeader("Content-Type");
|
||||||
if (contentTypeHeader != null) {
|
if (contentTypeHeader != null) {
|
||||||
return getContentType(contentTypeHeader.getValue()).getMimeType();
|
return getContentType(contentTypeHeader.getValue()).getMimeType();
|
||||||
@ -877,7 +877,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private File downloadFileFromResponse(CloseableHttpResponse response) throws IOException {
|
protected File downloadFileFromResponse(CloseableHttpResponse response) throws IOException {
|
||||||
Header contentDispositionHeader = response.getFirstHeader("Content-Disposition");
|
Header contentDispositionHeader = response.getFirstHeader("Content-Disposition");
|
||||||
String contentDisposition = contentDispositionHeader == null ? null : contentDispositionHeader.getValue();
|
String contentDisposition = contentDispositionHeader == null ? null : contentDispositionHeader.getValue();
|
||||||
File file = prepareDownloadFile(contentDisposition);
|
File file = prepareDownloadFile(contentDisposition);
|
||||||
@ -948,7 +948,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
* @param urlQueryDeepObject URL query string of the deep object parameters
|
* @param urlQueryDeepObject URL query string of the deep object parameters
|
||||||
* @return The full URL
|
* @return The full URL
|
||||||
*/
|
*/
|
||||||
private String buildUrl(String path, List<Pair> queryParams, List<Pair> collectionQueryParams, String urlQueryDeepObject) {
|
protected String buildUrl(String path, List<Pair> queryParams, List<Pair> collectionQueryParams, String urlQueryDeepObject) {
|
||||||
String baseURL = getBaseURL();
|
String baseURL = getBaseURL();
|
||||||
|
|
||||||
final StringBuilder url = new StringBuilder();
|
final StringBuilder url = new StringBuilder();
|
||||||
@ -1127,7 +1127,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
* @param headerParams Header parameters
|
* @param headerParams Header parameters
|
||||||
* @param cookieParams Cookie parameters
|
* @param cookieParams Cookie parameters
|
||||||
*/
|
*/
|
||||||
private void updateParamsForAuth(String[] authNames, List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams) {
|
protected void updateParamsForAuth(String[] authNames, List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams) {
|
||||||
for (String authName : authNames) {
|
for (String authName : authNames) {
|
||||||
Authentication auth = authentications.get(authName);
|
Authentication auth = authentications.get(authName);
|
||||||
if (auth == null) throw new RuntimeException("Authentication undefined: " + authName);
|
if (auth == null) throw new RuntimeException("Authentication undefined: " + authName);
|
||||||
|
@ -54,16 +54,16 @@ import feign.Retryer;
|
|||||||
|
|
||||||
{{>generatedAnnotation}}
|
{{>generatedAnnotation}}
|
||||||
public class ApiClient {
|
public class ApiClient {
|
||||||
private static final Logger log = Logger.getLogger(ApiClient.class.getName());
|
protected static final Logger log = Logger.getLogger(ApiClient.class.getName());
|
||||||
|
|
||||||
public interface Api {}
|
public interface Api {}
|
||||||
|
|
||||||
{{#jackson}}
|
{{#jackson}}
|
||||||
protected ObjectMapper objectMapper;
|
protected ObjectMapper objectMapper;
|
||||||
{{/jackson}}
|
{{/jackson}}
|
||||||
private String basePath = "{{{basePath}}}";
|
protected String basePath = "{{{basePath}}}";
|
||||||
private Map<String, RequestInterceptor> apiAuthorizations;
|
protected Map<String, RequestInterceptor> apiAuthorizations;
|
||||||
private Feign.Builder feignBuilder;
|
protected Feign.Builder feignBuilder;
|
||||||
|
|
||||||
public ApiClient() {
|
public ApiClient() {
|
||||||
apiAuthorizations = new LinkedHashMap<String, RequestInterceptor>();
|
apiAuthorizations = new LinkedHashMap<String, RequestInterceptor>();
|
||||||
@ -167,7 +167,7 @@ public class ApiClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
{{#jackson}}
|
{{#jackson}}
|
||||||
private ObjectMapper createObjectMapper() {
|
protected ObjectMapper createObjectMapper() {
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
objectMapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
|
objectMapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
|
||||||
objectMapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING);
|
objectMapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING);
|
||||||
@ -194,7 +194,7 @@ public class ApiClient {
|
|||||||
{{/jackson}}
|
{{/jackson}}
|
||||||
|
|
||||||
{{#hasOAuthMethods}}
|
{{#hasOAuthMethods}}
|
||||||
private RequestInterceptor buildOauthRequestInterceptor(OAuthFlow flow, String authorizationUrl, String tokenUrl, String scopes) {
|
protected RequestInterceptor buildOauthRequestInterceptor(OAuthFlow flow, String authorizationUrl, String tokenUrl, String scopes) {
|
||||||
switch (flow) {
|
switch (flow) {
|
||||||
case PASSWORD:
|
case PASSWORD:
|
||||||
return new OauthPasswordGrant(tokenUrl, scopes);
|
return new OauthPasswordGrant(tokenUrl, scopes);
|
||||||
@ -375,7 +375,7 @@ public class ApiClient {
|
|||||||
feignBuilder.requestInterceptor(authorization);
|
feignBuilder.requestInterceptor(authorization);
|
||||||
}
|
}
|
||||||
|
|
||||||
private <T extends RequestInterceptor> T getAuthorization(Class<T> type) {
|
protected <T extends RequestInterceptor> T getAuthorization(Class<T> type) {
|
||||||
return (T) apiAuthorizations.values()
|
return (T) apiAuthorizations.values()
|
||||||
.stream()
|
.stream()
|
||||||
.filter(requestInterceptor -> type.isAssignableFrom(requestInterceptor.getClass()))
|
.filter(requestInterceptor -> type.isAssignableFrom(requestInterceptor.getClass()))
|
||||||
|
@ -25,14 +25,14 @@ import java.io.OutputStream;
|
|||||||
|
|
||||||
{{>generatedAnnotation}}
|
{{>generatedAnnotation}}
|
||||||
public class ApiClient {
|
public class ApiClient {
|
||||||
private final String basePath;
|
protected final String basePath;
|
||||||
private final HttpRequestFactory httpRequestFactory;
|
protected final HttpRequestFactory httpRequestFactory;
|
||||||
private final ObjectMapper objectMapper;
|
protected final ObjectMapper objectMapper;
|
||||||
|
|
||||||
private static final String defaultBasePath = "{{basePath}}";
|
protected static final String defaultBasePath = "{{basePath}}";
|
||||||
|
|
||||||
// A reasonable default object mapper. Client can pass in a chosen ObjectMapper anyway, this is just for reasonable defaults.
|
// A reasonable default object mapper. Client can pass in a chosen ObjectMapper anyway, this is just for reasonable defaults.
|
||||||
private static ObjectMapper createDefaultObjectMapper() {
|
protected static ObjectMapper createDefaultObjectMapper() {
|
||||||
ObjectMapper objectMapper = new ObjectMapper()
|
ObjectMapper objectMapper = new ObjectMapper()
|
||||||
{{#failOnUnknownProperties}}
|
{{#failOnUnknownProperties}}
|
||||||
.enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
|
.enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
|
||||||
@ -84,7 +84,7 @@ public class ApiClient {
|
|||||||
|
|
||||||
public class JacksonJsonHttpContent extends AbstractHttpContent {
|
public class JacksonJsonHttpContent extends AbstractHttpContent {
|
||||||
/* A POJO that can be serialized with a com.fasterxml Jackson ObjectMapper */
|
/* A POJO that can be serialized with a com.fasterxml Jackson ObjectMapper */
|
||||||
private final Object data;
|
protected final Object data;
|
||||||
|
|
||||||
public JacksonJsonHttpContent(Object data) {
|
public JacksonJsonHttpContent(Object data) {
|
||||||
super(Json.MEDIA_TYPE);
|
super(Json.MEDIA_TYPE);
|
||||||
|
@ -85,13 +85,13 @@ import {{invokerPackage}}.auth.OAuth;
|
|||||||
*/
|
*/
|
||||||
{{>generatedAnnotation}}
|
{{>generatedAnnotation}}
|
||||||
public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
||||||
private static final Pattern JSON_MIME_PATTERN = Pattern.compile("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
|
protected static final Pattern JSON_MIME_PATTERN = Pattern.compile("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
|
||||||
|
|
||||||
protected Map<String, String> defaultHeaderMap = new HashMap<>();
|
protected Map<String, String> defaultHeaderMap = new HashMap<>();
|
||||||
protected Map<String, String> defaultCookieMap = new HashMap<>();
|
protected Map<String, String> defaultCookieMap = new HashMap<>();
|
||||||
protected String basePath = "{{{basePath}}}";
|
protected String basePath = "{{{basePath}}}";
|
||||||
protected String userAgent;
|
protected String userAgent;
|
||||||
private static final Logger log = Logger.getLogger(ApiClient.class.getName());
|
protected static final Logger log = Logger.getLogger(ApiClient.class.getName());
|
||||||
|
|
||||||
protected List<ServerConfiguration> servers = new ArrayList<>({{#servers}}{{#-first}}Arrays.asList(
|
protected List<ServerConfiguration> servers = new ArrayList<>({{#servers}}{{#-first}}Arrays.asList(
|
||||||
{{/-first}} new ServerConfiguration(
|
{{/-first}} new ServerConfiguration(
|
||||||
@ -175,7 +175,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
protected boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
protected ClientConfig clientConfig;
|
protected ClientConfig clientConfig;
|
||||||
protected int connectionTimeout = 0;
|
protected int connectionTimeout = 0;
|
||||||
private int readTimeout = 0;
|
protected int readTimeout = 0;
|
||||||
|
|
||||||
protected Client httpClient;
|
protected Client httpClient;
|
||||||
protected JSON json;
|
protected JSON json;
|
||||||
@ -373,14 +373,14 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateBasePath() {
|
protected void updateBasePath() {
|
||||||
if (serverIndex != null) {
|
if (serverIndex != null) {
|
||||||
setBasePath(servers.get(serverIndex).URL(serverVariables));
|
setBasePath(servers.get(serverIndex).URL(serverVariables));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{{#hasOAuthMethods}}
|
{{#hasOAuthMethods}}
|
||||||
private void setOauthBasePath(String basePath) {
|
protected void setOauthBasePath(String basePath) {
|
||||||
for(Authentication auth : authentications.values()) {
|
for(Authentication auth : authentications.values()) {
|
||||||
if (auth instanceof OAuth) {
|
if (auth instanceof OAuth) {
|
||||||
((OAuth) auth).setBasePath(basePath);
|
((OAuth) auth).setBasePath(basePath);
|
||||||
@ -1029,7 +1029,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
* @param key Key of the object
|
* @param key Key of the object
|
||||||
* @param multiPart MultiPart to add the form param to
|
* @param multiPart MultiPart to add the form param to
|
||||||
*/
|
*/
|
||||||
private void addParamToMultipart(Object value, String key, MultiPart multiPart) {
|
protected void addParamToMultipart(Object value, String key, MultiPart multiPart) {
|
||||||
if (value instanceof File) {
|
if (value instanceof File) {
|
||||||
File file = (File) value;
|
File file = (File) value;
|
||||||
FormDataContentDisposition contentDisp = FormDataContentDisposition.name(key)
|
FormDataContentDisposition contentDisp = FormDataContentDisposition.name(key)
|
||||||
@ -1350,7 +1350,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Response sendRequest(String method, Invocation.Builder invocationBuilder, Entity<?> entity) {
|
protected Response sendRequest(String method, Invocation.Builder invocationBuilder, Entity<?> entity) {
|
||||||
Response response;
|
Response response;
|
||||||
if ("POST".equals(method)) {
|
if ("POST".equals(method)) {
|
||||||
response = invocationBuilder.post(entity);
|
response = invocationBuilder.post(entity);
|
||||||
@ -1412,7 +1412,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
return clientConfig;
|
return clientConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyDebugSetting(ClientConfig clientConfig) {
|
protected void applyDebugSetting(ClientConfig clientConfig) {
|
||||||
if (debugging) {
|
if (debugging) {
|
||||||
clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */));
|
clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */));
|
||||||
clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY);
|
clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY);
|
||||||
|
@ -85,13 +85,13 @@ import {{invokerPackage}}.auth.OAuth;
|
|||||||
*/
|
*/
|
||||||
{{>generatedAnnotation}}
|
{{>generatedAnnotation}}
|
||||||
public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
||||||
private static final Pattern JSON_MIME_PATTERN = Pattern.compile("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
|
protected static final Pattern JSON_MIME_PATTERN = Pattern.compile("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
|
||||||
|
|
||||||
protected Map<String, String> defaultHeaderMap = new HashMap<>();
|
protected Map<String, String> defaultHeaderMap = new HashMap<>();
|
||||||
protected Map<String, String> defaultCookieMap = new HashMap<>();
|
protected Map<String, String> defaultCookieMap = new HashMap<>();
|
||||||
protected String basePath = "{{{basePath}}}";
|
protected String basePath = "{{{basePath}}}";
|
||||||
protected String userAgent;
|
protected String userAgent;
|
||||||
private static final Logger log = Logger.getLogger(ApiClient.class.getName());
|
protected static final Logger log = Logger.getLogger(ApiClient.class.getName());
|
||||||
|
|
||||||
protected List<ServerConfiguration> servers = new ArrayList<>({{#servers}}{{#-first}}Arrays.asList(
|
protected List<ServerConfiguration> servers = new ArrayList<>({{#servers}}{{#-first}}Arrays.asList(
|
||||||
{{/-first}} new ServerConfiguration(
|
{{/-first}} new ServerConfiguration(
|
||||||
@ -175,7 +175,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
protected boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
protected ClientConfig clientConfig;
|
protected ClientConfig clientConfig;
|
||||||
protected int connectionTimeout = 0;
|
protected int connectionTimeout = 0;
|
||||||
private int readTimeout = 0;
|
protected int readTimeout = 0;
|
||||||
|
|
||||||
protected Client httpClient;
|
protected Client httpClient;
|
||||||
protected JSON json;
|
protected JSON json;
|
||||||
@ -373,14 +373,14 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateBasePath() {
|
protected void updateBasePath() {
|
||||||
if (serverIndex != null) {
|
if (serverIndex != null) {
|
||||||
setBasePath(servers.get(serverIndex).URL(serverVariables));
|
setBasePath(servers.get(serverIndex).URL(serverVariables));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{{#hasOAuthMethods}}
|
{{#hasOAuthMethods}}
|
||||||
private void setOauthBasePath(String basePath) {
|
protected void setOauthBasePath(String basePath) {
|
||||||
for(Authentication auth : authentications.values()) {
|
for(Authentication auth : authentications.values()) {
|
||||||
if (auth instanceof OAuth) {
|
if (auth instanceof OAuth) {
|
||||||
((OAuth) auth).setBasePath(basePath);
|
((OAuth) auth).setBasePath(basePath);
|
||||||
@ -1029,7 +1029,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
* @param key Key of the object
|
* @param key Key of the object
|
||||||
* @param multiPart MultiPart to add the form param to
|
* @param multiPart MultiPart to add the form param to
|
||||||
*/
|
*/
|
||||||
private void addParamToMultipart(Object value, String key, MultiPart multiPart) {
|
protected void addParamToMultipart(Object value, String key, MultiPart multiPart) {
|
||||||
if (value instanceof File) {
|
if (value instanceof File) {
|
||||||
File file = (File) value;
|
File file = (File) value;
|
||||||
FormDataContentDisposition contentDisp = FormDataContentDisposition.name(key)
|
FormDataContentDisposition contentDisp = FormDataContentDisposition.name(key)
|
||||||
@ -1350,7 +1350,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Response sendRequest(String method, Invocation.Builder invocationBuilder, Entity<?> entity) {
|
protected Response sendRequest(String method, Invocation.Builder invocationBuilder, Entity<?> entity) {
|
||||||
Response response;
|
Response response;
|
||||||
if ("POST".equals(method)) {
|
if ("POST".equals(method)) {
|
||||||
response = invocationBuilder.post(entity);
|
response = invocationBuilder.post(entity);
|
||||||
@ -1412,7 +1412,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
return clientConfig;
|
return clientConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyDebugSetting(ClientConfig clientConfig) {
|
protected void applyDebugSetting(ClientConfig clientConfig) {
|
||||||
if (debugging) {
|
if (debugging) {
|
||||||
clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */));
|
clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */));
|
||||||
clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY);
|
clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY);
|
||||||
|
@ -45,17 +45,17 @@ import static java.nio.charset.StandardCharsets.UTF_8;
|
|||||||
{{>generatedAnnotation}}
|
{{>generatedAnnotation}}
|
||||||
public class ApiClient {
|
public class ApiClient {
|
||||||
|
|
||||||
private HttpClient.Builder builder;
|
protected HttpClient.Builder builder;
|
||||||
private ObjectMapper mapper;
|
protected ObjectMapper mapper;
|
||||||
private String scheme;
|
protected String scheme;
|
||||||
private String host;
|
protected String host;
|
||||||
private int port;
|
protected int port;
|
||||||
private String basePath;
|
protected String basePath;
|
||||||
private Consumer<HttpRequest.Builder> interceptor;
|
protected Consumer<HttpRequest.Builder> interceptor;
|
||||||
private Consumer<HttpResponse<InputStream>> responseInterceptor;
|
protected Consumer<HttpResponse<InputStream>> responseInterceptor;
|
||||||
private Consumer<HttpResponse<String>> asyncResponseInterceptor;
|
protected Consumer<HttpResponse<String>> asyncResponseInterceptor;
|
||||||
private Duration readTimeout;
|
protected Duration readTimeout;
|
||||||
private Duration connectTimeout;
|
protected Duration connectTimeout;
|
||||||
|
|
||||||
public static String valueToString(Object value) {
|
public static String valueToString(Object value) {
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
@ -200,7 +200,7 @@ public class ApiClient {
|
|||||||
return mapper;
|
return mapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getDefaultBaseUri() {
|
protected String getDefaultBaseUri() {
|
||||||
return "{{{basePath}}}";
|
return "{{{basePath}}}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ import {{invokerPackage}}.auth.AWS4Auth;
|
|||||||
*/
|
*/
|
||||||
public class ApiClient {
|
public class ApiClient {
|
||||||
|
|
||||||
private String basePath = "{{{basePath}}}";
|
protected String basePath = "{{{basePath}}}";
|
||||||
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>({{#servers}}{{#-first}}Arrays.asList(
|
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>({{#servers}}{{#-first}}Arrays.asList(
|
||||||
{{/-first}} new ServerConfiguration(
|
{{/-first}} new ServerConfiguration(
|
||||||
"{{{url}}}",
|
"{{{url}}}",
|
||||||
@ -105,29 +105,29 @@ public class ApiClient {
|
|||||||
){{/-last}}{{/servers}});
|
){{/-last}}{{/servers}});
|
||||||
protected Integer serverIndex = 0;
|
protected Integer serverIndex = 0;
|
||||||
protected Map<String, String> serverVariables = null;
|
protected Map<String, String> serverVariables = null;
|
||||||
private boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
protected Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||||
private Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
protected Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
||||||
private String tempFolderPath = null;
|
protected String tempFolderPath = null;
|
||||||
|
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
private DateFormat dateFormat;
|
protected DateFormat dateFormat;
|
||||||
private DateFormat datetimeFormat;
|
protected DateFormat datetimeFormat;
|
||||||
private boolean lenientDatetimeFormat;
|
protected boolean lenientDatetimeFormat;
|
||||||
private int dateLength;
|
protected int dateLength;
|
||||||
|
|
||||||
private InputStream sslCaCert;
|
protected InputStream sslCaCert;
|
||||||
private boolean verifyingSsl;
|
protected boolean verifyingSsl;
|
||||||
private KeyManager[] keyManagers;
|
protected KeyManager[] keyManagers;
|
||||||
|
|
||||||
private OkHttpClient httpClient;
|
protected OkHttpClient httpClient;
|
||||||
private JSON json;
|
protected JSON json;
|
||||||
|
|
||||||
private HttpLoggingInterceptor loggingInterceptor;
|
protected HttpLoggingInterceptor loggingInterceptor;
|
||||||
|
|
||||||
{{#dynamicOperations}}
|
{{#dynamicOperations}}
|
||||||
private Map<String, ApiOperation> operationLookupMap = new HashMap<>();
|
protected Map<String, ApiOperation> operationLookupMap = new HashMap<>();
|
||||||
|
|
||||||
{{/dynamicOperations}}
|
{{/dynamicOperations}}
|
||||||
/**
|
/**
|
||||||
@ -243,11 +243,11 @@ public class ApiClient {
|
|||||||
{{/-first}}
|
{{/-first}}
|
||||||
{{/oauthMethods}}
|
{{/oauthMethods}}
|
||||||
{{/hasOAuthMethods}}
|
{{/hasOAuthMethods}}
|
||||||
private void initHttpClient() {
|
protected void initHttpClient() {
|
||||||
initHttpClient(Collections.<Interceptor>emptyList());
|
initHttpClient(Collections.<Interceptor>emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initHttpClient(List<Interceptor> interceptors) {
|
protected void initHttpClient(List<Interceptor> interceptors) {
|
||||||
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
||||||
builder.addNetworkInterceptor(getProgressInterceptor());
|
builder.addNetworkInterceptor(getProgressInterceptor());
|
||||||
for (Interceptor interceptor: interceptors) {
|
for (Interceptor interceptor: interceptors) {
|
||||||
@ -261,7 +261,7 @@ public class ApiClient {
|
|||||||
httpClient = builder.build();
|
httpClient = builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init() {
|
protected void init() {
|
||||||
verifyingSsl = true;
|
verifyingSsl = true;
|
||||||
|
|
||||||
json = new JSON();
|
json = new JSON();
|
||||||
@ -1715,7 +1715,7 @@ public class ApiClient {
|
|||||||
* @param key The key of the Header element
|
* @param key The key of the Header element
|
||||||
* @param file The file to add to the Header
|
* @param file The file to add to the Header
|
||||||
*/
|
*/
|
||||||
private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) {
|
protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) {
|
||||||
Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\"");
|
Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\"");
|
||||||
MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file));
|
MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file));
|
||||||
mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType));
|
mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType));
|
||||||
@ -1728,7 +1728,7 @@ public class ApiClient {
|
|||||||
* @param key The key of the Header element
|
* @param key The key of the Header element
|
||||||
* @param obj The complex object to add to the Header
|
* @param obj The complex object to add to the Header
|
||||||
*/
|
*/
|
||||||
private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) {
|
protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) {
|
||||||
RequestBody requestBody;
|
RequestBody requestBody;
|
||||||
if (obj instanceof String) {
|
if (obj instanceof String) {
|
||||||
requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain"));
|
requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain"));
|
||||||
@ -1750,7 +1750,7 @@ public class ApiClient {
|
|||||||
* Get network interceptor to add it to the httpClient to track download progress for
|
* Get network interceptor to add it to the httpClient to track download progress for
|
||||||
* async requests.
|
* async requests.
|
||||||
*/
|
*/
|
||||||
private Interceptor getProgressInterceptor() {
|
protected Interceptor getProgressInterceptor() {
|
||||||
return new Interceptor() {
|
return new Interceptor() {
|
||||||
@Override
|
@Override
|
||||||
public Response intercept(Interceptor.Chain chain) throws IOException {
|
public Response intercept(Interceptor.Chain chain) throws IOException {
|
||||||
@ -1771,7 +1771,7 @@ public class ApiClient {
|
|||||||
* Apply SSL related settings to httpClient according to the current values of
|
* Apply SSL related settings to httpClient according to the current values of
|
||||||
* verifyingSsl and sslCaCert.
|
* verifyingSsl and sslCaCert.
|
||||||
*/
|
*/
|
||||||
private void applySslSettings() {
|
protected void applySslSettings() {
|
||||||
try {
|
try {
|
||||||
TrustManager[] trustManagers;
|
TrustManager[] trustManagers;
|
||||||
HostnameVerifier hostnameVerifier;
|
HostnameVerifier hostnameVerifier;
|
||||||
@ -1833,7 +1833,7 @@ public class ApiClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException {
|
protected KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException {
|
||||||
try {
|
try {
|
||||||
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
|
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
|
||||||
keyStore.load(null, password);
|
keyStore.load(null, password);
|
||||||
@ -1861,7 +1861,7 @@ public class ApiClient {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addOperationLookupEntry(String path, String method, Operation operation) {
|
protected void addOperationLookupEntry(String path, String method, Operation operation) {
|
||||||
if ( operation != null && operation.getOperationId() != null) {
|
if ( operation != null && operation.getOperationId() != null) {
|
||||||
operationLookupMap.put(
|
operationLookupMap.put(
|
||||||
operation.getOperationId(),
|
operation.getOperationId(),
|
||||||
@ -1921,7 +1921,7 @@ public class ApiClient {
|
|||||||
* @return The string representation of the HTTP request body
|
* @return The string representation of the HTTP request body
|
||||||
* @throws {{invokerPackage}}.ApiException If fail to serialize the request body object into a string
|
* @throws {{invokerPackage}}.ApiException If fail to serialize the request body object into a string
|
||||||
*/
|
*/
|
||||||
private String requestBodyToString(RequestBody requestBody) throws ApiException {
|
protected String requestBodyToString(RequestBody requestBody) throws ApiException {
|
||||||
if (requestBody != null) {
|
if (requestBody != null) {
|
||||||
try {
|
try {
|
||||||
final Buffer buffer = new Buffer();
|
final Buffer buffer = new Buffer();
|
||||||
|
@ -19,9 +19,9 @@ public class ApiClient {
|
|||||||
public static final String BASE_URI = "{{.}}";
|
public static final String BASE_URI = "{{.}}";
|
||||||
{{/basePath}}
|
{{/basePath}}
|
||||||
|
|
||||||
private final Config config;
|
protected final Config config;
|
||||||
|
|
||||||
private ApiClient(Config config) {
|
protected ApiClient(Config config) {
|
||||||
this.config = config;
|
this.config = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ public class ApiClient {
|
|||||||
{{/apiInfo}}
|
{{/apiInfo}}
|
||||||
|
|
||||||
public static class Config {
|
public static class Config {
|
||||||
private Supplier<RequestSpecBuilder> reqSpecSupplier = () -> new RequestSpecBuilder()
|
protected Supplier<RequestSpecBuilder> reqSpecSupplier = () -> new RequestSpecBuilder()
|
||||||
{{#basePath}}.setBaseUri(BASE_URI){{/basePath}}
|
{{#basePath}}.setBaseUri(BASE_URI){{/basePath}}
|
||||||
.setConfig(config().objectMapperConfig(objectMapperConfig().defaultObjectMapper({{#gson}}gson(){{/gson}}{{#jackson}}jackson(){{/jackson}})));
|
.setConfig(config().objectMapperConfig(objectMapperConfig().defaultObjectMapper({{#gson}}gson(){{/gson}}{{#jackson}}jackson(){{/jackson}})));
|
||||||
|
|
||||||
|
@ -74,26 +74,26 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
public enum CollectionFormat {
|
public enum CollectionFormat {
|
||||||
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
||||||
|
|
||||||
private final String separator;
|
protected final String separator;
|
||||||
CollectionFormat(String separator) {
|
CollectionFormat(String separator) {
|
||||||
this.separator = separator;
|
this.separator = separator;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String collectionToString(Collection<?> collection) {
|
protected String collectionToString(Collection<?> collection) {
|
||||||
return StringUtils.collectionToDelimitedString(collection, separator);
|
return StringUtils.collectionToDelimitedString(collection, separator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final HttpHeaders defaultHeaders = new HttpHeaders();
|
protected final HttpHeaders defaultHeaders = new HttpHeaders();
|
||||||
private final MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<>();
|
protected final MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<>();
|
||||||
|
|
||||||
private String basePath = "{{basePath}}";
|
protected String basePath = "{{basePath}}";
|
||||||
|
|
||||||
private final RestClient restClient;
|
protected final RestClient restClient;
|
||||||
private final DateFormat dateFormat;
|
protected final DateFormat dateFormat;
|
||||||
private final ObjectMapper objectMapper;
|
protected final ObjectMapper objectMapper;
|
||||||
|
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
|
|
||||||
public ApiClient() {
|
public ApiClient() {
|
||||||
@ -118,7 +118,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
this.init();
|
this.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
private ApiClient(RestClient restClient, DateFormat format) {
|
protected ApiClient(RestClient restClient, DateFormat format) {
|
||||||
this(restClient, createDefaultObjectMapper(format), format);
|
this(restClient, createDefaultObjectMapper(format), format);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -626,7 +626,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
* @param uriParams The path parameters
|
* @param uriParams The path parameters
|
||||||
* return templatized query string
|
* return templatized query string
|
||||||
*/
|
*/
|
||||||
private String generateQueryUri(MultiValueMap<String, String> queryParams, Map<String, Object> uriParams) {
|
protected String generateQueryUri(MultiValueMap<String, String> queryParams, Map<String, Object> uriParams) {
|
||||||
StringBuilder queryBuilder = new StringBuilder();
|
StringBuilder queryBuilder = new StringBuilder();
|
||||||
queryParams.forEach((name, values) -> {
|
queryParams.forEach((name, values) -> {
|
||||||
if (CollectionUtils.isEmpty(values)) {
|
if (CollectionUtils.isEmpty(values)) {
|
||||||
@ -652,7 +652,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
return queryBuilder.toString();
|
return queryBuilder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private RestClient.RequestBodySpec prepareRequest(String path, HttpMethod method, Map<String, Object> pathParams,
|
protected RestClient.RequestBodySpec prepareRequest(String path, HttpMethod method, Map<String, Object> pathParams,
|
||||||
MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams,
|
MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams,
|
||||||
MultiValueMap<String, String> cookieParams, MultiValueMap<String, Object> formParams, List<MediaType> accept,
|
MultiValueMap<String, String> cookieParams, MultiValueMap<String, Object> formParams, List<MediaType> accept,
|
||||||
MediaType contentType, String[] authNames) {
|
MediaType contentType, String[] authNames) {
|
||||||
@ -728,7 +728,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
* @param cookies map all cookies
|
* @param cookies map all cookies
|
||||||
* @return header string for cookies.
|
* @return header string for cookies.
|
||||||
*/
|
*/
|
||||||
private String buildCookieHeader(MultiValueMap<String, String> cookies) {
|
protected String buildCookieHeader(MultiValueMap<String, String> cookies) {
|
||||||
final StringBuilder cookieValue = new StringBuilder();
|
final StringBuilder cookieValue = new StringBuilder();
|
||||||
String delimiter = "";
|
String delimiter = "";
|
||||||
for (final Map.Entry<String, List<String>> entry : cookies.entrySet()) {
|
for (final Map.Entry<String, List<String>> entry : cookies.entrySet()) {
|
||||||
|
@ -56,21 +56,21 @@ import {{invokerPackage}}.auth.OAuth;
|
|||||||
|
|
||||||
{{>generatedAnnotation}}
|
{{>generatedAnnotation}}
|
||||||
public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
||||||
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
protected Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||||
private Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
protected Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
||||||
private String basePath = "{{{basePath}}}";
|
protected String basePath = "{{{basePath}}}";
|
||||||
private boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
|
|
||||||
private Client httpClient;
|
protected Client httpClient;
|
||||||
private JSON json;
|
protected JSON json;
|
||||||
private String tempFolderPath = null;
|
protected String tempFolderPath = null;
|
||||||
|
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
private int statusCode;
|
protected int statusCode;
|
||||||
private Map<String, List<String>> responseHeaders;
|
protected Map<String, List<String>> responseHeaders;
|
||||||
|
|
||||||
private DateFormat dateFormat;
|
protected DateFormat dateFormat;
|
||||||
|
|
||||||
public ApiClient() {
|
public ApiClient() {
|
||||||
json = new JSON();
|
json = new JSON();
|
||||||
@ -707,7 +707,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Response invoke(Invocation.Builder invocationBuilder, String method, Entity<?> entity) throws ApiException {
|
protected Response invoke(Invocation.Builder invocationBuilder, String method, Entity<?> entity) throws ApiException {
|
||||||
Response response = null;
|
Response response = null;
|
||||||
|
|
||||||
if ("GET".equals(method)) {
|
if ("GET".equals(method)) {
|
||||||
@ -736,7 +736,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
/**
|
/**
|
||||||
* Build the Client used to make HTTP requests.
|
* Build the Client used to make HTTP requests.
|
||||||
*/
|
*/
|
||||||
private Client buildHttpClient(boolean debugging) {
|
protected Client buildHttpClient(boolean debugging) {
|
||||||
final ClientConfiguration clientConfig = new ClientConfiguration(ResteasyProviderFactory.getInstance());
|
final ClientConfiguration clientConfig = new ClientConfiguration(ResteasyProviderFactory.getInstance());
|
||||||
clientConfig.register(json);
|
clientConfig.register(json);
|
||||||
if(debugging){
|
if(debugging){
|
||||||
@ -744,7 +744,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
}
|
}
|
||||||
return ClientBuilder.newClient(clientConfig);
|
return ClientBuilder.newClient(clientConfig);
|
||||||
}
|
}
|
||||||
private Map<String, List<String>> buildResponseHeaders(Response response) {
|
protected Map<String, List<String>> buildResponseHeaders(Response response) {
|
||||||
Map<String, List<String>> responseHeaders = new HashMap<String, List<String>>();
|
Map<String, List<String>> responseHeaders = new HashMap<String, List<String>>();
|
||||||
for (Entry<String, List<Object>> entry: response.getHeaders().entrySet()) {
|
for (Entry<String, List<Object>> entry: response.getHeaders().entrySet()) {
|
||||||
List<Object> values = entry.getValue();
|
List<Object> values = entry.getValue();
|
||||||
@ -762,7 +762,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
*
|
*
|
||||||
* @param authNames The authentications to apply
|
* @param authNames The authentications to apply
|
||||||
*/
|
*/
|
||||||
private void updateParamsForAuth(String[] authNames, List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams) {
|
protected void updateParamsForAuth(String[] authNames, List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams) {
|
||||||
for (String authName : authNames) {
|
for (String authName : authNames) {
|
||||||
Authentication auth = authentications.get(authName);
|
Authentication auth = authentications.get(authName);
|
||||||
if (auth == null) throw new RuntimeException("Authentication undefined: " + authName);
|
if (auth == null) throw new RuntimeException("Authentication undefined: " + authName);
|
||||||
|
@ -93,33 +93,33 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
public enum CollectionFormat {
|
public enum CollectionFormat {
|
||||||
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
||||||
|
|
||||||
private final String separator;
|
protected final String separator;
|
||||||
|
|
||||||
private CollectionFormat(String separator) {
|
CollectionFormat(String separator) {
|
||||||
this.separator = separator;
|
this.separator = separator;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String collectionToString(Collection<?> collection) {
|
protected String collectionToString(Collection<?> collection) {
|
||||||
return StringUtils.collectionToDelimitedString(collection, separator);
|
return StringUtils.collectionToDelimitedString(collection, separator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
|
|
||||||
private HttpHeaders defaultHeaders = new HttpHeaders();
|
protected HttpHeaders defaultHeaders = new HttpHeaders();
|
||||||
private MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<String, String>();
|
protected MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<String, String>();
|
||||||
|
|
||||||
private int maxAttemptsForRetry = {{maxAttemptsForRetry}};
|
protected int maxAttemptsForRetry = {{maxAttemptsForRetry}};
|
||||||
|
|
||||||
private long waitTimeMillis = {{waitTimeMillis}};
|
protected long waitTimeMillis = {{waitTimeMillis}};
|
||||||
|
|
||||||
private String basePath = "{{basePath}}";
|
protected String basePath = "{{basePath}}";
|
||||||
|
|
||||||
private RestTemplate restTemplate;
|
protected RestTemplate restTemplate;
|
||||||
|
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
private DateFormat dateFormat;
|
protected DateFormat dateFormat;
|
||||||
|
|
||||||
public ApiClient() {
|
public ApiClient() {
|
||||||
this.restTemplate = buildRestTemplate();
|
this.restTemplate = buildRestTemplate();
|
||||||
@ -852,7 +852,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
* @param cookies map all cookies
|
* @param cookies map all cookies
|
||||||
* @return header string for cookies.
|
* @return header string for cookies.
|
||||||
*/
|
*/
|
||||||
private String buildCookieHeader(MultiValueMap<String, String> cookies) {
|
protected String buildCookieHeader(MultiValueMap<String, String> cookies) {
|
||||||
final StringBuilder cookieValue = new StringBuilder();
|
final StringBuilder cookieValue = new StringBuilder();
|
||||||
String delimiter = "";
|
String delimiter = "";
|
||||||
for (final Map.Entry<String, List<String>> entry : cookies.entrySet()) {
|
for (final Map.Entry<String, List<String>> entry : cookies.entrySet()) {
|
||||||
@ -906,8 +906,8 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ApiClientHttpRequestInterceptor implements ClientHttpRequestInterceptor {
|
protected class ApiClientHttpRequestInterceptor implements ClientHttpRequestInterceptor {
|
||||||
private final Log log = LogFactory.getLog(ApiClientHttpRequestInterceptor.class);
|
protected final Log log = LogFactory.getLog(ApiClientHttpRequestInterceptor.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException {
|
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException {
|
||||||
@ -917,21 +917,21 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void logRequest(HttpRequest request, byte[] body) throws UnsupportedEncodingException {
|
protected void logRequest(HttpRequest request, byte[] body) throws UnsupportedEncodingException {
|
||||||
log.info("URI: " + request.getURI());
|
log.info("URI: " + request.getURI());
|
||||||
log.info("HTTP Method: " + request.getMethod());
|
log.info("HTTP Method: " + request.getMethod());
|
||||||
log.info("HTTP Headers: " + headersToString(request.getHeaders()));
|
log.info("HTTP Headers: " + headersToString(request.getHeaders()));
|
||||||
log.info("Request Body: " + new String(body, StandardCharsets.UTF_8));
|
log.info("Request Body: " + new String(body, StandardCharsets.UTF_8));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void logResponse(ClientHttpResponse response) throws IOException {
|
protected void logResponse(ClientHttpResponse response) throws IOException {
|
||||||
log.info("HTTP Status Code: " + response.getStatusCode().value());
|
log.info("HTTP Status Code: " + response.getStatusCode().value());
|
||||||
log.info("Status Text: " + response.getStatusText());
|
log.info("Status Text: " + response.getStatusText());
|
||||||
log.info("HTTP Headers: " + headersToString(response.getHeaders()));
|
log.info("HTTP Headers: " + headersToString(response.getHeaders()));
|
||||||
log.info("Response Body: " + bodyToString(response.getBody()));
|
log.info("Response Body: " + bodyToString(response.getBody()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private String headersToString(HttpHeaders headers) {
|
protected String headersToString(HttpHeaders headers) {
|
||||||
if(headers == null || headers.isEmpty()) {
|
if(headers == null || headers.isEmpty()) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@ -948,7 +948,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String bodyToString(InputStream body) throws IOException {
|
protected String bodyToString(InputStream body) throws IOException {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(body, StandardCharsets.UTF_8));
|
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(body, StandardCharsets.UTF_8));
|
||||||
String line = bufferedReader.readLine();
|
String line = bufferedReader.readLine();
|
||||||
|
@ -55,11 +55,11 @@ import java.util.HashMap;
|
|||||||
|
|
||||||
public class ApiClient {
|
public class ApiClient {
|
||||||
|
|
||||||
private Map<String, Interceptor> apiAuthorizations;
|
protected Map<String, Interceptor> apiAuthorizations;
|
||||||
private OkHttpClient.Builder okBuilder;
|
protected OkHttpClient.Builder okBuilder;
|
||||||
private Retrofit.Builder adapterBuilder;
|
protected Retrofit.Builder adapterBuilder;
|
||||||
private JSON json;
|
protected JSON json;
|
||||||
private OkHttpClient okHttpClient;
|
protected OkHttpClient okHttpClient;
|
||||||
|
|
||||||
public ApiClient() {
|
public ApiClient() {
|
||||||
apiAuthorizations = new LinkedHashMap<String, Interceptor>();
|
apiAuthorizations = new LinkedHashMap<String, Interceptor>();
|
||||||
@ -426,8 +426,8 @@ public class ApiClient {
|
|||||||
* expected type is String, then just return the body string.
|
* expected type is String, then just return the body string.
|
||||||
*/
|
*/
|
||||||
class GsonResponseBodyConverterToString<T> implements Converter<ResponseBody, T> {
|
class GsonResponseBodyConverterToString<T> implements Converter<ResponseBody, T> {
|
||||||
private final Gson gson;
|
protected final Gson gson;
|
||||||
private final Type type;
|
protected final Type type;
|
||||||
|
|
||||||
GsonResponseBodyConverterToString(Gson gson, Type type) {
|
GsonResponseBodyConverterToString(Gson gson, Type type) {
|
||||||
this.gson = gson;
|
this.gson = gson;
|
||||||
@ -447,14 +447,14 @@ class GsonResponseBodyConverterToString<T> implements Converter<ResponseBody, T>
|
|||||||
|
|
||||||
class GsonCustomConverterFactory extends Converter.Factory
|
class GsonCustomConverterFactory extends Converter.Factory
|
||||||
{
|
{
|
||||||
private final Gson gson;
|
protected final Gson gson;
|
||||||
private final GsonConverterFactory gsonConverterFactory;
|
protected final GsonConverterFactory gsonConverterFactory;
|
||||||
|
|
||||||
public static GsonCustomConverterFactory create(Gson gson) {
|
public static GsonCustomConverterFactory create(Gson gson) {
|
||||||
return new GsonCustomConverterFactory(gson);
|
return new GsonCustomConverterFactory(gson);
|
||||||
}
|
}
|
||||||
|
|
||||||
private GsonCustomConverterFactory(Gson gson) {
|
protected GsonCustomConverterFactory(Gson gson) {
|
||||||
if (gson == null)
|
if (gson == null)
|
||||||
throw new NullPointerException("gson == null");
|
throw new NullPointerException("gson == null");
|
||||||
this.gson = gson;
|
this.gson = gson;
|
||||||
|
@ -31,13 +31,13 @@ import {{invokerPackage}}.auth.Authentication;
|
|||||||
public class ApiClient {
|
public class ApiClient {
|
||||||
|
|
||||||
/** Underlying HTTP-client */
|
/** Underlying HTTP-client */
|
||||||
private WSClient wsClient;
|
protected WSClient wsClient;
|
||||||
|
|
||||||
/** Supported auths */
|
/** Supported auths */
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
/** API base path */
|
/** API base path */
|
||||||
private String basePath = "{{{basePath}}}";
|
protected String basePath = "{{{basePath}}}";
|
||||||
|
|
||||||
public ApiClient(WSClient wsClient) {
|
public ApiClient(WSClient wsClient) {
|
||||||
this();
|
this();
|
||||||
|
@ -31,13 +31,13 @@ import {{invokerPackage}}.auth.Authentication;
|
|||||||
public class ApiClient {
|
public class ApiClient {
|
||||||
|
|
||||||
/** Underlying HTTP-client */
|
/** Underlying HTTP-client */
|
||||||
private WSClient wsClient;
|
protected WSClient wsClient;
|
||||||
|
|
||||||
/** Supported auths */
|
/** Supported auths */
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
/** API base path */
|
/** API base path */
|
||||||
private String basePath = "{{{basePath}}}";
|
protected String basePath = "{{{basePath}}}";
|
||||||
|
|
||||||
public ApiClient(WSClient wsClient) {
|
public ApiClient(WSClient wsClient) {
|
||||||
this();
|
this();
|
||||||
|
@ -37,22 +37,22 @@ import {{invokerPackage}}.auth.Authentication;
|
|||||||
public class ApiClient {
|
public class ApiClient {
|
||||||
|
|
||||||
/** Underlying HTTP-client */
|
/** Underlying HTTP-client */
|
||||||
private WSClient wsClient;
|
protected WSClient wsClient;
|
||||||
|
|
||||||
/** Creates HTTP call instances */
|
/** Creates HTTP call instances */
|
||||||
private Play26CallFactory callFactory;
|
protected Play26CallFactory callFactory;
|
||||||
|
|
||||||
/** Create {@link java.util.concurrent.CompletionStage} instances from HTTP calls */
|
/** Create {@link java.util.concurrent.CompletionStage} instances from HTTP calls */
|
||||||
private Play26CallAdapterFactory callAdapterFactory;
|
protected Play26CallAdapterFactory callAdapterFactory;
|
||||||
|
|
||||||
/** Supported auths */
|
/** Supported auths */
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
/** API base path */
|
/** API base path */
|
||||||
private String basePath = "{{{basePath}}}";
|
protected String basePath = "{{{basePath}}}";
|
||||||
|
|
||||||
/** Default ObjectMapper */
|
/** Default ObjectMapper */
|
||||||
private ObjectMapper defaultMapper;
|
protected ObjectMapper defaultMapper;
|
||||||
|
|
||||||
public ApiClient(WSClient wsClient) {
|
public ApiClient(WSClient wsClient) {
|
||||||
this();
|
this();
|
||||||
|
@ -49,21 +49,21 @@ import static java.util.stream.Collectors.toMap;
|
|||||||
{{>generatedAnnotation}}
|
{{>generatedAnnotation}}
|
||||||
public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
||||||
|
|
||||||
private static final Pattern CONTENT_DISPOSITION_PATTERN = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?");
|
protected static final Pattern CONTENT_DISPOSITION_PATTERN = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?");
|
||||||
private static final OpenOptions FILE_DOWNLOAD_OPTIONS = new OpenOptions().setCreate(true).setTruncateExisting(true);
|
protected static final OpenOptions FILE_DOWNLOAD_OPTIONS = new OpenOptions().setCreate(true).setTruncateExisting(true);
|
||||||
|
|
||||||
private final Vertx vertx;
|
protected final Vertx vertx;
|
||||||
private final JsonObject config;
|
protected final JsonObject config;
|
||||||
private final String identifier;
|
protected final String identifier;
|
||||||
|
|
||||||
private MultiMap defaultHeaders = MultiMap.caseInsensitiveMultiMap();
|
protected MultiMap defaultHeaders = MultiMap.caseInsensitiveMultiMap();
|
||||||
private MultiMap defaultCookies = MultiMap.caseInsensitiveMultiMap();
|
protected MultiMap defaultCookies = MultiMap.caseInsensitiveMultiMap();
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
private String basePath = "{{{basePath}}}";
|
protected String basePath = "{{{basePath}}}";
|
||||||
private DateFormat dateFormat;
|
protected DateFormat dateFormat;
|
||||||
private ObjectMapper objectMapper;
|
protected ObjectMapper objectMapper;
|
||||||
private String downloadsDir = "";
|
protected String downloadsDir = "";
|
||||||
private int timeout = -1;
|
protected int timeout = -1;
|
||||||
|
|
||||||
public ApiClient(Vertx vertx, JsonObject config) {
|
public ApiClient(Vertx vertx, JsonObject config) {
|
||||||
Objects.requireNonNull(vertx, "Vertx must not be null");
|
Objects.requireNonNull(vertx, "Vertx must not be null");
|
||||||
@ -385,7 +385,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
* @param mime MIME
|
* @param mime MIME
|
||||||
* @return True if the MIME type is JSON
|
* @return True if the MIME type is JSON
|
||||||
*/
|
*/
|
||||||
private boolean isJsonMime(String mime) {
|
protected boolean isJsonMime(String mime) {
|
||||||
String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$";
|
String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$";
|
||||||
return mime != null && (mime.matches(jsonMime) || mime.equalsIgnoreCase("application/json-patch+json"));
|
return mime != null && (mime.matches(jsonMime) || mime.equalsIgnoreCase("application/json-patch+json"));
|
||||||
}
|
}
|
||||||
@ -523,7 +523,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String buildCookieHeader(MultiMap cookies) {
|
protected String buildCookieHeader(MultiMap cookies) {
|
||||||
final StringBuilder cookieValue = new StringBuilder();
|
final StringBuilder cookieValue = new StringBuilder();
|
||||||
String delimiter = "";
|
String delimiter = "";
|
||||||
for (final Map.Entry<String, String> entry : cookies.entries()) {
|
for (final Map.Entry<String, String> entry : cookies.entries()) {
|
||||||
@ -680,7 +680,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
|
|
||||||
public static class AuthInfo {
|
public static class AuthInfo {
|
||||||
|
|
||||||
private final Map<String, Authentication> authentications = new LinkedHashMap<>();{{#authMethods}}{{#isBasic}}{{#isBasicBasic}}
|
protected final Map<String, Authentication> authentications = new LinkedHashMap<>();{{#authMethods}}{{#isBasic}}{{#isBasicBasic}}
|
||||||
|
|
||||||
public void add{{#lambda.pascalcase}}{{name}}{{/lambda.pascalcase}}Authentication(String username, String password) {
|
public void add{{#lambda.pascalcase}}{{name}}{{/lambda.pascalcase}}Authentication(String username, String password) {
|
||||||
HttpBasicAuth auth = new HttpBasicAuth();
|
HttpBasicAuth auth = new HttpBasicAuth();
|
||||||
|
@ -89,28 +89,28 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
public enum CollectionFormat {
|
public enum CollectionFormat {
|
||||||
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
||||||
|
|
||||||
private final String separator;
|
protected final String separator;
|
||||||
private CollectionFormat(String separator) {
|
CollectionFormat(String separator) {
|
||||||
this.separator = separator;
|
this.separator = separator;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String collectionToString(Collection<?> collection) {
|
protected String collectionToString(Collection<?> collection) {
|
||||||
return StringUtils.collectionToDelimitedString(collection, separator);
|
return StringUtils.collectionToDelimitedString(collection, separator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String URI_TEMPLATE_ATTRIBUTE = WebClient.class.getName() + ".uriTemplate";
|
protected static final String URI_TEMPLATE_ATTRIBUTE = WebClient.class.getName() + ".uriTemplate";
|
||||||
|
|
||||||
private HttpHeaders defaultHeaders = new HttpHeaders();
|
protected HttpHeaders defaultHeaders = new HttpHeaders();
|
||||||
private MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<String, String>();
|
protected MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<String, String>();
|
||||||
|
|
||||||
private String basePath = "{{basePath}}";
|
protected String basePath = "{{basePath}}";
|
||||||
|
|
||||||
private final WebClient webClient;
|
protected final WebClient webClient;
|
||||||
private final DateFormat dateFormat;
|
protected final DateFormat dateFormat;
|
||||||
private final ObjectMapper objectMapper;
|
protected final ObjectMapper objectMapper;
|
||||||
|
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
|
|
||||||
public ApiClient() {
|
public ApiClient() {
|
||||||
@ -135,7 +135,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
this(Optional.ofNullable(webClient).orElseGet(() -> buildWebClient(mapper.copy())), format);
|
this(Optional.ofNullable(webClient).orElseGet(() -> buildWebClient(mapper.copy())), format);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ApiClient(WebClient webClient, DateFormat format) {
|
protected ApiClient(WebClient webClient, DateFormat format) {
|
||||||
this.webClient = webClient;
|
this.webClient = webClient;
|
||||||
this.dateFormat = format;
|
this.dateFormat = format;
|
||||||
this.objectMapper = createDefaultObjectMapper(format);
|
this.objectMapper = createDefaultObjectMapper(format);
|
||||||
@ -634,7 +634,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
* @param uriParams The path parameters
|
* @param uriParams The path parameters
|
||||||
* return templatized query string
|
* return templatized query string
|
||||||
*/
|
*/
|
||||||
private String generateQueryUri(MultiValueMap<String, String> queryParams, Map<String, Object> uriParams) {
|
protected String generateQueryUri(MultiValueMap<String, String> queryParams, Map<String, Object> uriParams) {
|
||||||
StringBuilder queryBuilder = new StringBuilder();
|
StringBuilder queryBuilder = new StringBuilder();
|
||||||
queryParams.forEach((name, values) -> {
|
queryParams.forEach((name, values) -> {
|
||||||
if (CollectionUtils.isEmpty(values)) {
|
if (CollectionUtils.isEmpty(values)) {
|
||||||
@ -660,7 +660,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
return queryBuilder.toString();
|
return queryBuilder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private WebClient.RequestBodySpec prepareRequest(String path, HttpMethod method, Map<String, Object> pathParams,
|
protected WebClient.RequestBodySpec prepareRequest(String path, HttpMethod method, Map<String, Object> pathParams,
|
||||||
MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams,
|
MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams,
|
||||||
MultiValueMap<String, String> cookieParams, MultiValueMap<String, Object> formParams, List<MediaType> accept,
|
MultiValueMap<String, String> cookieParams, MultiValueMap<String, Object> formParams, List<MediaType> accept,
|
||||||
MediaType contentType, String[] authNames) {
|
MediaType contentType, String[] authNames) {
|
||||||
|
@ -76,9 +76,9 @@ import {{invokerPackage}}.auth.OAuth;
|
|||||||
|
|
||||||
{{>generatedAnnotation}}
|
{{>generatedAnnotation}}
|
||||||
public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
||||||
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
protected Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||||
private Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
protected Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
||||||
private String basePath = "{{{basePath}}}";
|
protected String basePath = "{{{basePath}}}";
|
||||||
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>({{#servers}}{{#-first}}Arrays.asList(
|
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>({{#servers}}{{#-first}}Arrays.asList(
|
||||||
{{/-first}} new ServerConfiguration(
|
{{/-first}} new ServerConfiguration(
|
||||||
"{{{url}}}",
|
"{{{url}}}",
|
||||||
@ -106,18 +106,18 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
){{/-last}}{{/servers}});
|
){{/-last}}{{/servers}});
|
||||||
protected Integer serverIndex = 0;
|
protected Integer serverIndex = 0;
|
||||||
protected Map<String, String> serverVariables = null;
|
protected Map<String, String> serverVariables = null;
|
||||||
private boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
private int connectionTimeout = 0;
|
protected int connectionTimeout = 0;
|
||||||
|
|
||||||
private Client httpClient;
|
protected Client httpClient;
|
||||||
private ObjectMapper objectMapper;
|
protected ObjectMapper objectMapper;
|
||||||
|
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
private int statusCode;
|
protected int statusCode;
|
||||||
private Map<String, List<String>> responseHeaders;
|
protected Map<String, List<String>> responseHeaders;
|
||||||
|
|
||||||
private DateFormat dateFormat;
|
protected DateFormat dateFormat;
|
||||||
|
|
||||||
public ApiClient() {
|
public ApiClient() {
|
||||||
objectMapper = new ObjectMapper();
|
objectMapper = new ObjectMapper();
|
||||||
@ -706,7 +706,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
* @param collectionQueryParams The collection query parameters
|
* @param collectionQueryParams The collection query parameters
|
||||||
* @return The full URL
|
* @return The full URL
|
||||||
*/
|
*/
|
||||||
private String buildUrl(String path, List<Pair> queryParams, List<Pair> collectionQueryParams) {
|
protected String buildUrl(String path, List<Pair> queryParams, List<Pair> collectionQueryParams) {
|
||||||
String baseURL;
|
String baseURL;
|
||||||
if (serverIndex != null) {
|
if (serverIndex != null) {
|
||||||
if (serverIndex < 0 || serverIndex >= servers.size()) {
|
if (serverIndex < 0 || serverIndex >= servers.size()) {
|
||||||
@ -759,7 +759,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
return url.toString();
|
return url.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private ClientResponse getAPIResponse(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String accept, String contentType, String[] authNames) throws ApiException {
|
protected ClientResponse getAPIResponse(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String accept, String contentType, String[] authNames) throws ApiException {
|
||||||
if (body != null && !formParams.isEmpty()) {
|
if (body != null && !formParams.isEmpty()) {
|
||||||
throw new ApiException(500, "Cannot have body and form params");
|
throw new ApiException(500, "Cannot have body and form params");
|
||||||
}
|
}
|
||||||
@ -872,7 +872,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
* @param headerParams Header parameters
|
* @param headerParams Header parameters
|
||||||
* @param cookieParams Cookie parameters
|
* @param cookieParams Cookie parameters
|
||||||
*/
|
*/
|
||||||
private void updateParamsForAuth(String[] authNames, List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams) {
|
protected void updateParamsForAuth(String[] authNames, List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams) {
|
||||||
for (String authName : authNames) {
|
for (String authName : authNames) {
|
||||||
Authentication auth = authentications.get(authName);
|
Authentication auth = authentications.get(authName);
|
||||||
if (auth == null) throw new RuntimeException("Authentication undefined: " + authName);
|
if (auth == null) throw new RuntimeException("Authentication undefined: " + authName);
|
||||||
@ -885,7 +885,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
* @param formParams Form parameters
|
* @param formParams Form parameters
|
||||||
* @return HTTP form encoded parameters
|
* @return HTTP form encoded parameters
|
||||||
*/
|
*/
|
||||||
private String getXWWWFormUrlencodedParams(Map<String, Object> formParams) {
|
protected String getXWWWFormUrlencodedParams(Map<String, Object> formParams) {
|
||||||
StringBuilder formParamBuilder = new StringBuilder();
|
StringBuilder formParamBuilder = new StringBuilder();
|
||||||
|
|
||||||
for (Entry<String, Object> param : formParams.entrySet()) {
|
for (Entry<String, Object> param : formParams.entrySet()) {
|
||||||
|
@ -85,7 +85,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
protected Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
protected Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
||||||
protected String basePath = "{{{basePath}}}";
|
protected String basePath = "{{{basePath}}}";
|
||||||
protected String userAgent;
|
protected String userAgent;
|
||||||
private static final Logger log = Logger.getLogger(ApiClient.class.getName());
|
protected static final Logger log = Logger.getLogger(ApiClient.class.getName());
|
||||||
|
|
||||||
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>({{#servers}}{{#-first}}Arrays.asList(
|
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>({{#servers}}{{#-first}}Arrays.asList(
|
||||||
{{/-first}} new ServerConfiguration(
|
{{/-first}} new ServerConfiguration(
|
||||||
@ -158,7 +158,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
protected boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
protected ClientConfig clientConfig;
|
protected ClientConfig clientConfig;
|
||||||
protected int connectionTimeout = 0;
|
protected int connectionTimeout = 0;
|
||||||
private int readTimeout = 0;
|
protected int readTimeout = 0;
|
||||||
|
|
||||||
protected Client httpClient;
|
protected Client httpClient;
|
||||||
protected JSON json;
|
protected JSON json;
|
||||||
@ -311,14 +311,14 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateBasePath() {
|
protected void updateBasePath() {
|
||||||
if (serverIndex != null) {
|
if (serverIndex != null) {
|
||||||
setBasePath(servers.get(serverIndex).URL(serverVariables));
|
setBasePath(servers.get(serverIndex).URL(serverVariables));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{{#hasOAuthMethods}}
|
{{#hasOAuthMethods}}
|
||||||
private void setOauthBasePath(String basePath) {
|
protected void setOauthBasePath(String basePath) {
|
||||||
for(Authentication auth : authentications.values()) {
|
for(Authentication auth : authentications.values()) {
|
||||||
if (auth instanceof OAuth) {
|
if (auth instanceof OAuth) {
|
||||||
((OAuth) auth).setBasePath(basePath);
|
((OAuth) auth).setBasePath(basePath);
|
||||||
@ -1200,7 +1200,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Response sendRequest(String method, Invocation.Builder invocationBuilder, Entity<?> entity) {
|
protected Response sendRequest(String method, Invocation.Builder invocationBuilder, Entity<?> entity) {
|
||||||
Response response;
|
Response response;
|
||||||
if ("POST".equals(method)) {
|
if ("POST".equals(method)) {
|
||||||
response = invocationBuilder.post(entity);
|
response = invocationBuilder.post(entity);
|
||||||
|
@ -83,9 +83,9 @@ import org.openapitools.client.auth.HttpBearerAuth;
|
|||||||
|
|
||||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
||||||
public class ApiClient extends JavaTimeFormatter {
|
public class ApiClient extends JavaTimeFormatter {
|
||||||
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
protected Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||||
private Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
protected Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
||||||
private String basePath = "http://localhost:3000";
|
protected String basePath = "http://localhost:3000";
|
||||||
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>(Arrays.asList(
|
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>(Arrays.asList(
|
||||||
new ServerConfiguration(
|
new ServerConfiguration(
|
||||||
"http://localhost:3000",
|
"http://localhost:3000",
|
||||||
@ -95,22 +95,22 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
));
|
));
|
||||||
protected Integer serverIndex = 0;
|
protected Integer serverIndex = 0;
|
||||||
protected Map<String, String> serverVariables = null;
|
protected Map<String, String> serverVariables = null;
|
||||||
private boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
private int connectionTimeout = 0;
|
protected int connectionTimeout = 0;
|
||||||
|
|
||||||
private CloseableHttpClient httpClient;
|
protected CloseableHttpClient httpClient;
|
||||||
private ObjectMapper objectMapper;
|
protected ObjectMapper objectMapper;
|
||||||
protected String tempFolderPath = null;
|
protected String tempFolderPath = null;
|
||||||
|
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
private Map<Long, Integer> lastStatusCodeByThread = new ConcurrentHashMap<>();
|
protected Map<Long, Integer> lastStatusCodeByThread = new ConcurrentHashMap<>();
|
||||||
private Map<Long, Map<String, List<String>>> lastResponseHeadersByThread = new ConcurrentHashMap<>();
|
protected Map<Long, Map<String, List<String>>> lastResponseHeadersByThread = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
private DateFormat dateFormat;
|
protected DateFormat dateFormat;
|
||||||
|
|
||||||
// Methods that can have a request body
|
// Methods that can have a request body
|
||||||
private static List<String> bodyMethods = Arrays.asList("POST", "PUT", "DELETE", "PATCH");
|
protected static List<String> bodyMethods = Arrays.asList("POST", "PUT", "DELETE", "PATCH");
|
||||||
|
|
||||||
public ApiClient(CloseableHttpClient httpClient) {
|
public ApiClient(CloseableHttpClient httpClient) {
|
||||||
objectMapper = new ObjectMapper();
|
objectMapper = new ObjectMapper();
|
||||||
@ -675,7 +675,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
/**
|
/**
|
||||||
* Parse content type object from header value
|
* Parse content type object from header value
|
||||||
*/
|
*/
|
||||||
private ContentType getContentType(String headerValue) throws ApiException {
|
protected ContentType getContentType(String headerValue) throws ApiException {
|
||||||
try {
|
try {
|
||||||
return ContentType.parse(headerValue);
|
return ContentType.parse(headerValue);
|
||||||
} catch (UnsupportedCharsetException e) {
|
} catch (UnsupportedCharsetException e) {
|
||||||
@ -686,7 +686,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
/**
|
/**
|
||||||
* Get content type of a response or null if one was not provided
|
* Get content type of a response or null if one was not provided
|
||||||
*/
|
*/
|
||||||
private String getResponseMimeType(HttpResponse response) throws ApiException {
|
protected String getResponseMimeType(HttpResponse response) throws ApiException {
|
||||||
Header contentTypeHeader = response.getFirstHeader("Content-Type");
|
Header contentTypeHeader = response.getFirstHeader("Content-Type");
|
||||||
if (contentTypeHeader != null) {
|
if (contentTypeHeader != null) {
|
||||||
return getContentType(contentTypeHeader.getValue()).getMimeType();
|
return getContentType(contentTypeHeader.getValue()).getMimeType();
|
||||||
@ -795,7 +795,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private File downloadFileFromResponse(CloseableHttpResponse response) throws IOException {
|
protected File downloadFileFromResponse(CloseableHttpResponse response) throws IOException {
|
||||||
Header contentDispositionHeader = response.getFirstHeader("Content-Disposition");
|
Header contentDispositionHeader = response.getFirstHeader("Content-Disposition");
|
||||||
String contentDisposition = contentDispositionHeader == null ? null : contentDispositionHeader.getValue();
|
String contentDisposition = contentDispositionHeader == null ? null : contentDispositionHeader.getValue();
|
||||||
File file = prepareDownloadFile(contentDisposition);
|
File file = prepareDownloadFile(contentDisposition);
|
||||||
@ -866,7 +866,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
* @param urlQueryDeepObject URL query string of the deep object parameters
|
* @param urlQueryDeepObject URL query string of the deep object parameters
|
||||||
* @return The full URL
|
* @return The full URL
|
||||||
*/
|
*/
|
||||||
private String buildUrl(String path, List<Pair> queryParams, List<Pair> collectionQueryParams, String urlQueryDeepObject) {
|
protected String buildUrl(String path, List<Pair> queryParams, List<Pair> collectionQueryParams, String urlQueryDeepObject) {
|
||||||
String baseURL = getBaseURL();
|
String baseURL = getBaseURL();
|
||||||
|
|
||||||
final StringBuilder url = new StringBuilder();
|
final StringBuilder url = new StringBuilder();
|
||||||
@ -1045,7 +1045,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
* @param headerParams Header parameters
|
* @param headerParams Header parameters
|
||||||
* @param cookieParams Cookie parameters
|
* @param cookieParams Cookie parameters
|
||||||
*/
|
*/
|
||||||
private void updateParamsForAuth(String[] authNames, List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams) {
|
protected void updateParamsForAuth(String[] authNames, List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams) {
|
||||||
for (String authName : authNames) {
|
for (String authName : authNames) {
|
||||||
Authentication auth = authentications.get(authName);
|
Authentication auth = authentications.get(authName);
|
||||||
if (auth == null) throw new RuntimeException("Authentication undefined: " + authName);
|
if (auth == null) throw new RuntimeException("Authentication undefined: " + authName);
|
||||||
|
@ -33,13 +33,13 @@ import org.openapitools.client.auth.ApiKeyAuth;
|
|||||||
|
|
||||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
||||||
public class ApiClient {
|
public class ApiClient {
|
||||||
private static final Logger log = Logger.getLogger(ApiClient.class.getName());
|
protected static final Logger log = Logger.getLogger(ApiClient.class.getName());
|
||||||
|
|
||||||
public interface Api {}
|
public interface Api {}
|
||||||
|
|
||||||
private String basePath = "http://localhost:3000";
|
protected String basePath = "http://localhost:3000";
|
||||||
private Map<String, RequestInterceptor> apiAuthorizations;
|
protected Map<String, RequestInterceptor> apiAuthorizations;
|
||||||
private Feign.Builder feignBuilder;
|
protected Feign.Builder feignBuilder;
|
||||||
|
|
||||||
public ApiClient() {
|
public ApiClient() {
|
||||||
apiAuthorizations = new LinkedHashMap<String, RequestInterceptor>();
|
apiAuthorizations = new LinkedHashMap<String, RequestInterceptor>();
|
||||||
@ -219,7 +219,7 @@ public class ApiClient {
|
|||||||
feignBuilder.requestInterceptor(authorization);
|
feignBuilder.requestInterceptor(authorization);
|
||||||
}
|
}
|
||||||
|
|
||||||
private <T extends RequestInterceptor> T getAuthorization(Class<T> type) {
|
protected <T extends RequestInterceptor> T getAuthorization(Class<T> type) {
|
||||||
return (T) apiAuthorizations.values()
|
return (T) apiAuthorizations.values()
|
||||||
.stream()
|
.stream()
|
||||||
.filter(requestInterceptor -> type.isAssignableFrom(requestInterceptor.getClass()))
|
.filter(requestInterceptor -> type.isAssignableFrom(requestInterceptor.getClass()))
|
||||||
|
@ -54,17 +54,17 @@ import static java.nio.charset.StandardCharsets.UTF_8;
|
|||||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
||||||
public class ApiClient {
|
public class ApiClient {
|
||||||
|
|
||||||
private HttpClient.Builder builder;
|
protected HttpClient.Builder builder;
|
||||||
private ObjectMapper mapper;
|
protected ObjectMapper mapper;
|
||||||
private String scheme;
|
protected String scheme;
|
||||||
private String host;
|
protected String host;
|
||||||
private int port;
|
protected int port;
|
||||||
private String basePath;
|
protected String basePath;
|
||||||
private Consumer<HttpRequest.Builder> interceptor;
|
protected Consumer<HttpRequest.Builder> interceptor;
|
||||||
private Consumer<HttpResponse<InputStream>> responseInterceptor;
|
protected Consumer<HttpResponse<InputStream>> responseInterceptor;
|
||||||
private Consumer<HttpResponse<String>> asyncResponseInterceptor;
|
protected Consumer<HttpResponse<String>> asyncResponseInterceptor;
|
||||||
private Duration readTimeout;
|
protected Duration readTimeout;
|
||||||
private Duration connectTimeout;
|
protected Duration connectTimeout;
|
||||||
|
|
||||||
public static String valueToString(Object value) {
|
public static String valueToString(Object value) {
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
@ -207,7 +207,7 @@ public class ApiClient {
|
|||||||
return mapper;
|
return mapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getDefaultBaseUri() {
|
protected String getDefaultBaseUri() {
|
||||||
return "http://localhost:3000";
|
return "http://localhost:3000";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ import org.openapitools.client.auth.OAuthFlow;
|
|||||||
*/
|
*/
|
||||||
public class ApiClient {
|
public class ApiClient {
|
||||||
|
|
||||||
private String basePath = "http://petstore.swagger.io/v2";
|
protected String basePath = "http://petstore.swagger.io/v2";
|
||||||
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>(Arrays.asList(
|
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>(Arrays.asList(
|
||||||
new ServerConfiguration(
|
new ServerConfiguration(
|
||||||
"http://petstore.swagger.io/v2",
|
"http://petstore.swagger.io/v2",
|
||||||
@ -76,26 +76,26 @@ public class ApiClient {
|
|||||||
));
|
));
|
||||||
protected Integer serverIndex = 0;
|
protected Integer serverIndex = 0;
|
||||||
protected Map<String, String> serverVariables = null;
|
protected Map<String, String> serverVariables = null;
|
||||||
private boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
protected Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||||
private Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
protected Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
||||||
private String tempFolderPath = null;
|
protected String tempFolderPath = null;
|
||||||
|
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
private DateFormat dateFormat;
|
protected DateFormat dateFormat;
|
||||||
private DateFormat datetimeFormat;
|
protected DateFormat datetimeFormat;
|
||||||
private boolean lenientDatetimeFormat;
|
protected boolean lenientDatetimeFormat;
|
||||||
private int dateLength;
|
protected int dateLength;
|
||||||
|
|
||||||
private InputStream sslCaCert;
|
protected InputStream sslCaCert;
|
||||||
private boolean verifyingSsl;
|
protected boolean verifyingSsl;
|
||||||
private KeyManager[] keyManagers;
|
protected KeyManager[] keyManagers;
|
||||||
|
|
||||||
private OkHttpClient httpClient;
|
protected OkHttpClient httpClient;
|
||||||
private JSON json;
|
protected JSON json;
|
||||||
|
|
||||||
private HttpLoggingInterceptor loggingInterceptor;
|
protected HttpLoggingInterceptor loggingInterceptor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Basic constructor for ApiClient
|
* Basic constructor for ApiClient
|
||||||
@ -195,11 +195,11 @@ public class ApiClient {
|
|||||||
authentications = Collections.unmodifiableMap(authentications);
|
authentications = Collections.unmodifiableMap(authentications);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initHttpClient() {
|
protected void initHttpClient() {
|
||||||
initHttpClient(Collections.<Interceptor>emptyList());
|
initHttpClient(Collections.<Interceptor>emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initHttpClient(List<Interceptor> interceptors) {
|
protected void initHttpClient(List<Interceptor> interceptors) {
|
||||||
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
||||||
builder.addNetworkInterceptor(getProgressInterceptor());
|
builder.addNetworkInterceptor(getProgressInterceptor());
|
||||||
for (Interceptor interceptor: interceptors) {
|
for (Interceptor interceptor: interceptors) {
|
||||||
@ -209,7 +209,7 @@ public class ApiClient {
|
|||||||
httpClient = builder.build();
|
httpClient = builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init() {
|
protected void init() {
|
||||||
verifyingSsl = true;
|
verifyingSsl = true;
|
||||||
|
|
||||||
json = new JSON();
|
json = new JSON();
|
||||||
@ -1530,7 +1530,7 @@ public class ApiClient {
|
|||||||
* @param key The key of the Header element
|
* @param key The key of the Header element
|
||||||
* @param file The file to add to the Header
|
* @param file The file to add to the Header
|
||||||
*/
|
*/
|
||||||
private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) {
|
protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) {
|
||||||
Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\"");
|
Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\"");
|
||||||
MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file));
|
MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file));
|
||||||
mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType));
|
mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType));
|
||||||
@ -1543,7 +1543,7 @@ public class ApiClient {
|
|||||||
* @param key The key of the Header element
|
* @param key The key of the Header element
|
||||||
* @param obj The complex object to add to the Header
|
* @param obj The complex object to add to the Header
|
||||||
*/
|
*/
|
||||||
private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) {
|
protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) {
|
||||||
RequestBody requestBody;
|
RequestBody requestBody;
|
||||||
if (obj instanceof String) {
|
if (obj instanceof String) {
|
||||||
requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain"));
|
requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain"));
|
||||||
@ -1565,7 +1565,7 @@ public class ApiClient {
|
|||||||
* Get network interceptor to add it to the httpClient to track download progress for
|
* Get network interceptor to add it to the httpClient to track download progress for
|
||||||
* async requests.
|
* async requests.
|
||||||
*/
|
*/
|
||||||
private Interceptor getProgressInterceptor() {
|
protected Interceptor getProgressInterceptor() {
|
||||||
return new Interceptor() {
|
return new Interceptor() {
|
||||||
@Override
|
@Override
|
||||||
public Response intercept(Interceptor.Chain chain) throws IOException {
|
public Response intercept(Interceptor.Chain chain) throws IOException {
|
||||||
@ -1586,7 +1586,7 @@ public class ApiClient {
|
|||||||
* Apply SSL related settings to httpClient according to the current values of
|
* Apply SSL related settings to httpClient according to the current values of
|
||||||
* verifyingSsl and sslCaCert.
|
* verifyingSsl and sslCaCert.
|
||||||
*/
|
*/
|
||||||
private void applySslSettings() {
|
protected void applySslSettings() {
|
||||||
try {
|
try {
|
||||||
TrustManager[] trustManagers;
|
TrustManager[] trustManagers;
|
||||||
HostnameVerifier hostnameVerifier;
|
HostnameVerifier hostnameVerifier;
|
||||||
@ -1648,7 +1648,7 @@ public class ApiClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException {
|
protected KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException {
|
||||||
try {
|
try {
|
||||||
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
|
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
|
||||||
keyStore.load(null, password);
|
keyStore.load(null, password);
|
||||||
@ -1665,7 +1665,7 @@ public class ApiClient {
|
|||||||
* @return The string representation of the HTTP request body
|
* @return The string representation of the HTTP request body
|
||||||
* @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string
|
* @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string
|
||||||
*/
|
*/
|
||||||
private String requestBodyToString(RequestBody requestBody) throws ApiException {
|
protected String requestBodyToString(RequestBody requestBody) throws ApiException {
|
||||||
if (requestBody != null) {
|
if (requestBody != null) {
|
||||||
try {
|
try {
|
||||||
final Buffer buffer = new Buffer();
|
final Buffer buffer = new Buffer();
|
||||||
|
@ -61,7 +61,7 @@ import org.openapitools.client.auth.ApiKeyAuth;
|
|||||||
*/
|
*/
|
||||||
public class ApiClient {
|
public class ApiClient {
|
||||||
|
|
||||||
private String basePath = "http://localhost:3000";
|
protected String basePath = "http://localhost:3000";
|
||||||
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>(Arrays.asList(
|
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>(Arrays.asList(
|
||||||
new ServerConfiguration(
|
new ServerConfiguration(
|
||||||
"http://localhost:3000",
|
"http://localhost:3000",
|
||||||
@ -71,26 +71,26 @@ public class ApiClient {
|
|||||||
));
|
));
|
||||||
protected Integer serverIndex = 0;
|
protected Integer serverIndex = 0;
|
||||||
protected Map<String, String> serverVariables = null;
|
protected Map<String, String> serverVariables = null;
|
||||||
private boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
protected Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||||
private Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
protected Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
||||||
private String tempFolderPath = null;
|
protected String tempFolderPath = null;
|
||||||
|
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
private DateFormat dateFormat;
|
protected DateFormat dateFormat;
|
||||||
private DateFormat datetimeFormat;
|
protected DateFormat datetimeFormat;
|
||||||
private boolean lenientDatetimeFormat;
|
protected boolean lenientDatetimeFormat;
|
||||||
private int dateLength;
|
protected int dateLength;
|
||||||
|
|
||||||
private InputStream sslCaCert;
|
protected InputStream sslCaCert;
|
||||||
private boolean verifyingSsl;
|
protected boolean verifyingSsl;
|
||||||
private KeyManager[] keyManagers;
|
protected KeyManager[] keyManagers;
|
||||||
|
|
||||||
private OkHttpClient httpClient;
|
protected OkHttpClient httpClient;
|
||||||
private JSON json;
|
protected JSON json;
|
||||||
|
|
||||||
private HttpLoggingInterceptor loggingInterceptor;
|
protected HttpLoggingInterceptor loggingInterceptor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Basic constructor for ApiClient
|
* Basic constructor for ApiClient
|
||||||
@ -123,11 +123,11 @@ public class ApiClient {
|
|||||||
authentications = Collections.unmodifiableMap(authentications);
|
authentications = Collections.unmodifiableMap(authentications);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initHttpClient() {
|
protected void initHttpClient() {
|
||||||
initHttpClient(Collections.<Interceptor>emptyList());
|
initHttpClient(Collections.<Interceptor>emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initHttpClient(List<Interceptor> interceptors) {
|
protected void initHttpClient(List<Interceptor> interceptors) {
|
||||||
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
||||||
builder.addNetworkInterceptor(getProgressInterceptor());
|
builder.addNetworkInterceptor(getProgressInterceptor());
|
||||||
for (Interceptor interceptor: interceptors) {
|
for (Interceptor interceptor: interceptors) {
|
||||||
@ -137,7 +137,7 @@ public class ApiClient {
|
|||||||
httpClient = builder.build();
|
httpClient = builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init() {
|
protected void init() {
|
||||||
verifyingSsl = true;
|
verifyingSsl = true;
|
||||||
|
|
||||||
json = new JSON();
|
json = new JSON();
|
||||||
@ -1460,7 +1460,7 @@ public class ApiClient {
|
|||||||
* @param key The key of the Header element
|
* @param key The key of the Header element
|
||||||
* @param file The file to add to the Header
|
* @param file The file to add to the Header
|
||||||
*/
|
*/
|
||||||
private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) {
|
protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) {
|
||||||
Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\"");
|
Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\"");
|
||||||
MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file));
|
MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file));
|
||||||
mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType));
|
mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType));
|
||||||
@ -1473,7 +1473,7 @@ public class ApiClient {
|
|||||||
* @param key The key of the Header element
|
* @param key The key of the Header element
|
||||||
* @param obj The complex object to add to the Header
|
* @param obj The complex object to add to the Header
|
||||||
*/
|
*/
|
||||||
private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) {
|
protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) {
|
||||||
RequestBody requestBody;
|
RequestBody requestBody;
|
||||||
if (obj instanceof String) {
|
if (obj instanceof String) {
|
||||||
requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain"));
|
requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain"));
|
||||||
@ -1495,7 +1495,7 @@ public class ApiClient {
|
|||||||
* Get network interceptor to add it to the httpClient to track download progress for
|
* Get network interceptor to add it to the httpClient to track download progress for
|
||||||
* async requests.
|
* async requests.
|
||||||
*/
|
*/
|
||||||
private Interceptor getProgressInterceptor() {
|
protected Interceptor getProgressInterceptor() {
|
||||||
return new Interceptor() {
|
return new Interceptor() {
|
||||||
@Override
|
@Override
|
||||||
public Response intercept(Interceptor.Chain chain) throws IOException {
|
public Response intercept(Interceptor.Chain chain) throws IOException {
|
||||||
@ -1516,7 +1516,7 @@ public class ApiClient {
|
|||||||
* Apply SSL related settings to httpClient according to the current values of
|
* Apply SSL related settings to httpClient according to the current values of
|
||||||
* verifyingSsl and sslCaCert.
|
* verifyingSsl and sslCaCert.
|
||||||
*/
|
*/
|
||||||
private void applySslSettings() {
|
protected void applySslSettings() {
|
||||||
try {
|
try {
|
||||||
TrustManager[] trustManagers;
|
TrustManager[] trustManagers;
|
||||||
HostnameVerifier hostnameVerifier;
|
HostnameVerifier hostnameVerifier;
|
||||||
@ -1578,7 +1578,7 @@ public class ApiClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException {
|
protected KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException {
|
||||||
try {
|
try {
|
||||||
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
|
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
|
||||||
keyStore.load(null, password);
|
keyStore.load(null, password);
|
||||||
@ -1595,7 +1595,7 @@ public class ApiClient {
|
|||||||
* @return The string representation of the HTTP request body
|
* @return The string representation of the HTTP request body
|
||||||
* @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string
|
* @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string
|
||||||
*/
|
*/
|
||||||
private String requestBodyToString(RequestBody requestBody) throws ApiException {
|
protected String requestBodyToString(RequestBody requestBody) throws ApiException {
|
||||||
if (requestBody != null) {
|
if (requestBody != null) {
|
||||||
try {
|
try {
|
||||||
final Buffer buffer = new Buffer();
|
final Buffer buffer = new Buffer();
|
||||||
|
@ -62,26 +62,26 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
public enum CollectionFormat {
|
public enum CollectionFormat {
|
||||||
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
||||||
|
|
||||||
private final String separator;
|
protected final String separator;
|
||||||
CollectionFormat(String separator) {
|
CollectionFormat(String separator) {
|
||||||
this.separator = separator;
|
this.separator = separator;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String collectionToString(Collection<?> collection) {
|
protected String collectionToString(Collection<?> collection) {
|
||||||
return StringUtils.collectionToDelimitedString(collection, separator);
|
return StringUtils.collectionToDelimitedString(collection, separator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final HttpHeaders defaultHeaders = new HttpHeaders();
|
protected final HttpHeaders defaultHeaders = new HttpHeaders();
|
||||||
private final MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<>();
|
protected final MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<>();
|
||||||
|
|
||||||
private String basePath = "http://localhost:3000";
|
protected String basePath = "http://localhost:3000";
|
||||||
|
|
||||||
private final RestClient restClient;
|
protected final RestClient restClient;
|
||||||
private final DateFormat dateFormat;
|
protected final DateFormat dateFormat;
|
||||||
private final ObjectMapper objectMapper;
|
protected final ObjectMapper objectMapper;
|
||||||
|
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
|
|
||||||
public ApiClient() {
|
public ApiClient() {
|
||||||
@ -103,7 +103,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
this.init();
|
this.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
private ApiClient(RestClient restClient, DateFormat format) {
|
protected ApiClient(RestClient restClient, DateFormat format) {
|
||||||
this(restClient, createDefaultObjectMapper(format), format);
|
this(restClient, createDefaultObjectMapper(format), format);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -580,7 +580,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
* @param uriParams The path parameters
|
* @param uriParams The path parameters
|
||||||
* return templatized query string
|
* return templatized query string
|
||||||
*/
|
*/
|
||||||
private String generateQueryUri(MultiValueMap<String, String> queryParams, Map<String, Object> uriParams) {
|
protected String generateQueryUri(MultiValueMap<String, String> queryParams, Map<String, Object> uriParams) {
|
||||||
StringBuilder queryBuilder = new StringBuilder();
|
StringBuilder queryBuilder = new StringBuilder();
|
||||||
queryParams.forEach((name, values) -> {
|
queryParams.forEach((name, values) -> {
|
||||||
if (CollectionUtils.isEmpty(values)) {
|
if (CollectionUtils.isEmpty(values)) {
|
||||||
@ -606,7 +606,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return queryBuilder.toString();
|
return queryBuilder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private RestClient.RequestBodySpec prepareRequest(String path, HttpMethod method, Map<String, Object> pathParams,
|
protected RestClient.RequestBodySpec prepareRequest(String path, HttpMethod method, Map<String, Object> pathParams,
|
||||||
MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams,
|
MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams,
|
||||||
MultiValueMap<String, String> cookieParams, MultiValueMap<String, Object> formParams, List<MediaType> accept,
|
MultiValueMap<String, String> cookieParams, MultiValueMap<String, Object> formParams, List<MediaType> accept,
|
||||||
MediaType contentType, String[] authNames) {
|
MediaType contentType, String[] authNames) {
|
||||||
@ -682,7 +682,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
* @param cookies map all cookies
|
* @param cookies map all cookies
|
||||||
* @return header string for cookies.
|
* @return header string for cookies.
|
||||||
*/
|
*/
|
||||||
private String buildCookieHeader(MultiValueMap<String, String> cookies) {
|
protected String buildCookieHeader(MultiValueMap<String, String> cookies) {
|
||||||
final StringBuilder cookieValue = new StringBuilder();
|
final StringBuilder cookieValue = new StringBuilder();
|
||||||
String delimiter = "";
|
String delimiter = "";
|
||||||
for (final Map.Entry<String, List<String>> entry : cookies.entrySet()) {
|
for (final Map.Entry<String, List<String>> entry : cookies.entrySet()) {
|
||||||
|
@ -62,21 +62,21 @@ import org.openapitools.client.auth.ApiKeyAuth;
|
|||||||
|
|
||||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
||||||
public class ApiClient extends JavaTimeFormatter {
|
public class ApiClient extends JavaTimeFormatter {
|
||||||
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
protected Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||||
private Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
protected Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
||||||
private String basePath = "http://localhost:3000";
|
protected String basePath = "http://localhost:3000";
|
||||||
private boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
|
|
||||||
private Client httpClient;
|
protected Client httpClient;
|
||||||
private JSON json;
|
protected JSON json;
|
||||||
private String tempFolderPath = null;
|
protected String tempFolderPath = null;
|
||||||
|
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
private int statusCode;
|
protected int statusCode;
|
||||||
private Map<String, List<String>> responseHeaders;
|
protected Map<String, List<String>> responseHeaders;
|
||||||
|
|
||||||
private DateFormat dateFormat;
|
protected DateFormat dateFormat;
|
||||||
|
|
||||||
public ApiClient() {
|
public ApiClient() {
|
||||||
json = new JSON();
|
json = new JSON();
|
||||||
@ -695,7 +695,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Response invoke(Invocation.Builder invocationBuilder, String method, Entity<?> entity) throws ApiException {
|
protected Response invoke(Invocation.Builder invocationBuilder, String method, Entity<?> entity) throws ApiException {
|
||||||
Response response = null;
|
Response response = null;
|
||||||
|
|
||||||
if ("GET".equals(method)) {
|
if ("GET".equals(method)) {
|
||||||
@ -724,7 +724,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
/**
|
/**
|
||||||
* Build the Client used to make HTTP requests.
|
* Build the Client used to make HTTP requests.
|
||||||
*/
|
*/
|
||||||
private Client buildHttpClient(boolean debugging) {
|
protected Client buildHttpClient(boolean debugging) {
|
||||||
final ClientConfiguration clientConfig = new ClientConfiguration(ResteasyProviderFactory.getInstance());
|
final ClientConfiguration clientConfig = new ClientConfiguration(ResteasyProviderFactory.getInstance());
|
||||||
clientConfig.register(json);
|
clientConfig.register(json);
|
||||||
if(debugging){
|
if(debugging){
|
||||||
@ -732,7 +732,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
}
|
}
|
||||||
return ClientBuilder.newClient(clientConfig);
|
return ClientBuilder.newClient(clientConfig);
|
||||||
}
|
}
|
||||||
private Map<String, List<String>> buildResponseHeaders(Response response) {
|
protected Map<String, List<String>> buildResponseHeaders(Response response) {
|
||||||
Map<String, List<String>> responseHeaders = new HashMap<String, List<String>>();
|
Map<String, List<String>> responseHeaders = new HashMap<String, List<String>>();
|
||||||
for (Entry<String, List<Object>> entry: response.getHeaders().entrySet()) {
|
for (Entry<String, List<Object>> entry: response.getHeaders().entrySet()) {
|
||||||
List<Object> values = entry.getValue();
|
List<Object> values = entry.getValue();
|
||||||
@ -750,7 +750,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
*
|
*
|
||||||
* @param authNames The authentications to apply
|
* @param authNames The authentications to apply
|
||||||
*/
|
*/
|
||||||
private void updateParamsForAuth(String[] authNames, List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams) {
|
protected void updateParamsForAuth(String[] authNames, List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams) {
|
||||||
for (String authName : authNames) {
|
for (String authName : authNames) {
|
||||||
Authentication auth = authentications.get(authName);
|
Authentication auth = authentications.get(authName);
|
||||||
if (auth == null) throw new RuntimeException("Authentication undefined: " + authName);
|
if (auth == null) throw new RuntimeException("Authentication undefined: " + authName);
|
||||||
|
@ -78,33 +78,33 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
public enum CollectionFormat {
|
public enum CollectionFormat {
|
||||||
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
||||||
|
|
||||||
private final String separator;
|
protected final String separator;
|
||||||
|
|
||||||
private CollectionFormat(String separator) {
|
CollectionFormat(String separator) {
|
||||||
this.separator = separator;
|
this.separator = separator;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String collectionToString(Collection<?> collection) {
|
protected String collectionToString(Collection<?> collection) {
|
||||||
return StringUtils.collectionToDelimitedString(collection, separator);
|
return StringUtils.collectionToDelimitedString(collection, separator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
|
|
||||||
private HttpHeaders defaultHeaders = new HttpHeaders();
|
protected HttpHeaders defaultHeaders = new HttpHeaders();
|
||||||
private MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<String, String>();
|
protected MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<String, String>();
|
||||||
|
|
||||||
private int maxAttemptsForRetry = 1;
|
protected int maxAttemptsForRetry = 1;
|
||||||
|
|
||||||
private long waitTimeMillis = 10;
|
protected long waitTimeMillis = 10;
|
||||||
|
|
||||||
private String basePath = "http://localhost:3000";
|
protected String basePath = "http://localhost:3000";
|
||||||
|
|
||||||
private RestTemplate restTemplate;
|
protected RestTemplate restTemplate;
|
||||||
|
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
private DateFormat dateFormat;
|
protected DateFormat dateFormat;
|
||||||
|
|
||||||
public ApiClient() {
|
public ApiClient() {
|
||||||
this.restTemplate = buildRestTemplate();
|
this.restTemplate = buildRestTemplate();
|
||||||
@ -770,7 +770,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
* @param cookies map all cookies
|
* @param cookies map all cookies
|
||||||
* @return header string for cookies.
|
* @return header string for cookies.
|
||||||
*/
|
*/
|
||||||
private String buildCookieHeader(MultiValueMap<String, String> cookies) {
|
protected String buildCookieHeader(MultiValueMap<String, String> cookies) {
|
||||||
final StringBuilder cookieValue = new StringBuilder();
|
final StringBuilder cookieValue = new StringBuilder();
|
||||||
String delimiter = "";
|
String delimiter = "";
|
||||||
for (final Map.Entry<String, List<String>> entry : cookies.entrySet()) {
|
for (final Map.Entry<String, List<String>> entry : cookies.entrySet()) {
|
||||||
@ -814,8 +814,8 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ApiClientHttpRequestInterceptor implements ClientHttpRequestInterceptor {
|
protected class ApiClientHttpRequestInterceptor implements ClientHttpRequestInterceptor {
|
||||||
private final Log log = LogFactory.getLog(ApiClientHttpRequestInterceptor.class);
|
protected final Log log = LogFactory.getLog(ApiClientHttpRequestInterceptor.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException {
|
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException {
|
||||||
@ -825,21 +825,21 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void logRequest(HttpRequest request, byte[] body) throws UnsupportedEncodingException {
|
protected void logRequest(HttpRequest request, byte[] body) throws UnsupportedEncodingException {
|
||||||
log.info("URI: " + request.getURI());
|
log.info("URI: " + request.getURI());
|
||||||
log.info("HTTP Method: " + request.getMethod());
|
log.info("HTTP Method: " + request.getMethod());
|
||||||
log.info("HTTP Headers: " + headersToString(request.getHeaders()));
|
log.info("HTTP Headers: " + headersToString(request.getHeaders()));
|
||||||
log.info("Request Body: " + new String(body, StandardCharsets.UTF_8));
|
log.info("Request Body: " + new String(body, StandardCharsets.UTF_8));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void logResponse(ClientHttpResponse response) throws IOException {
|
protected void logResponse(ClientHttpResponse response) throws IOException {
|
||||||
log.info("HTTP Status Code: " + response.getStatusCode().value());
|
log.info("HTTP Status Code: " + response.getStatusCode().value());
|
||||||
log.info("Status Text: " + response.getStatusText());
|
log.info("Status Text: " + response.getStatusText());
|
||||||
log.info("HTTP Headers: " + headersToString(response.getHeaders()));
|
log.info("HTTP Headers: " + headersToString(response.getHeaders()));
|
||||||
log.info("Response Body: " + bodyToString(response.getBody()));
|
log.info("Response Body: " + bodyToString(response.getBody()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private String headersToString(HttpHeaders headers) {
|
protected String headersToString(HttpHeaders headers) {
|
||||||
if(headers == null || headers.isEmpty()) {
|
if(headers == null || headers.isEmpty()) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@ -856,7 +856,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String bodyToString(InputStream body) throws IOException {
|
protected String bodyToString(InputStream body) throws IOException {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(body, StandardCharsets.UTF_8));
|
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(body, StandardCharsets.UTF_8));
|
||||||
String line = bufferedReader.readLine();
|
String line = bufferedReader.readLine();
|
||||||
|
@ -85,13 +85,13 @@ import org.openapitools.client.auth.ApiKeyAuth;
|
|||||||
*/
|
*/
|
||||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
||||||
public class ApiClient extends JavaTimeFormatter {
|
public class ApiClient extends JavaTimeFormatter {
|
||||||
private static final Pattern JSON_MIME_PATTERN = Pattern.compile("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
|
protected static final Pattern JSON_MIME_PATTERN = Pattern.compile("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
|
||||||
|
|
||||||
protected Map<String, String> defaultHeaderMap = new HashMap<>();
|
protected Map<String, String> defaultHeaderMap = new HashMap<>();
|
||||||
protected Map<String, String> defaultCookieMap = new HashMap<>();
|
protected Map<String, String> defaultCookieMap = new HashMap<>();
|
||||||
protected String basePath = "http://api.example.xyz/v1";
|
protected String basePath = "http://api.example.xyz/v1";
|
||||||
protected String userAgent;
|
protected String userAgent;
|
||||||
private static final Logger log = Logger.getLogger(ApiClient.class.getName());
|
protected static final Logger log = Logger.getLogger(ApiClient.class.getName());
|
||||||
|
|
||||||
protected List<ServerConfiguration> servers = new ArrayList<>(Arrays.asList(
|
protected List<ServerConfiguration> servers = new ArrayList<>(Arrays.asList(
|
||||||
new ServerConfiguration(
|
new ServerConfiguration(
|
||||||
@ -108,7 +108,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
protected boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
protected ClientConfig clientConfig;
|
protected ClientConfig clientConfig;
|
||||||
protected int connectionTimeout = 0;
|
protected int connectionTimeout = 0;
|
||||||
private int readTimeout = 0;
|
protected int readTimeout = 0;
|
||||||
|
|
||||||
protected Client httpClient;
|
protected Client httpClient;
|
||||||
protected JSON json;
|
protected JSON json;
|
||||||
@ -262,7 +262,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateBasePath() {
|
protected void updateBasePath() {
|
||||||
if (serverIndex != null) {
|
if (serverIndex != null) {
|
||||||
setBasePath(servers.get(serverIndex).URL(serverVariables));
|
setBasePath(servers.get(serverIndex).URL(serverVariables));
|
||||||
}
|
}
|
||||||
@ -808,7 +808,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
* @param key Key of the object
|
* @param key Key of the object
|
||||||
* @param multiPart MultiPart to add the form param to
|
* @param multiPart MultiPart to add the form param to
|
||||||
*/
|
*/
|
||||||
private void addParamToMultipart(Object value, String key, MultiPart multiPart) {
|
protected void addParamToMultipart(Object value, String key, MultiPart multiPart) {
|
||||||
if (value instanceof File) {
|
if (value instanceof File) {
|
||||||
File file = (File) value;
|
File file = (File) value;
|
||||||
FormDataContentDisposition contentDisp = FormDataContentDisposition.name(key)
|
FormDataContentDisposition contentDisp = FormDataContentDisposition.name(key)
|
||||||
@ -1106,7 +1106,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Response sendRequest(String method, Invocation.Builder invocationBuilder, Entity<?> entity) {
|
protected Response sendRequest(String method, Invocation.Builder invocationBuilder, Entity<?> entity) {
|
||||||
Response response;
|
Response response;
|
||||||
if ("POST".equals(method)) {
|
if ("POST".equals(method)) {
|
||||||
response = invocationBuilder.post(entity);
|
response = invocationBuilder.post(entity);
|
||||||
@ -1168,7 +1168,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return clientConfig;
|
return clientConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyDebugSetting(ClientConfig clientConfig) {
|
protected void applyDebugSetting(ClientConfig clientConfig) {
|
||||||
if (debugging) {
|
if (debugging) {
|
||||||
clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */));
|
clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */));
|
||||||
clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY);
|
clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY);
|
||||||
|
@ -85,13 +85,13 @@ import org.openapitools.client.auth.ApiKeyAuth;
|
|||||||
*/
|
*/
|
||||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
||||||
public class ApiClient extends JavaTimeFormatter {
|
public class ApiClient extends JavaTimeFormatter {
|
||||||
private static final Pattern JSON_MIME_PATTERN = Pattern.compile("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
|
protected static final Pattern JSON_MIME_PATTERN = Pattern.compile("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
|
||||||
|
|
||||||
protected Map<String, String> defaultHeaderMap = new HashMap<>();
|
protected Map<String, String> defaultHeaderMap = new HashMap<>();
|
||||||
protected Map<String, String> defaultCookieMap = new HashMap<>();
|
protected Map<String, String> defaultCookieMap = new HashMap<>();
|
||||||
protected String basePath = "http://api.example.xyz/v1";
|
protected String basePath = "http://api.example.xyz/v1";
|
||||||
protected String userAgent;
|
protected String userAgent;
|
||||||
private static final Logger log = Logger.getLogger(ApiClient.class.getName());
|
protected static final Logger log = Logger.getLogger(ApiClient.class.getName());
|
||||||
|
|
||||||
protected List<ServerConfiguration> servers = new ArrayList<>(Arrays.asList(
|
protected List<ServerConfiguration> servers = new ArrayList<>(Arrays.asList(
|
||||||
new ServerConfiguration(
|
new ServerConfiguration(
|
||||||
@ -108,7 +108,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
protected boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
protected ClientConfig clientConfig;
|
protected ClientConfig clientConfig;
|
||||||
protected int connectionTimeout = 0;
|
protected int connectionTimeout = 0;
|
||||||
private int readTimeout = 0;
|
protected int readTimeout = 0;
|
||||||
|
|
||||||
protected Client httpClient;
|
protected Client httpClient;
|
||||||
protected JSON json;
|
protected JSON json;
|
||||||
@ -262,7 +262,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateBasePath() {
|
protected void updateBasePath() {
|
||||||
if (serverIndex != null) {
|
if (serverIndex != null) {
|
||||||
setBasePath(servers.get(serverIndex).URL(serverVariables));
|
setBasePath(servers.get(serverIndex).URL(serverVariables));
|
||||||
}
|
}
|
||||||
@ -808,7 +808,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
* @param key Key of the object
|
* @param key Key of the object
|
||||||
* @param multiPart MultiPart to add the form param to
|
* @param multiPart MultiPart to add the form param to
|
||||||
*/
|
*/
|
||||||
private void addParamToMultipart(Object value, String key, MultiPart multiPart) {
|
protected void addParamToMultipart(Object value, String key, MultiPart multiPart) {
|
||||||
if (value instanceof File) {
|
if (value instanceof File) {
|
||||||
File file = (File) value;
|
File file = (File) value;
|
||||||
FormDataContentDisposition contentDisp = FormDataContentDisposition.name(key)
|
FormDataContentDisposition contentDisp = FormDataContentDisposition.name(key)
|
||||||
@ -1106,7 +1106,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Response sendRequest(String method, Invocation.Builder invocationBuilder, Entity<?> entity) {
|
protected Response sendRequest(String method, Invocation.Builder invocationBuilder, Entity<?> entity) {
|
||||||
Response response;
|
Response response;
|
||||||
if ("POST".equals(method)) {
|
if ("POST".equals(method)) {
|
||||||
response = invocationBuilder.post(entity);
|
response = invocationBuilder.post(entity);
|
||||||
@ -1168,7 +1168,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return clientConfig;
|
return clientConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyDebugSetting(ClientConfig clientConfig) {
|
protected void applyDebugSetting(ClientConfig clientConfig) {
|
||||||
if (debugging) {
|
if (debugging) {
|
||||||
clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */));
|
clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */));
|
||||||
clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY);
|
clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY);
|
||||||
|
@ -61,7 +61,7 @@ import org.openapitools.client.auth.ApiKeyAuth;
|
|||||||
*/
|
*/
|
||||||
public class ApiClient {
|
public class ApiClient {
|
||||||
|
|
||||||
private String basePath = "http://localhost";
|
protected String basePath = "http://localhost";
|
||||||
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>(Arrays.asList(
|
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>(Arrays.asList(
|
||||||
new ServerConfiguration(
|
new ServerConfiguration(
|
||||||
"",
|
"",
|
||||||
@ -71,26 +71,26 @@ public class ApiClient {
|
|||||||
));
|
));
|
||||||
protected Integer serverIndex = 0;
|
protected Integer serverIndex = 0;
|
||||||
protected Map<String, String> serverVariables = null;
|
protected Map<String, String> serverVariables = null;
|
||||||
private boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
protected Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||||
private Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
protected Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
||||||
private String tempFolderPath = null;
|
protected String tempFolderPath = null;
|
||||||
|
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
private DateFormat dateFormat;
|
protected DateFormat dateFormat;
|
||||||
private DateFormat datetimeFormat;
|
protected DateFormat datetimeFormat;
|
||||||
private boolean lenientDatetimeFormat;
|
protected boolean lenientDatetimeFormat;
|
||||||
private int dateLength;
|
protected int dateLength;
|
||||||
|
|
||||||
private InputStream sslCaCert;
|
protected InputStream sslCaCert;
|
||||||
private boolean verifyingSsl;
|
protected boolean verifyingSsl;
|
||||||
private KeyManager[] keyManagers;
|
protected KeyManager[] keyManagers;
|
||||||
|
|
||||||
private OkHttpClient httpClient;
|
protected OkHttpClient httpClient;
|
||||||
private JSON json;
|
protected JSON json;
|
||||||
|
|
||||||
private HttpLoggingInterceptor loggingInterceptor;
|
protected HttpLoggingInterceptor loggingInterceptor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Basic constructor for ApiClient
|
* Basic constructor for ApiClient
|
||||||
@ -119,11 +119,11 @@ public class ApiClient {
|
|||||||
authentications = Collections.unmodifiableMap(authentications);
|
authentications = Collections.unmodifiableMap(authentications);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initHttpClient() {
|
protected void initHttpClient() {
|
||||||
initHttpClient(Collections.<Interceptor>emptyList());
|
initHttpClient(Collections.<Interceptor>emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initHttpClient(List<Interceptor> interceptors) {
|
protected void initHttpClient(List<Interceptor> interceptors) {
|
||||||
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
||||||
builder.addNetworkInterceptor(getProgressInterceptor());
|
builder.addNetworkInterceptor(getProgressInterceptor());
|
||||||
for (Interceptor interceptor: interceptors) {
|
for (Interceptor interceptor: interceptors) {
|
||||||
@ -133,7 +133,7 @@ public class ApiClient {
|
|||||||
httpClient = builder.build();
|
httpClient = builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init() {
|
protected void init() {
|
||||||
verifyingSsl = true;
|
verifyingSsl = true;
|
||||||
|
|
||||||
json = new JSON();
|
json = new JSON();
|
||||||
@ -1434,7 +1434,7 @@ public class ApiClient {
|
|||||||
* @param key The key of the Header element
|
* @param key The key of the Header element
|
||||||
* @param file The file to add to the Header
|
* @param file The file to add to the Header
|
||||||
*/
|
*/
|
||||||
private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) {
|
protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) {
|
||||||
Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\"");
|
Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\"");
|
||||||
MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file));
|
MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file));
|
||||||
mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType));
|
mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType));
|
||||||
@ -1447,7 +1447,7 @@ public class ApiClient {
|
|||||||
* @param key The key of the Header element
|
* @param key The key of the Header element
|
||||||
* @param obj The complex object to add to the Header
|
* @param obj The complex object to add to the Header
|
||||||
*/
|
*/
|
||||||
private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) {
|
protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) {
|
||||||
RequestBody requestBody;
|
RequestBody requestBody;
|
||||||
if (obj instanceof String) {
|
if (obj instanceof String) {
|
||||||
requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain"));
|
requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain"));
|
||||||
@ -1469,7 +1469,7 @@ public class ApiClient {
|
|||||||
* Get network interceptor to add it to the httpClient to track download progress for
|
* Get network interceptor to add it to the httpClient to track download progress for
|
||||||
* async requests.
|
* async requests.
|
||||||
*/
|
*/
|
||||||
private Interceptor getProgressInterceptor() {
|
protected Interceptor getProgressInterceptor() {
|
||||||
return new Interceptor() {
|
return new Interceptor() {
|
||||||
@Override
|
@Override
|
||||||
public Response intercept(Interceptor.Chain chain) throws IOException {
|
public Response intercept(Interceptor.Chain chain) throws IOException {
|
||||||
@ -1490,7 +1490,7 @@ public class ApiClient {
|
|||||||
* Apply SSL related settings to httpClient according to the current values of
|
* Apply SSL related settings to httpClient according to the current values of
|
||||||
* verifyingSsl and sslCaCert.
|
* verifyingSsl and sslCaCert.
|
||||||
*/
|
*/
|
||||||
private void applySslSettings() {
|
protected void applySslSettings() {
|
||||||
try {
|
try {
|
||||||
TrustManager[] trustManagers;
|
TrustManager[] trustManagers;
|
||||||
HostnameVerifier hostnameVerifier;
|
HostnameVerifier hostnameVerifier;
|
||||||
@ -1552,7 +1552,7 @@ public class ApiClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException {
|
protected KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException {
|
||||||
try {
|
try {
|
||||||
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
|
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
|
||||||
keyStore.load(null, password);
|
keyStore.load(null, password);
|
||||||
@ -1569,7 +1569,7 @@ public class ApiClient {
|
|||||||
* @return The string representation of the HTTP request body
|
* @return The string representation of the HTTP request body
|
||||||
* @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string
|
* @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string
|
||||||
*/
|
*/
|
||||||
private String requestBodyToString(RequestBody requestBody) throws ApiException {
|
protected String requestBodyToString(RequestBody requestBody) throws ApiException {
|
||||||
if (requestBody != null) {
|
if (requestBody != null) {
|
||||||
try {
|
try {
|
||||||
final Buffer buffer = new Buffer();
|
final Buffer buffer = new Buffer();
|
||||||
|
@ -61,7 +61,7 @@ import org.openapitools.client.auth.ApiKeyAuth;
|
|||||||
*/
|
*/
|
||||||
public class ApiClient {
|
public class ApiClient {
|
||||||
|
|
||||||
private String basePath = "http://localhost";
|
protected String basePath = "http://localhost";
|
||||||
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>(Arrays.asList(
|
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>(Arrays.asList(
|
||||||
new ServerConfiguration(
|
new ServerConfiguration(
|
||||||
"",
|
"",
|
||||||
@ -71,26 +71,26 @@ public class ApiClient {
|
|||||||
));
|
));
|
||||||
protected Integer serverIndex = 0;
|
protected Integer serverIndex = 0;
|
||||||
protected Map<String, String> serverVariables = null;
|
protected Map<String, String> serverVariables = null;
|
||||||
private boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
protected Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||||
private Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
protected Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
||||||
private String tempFolderPath = null;
|
protected String tempFolderPath = null;
|
||||||
|
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
private DateFormat dateFormat;
|
protected DateFormat dateFormat;
|
||||||
private DateFormat datetimeFormat;
|
protected DateFormat datetimeFormat;
|
||||||
private boolean lenientDatetimeFormat;
|
protected boolean lenientDatetimeFormat;
|
||||||
private int dateLength;
|
protected int dateLength;
|
||||||
|
|
||||||
private InputStream sslCaCert;
|
protected InputStream sslCaCert;
|
||||||
private boolean verifyingSsl;
|
protected boolean verifyingSsl;
|
||||||
private KeyManager[] keyManagers;
|
protected KeyManager[] keyManagers;
|
||||||
|
|
||||||
private OkHttpClient httpClient;
|
protected OkHttpClient httpClient;
|
||||||
private JSON json;
|
protected JSON json;
|
||||||
|
|
||||||
private HttpLoggingInterceptor loggingInterceptor;
|
protected HttpLoggingInterceptor loggingInterceptor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Basic constructor for ApiClient
|
* Basic constructor for ApiClient
|
||||||
@ -119,11 +119,11 @@ public class ApiClient {
|
|||||||
authentications = Collections.unmodifiableMap(authentications);
|
authentications = Collections.unmodifiableMap(authentications);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initHttpClient() {
|
protected void initHttpClient() {
|
||||||
initHttpClient(Collections.<Interceptor>emptyList());
|
initHttpClient(Collections.<Interceptor>emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initHttpClient(List<Interceptor> interceptors) {
|
protected void initHttpClient(List<Interceptor> interceptors) {
|
||||||
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
||||||
builder.addNetworkInterceptor(getProgressInterceptor());
|
builder.addNetworkInterceptor(getProgressInterceptor());
|
||||||
for (Interceptor interceptor: interceptors) {
|
for (Interceptor interceptor: interceptors) {
|
||||||
@ -133,7 +133,7 @@ public class ApiClient {
|
|||||||
httpClient = builder.build();
|
httpClient = builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init() {
|
protected void init() {
|
||||||
verifyingSsl = true;
|
verifyingSsl = true;
|
||||||
|
|
||||||
json = new JSON();
|
json = new JSON();
|
||||||
@ -1434,7 +1434,7 @@ public class ApiClient {
|
|||||||
* @param key The key of the Header element
|
* @param key The key of the Header element
|
||||||
* @param file The file to add to the Header
|
* @param file The file to add to the Header
|
||||||
*/
|
*/
|
||||||
private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) {
|
protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) {
|
||||||
Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\"");
|
Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\"");
|
||||||
MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file));
|
MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file));
|
||||||
mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType));
|
mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType));
|
||||||
@ -1447,7 +1447,7 @@ public class ApiClient {
|
|||||||
* @param key The key of the Header element
|
* @param key The key of the Header element
|
||||||
* @param obj The complex object to add to the Header
|
* @param obj The complex object to add to the Header
|
||||||
*/
|
*/
|
||||||
private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) {
|
protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) {
|
||||||
RequestBody requestBody;
|
RequestBody requestBody;
|
||||||
if (obj instanceof String) {
|
if (obj instanceof String) {
|
||||||
requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain"));
|
requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain"));
|
||||||
@ -1469,7 +1469,7 @@ public class ApiClient {
|
|||||||
* Get network interceptor to add it to the httpClient to track download progress for
|
* Get network interceptor to add it to the httpClient to track download progress for
|
||||||
* async requests.
|
* async requests.
|
||||||
*/
|
*/
|
||||||
private Interceptor getProgressInterceptor() {
|
protected Interceptor getProgressInterceptor() {
|
||||||
return new Interceptor() {
|
return new Interceptor() {
|
||||||
@Override
|
@Override
|
||||||
public Response intercept(Interceptor.Chain chain) throws IOException {
|
public Response intercept(Interceptor.Chain chain) throws IOException {
|
||||||
@ -1490,7 +1490,7 @@ public class ApiClient {
|
|||||||
* Apply SSL related settings to httpClient according to the current values of
|
* Apply SSL related settings to httpClient according to the current values of
|
||||||
* verifyingSsl and sslCaCert.
|
* verifyingSsl and sslCaCert.
|
||||||
*/
|
*/
|
||||||
private void applySslSettings() {
|
protected void applySslSettings() {
|
||||||
try {
|
try {
|
||||||
TrustManager[] trustManagers;
|
TrustManager[] trustManagers;
|
||||||
HostnameVerifier hostnameVerifier;
|
HostnameVerifier hostnameVerifier;
|
||||||
@ -1552,7 +1552,7 @@ public class ApiClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException {
|
protected KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException {
|
||||||
try {
|
try {
|
||||||
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
|
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
|
||||||
keyStore.load(null, password);
|
keyStore.load(null, password);
|
||||||
@ -1569,7 +1569,7 @@ public class ApiClient {
|
|||||||
* @return The string representation of the HTTP request body
|
* @return The string representation of the HTTP request body
|
||||||
* @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string
|
* @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string
|
||||||
*/
|
*/
|
||||||
private String requestBodyToString(RequestBody requestBody) throws ApiException {
|
protected String requestBodyToString(RequestBody requestBody) throws ApiException {
|
||||||
if (requestBody != null) {
|
if (requestBody != null) {
|
||||||
try {
|
try {
|
||||||
final Buffer buffer = new Buffer();
|
final Buffer buffer = new Buffer();
|
||||||
|
@ -61,7 +61,7 @@ import org.openapitools.client.auth.ApiKeyAuth;
|
|||||||
*/
|
*/
|
||||||
public class ApiClient {
|
public class ApiClient {
|
||||||
|
|
||||||
private String basePath = "http://localhost:8082";
|
protected String basePath = "http://localhost:8082";
|
||||||
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>(Arrays.asList(
|
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>(Arrays.asList(
|
||||||
new ServerConfiguration(
|
new ServerConfiguration(
|
||||||
"http://localhost:8082",
|
"http://localhost:8082",
|
||||||
@ -71,26 +71,26 @@ public class ApiClient {
|
|||||||
));
|
));
|
||||||
protected Integer serverIndex = 0;
|
protected Integer serverIndex = 0;
|
||||||
protected Map<String, String> serverVariables = null;
|
protected Map<String, String> serverVariables = null;
|
||||||
private boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
protected Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||||
private Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
protected Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
||||||
private String tempFolderPath = null;
|
protected String tempFolderPath = null;
|
||||||
|
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
private DateFormat dateFormat;
|
protected DateFormat dateFormat;
|
||||||
private DateFormat datetimeFormat;
|
protected DateFormat datetimeFormat;
|
||||||
private boolean lenientDatetimeFormat;
|
protected boolean lenientDatetimeFormat;
|
||||||
private int dateLength;
|
protected int dateLength;
|
||||||
|
|
||||||
private InputStream sslCaCert;
|
protected InputStream sslCaCert;
|
||||||
private boolean verifyingSsl;
|
protected boolean verifyingSsl;
|
||||||
private KeyManager[] keyManagers;
|
protected KeyManager[] keyManagers;
|
||||||
|
|
||||||
private OkHttpClient httpClient;
|
protected OkHttpClient httpClient;
|
||||||
private JSON json;
|
protected JSON json;
|
||||||
|
|
||||||
private HttpLoggingInterceptor loggingInterceptor;
|
protected HttpLoggingInterceptor loggingInterceptor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Basic constructor for ApiClient
|
* Basic constructor for ApiClient
|
||||||
@ -119,11 +119,11 @@ public class ApiClient {
|
|||||||
authentications = Collections.unmodifiableMap(authentications);
|
authentications = Collections.unmodifiableMap(authentications);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initHttpClient() {
|
protected void initHttpClient() {
|
||||||
initHttpClient(Collections.<Interceptor>emptyList());
|
initHttpClient(Collections.<Interceptor>emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initHttpClient(List<Interceptor> interceptors) {
|
protected void initHttpClient(List<Interceptor> interceptors) {
|
||||||
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
||||||
builder.addNetworkInterceptor(getProgressInterceptor());
|
builder.addNetworkInterceptor(getProgressInterceptor());
|
||||||
for (Interceptor interceptor: interceptors) {
|
for (Interceptor interceptor: interceptors) {
|
||||||
@ -133,7 +133,7 @@ public class ApiClient {
|
|||||||
httpClient = builder.build();
|
httpClient = builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init() {
|
protected void init() {
|
||||||
verifyingSsl = true;
|
verifyingSsl = true;
|
||||||
|
|
||||||
json = new JSON();
|
json = new JSON();
|
||||||
@ -1457,7 +1457,7 @@ public class ApiClient {
|
|||||||
* @param key The key of the Header element
|
* @param key The key of the Header element
|
||||||
* @param file The file to add to the Header
|
* @param file The file to add to the Header
|
||||||
*/
|
*/
|
||||||
private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) {
|
protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) {
|
||||||
Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\"");
|
Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\"");
|
||||||
MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file));
|
MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file));
|
||||||
mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType));
|
mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType));
|
||||||
@ -1470,7 +1470,7 @@ public class ApiClient {
|
|||||||
* @param key The key of the Header element
|
* @param key The key of the Header element
|
||||||
* @param obj The complex object to add to the Header
|
* @param obj The complex object to add to the Header
|
||||||
*/
|
*/
|
||||||
private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) {
|
protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) {
|
||||||
RequestBody requestBody;
|
RequestBody requestBody;
|
||||||
if (obj instanceof String) {
|
if (obj instanceof String) {
|
||||||
requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain"));
|
requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain"));
|
||||||
@ -1492,7 +1492,7 @@ public class ApiClient {
|
|||||||
* Get network interceptor to add it to the httpClient to track download progress for
|
* Get network interceptor to add it to the httpClient to track download progress for
|
||||||
* async requests.
|
* async requests.
|
||||||
*/
|
*/
|
||||||
private Interceptor getProgressInterceptor() {
|
protected Interceptor getProgressInterceptor() {
|
||||||
return new Interceptor() {
|
return new Interceptor() {
|
||||||
@Override
|
@Override
|
||||||
public Response intercept(Interceptor.Chain chain) throws IOException {
|
public Response intercept(Interceptor.Chain chain) throws IOException {
|
||||||
@ -1513,7 +1513,7 @@ public class ApiClient {
|
|||||||
* Apply SSL related settings to httpClient according to the current values of
|
* Apply SSL related settings to httpClient according to the current values of
|
||||||
* verifyingSsl and sslCaCert.
|
* verifyingSsl and sslCaCert.
|
||||||
*/
|
*/
|
||||||
private void applySslSettings() {
|
protected void applySslSettings() {
|
||||||
try {
|
try {
|
||||||
TrustManager[] trustManagers;
|
TrustManager[] trustManagers;
|
||||||
HostnameVerifier hostnameVerifier;
|
HostnameVerifier hostnameVerifier;
|
||||||
@ -1575,7 +1575,7 @@ public class ApiClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException {
|
protected KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException {
|
||||||
try {
|
try {
|
||||||
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
|
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
|
||||||
keyStore.load(null, password);
|
keyStore.load(null, password);
|
||||||
@ -1592,7 +1592,7 @@ public class ApiClient {
|
|||||||
* @return The string representation of the HTTP request body
|
* @return The string representation of the HTTP request body
|
||||||
* @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string
|
* @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string
|
||||||
*/
|
*/
|
||||||
private String requestBodyToString(RequestBody requestBody) throws ApiException {
|
protected String requestBodyToString(RequestBody requestBody) throws ApiException {
|
||||||
if (requestBody != null) {
|
if (requestBody != null) {
|
||||||
try {
|
try {
|
||||||
final Buffer buffer = new Buffer();
|
final Buffer buffer = new Buffer();
|
||||||
|
@ -62,26 +62,26 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
public enum CollectionFormat {
|
public enum CollectionFormat {
|
||||||
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
||||||
|
|
||||||
private final String separator;
|
protected final String separator;
|
||||||
CollectionFormat(String separator) {
|
CollectionFormat(String separator) {
|
||||||
this.separator = separator;
|
this.separator = separator;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String collectionToString(Collection<?> collection) {
|
protected String collectionToString(Collection<?> collection) {
|
||||||
return StringUtils.collectionToDelimitedString(collection, separator);
|
return StringUtils.collectionToDelimitedString(collection, separator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final HttpHeaders defaultHeaders = new HttpHeaders();
|
protected final HttpHeaders defaultHeaders = new HttpHeaders();
|
||||||
private final MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<>();
|
protected final MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<>();
|
||||||
|
|
||||||
private String basePath = "http://localhost";
|
protected String basePath = "http://localhost";
|
||||||
|
|
||||||
private final RestClient restClient;
|
protected final RestClient restClient;
|
||||||
private final DateFormat dateFormat;
|
protected final DateFormat dateFormat;
|
||||||
private final ObjectMapper objectMapper;
|
protected final ObjectMapper objectMapper;
|
||||||
|
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
|
|
||||||
public ApiClient() {
|
public ApiClient() {
|
||||||
@ -103,7 +103,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
this.init();
|
this.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
private ApiClient(RestClient restClient, DateFormat format) {
|
protected ApiClient(RestClient restClient, DateFormat format) {
|
||||||
this(restClient, createDefaultObjectMapper(format), format);
|
this(restClient, createDefaultObjectMapper(format), format);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -578,7 +578,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
* @param uriParams The path parameters
|
* @param uriParams The path parameters
|
||||||
* return templatized query string
|
* return templatized query string
|
||||||
*/
|
*/
|
||||||
private String generateQueryUri(MultiValueMap<String, String> queryParams, Map<String, Object> uriParams) {
|
protected String generateQueryUri(MultiValueMap<String, String> queryParams, Map<String, Object> uriParams) {
|
||||||
StringBuilder queryBuilder = new StringBuilder();
|
StringBuilder queryBuilder = new StringBuilder();
|
||||||
queryParams.forEach((name, values) -> {
|
queryParams.forEach((name, values) -> {
|
||||||
if (CollectionUtils.isEmpty(values)) {
|
if (CollectionUtils.isEmpty(values)) {
|
||||||
@ -604,7 +604,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return queryBuilder.toString();
|
return queryBuilder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private RestClient.RequestBodySpec prepareRequest(String path, HttpMethod method, Map<String, Object> pathParams,
|
protected RestClient.RequestBodySpec prepareRequest(String path, HttpMethod method, Map<String, Object> pathParams,
|
||||||
MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams,
|
MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams,
|
||||||
MultiValueMap<String, String> cookieParams, MultiValueMap<String, Object> formParams, List<MediaType> accept,
|
MultiValueMap<String, String> cookieParams, MultiValueMap<String, Object> formParams, List<MediaType> accept,
|
||||||
MediaType contentType, String[] authNames) {
|
MediaType contentType, String[] authNames) {
|
||||||
@ -680,7 +680,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
* @param cookies map all cookies
|
* @param cookies map all cookies
|
||||||
* @return header string for cookies.
|
* @return header string for cookies.
|
||||||
*/
|
*/
|
||||||
private String buildCookieHeader(MultiValueMap<String, String> cookies) {
|
protected String buildCookieHeader(MultiValueMap<String, String> cookies) {
|
||||||
final StringBuilder cookieValue = new StringBuilder();
|
final StringBuilder cookieValue = new StringBuilder();
|
||||||
String delimiter = "";
|
String delimiter = "";
|
||||||
for (final Map.Entry<String, List<String>> entry : cookies.entrySet()) {
|
for (final Map.Entry<String, List<String>> entry : cookies.entrySet()) {
|
||||||
|
@ -76,33 +76,33 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
public enum CollectionFormat {
|
public enum CollectionFormat {
|
||||||
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
||||||
|
|
||||||
private final String separator;
|
protected final String separator;
|
||||||
|
|
||||||
private CollectionFormat(String separator) {
|
CollectionFormat(String separator) {
|
||||||
this.separator = separator;
|
this.separator = separator;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String collectionToString(Collection<?> collection) {
|
protected String collectionToString(Collection<?> collection) {
|
||||||
return StringUtils.collectionToDelimitedString(collection, separator);
|
return StringUtils.collectionToDelimitedString(collection, separator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
|
|
||||||
private HttpHeaders defaultHeaders = new HttpHeaders();
|
protected HttpHeaders defaultHeaders = new HttpHeaders();
|
||||||
private MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<String, String>();
|
protected MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<String, String>();
|
||||||
|
|
||||||
private int maxAttemptsForRetry = 1;
|
protected int maxAttemptsForRetry = 1;
|
||||||
|
|
||||||
private long waitTimeMillis = 10;
|
protected long waitTimeMillis = 10;
|
||||||
|
|
||||||
private String basePath = "http://api.example.xyz/v1";
|
protected String basePath = "http://api.example.xyz/v1";
|
||||||
|
|
||||||
private RestTemplate restTemplate;
|
protected RestTemplate restTemplate;
|
||||||
|
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
private DateFormat dateFormat;
|
protected DateFormat dateFormat;
|
||||||
|
|
||||||
public ApiClient() {
|
public ApiClient() {
|
||||||
this.restTemplate = buildRestTemplate();
|
this.restTemplate = buildRestTemplate();
|
||||||
@ -713,7 +713,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
* @param cookies map all cookies
|
* @param cookies map all cookies
|
||||||
* @return header string for cookies.
|
* @return header string for cookies.
|
||||||
*/
|
*/
|
||||||
private String buildCookieHeader(MultiValueMap<String, String> cookies) {
|
protected String buildCookieHeader(MultiValueMap<String, String> cookies) {
|
||||||
final StringBuilder cookieValue = new StringBuilder();
|
final StringBuilder cookieValue = new StringBuilder();
|
||||||
String delimiter = "";
|
String delimiter = "";
|
||||||
for (final Map.Entry<String, List<String>> entry : cookies.entrySet()) {
|
for (final Map.Entry<String, List<String>> entry : cookies.entrySet()) {
|
||||||
@ -757,8 +757,8 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ApiClientHttpRequestInterceptor implements ClientHttpRequestInterceptor {
|
protected class ApiClientHttpRequestInterceptor implements ClientHttpRequestInterceptor {
|
||||||
private final Log log = LogFactory.getLog(ApiClientHttpRequestInterceptor.class);
|
protected final Log log = LogFactory.getLog(ApiClientHttpRequestInterceptor.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException {
|
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException {
|
||||||
@ -768,21 +768,21 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void logRequest(HttpRequest request, byte[] body) throws UnsupportedEncodingException {
|
protected void logRequest(HttpRequest request, byte[] body) throws UnsupportedEncodingException {
|
||||||
log.info("URI: " + request.getURI());
|
log.info("URI: " + request.getURI());
|
||||||
log.info("HTTP Method: " + request.getMethod());
|
log.info("HTTP Method: " + request.getMethod());
|
||||||
log.info("HTTP Headers: " + headersToString(request.getHeaders()));
|
log.info("HTTP Headers: " + headersToString(request.getHeaders()));
|
||||||
log.info("Request Body: " + new String(body, StandardCharsets.UTF_8));
|
log.info("Request Body: " + new String(body, StandardCharsets.UTF_8));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void logResponse(ClientHttpResponse response) throws IOException {
|
protected void logResponse(ClientHttpResponse response) throws IOException {
|
||||||
log.info("HTTP Status Code: " + response.getStatusCode().value());
|
log.info("HTTP Status Code: " + response.getStatusCode().value());
|
||||||
log.info("Status Text: " + response.getStatusText());
|
log.info("Status Text: " + response.getStatusText());
|
||||||
log.info("HTTP Headers: " + headersToString(response.getHeaders()));
|
log.info("HTTP Headers: " + headersToString(response.getHeaders()));
|
||||||
log.info("Response Body: " + bodyToString(response.getBody()));
|
log.info("Response Body: " + bodyToString(response.getBody()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private String headersToString(HttpHeaders headers) {
|
protected String headersToString(HttpHeaders headers) {
|
||||||
if(headers == null || headers.isEmpty()) {
|
if(headers == null || headers.isEmpty()) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@ -799,7 +799,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String bodyToString(InputStream body) throws IOException {
|
protected String bodyToString(InputStream body) throws IOException {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(body, StandardCharsets.UTF_8));
|
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(body, StandardCharsets.UTF_8));
|
||||||
String line = bufferedReader.readLine();
|
String line = bufferedReader.readLine();
|
||||||
|
@ -76,33 +76,33 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
public enum CollectionFormat {
|
public enum CollectionFormat {
|
||||||
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
||||||
|
|
||||||
private final String separator;
|
protected final String separator;
|
||||||
|
|
||||||
private CollectionFormat(String separator) {
|
CollectionFormat(String separator) {
|
||||||
this.separator = separator;
|
this.separator = separator;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String collectionToString(Collection<?> collection) {
|
protected String collectionToString(Collection<?> collection) {
|
||||||
return StringUtils.collectionToDelimitedString(collection, separator);
|
return StringUtils.collectionToDelimitedString(collection, separator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
|
|
||||||
private HttpHeaders defaultHeaders = new HttpHeaders();
|
protected HttpHeaders defaultHeaders = new HttpHeaders();
|
||||||
private MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<String, String>();
|
protected MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<String, String>();
|
||||||
|
|
||||||
private int maxAttemptsForRetry = 1;
|
protected int maxAttemptsForRetry = 1;
|
||||||
|
|
||||||
private long waitTimeMillis = 10;
|
protected long waitTimeMillis = 10;
|
||||||
|
|
||||||
private String basePath = "http://localhost";
|
protected String basePath = "http://localhost";
|
||||||
|
|
||||||
private RestTemplate restTemplate;
|
protected RestTemplate restTemplate;
|
||||||
|
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
private DateFormat dateFormat;
|
protected DateFormat dateFormat;
|
||||||
|
|
||||||
public ApiClient() {
|
public ApiClient() {
|
||||||
this.restTemplate = buildRestTemplate();
|
this.restTemplate = buildRestTemplate();
|
||||||
@ -713,7 +713,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
* @param cookies map all cookies
|
* @param cookies map all cookies
|
||||||
* @return header string for cookies.
|
* @return header string for cookies.
|
||||||
*/
|
*/
|
||||||
private String buildCookieHeader(MultiValueMap<String, String> cookies) {
|
protected String buildCookieHeader(MultiValueMap<String, String> cookies) {
|
||||||
final StringBuilder cookieValue = new StringBuilder();
|
final StringBuilder cookieValue = new StringBuilder();
|
||||||
String delimiter = "";
|
String delimiter = "";
|
||||||
for (final Map.Entry<String, List<String>> entry : cookies.entrySet()) {
|
for (final Map.Entry<String, List<String>> entry : cookies.entrySet()) {
|
||||||
@ -757,8 +757,8 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ApiClientHttpRequestInterceptor implements ClientHttpRequestInterceptor {
|
protected class ApiClientHttpRequestInterceptor implements ClientHttpRequestInterceptor {
|
||||||
private final Log log = LogFactory.getLog(ApiClientHttpRequestInterceptor.class);
|
protected final Log log = LogFactory.getLog(ApiClientHttpRequestInterceptor.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException {
|
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException {
|
||||||
@ -768,21 +768,21 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void logRequest(HttpRequest request, byte[] body) throws UnsupportedEncodingException {
|
protected void logRequest(HttpRequest request, byte[] body) throws UnsupportedEncodingException {
|
||||||
log.info("URI: " + request.getURI());
|
log.info("URI: " + request.getURI());
|
||||||
log.info("HTTP Method: " + request.getMethod());
|
log.info("HTTP Method: " + request.getMethod());
|
||||||
log.info("HTTP Headers: " + headersToString(request.getHeaders()));
|
log.info("HTTP Headers: " + headersToString(request.getHeaders()));
|
||||||
log.info("Request Body: " + new String(body, StandardCharsets.UTF_8));
|
log.info("Request Body: " + new String(body, StandardCharsets.UTF_8));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void logResponse(ClientHttpResponse response) throws IOException {
|
protected void logResponse(ClientHttpResponse response) throws IOException {
|
||||||
log.info("HTTP Status Code: " + response.getStatusCode().value());
|
log.info("HTTP Status Code: " + response.getStatusCode().value());
|
||||||
log.info("Status Text: " + response.getStatusText());
|
log.info("Status Text: " + response.getStatusText());
|
||||||
log.info("HTTP Headers: " + headersToString(response.getHeaders()));
|
log.info("HTTP Headers: " + headersToString(response.getHeaders()));
|
||||||
log.info("Response Body: " + bodyToString(response.getBody()));
|
log.info("Response Body: " + bodyToString(response.getBody()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private String headersToString(HttpHeaders headers) {
|
protected String headersToString(HttpHeaders headers) {
|
||||||
if(headers == null || headers.isEmpty()) {
|
if(headers == null || headers.isEmpty()) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@ -799,7 +799,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String bodyToString(InputStream body) throws IOException {
|
protected String bodyToString(InputStream body) throws IOException {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(body, StandardCharsets.UTF_8));
|
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(body, StandardCharsets.UTF_8));
|
||||||
String line = bufferedReader.readLine();
|
String line = bufferedReader.readLine();
|
||||||
|
@ -84,28 +84,28 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
public enum CollectionFormat {
|
public enum CollectionFormat {
|
||||||
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
||||||
|
|
||||||
private final String separator;
|
protected final String separator;
|
||||||
private CollectionFormat(String separator) {
|
CollectionFormat(String separator) {
|
||||||
this.separator = separator;
|
this.separator = separator;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String collectionToString(Collection<?> collection) {
|
protected String collectionToString(Collection<?> collection) {
|
||||||
return StringUtils.collectionToDelimitedString(collection, separator);
|
return StringUtils.collectionToDelimitedString(collection, separator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String URI_TEMPLATE_ATTRIBUTE = WebClient.class.getName() + ".uriTemplate";
|
protected static final String URI_TEMPLATE_ATTRIBUTE = WebClient.class.getName() + ".uriTemplate";
|
||||||
|
|
||||||
private HttpHeaders defaultHeaders = new HttpHeaders();
|
protected HttpHeaders defaultHeaders = new HttpHeaders();
|
||||||
private MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<String, String>();
|
protected MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<String, String>();
|
||||||
|
|
||||||
private String basePath = "http://localhost";
|
protected String basePath = "http://localhost";
|
||||||
|
|
||||||
private final WebClient webClient;
|
protected final WebClient webClient;
|
||||||
private final DateFormat dateFormat;
|
protected final DateFormat dateFormat;
|
||||||
private final ObjectMapper objectMapper;
|
protected final ObjectMapper objectMapper;
|
||||||
|
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
|
|
||||||
public ApiClient() {
|
public ApiClient() {
|
||||||
@ -127,7 +127,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
this(Optional.ofNullable(webClient).orElseGet(() -> buildWebClient(mapper.copy())), format);
|
this(Optional.ofNullable(webClient).orElseGet(() -> buildWebClient(mapper.copy())), format);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ApiClient(WebClient webClient, DateFormat format) {
|
protected ApiClient(WebClient webClient, DateFormat format) {
|
||||||
this.webClient = webClient;
|
this.webClient = webClient;
|
||||||
this.dateFormat = format;
|
this.dateFormat = format;
|
||||||
this.objectMapper = createDefaultObjectMapper(format);
|
this.objectMapper = createDefaultObjectMapper(format);
|
||||||
@ -604,7 +604,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
* @param uriParams The path parameters
|
* @param uriParams The path parameters
|
||||||
* return templatized query string
|
* return templatized query string
|
||||||
*/
|
*/
|
||||||
private String generateQueryUri(MultiValueMap<String, String> queryParams, Map<String, Object> uriParams) {
|
protected String generateQueryUri(MultiValueMap<String, String> queryParams, Map<String, Object> uriParams) {
|
||||||
StringBuilder queryBuilder = new StringBuilder();
|
StringBuilder queryBuilder = new StringBuilder();
|
||||||
queryParams.forEach((name, values) -> {
|
queryParams.forEach((name, values) -> {
|
||||||
if (CollectionUtils.isEmpty(values)) {
|
if (CollectionUtils.isEmpty(values)) {
|
||||||
@ -630,7 +630,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return queryBuilder.toString();
|
return queryBuilder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private WebClient.RequestBodySpec prepareRequest(String path, HttpMethod method, Map<String, Object> pathParams,
|
protected WebClient.RequestBodySpec prepareRequest(String path, HttpMethod method, Map<String, Object> pathParams,
|
||||||
MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams,
|
MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams,
|
||||||
MultiValueMap<String, String> cookieParams, MultiValueMap<String, Object> formParams, List<MediaType> accept,
|
MultiValueMap<String, String> cookieParams, MultiValueMap<String, Object> formParams, List<MediaType> accept,
|
||||||
MediaType contentType, String[] authNames) {
|
MediaType contentType, String[] authNames) {
|
||||||
|
@ -85,9 +85,9 @@ import org.openapitools.client.auth.OAuth;
|
|||||||
|
|
||||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
||||||
public class ApiClient extends JavaTimeFormatter {
|
public class ApiClient extends JavaTimeFormatter {
|
||||||
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
protected Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||||
private Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
protected Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
||||||
private String basePath = "http://petstore.swagger.io:80/v2";
|
protected String basePath = "http://petstore.swagger.io:80/v2";
|
||||||
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>(Arrays.asList(
|
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>(Arrays.asList(
|
||||||
new ServerConfiguration(
|
new ServerConfiguration(
|
||||||
"http://{server}.swagger.io:{port}/v2",
|
"http://{server}.swagger.io:{port}/v2",
|
||||||
@ -140,22 +140,22 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
));
|
));
|
||||||
protected Integer serverIndex = 0;
|
protected Integer serverIndex = 0;
|
||||||
protected Map<String, String> serverVariables = null;
|
protected Map<String, String> serverVariables = null;
|
||||||
private boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
private int connectionTimeout = 0;
|
protected int connectionTimeout = 0;
|
||||||
|
|
||||||
private CloseableHttpClient httpClient;
|
protected CloseableHttpClient httpClient;
|
||||||
private ObjectMapper objectMapper;
|
protected ObjectMapper objectMapper;
|
||||||
protected String tempFolderPath = null;
|
protected String tempFolderPath = null;
|
||||||
|
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
private Map<Long, Integer> lastStatusCodeByThread = new ConcurrentHashMap<>();
|
protected Map<Long, Integer> lastStatusCodeByThread = new ConcurrentHashMap<>();
|
||||||
private Map<Long, Map<String, List<String>>> lastResponseHeadersByThread = new ConcurrentHashMap<>();
|
protected Map<Long, Map<String, List<String>>> lastResponseHeadersByThread = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
private DateFormat dateFormat;
|
protected DateFormat dateFormat;
|
||||||
|
|
||||||
// Methods that can have a request body
|
// Methods that can have a request body
|
||||||
private static List<String> bodyMethods = Arrays.asList("POST", "PUT", "DELETE", "PATCH");
|
protected static List<String> bodyMethods = Arrays.asList("POST", "PUT", "DELETE", "PATCH");
|
||||||
|
|
||||||
public ApiClient(CloseableHttpClient httpClient) {
|
public ApiClient(CloseableHttpClient httpClient) {
|
||||||
objectMapper = new ObjectMapper();
|
objectMapper = new ObjectMapper();
|
||||||
@ -768,7 +768,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
/**
|
/**
|
||||||
* Parse content type object from header value
|
* Parse content type object from header value
|
||||||
*/
|
*/
|
||||||
private ContentType getContentType(String headerValue) throws ApiException {
|
protected ContentType getContentType(String headerValue) throws ApiException {
|
||||||
try {
|
try {
|
||||||
return ContentType.parse(headerValue);
|
return ContentType.parse(headerValue);
|
||||||
} catch (UnsupportedCharsetException e) {
|
} catch (UnsupportedCharsetException e) {
|
||||||
@ -779,7 +779,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
/**
|
/**
|
||||||
* Get content type of a response or null if one was not provided
|
* Get content type of a response or null if one was not provided
|
||||||
*/
|
*/
|
||||||
private String getResponseMimeType(HttpResponse response) throws ApiException {
|
protected String getResponseMimeType(HttpResponse response) throws ApiException {
|
||||||
Header contentTypeHeader = response.getFirstHeader("Content-Type");
|
Header contentTypeHeader = response.getFirstHeader("Content-Type");
|
||||||
if (contentTypeHeader != null) {
|
if (contentTypeHeader != null) {
|
||||||
return getContentType(contentTypeHeader.getValue()).getMimeType();
|
return getContentType(contentTypeHeader.getValue()).getMimeType();
|
||||||
@ -888,7 +888,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private File downloadFileFromResponse(CloseableHttpResponse response) throws IOException {
|
protected File downloadFileFromResponse(CloseableHttpResponse response) throws IOException {
|
||||||
Header contentDispositionHeader = response.getFirstHeader("Content-Disposition");
|
Header contentDispositionHeader = response.getFirstHeader("Content-Disposition");
|
||||||
String contentDisposition = contentDispositionHeader == null ? null : contentDispositionHeader.getValue();
|
String contentDisposition = contentDispositionHeader == null ? null : contentDispositionHeader.getValue();
|
||||||
File file = prepareDownloadFile(contentDisposition);
|
File file = prepareDownloadFile(contentDisposition);
|
||||||
@ -959,7 +959,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
* @param urlQueryDeepObject URL query string of the deep object parameters
|
* @param urlQueryDeepObject URL query string of the deep object parameters
|
||||||
* @return The full URL
|
* @return The full URL
|
||||||
*/
|
*/
|
||||||
private String buildUrl(String path, List<Pair> queryParams, List<Pair> collectionQueryParams, String urlQueryDeepObject) {
|
protected String buildUrl(String path, List<Pair> queryParams, List<Pair> collectionQueryParams, String urlQueryDeepObject) {
|
||||||
String baseURL = getBaseURL();
|
String baseURL = getBaseURL();
|
||||||
|
|
||||||
final StringBuilder url = new StringBuilder();
|
final StringBuilder url = new StringBuilder();
|
||||||
@ -1138,7 +1138,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
* @param headerParams Header parameters
|
* @param headerParams Header parameters
|
||||||
* @param cookieParams Cookie parameters
|
* @param cookieParams Cookie parameters
|
||||||
*/
|
*/
|
||||||
private void updateParamsForAuth(String[] authNames, List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams) {
|
protected void updateParamsForAuth(String[] authNames, List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams) {
|
||||||
for (String authName : authNames) {
|
for (String authName : authNames) {
|
||||||
Authentication auth = authentications.get(authName);
|
Authentication auth = authentications.get(authName);
|
||||||
if (auth == null) throw new RuntimeException("Authentication undefined: " + authName);
|
if (auth == null) throw new RuntimeException("Authentication undefined: " + authName);
|
||||||
|
@ -46,14 +46,14 @@ import feign.Retryer;
|
|||||||
|
|
||||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
||||||
public class ApiClient {
|
public class ApiClient {
|
||||||
private static final Logger log = Logger.getLogger(ApiClient.class.getName());
|
protected static final Logger log = Logger.getLogger(ApiClient.class.getName());
|
||||||
|
|
||||||
public interface Api {}
|
public interface Api {}
|
||||||
|
|
||||||
protected ObjectMapper objectMapper;
|
protected ObjectMapper objectMapper;
|
||||||
private String basePath = "http://petstore.swagger.io:80/v2";
|
protected String basePath = "http://petstore.swagger.io:80/v2";
|
||||||
private Map<String, RequestInterceptor> apiAuthorizations;
|
protected Map<String, RequestInterceptor> apiAuthorizations;
|
||||||
private Feign.Builder feignBuilder;
|
protected Feign.Builder feignBuilder;
|
||||||
|
|
||||||
public ApiClient() {
|
public ApiClient() {
|
||||||
apiAuthorizations = new LinkedHashMap<String, RequestInterceptor>();
|
apiAuthorizations = new LinkedHashMap<String, RequestInterceptor>();
|
||||||
@ -135,7 +135,7 @@ public class ApiClient {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ObjectMapper createObjectMapper() {
|
protected ObjectMapper createObjectMapper() {
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
objectMapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
|
objectMapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
|
||||||
objectMapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING);
|
objectMapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING);
|
||||||
@ -150,7 +150,7 @@ public class ApiClient {
|
|||||||
return objectMapper;
|
return objectMapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
private RequestInterceptor buildOauthRequestInterceptor(OAuthFlow flow, String authorizationUrl, String tokenUrl, String scopes) {
|
protected RequestInterceptor buildOauthRequestInterceptor(OAuthFlow flow, String authorizationUrl, String tokenUrl, String scopes) {
|
||||||
switch (flow) {
|
switch (flow) {
|
||||||
case PASSWORD:
|
case PASSWORD:
|
||||||
return new OauthPasswordGrant(tokenUrl, scopes);
|
return new OauthPasswordGrant(tokenUrl, scopes);
|
||||||
@ -326,7 +326,7 @@ public class ApiClient {
|
|||||||
feignBuilder.requestInterceptor(authorization);
|
feignBuilder.requestInterceptor(authorization);
|
||||||
}
|
}
|
||||||
|
|
||||||
private <T extends RequestInterceptor> T getAuthorization(Class<T> type) {
|
protected <T extends RequestInterceptor> T getAuthorization(Class<T> type) {
|
||||||
return (T) apiAuthorizations.values()
|
return (T) apiAuthorizations.values()
|
||||||
.stream()
|
.stream()
|
||||||
.filter(requestInterceptor -> type.isAssignableFrom(requestInterceptor.getClass()))
|
.filter(requestInterceptor -> type.isAssignableFrom(requestInterceptor.getClass()))
|
||||||
|
@ -45,14 +45,14 @@ import feign.Retryer;
|
|||||||
|
|
||||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
||||||
public class ApiClient {
|
public class ApiClient {
|
||||||
private static final Logger log = Logger.getLogger(ApiClient.class.getName());
|
protected static final Logger log = Logger.getLogger(ApiClient.class.getName());
|
||||||
|
|
||||||
public interface Api {}
|
public interface Api {}
|
||||||
|
|
||||||
protected ObjectMapper objectMapper;
|
protected ObjectMapper objectMapper;
|
||||||
private String basePath = "http://petstore.swagger.io:80/v2";
|
protected String basePath = "http://petstore.swagger.io:80/v2";
|
||||||
private Map<String, RequestInterceptor> apiAuthorizations;
|
protected Map<String, RequestInterceptor> apiAuthorizations;
|
||||||
private Feign.Builder feignBuilder;
|
protected Feign.Builder feignBuilder;
|
||||||
|
|
||||||
public ApiClient() {
|
public ApiClient() {
|
||||||
apiAuthorizations = new LinkedHashMap<String, RequestInterceptor>();
|
apiAuthorizations = new LinkedHashMap<String, RequestInterceptor>();
|
||||||
@ -131,7 +131,7 @@ public class ApiClient {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ObjectMapper createObjectMapper() {
|
protected ObjectMapper createObjectMapper() {
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
objectMapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
|
objectMapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
|
||||||
objectMapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING);
|
objectMapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING);
|
||||||
@ -144,7 +144,7 @@ public class ApiClient {
|
|||||||
return objectMapper;
|
return objectMapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
private RequestInterceptor buildOauthRequestInterceptor(OAuthFlow flow, String authorizationUrl, String tokenUrl, String scopes) {
|
protected RequestInterceptor buildOauthRequestInterceptor(OAuthFlow flow, String authorizationUrl, String tokenUrl, String scopes) {
|
||||||
switch (flow) {
|
switch (flow) {
|
||||||
case PASSWORD:
|
case PASSWORD:
|
||||||
return new OauthPasswordGrant(tokenUrl, scopes);
|
return new OauthPasswordGrant(tokenUrl, scopes);
|
||||||
@ -320,7 +320,7 @@ public class ApiClient {
|
|||||||
feignBuilder.requestInterceptor(authorization);
|
feignBuilder.requestInterceptor(authorization);
|
||||||
}
|
}
|
||||||
|
|
||||||
private <T extends RequestInterceptor> T getAuthorization(Class<T> type) {
|
protected <T extends RequestInterceptor> T getAuthorization(Class<T> type) {
|
||||||
return (T) apiAuthorizations.values()
|
return (T) apiAuthorizations.values()
|
||||||
.stream()
|
.stream()
|
||||||
.filter(requestInterceptor -> type.isAssignableFrom(requestInterceptor.getClass()))
|
.filter(requestInterceptor -> type.isAssignableFrom(requestInterceptor.getClass()))
|
||||||
|
@ -46,14 +46,14 @@ import feign.Retryer;
|
|||||||
|
|
||||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
||||||
public class ApiClient {
|
public class ApiClient {
|
||||||
private static final Logger log = Logger.getLogger(ApiClient.class.getName());
|
protected static final Logger log = Logger.getLogger(ApiClient.class.getName());
|
||||||
|
|
||||||
public interface Api {}
|
public interface Api {}
|
||||||
|
|
||||||
protected ObjectMapper objectMapper;
|
protected ObjectMapper objectMapper;
|
||||||
private String basePath = "http://petstore.swagger.io:80/v2";
|
protected String basePath = "http://petstore.swagger.io:80/v2";
|
||||||
private Map<String, RequestInterceptor> apiAuthorizations;
|
protected Map<String, RequestInterceptor> apiAuthorizations;
|
||||||
private Feign.Builder feignBuilder;
|
protected Feign.Builder feignBuilder;
|
||||||
|
|
||||||
public ApiClient() {
|
public ApiClient() {
|
||||||
apiAuthorizations = new LinkedHashMap<String, RequestInterceptor>();
|
apiAuthorizations = new LinkedHashMap<String, RequestInterceptor>();
|
||||||
@ -135,7 +135,7 @@ public class ApiClient {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ObjectMapper createObjectMapper() {
|
protected ObjectMapper createObjectMapper() {
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
objectMapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
|
objectMapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
|
||||||
objectMapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING);
|
objectMapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING);
|
||||||
@ -150,7 +150,7 @@ public class ApiClient {
|
|||||||
return objectMapper;
|
return objectMapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
private RequestInterceptor buildOauthRequestInterceptor(OAuthFlow flow, String authorizationUrl, String tokenUrl, String scopes) {
|
protected RequestInterceptor buildOauthRequestInterceptor(OAuthFlow flow, String authorizationUrl, String tokenUrl, String scopes) {
|
||||||
switch (flow) {
|
switch (flow) {
|
||||||
case PASSWORD:
|
case PASSWORD:
|
||||||
return new OauthPasswordGrant(tokenUrl, scopes);
|
return new OauthPasswordGrant(tokenUrl, scopes);
|
||||||
@ -326,7 +326,7 @@ public class ApiClient {
|
|||||||
feignBuilder.requestInterceptor(authorization);
|
feignBuilder.requestInterceptor(authorization);
|
||||||
}
|
}
|
||||||
|
|
||||||
private <T extends RequestInterceptor> T getAuthorization(Class<T> type) {
|
protected <T extends RequestInterceptor> T getAuthorization(Class<T> type) {
|
||||||
return (T) apiAuthorizations.values()
|
return (T) apiAuthorizations.values()
|
||||||
.stream()
|
.stream()
|
||||||
.filter(requestInterceptor -> type.isAssignableFrom(requestInterceptor.getClass()))
|
.filter(requestInterceptor -> type.isAssignableFrom(requestInterceptor.getClass()))
|
||||||
|
@ -31,14 +31,14 @@ import java.io.OutputStream;
|
|||||||
|
|
||||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
||||||
public class ApiClient {
|
public class ApiClient {
|
||||||
private final String basePath;
|
protected final String basePath;
|
||||||
private final HttpRequestFactory httpRequestFactory;
|
protected final HttpRequestFactory httpRequestFactory;
|
||||||
private final ObjectMapper objectMapper;
|
protected final ObjectMapper objectMapper;
|
||||||
|
|
||||||
private static final String defaultBasePath = "http://petstore.swagger.io:80/v2";
|
protected static final String defaultBasePath = "http://petstore.swagger.io:80/v2";
|
||||||
|
|
||||||
// A reasonable default object mapper. Client can pass in a chosen ObjectMapper anyway, this is just for reasonable defaults.
|
// A reasonable default object mapper. Client can pass in a chosen ObjectMapper anyway, this is just for reasonable defaults.
|
||||||
private static ObjectMapper createDefaultObjectMapper() {
|
protected static ObjectMapper createDefaultObjectMapper() {
|
||||||
ObjectMapper objectMapper = new ObjectMapper()
|
ObjectMapper objectMapper = new ObjectMapper()
|
||||||
.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
|
.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
|
||||||
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
|
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
|
||||||
@ -80,7 +80,7 @@ public class ApiClient {
|
|||||||
|
|
||||||
public class JacksonJsonHttpContent extends AbstractHttpContent {
|
public class JacksonJsonHttpContent extends AbstractHttpContent {
|
||||||
/* A POJO that can be serialized with a com.fasterxml Jackson ObjectMapper */
|
/* A POJO that can be serialized with a com.fasterxml Jackson ObjectMapper */
|
||||||
private final Object data;
|
protected final Object data;
|
||||||
|
|
||||||
public JacksonJsonHttpContent(Object data) {
|
public JacksonJsonHttpContent(Object data) {
|
||||||
super(Json.MEDIA_TYPE);
|
super(Json.MEDIA_TYPE);
|
||||||
|
@ -87,13 +87,13 @@ import org.openapitools.client.auth.OAuth;
|
|||||||
*/
|
*/
|
||||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
||||||
public class ApiClient extends JavaTimeFormatter {
|
public class ApiClient extends JavaTimeFormatter {
|
||||||
private static final Pattern JSON_MIME_PATTERN = Pattern.compile("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
|
protected static final Pattern JSON_MIME_PATTERN = Pattern.compile("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
|
||||||
|
|
||||||
protected Map<String, String> defaultHeaderMap = new HashMap<>();
|
protected Map<String, String> defaultHeaderMap = new HashMap<>();
|
||||||
protected Map<String, String> defaultCookieMap = new HashMap<>();
|
protected Map<String, String> defaultCookieMap = new HashMap<>();
|
||||||
protected String basePath = "http://petstore.swagger.io:80/v2";
|
protected String basePath = "http://petstore.swagger.io:80/v2";
|
||||||
protected String userAgent;
|
protected String userAgent;
|
||||||
private static final Logger log = Logger.getLogger(ApiClient.class.getName());
|
protected static final Logger log = Logger.getLogger(ApiClient.class.getName());
|
||||||
|
|
||||||
protected List<ServerConfiguration> servers = new ArrayList<>(Arrays.asList(
|
protected List<ServerConfiguration> servers = new ArrayList<>(Arrays.asList(
|
||||||
new ServerConfiguration(
|
new ServerConfiguration(
|
||||||
@ -110,7 +110,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
protected boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
protected ClientConfig clientConfig;
|
protected ClientConfig clientConfig;
|
||||||
protected int connectionTimeout = 0;
|
protected int connectionTimeout = 0;
|
||||||
private int readTimeout = 0;
|
protected int readTimeout = 0;
|
||||||
|
|
||||||
protected Client httpClient;
|
protected Client httpClient;
|
||||||
protected JSON json;
|
protected JSON json;
|
||||||
@ -297,13 +297,13 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateBasePath() {
|
protected void updateBasePath() {
|
||||||
if (serverIndex != null) {
|
if (serverIndex != null) {
|
||||||
setBasePath(servers.get(serverIndex).URL(serverVariables));
|
setBasePath(servers.get(serverIndex).URL(serverVariables));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setOauthBasePath(String basePath) {
|
protected void setOauthBasePath(String basePath) {
|
||||||
for(Authentication auth : authentications.values()) {
|
for(Authentication auth : authentications.values()) {
|
||||||
if (auth instanceof OAuth) {
|
if (auth instanceof OAuth) {
|
||||||
((OAuth) auth).setBasePath(basePath);
|
((OAuth) auth).setBasePath(basePath);
|
||||||
@ -949,7 +949,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
* @param key Key of the object
|
* @param key Key of the object
|
||||||
* @param multiPart MultiPart to add the form param to
|
* @param multiPart MultiPart to add the form param to
|
||||||
*/
|
*/
|
||||||
private void addParamToMultipart(Object value, String key, MultiPart multiPart) {
|
protected void addParamToMultipart(Object value, String key, MultiPart multiPart) {
|
||||||
if (value instanceof File) {
|
if (value instanceof File) {
|
||||||
File file = (File) value;
|
File file = (File) value;
|
||||||
FormDataContentDisposition contentDisp = FormDataContentDisposition.name(key)
|
FormDataContentDisposition contentDisp = FormDataContentDisposition.name(key)
|
||||||
@ -1263,7 +1263,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Response sendRequest(String method, Invocation.Builder invocationBuilder, Entity<?> entity) {
|
protected Response sendRequest(String method, Invocation.Builder invocationBuilder, Entity<?> entity) {
|
||||||
Response response;
|
Response response;
|
||||||
if ("POST".equals(method)) {
|
if ("POST".equals(method)) {
|
||||||
response = invocationBuilder.post(entity);
|
response = invocationBuilder.post(entity);
|
||||||
@ -1325,7 +1325,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return clientConfig;
|
return clientConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyDebugSetting(ClientConfig clientConfig) {
|
protected void applyDebugSetting(ClientConfig clientConfig) {
|
||||||
if (debugging) {
|
if (debugging) {
|
||||||
clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */));
|
clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */));
|
||||||
clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY);
|
clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY);
|
||||||
|
@ -87,13 +87,13 @@ import org.openapitools.client.auth.OAuth;
|
|||||||
*/
|
*/
|
||||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
||||||
public class ApiClient extends JavaTimeFormatter {
|
public class ApiClient extends JavaTimeFormatter {
|
||||||
private static final Pattern JSON_MIME_PATTERN = Pattern.compile("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
|
protected static final Pattern JSON_MIME_PATTERN = Pattern.compile("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
|
||||||
|
|
||||||
protected Map<String, String> defaultHeaderMap = new HashMap<>();
|
protected Map<String, String> defaultHeaderMap = new HashMap<>();
|
||||||
protected Map<String, String> defaultCookieMap = new HashMap<>();
|
protected Map<String, String> defaultCookieMap = new HashMap<>();
|
||||||
protected String basePath = "http://petstore.swagger.io:80/v2";
|
protected String basePath = "http://petstore.swagger.io:80/v2";
|
||||||
protected String userAgent;
|
protected String userAgent;
|
||||||
private static final Logger log = Logger.getLogger(ApiClient.class.getName());
|
protected static final Logger log = Logger.getLogger(ApiClient.class.getName());
|
||||||
|
|
||||||
protected List<ServerConfiguration> servers = new ArrayList<>(Arrays.asList(
|
protected List<ServerConfiguration> servers = new ArrayList<>(Arrays.asList(
|
||||||
new ServerConfiguration(
|
new ServerConfiguration(
|
||||||
@ -110,7 +110,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
protected boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
protected ClientConfig clientConfig;
|
protected ClientConfig clientConfig;
|
||||||
protected int connectionTimeout = 0;
|
protected int connectionTimeout = 0;
|
||||||
private int readTimeout = 0;
|
protected int readTimeout = 0;
|
||||||
|
|
||||||
protected Client httpClient;
|
protected Client httpClient;
|
||||||
protected JSON json;
|
protected JSON json;
|
||||||
@ -297,13 +297,13 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateBasePath() {
|
protected void updateBasePath() {
|
||||||
if (serverIndex != null) {
|
if (serverIndex != null) {
|
||||||
setBasePath(servers.get(serverIndex).URL(serverVariables));
|
setBasePath(servers.get(serverIndex).URL(serverVariables));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setOauthBasePath(String basePath) {
|
protected void setOauthBasePath(String basePath) {
|
||||||
for(Authentication auth : authentications.values()) {
|
for(Authentication auth : authentications.values()) {
|
||||||
if (auth instanceof OAuth) {
|
if (auth instanceof OAuth) {
|
||||||
((OAuth) auth).setBasePath(basePath);
|
((OAuth) auth).setBasePath(basePath);
|
||||||
@ -949,7 +949,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
* @param key Key of the object
|
* @param key Key of the object
|
||||||
* @param multiPart MultiPart to add the form param to
|
* @param multiPart MultiPart to add the form param to
|
||||||
*/
|
*/
|
||||||
private void addParamToMultipart(Object value, String key, MultiPart multiPart) {
|
protected void addParamToMultipart(Object value, String key, MultiPart multiPart) {
|
||||||
if (value instanceof File) {
|
if (value instanceof File) {
|
||||||
File file = (File) value;
|
File file = (File) value;
|
||||||
FormDataContentDisposition contentDisp = FormDataContentDisposition.name(key)
|
FormDataContentDisposition contentDisp = FormDataContentDisposition.name(key)
|
||||||
@ -1263,7 +1263,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Response sendRequest(String method, Invocation.Builder invocationBuilder, Entity<?> entity) {
|
protected Response sendRequest(String method, Invocation.Builder invocationBuilder, Entity<?> entity) {
|
||||||
Response response;
|
Response response;
|
||||||
if ("POST".equals(method)) {
|
if ("POST".equals(method)) {
|
||||||
response = invocationBuilder.post(entity);
|
response = invocationBuilder.post(entity);
|
||||||
@ -1325,7 +1325,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return clientConfig;
|
return clientConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyDebugSetting(ClientConfig clientConfig) {
|
protected void applyDebugSetting(ClientConfig clientConfig) {
|
||||||
if (debugging) {
|
if (debugging) {
|
||||||
clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */));
|
clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */));
|
||||||
clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY);
|
clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY);
|
||||||
|
@ -85,13 +85,13 @@ import org.openapitools.client.auth.ApiKeyAuth;
|
|||||||
*/
|
*/
|
||||||
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
||||||
public class ApiClient extends JavaTimeFormatter {
|
public class ApiClient extends JavaTimeFormatter {
|
||||||
private static final Pattern JSON_MIME_PATTERN = Pattern.compile("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
|
protected static final Pattern JSON_MIME_PATTERN = Pattern.compile("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
|
||||||
|
|
||||||
protected Map<String, String> defaultHeaderMap = new HashMap<>();
|
protected Map<String, String> defaultHeaderMap = new HashMap<>();
|
||||||
protected Map<String, String> defaultCookieMap = new HashMap<>();
|
protected Map<String, String> defaultCookieMap = new HashMap<>();
|
||||||
protected String basePath = "http://localhost";
|
protected String basePath = "http://localhost";
|
||||||
protected String userAgent;
|
protected String userAgent;
|
||||||
private static final Logger log = Logger.getLogger(ApiClient.class.getName());
|
protected static final Logger log = Logger.getLogger(ApiClient.class.getName());
|
||||||
|
|
||||||
protected List<ServerConfiguration> servers = new ArrayList<>(Arrays.asList(
|
protected List<ServerConfiguration> servers = new ArrayList<>(Arrays.asList(
|
||||||
new ServerConfiguration(
|
new ServerConfiguration(
|
||||||
@ -108,7 +108,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
protected boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
protected ClientConfig clientConfig;
|
protected ClientConfig clientConfig;
|
||||||
protected int connectionTimeout = 0;
|
protected int connectionTimeout = 0;
|
||||||
private int readTimeout = 0;
|
protected int readTimeout = 0;
|
||||||
|
|
||||||
protected Client httpClient;
|
protected Client httpClient;
|
||||||
protected JSON json;
|
protected JSON json;
|
||||||
@ -262,7 +262,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateBasePath() {
|
protected void updateBasePath() {
|
||||||
if (serverIndex != null) {
|
if (serverIndex != null) {
|
||||||
setBasePath(servers.get(serverIndex).URL(serverVariables));
|
setBasePath(servers.get(serverIndex).URL(serverVariables));
|
||||||
}
|
}
|
||||||
@ -808,7 +808,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
* @param key Key of the object
|
* @param key Key of the object
|
||||||
* @param multiPart MultiPart to add the form param to
|
* @param multiPart MultiPart to add the form param to
|
||||||
*/
|
*/
|
||||||
private void addParamToMultipart(Object value, String key, MultiPart multiPart) {
|
protected void addParamToMultipart(Object value, String key, MultiPart multiPart) {
|
||||||
if (value instanceof File) {
|
if (value instanceof File) {
|
||||||
File file = (File) value;
|
File file = (File) value;
|
||||||
FormDataContentDisposition contentDisp = FormDataContentDisposition.name(key)
|
FormDataContentDisposition contentDisp = FormDataContentDisposition.name(key)
|
||||||
@ -1106,7 +1106,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Response sendRequest(String method, Invocation.Builder invocationBuilder, Entity<?> entity) {
|
protected Response sendRequest(String method, Invocation.Builder invocationBuilder, Entity<?> entity) {
|
||||||
Response response;
|
Response response;
|
||||||
if ("POST".equals(method)) {
|
if ("POST".equals(method)) {
|
||||||
response = invocationBuilder.post(entity);
|
response = invocationBuilder.post(entity);
|
||||||
@ -1168,7 +1168,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return clientConfig;
|
return clientConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyDebugSetting(ClientConfig clientConfig) {
|
protected void applyDebugSetting(ClientConfig clientConfig) {
|
||||||
if (debugging) {
|
if (debugging) {
|
||||||
clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */));
|
clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */));
|
||||||
clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY);
|
clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY);
|
||||||
|
@ -88,13 +88,13 @@ import org.openapitools.client.auth.OAuth;
|
|||||||
*/
|
*/
|
||||||
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
||||||
public class ApiClient extends JavaTimeFormatter {
|
public class ApiClient extends JavaTimeFormatter {
|
||||||
private static final Pattern JSON_MIME_PATTERN = Pattern.compile("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
|
protected static final Pattern JSON_MIME_PATTERN = Pattern.compile("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
|
||||||
|
|
||||||
protected Map<String, String> defaultHeaderMap = new HashMap<>();
|
protected Map<String, String> defaultHeaderMap = new HashMap<>();
|
||||||
protected Map<String, String> defaultCookieMap = new HashMap<>();
|
protected Map<String, String> defaultCookieMap = new HashMap<>();
|
||||||
protected String basePath = "http://petstore.swagger.io:80/v2";
|
protected String basePath = "http://petstore.swagger.io:80/v2";
|
||||||
protected String userAgent;
|
protected String userAgent;
|
||||||
private static final Logger log = Logger.getLogger(ApiClient.class.getName());
|
protected static final Logger log = Logger.getLogger(ApiClient.class.getName());
|
||||||
|
|
||||||
protected List<ServerConfiguration> servers = new ArrayList<>(Arrays.asList(
|
protected List<ServerConfiguration> servers = new ArrayList<>(Arrays.asList(
|
||||||
new ServerConfiguration(
|
new ServerConfiguration(
|
||||||
@ -178,7 +178,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
protected boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
protected ClientConfig clientConfig;
|
protected ClientConfig clientConfig;
|
||||||
protected int connectionTimeout = 0;
|
protected int connectionTimeout = 0;
|
||||||
private int readTimeout = 0;
|
protected int readTimeout = 0;
|
||||||
|
|
||||||
protected Client httpClient;
|
protected Client httpClient;
|
||||||
protected JSON json;
|
protected JSON json;
|
||||||
@ -379,13 +379,13 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateBasePath() {
|
protected void updateBasePath() {
|
||||||
if (serverIndex != null) {
|
if (serverIndex != null) {
|
||||||
setBasePath(servers.get(serverIndex).URL(serverVariables));
|
setBasePath(servers.get(serverIndex).URL(serverVariables));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setOauthBasePath(String basePath) {
|
protected void setOauthBasePath(String basePath) {
|
||||||
for(Authentication auth : authentications.values()) {
|
for(Authentication auth : authentications.values()) {
|
||||||
if (auth instanceof OAuth) {
|
if (auth instanceof OAuth) {
|
||||||
((OAuth) auth).setBasePath(basePath);
|
((OAuth) auth).setBasePath(basePath);
|
||||||
@ -1031,7 +1031,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
* @param key Key of the object
|
* @param key Key of the object
|
||||||
* @param multiPart MultiPart to add the form param to
|
* @param multiPart MultiPart to add the form param to
|
||||||
*/
|
*/
|
||||||
private void addParamToMultipart(Object value, String key, MultiPart multiPart) {
|
protected void addParamToMultipart(Object value, String key, MultiPart multiPart) {
|
||||||
if (value instanceof File) {
|
if (value instanceof File) {
|
||||||
File file = (File) value;
|
File file = (File) value;
|
||||||
FormDataContentDisposition contentDisp = FormDataContentDisposition.name(key)
|
FormDataContentDisposition contentDisp = FormDataContentDisposition.name(key)
|
||||||
@ -1345,7 +1345,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Response sendRequest(String method, Invocation.Builder invocationBuilder, Entity<?> entity) {
|
protected Response sendRequest(String method, Invocation.Builder invocationBuilder, Entity<?> entity) {
|
||||||
Response response;
|
Response response;
|
||||||
if ("POST".equals(method)) {
|
if ("POST".equals(method)) {
|
||||||
response = invocationBuilder.post(entity);
|
response = invocationBuilder.post(entity);
|
||||||
@ -1407,7 +1407,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return clientConfig;
|
return clientConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyDebugSetting(ClientConfig clientConfig) {
|
protected void applyDebugSetting(ClientConfig clientConfig) {
|
||||||
if (debugging) {
|
if (debugging) {
|
||||||
clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */));
|
clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */));
|
||||||
clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY);
|
clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY);
|
||||||
|
@ -54,17 +54,17 @@ import static java.nio.charset.StandardCharsets.UTF_8;
|
|||||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
||||||
public class ApiClient {
|
public class ApiClient {
|
||||||
|
|
||||||
private HttpClient.Builder builder;
|
protected HttpClient.Builder builder;
|
||||||
private ObjectMapper mapper;
|
protected ObjectMapper mapper;
|
||||||
private String scheme;
|
protected String scheme;
|
||||||
private String host;
|
protected String host;
|
||||||
private int port;
|
protected int port;
|
||||||
private String basePath;
|
protected String basePath;
|
||||||
private Consumer<HttpRequest.Builder> interceptor;
|
protected Consumer<HttpRequest.Builder> interceptor;
|
||||||
private Consumer<HttpResponse<InputStream>> responseInterceptor;
|
protected Consumer<HttpResponse<InputStream>> responseInterceptor;
|
||||||
private Consumer<HttpResponse<String>> asyncResponseInterceptor;
|
protected Consumer<HttpResponse<String>> asyncResponseInterceptor;
|
||||||
private Duration readTimeout;
|
protected Duration readTimeout;
|
||||||
private Duration connectTimeout;
|
protected Duration connectTimeout;
|
||||||
|
|
||||||
public static String valueToString(Object value) {
|
public static String valueToString(Object value) {
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
@ -207,7 +207,7 @@ public class ApiClient {
|
|||||||
return mapper;
|
return mapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getDefaultBaseUri() {
|
protected String getDefaultBaseUri() {
|
||||||
return "http://petstore.swagger.io:80/v2";
|
return "http://petstore.swagger.io:80/v2";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,17 +54,17 @@ import static java.nio.charset.StandardCharsets.UTF_8;
|
|||||||
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
||||||
public class ApiClient {
|
public class ApiClient {
|
||||||
|
|
||||||
private HttpClient.Builder builder;
|
protected HttpClient.Builder builder;
|
||||||
private ObjectMapper mapper;
|
protected ObjectMapper mapper;
|
||||||
private String scheme;
|
protected String scheme;
|
||||||
private String host;
|
protected String host;
|
||||||
private int port;
|
protected int port;
|
||||||
private String basePath;
|
protected String basePath;
|
||||||
private Consumer<HttpRequest.Builder> interceptor;
|
protected Consumer<HttpRequest.Builder> interceptor;
|
||||||
private Consumer<HttpResponse<InputStream>> responseInterceptor;
|
protected Consumer<HttpResponse<InputStream>> responseInterceptor;
|
||||||
private Consumer<HttpResponse<String>> asyncResponseInterceptor;
|
protected Consumer<HttpResponse<String>> asyncResponseInterceptor;
|
||||||
private Duration readTimeout;
|
protected Duration readTimeout;
|
||||||
private Duration connectTimeout;
|
protected Duration connectTimeout;
|
||||||
|
|
||||||
public static String valueToString(Object value) {
|
public static String valueToString(Object value) {
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
@ -207,7 +207,7 @@ public class ApiClient {
|
|||||||
return mapper;
|
return mapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getDefaultBaseUri() {
|
protected String getDefaultBaseUri() {
|
||||||
return "http://petstore.swagger.io/v2";
|
return "http://petstore.swagger.io/v2";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,17 +54,17 @@ import static java.nio.charset.StandardCharsets.UTF_8;
|
|||||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
||||||
public class ApiClient {
|
public class ApiClient {
|
||||||
|
|
||||||
private HttpClient.Builder builder;
|
protected HttpClient.Builder builder;
|
||||||
private ObjectMapper mapper;
|
protected ObjectMapper mapper;
|
||||||
private String scheme;
|
protected String scheme;
|
||||||
private String host;
|
protected String host;
|
||||||
private int port;
|
protected int port;
|
||||||
private String basePath;
|
protected String basePath;
|
||||||
private Consumer<HttpRequest.Builder> interceptor;
|
protected Consumer<HttpRequest.Builder> interceptor;
|
||||||
private Consumer<HttpResponse<InputStream>> responseInterceptor;
|
protected Consumer<HttpResponse<InputStream>> responseInterceptor;
|
||||||
private Consumer<HttpResponse<String>> asyncResponseInterceptor;
|
protected Consumer<HttpResponse<String>> asyncResponseInterceptor;
|
||||||
private Duration readTimeout;
|
protected Duration readTimeout;
|
||||||
private Duration connectTimeout;
|
protected Duration connectTimeout;
|
||||||
|
|
||||||
public static String valueToString(Object value) {
|
public static String valueToString(Object value) {
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
@ -207,7 +207,7 @@ public class ApiClient {
|
|||||||
return mapper;
|
return mapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getDefaultBaseUri() {
|
protected String getDefaultBaseUri() {
|
||||||
return "http://petstore.swagger.io:80/v2";
|
return "http://petstore.swagger.io:80/v2";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ import org.openapitools.client.auth.OAuthFlow;
|
|||||||
*/
|
*/
|
||||||
public class ApiClient {
|
public class ApiClient {
|
||||||
|
|
||||||
private String basePath = "http://petstore.swagger.io/v2";
|
protected String basePath = "http://petstore.swagger.io/v2";
|
||||||
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>(Arrays.asList(
|
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>(Arrays.asList(
|
||||||
new ServerConfiguration(
|
new ServerConfiguration(
|
||||||
"http://petstore.swagger.io/v2",
|
"http://petstore.swagger.io/v2",
|
||||||
@ -76,26 +76,26 @@ public class ApiClient {
|
|||||||
));
|
));
|
||||||
protected Integer serverIndex = 0;
|
protected Integer serverIndex = 0;
|
||||||
protected Map<String, String> serverVariables = null;
|
protected Map<String, String> serverVariables = null;
|
||||||
private boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
protected Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||||
private Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
protected Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
||||||
private String tempFolderPath = null;
|
protected String tempFolderPath = null;
|
||||||
|
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
private DateFormat dateFormat;
|
protected DateFormat dateFormat;
|
||||||
private DateFormat datetimeFormat;
|
protected DateFormat datetimeFormat;
|
||||||
private boolean lenientDatetimeFormat;
|
protected boolean lenientDatetimeFormat;
|
||||||
private int dateLength;
|
protected int dateLength;
|
||||||
|
|
||||||
private InputStream sslCaCert;
|
protected InputStream sslCaCert;
|
||||||
private boolean verifyingSsl;
|
protected boolean verifyingSsl;
|
||||||
private KeyManager[] keyManagers;
|
protected KeyManager[] keyManagers;
|
||||||
|
|
||||||
private OkHttpClient httpClient;
|
protected OkHttpClient httpClient;
|
||||||
private JSON json;
|
protected JSON json;
|
||||||
|
|
||||||
private HttpLoggingInterceptor loggingInterceptor;
|
protected HttpLoggingInterceptor loggingInterceptor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Basic constructor for ApiClient
|
* Basic constructor for ApiClient
|
||||||
@ -195,11 +195,11 @@ public class ApiClient {
|
|||||||
authentications = Collections.unmodifiableMap(authentications);
|
authentications = Collections.unmodifiableMap(authentications);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initHttpClient() {
|
protected void initHttpClient() {
|
||||||
initHttpClient(Collections.<Interceptor>emptyList());
|
initHttpClient(Collections.<Interceptor>emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initHttpClient(List<Interceptor> interceptors) {
|
protected void initHttpClient(List<Interceptor> interceptors) {
|
||||||
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
||||||
builder.addNetworkInterceptor(getProgressInterceptor());
|
builder.addNetworkInterceptor(getProgressInterceptor());
|
||||||
for (Interceptor interceptor: interceptors) {
|
for (Interceptor interceptor: interceptors) {
|
||||||
@ -209,7 +209,7 @@ public class ApiClient {
|
|||||||
httpClient = builder.build();
|
httpClient = builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init() {
|
protected void init() {
|
||||||
verifyingSsl = true;
|
verifyingSsl = true;
|
||||||
|
|
||||||
json = new JSON();
|
json = new JSON();
|
||||||
@ -1530,7 +1530,7 @@ public class ApiClient {
|
|||||||
* @param key The key of the Header element
|
* @param key The key of the Header element
|
||||||
* @param file The file to add to the Header
|
* @param file The file to add to the Header
|
||||||
*/
|
*/
|
||||||
private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) {
|
protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) {
|
||||||
Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\"");
|
Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\"");
|
||||||
MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file));
|
MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file));
|
||||||
mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType));
|
mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType));
|
||||||
@ -1543,7 +1543,7 @@ public class ApiClient {
|
|||||||
* @param key The key of the Header element
|
* @param key The key of the Header element
|
||||||
* @param obj The complex object to add to the Header
|
* @param obj The complex object to add to the Header
|
||||||
*/
|
*/
|
||||||
private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) {
|
protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) {
|
||||||
RequestBody requestBody;
|
RequestBody requestBody;
|
||||||
if (obj instanceof String) {
|
if (obj instanceof String) {
|
||||||
requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain"));
|
requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain"));
|
||||||
@ -1565,7 +1565,7 @@ public class ApiClient {
|
|||||||
* Get network interceptor to add it to the httpClient to track download progress for
|
* Get network interceptor to add it to the httpClient to track download progress for
|
||||||
* async requests.
|
* async requests.
|
||||||
*/
|
*/
|
||||||
private Interceptor getProgressInterceptor() {
|
protected Interceptor getProgressInterceptor() {
|
||||||
return new Interceptor() {
|
return new Interceptor() {
|
||||||
@Override
|
@Override
|
||||||
public Response intercept(Interceptor.Chain chain) throws IOException {
|
public Response intercept(Interceptor.Chain chain) throws IOException {
|
||||||
@ -1586,7 +1586,7 @@ public class ApiClient {
|
|||||||
* Apply SSL related settings to httpClient according to the current values of
|
* Apply SSL related settings to httpClient according to the current values of
|
||||||
* verifyingSsl and sslCaCert.
|
* verifyingSsl and sslCaCert.
|
||||||
*/
|
*/
|
||||||
private void applySslSettings() {
|
protected void applySslSettings() {
|
||||||
try {
|
try {
|
||||||
TrustManager[] trustManagers;
|
TrustManager[] trustManagers;
|
||||||
HostnameVerifier hostnameVerifier;
|
HostnameVerifier hostnameVerifier;
|
||||||
@ -1648,7 +1648,7 @@ public class ApiClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException {
|
protected KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException {
|
||||||
try {
|
try {
|
||||||
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
|
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
|
||||||
keyStore.load(null, password);
|
keyStore.load(null, password);
|
||||||
@ -1665,7 +1665,7 @@ public class ApiClient {
|
|||||||
* @return The string representation of the HTTP request body
|
* @return The string representation of the HTTP request body
|
||||||
* @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string
|
* @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string
|
||||||
*/
|
*/
|
||||||
private String requestBodyToString(RequestBody requestBody) throws ApiException {
|
protected String requestBodyToString(RequestBody requestBody) throws ApiException {
|
||||||
if (requestBody != null) {
|
if (requestBody != null) {
|
||||||
try {
|
try {
|
||||||
final Buffer buffer = new Buffer();
|
final Buffer buffer = new Buffer();
|
||||||
|
@ -66,7 +66,7 @@ import org.openapitools.client.auth.OAuthFlow;
|
|||||||
*/
|
*/
|
||||||
public class ApiClient {
|
public class ApiClient {
|
||||||
|
|
||||||
private String basePath = "http://petstore.swagger.io/v2";
|
protected String basePath = "http://petstore.swagger.io/v2";
|
||||||
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>(Arrays.asList(
|
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>(Arrays.asList(
|
||||||
new ServerConfiguration(
|
new ServerConfiguration(
|
||||||
"http://petstore.swagger.io/v2",
|
"http://petstore.swagger.io/v2",
|
||||||
@ -76,26 +76,26 @@ public class ApiClient {
|
|||||||
));
|
));
|
||||||
protected Integer serverIndex = 0;
|
protected Integer serverIndex = 0;
|
||||||
protected Map<String, String> serverVariables = null;
|
protected Map<String, String> serverVariables = null;
|
||||||
private boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
protected Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||||
private Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
protected Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
||||||
private String tempFolderPath = null;
|
protected String tempFolderPath = null;
|
||||||
|
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
private DateFormat dateFormat;
|
protected DateFormat dateFormat;
|
||||||
private DateFormat datetimeFormat;
|
protected DateFormat datetimeFormat;
|
||||||
private boolean lenientDatetimeFormat;
|
protected boolean lenientDatetimeFormat;
|
||||||
private int dateLength;
|
protected int dateLength;
|
||||||
|
|
||||||
private InputStream sslCaCert;
|
protected InputStream sslCaCert;
|
||||||
private boolean verifyingSsl;
|
protected boolean verifyingSsl;
|
||||||
private KeyManager[] keyManagers;
|
protected KeyManager[] keyManagers;
|
||||||
|
|
||||||
private OkHttpClient httpClient;
|
protected OkHttpClient httpClient;
|
||||||
private JSON json;
|
protected JSON json;
|
||||||
|
|
||||||
private HttpLoggingInterceptor loggingInterceptor;
|
protected HttpLoggingInterceptor loggingInterceptor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Basic constructor for ApiClient
|
* Basic constructor for ApiClient
|
||||||
@ -195,11 +195,11 @@ public class ApiClient {
|
|||||||
authentications = Collections.unmodifiableMap(authentications);
|
authentications = Collections.unmodifiableMap(authentications);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initHttpClient() {
|
protected void initHttpClient() {
|
||||||
initHttpClient(Collections.<Interceptor>emptyList());
|
initHttpClient(Collections.<Interceptor>emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initHttpClient(List<Interceptor> interceptors) {
|
protected void initHttpClient(List<Interceptor> interceptors) {
|
||||||
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
||||||
builder.addNetworkInterceptor(getProgressInterceptor());
|
builder.addNetworkInterceptor(getProgressInterceptor());
|
||||||
for (Interceptor interceptor: interceptors) {
|
for (Interceptor interceptor: interceptors) {
|
||||||
@ -209,7 +209,7 @@ public class ApiClient {
|
|||||||
httpClient = builder.build();
|
httpClient = builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init() {
|
protected void init() {
|
||||||
verifyingSsl = true;
|
verifyingSsl = true;
|
||||||
|
|
||||||
json = new JSON();
|
json = new JSON();
|
||||||
@ -1530,7 +1530,7 @@ public class ApiClient {
|
|||||||
* @param key The key of the Header element
|
* @param key The key of the Header element
|
||||||
* @param file The file to add to the Header
|
* @param file The file to add to the Header
|
||||||
*/
|
*/
|
||||||
private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) {
|
protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) {
|
||||||
Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\"");
|
Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\"");
|
||||||
MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file));
|
MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file));
|
||||||
mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType));
|
mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType));
|
||||||
@ -1543,7 +1543,7 @@ public class ApiClient {
|
|||||||
* @param key The key of the Header element
|
* @param key The key of the Header element
|
||||||
* @param obj The complex object to add to the Header
|
* @param obj The complex object to add to the Header
|
||||||
*/
|
*/
|
||||||
private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) {
|
protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) {
|
||||||
RequestBody requestBody;
|
RequestBody requestBody;
|
||||||
if (obj instanceof String) {
|
if (obj instanceof String) {
|
||||||
requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain"));
|
requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain"));
|
||||||
@ -1565,7 +1565,7 @@ public class ApiClient {
|
|||||||
* Get network interceptor to add it to the httpClient to track download progress for
|
* Get network interceptor to add it to the httpClient to track download progress for
|
||||||
* async requests.
|
* async requests.
|
||||||
*/
|
*/
|
||||||
private Interceptor getProgressInterceptor() {
|
protected Interceptor getProgressInterceptor() {
|
||||||
return new Interceptor() {
|
return new Interceptor() {
|
||||||
@Override
|
@Override
|
||||||
public Response intercept(Interceptor.Chain chain) throws IOException {
|
public Response intercept(Interceptor.Chain chain) throws IOException {
|
||||||
@ -1586,7 +1586,7 @@ public class ApiClient {
|
|||||||
* Apply SSL related settings to httpClient according to the current values of
|
* Apply SSL related settings to httpClient according to the current values of
|
||||||
* verifyingSsl and sslCaCert.
|
* verifyingSsl and sslCaCert.
|
||||||
*/
|
*/
|
||||||
private void applySslSettings() {
|
protected void applySslSettings() {
|
||||||
try {
|
try {
|
||||||
TrustManager[] trustManagers;
|
TrustManager[] trustManagers;
|
||||||
HostnameVerifier hostnameVerifier;
|
HostnameVerifier hostnameVerifier;
|
||||||
@ -1648,7 +1648,7 @@ public class ApiClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException {
|
protected KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException {
|
||||||
try {
|
try {
|
||||||
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
|
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
|
||||||
keyStore.load(null, password);
|
keyStore.load(null, password);
|
||||||
@ -1665,7 +1665,7 @@ public class ApiClient {
|
|||||||
* @return The string representation of the HTTP request body
|
* @return The string representation of the HTTP request body
|
||||||
* @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string
|
* @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string
|
||||||
*/
|
*/
|
||||||
private String requestBodyToString(RequestBody requestBody) throws ApiException {
|
protected String requestBodyToString(RequestBody requestBody) throws ApiException {
|
||||||
if (requestBody != null) {
|
if (requestBody != null) {
|
||||||
try {
|
try {
|
||||||
final Buffer buffer = new Buffer();
|
final Buffer buffer = new Buffer();
|
||||||
|
@ -67,7 +67,7 @@ import org.openapitools.client.auth.AWS4Auth;
|
|||||||
*/
|
*/
|
||||||
public class ApiClient {
|
public class ApiClient {
|
||||||
|
|
||||||
private String basePath = "http://petstore.swagger.io/v2";
|
protected String basePath = "http://petstore.swagger.io/v2";
|
||||||
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>(Arrays.asList(
|
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>(Arrays.asList(
|
||||||
new ServerConfiguration(
|
new ServerConfiguration(
|
||||||
"http://petstore.swagger.io/v2",
|
"http://petstore.swagger.io/v2",
|
||||||
@ -77,26 +77,26 @@ public class ApiClient {
|
|||||||
));
|
));
|
||||||
protected Integer serverIndex = 0;
|
protected Integer serverIndex = 0;
|
||||||
protected Map<String, String> serverVariables = null;
|
protected Map<String, String> serverVariables = null;
|
||||||
private boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
protected Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||||
private Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
protected Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
||||||
private String tempFolderPath = null;
|
protected String tempFolderPath = null;
|
||||||
|
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
private DateFormat dateFormat;
|
protected DateFormat dateFormat;
|
||||||
private DateFormat datetimeFormat;
|
protected DateFormat datetimeFormat;
|
||||||
private boolean lenientDatetimeFormat;
|
protected boolean lenientDatetimeFormat;
|
||||||
private int dateLength;
|
protected int dateLength;
|
||||||
|
|
||||||
private InputStream sslCaCert;
|
protected InputStream sslCaCert;
|
||||||
private boolean verifyingSsl;
|
protected boolean verifyingSsl;
|
||||||
private KeyManager[] keyManagers;
|
protected KeyManager[] keyManagers;
|
||||||
|
|
||||||
private OkHttpClient httpClient;
|
protected OkHttpClient httpClient;
|
||||||
private JSON json;
|
protected JSON json;
|
||||||
|
|
||||||
private HttpLoggingInterceptor loggingInterceptor;
|
protected HttpLoggingInterceptor loggingInterceptor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Basic constructor for ApiClient
|
* Basic constructor for ApiClient
|
||||||
@ -199,11 +199,11 @@ public class ApiClient {
|
|||||||
authentications = Collections.unmodifiableMap(authentications);
|
authentications = Collections.unmodifiableMap(authentications);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initHttpClient() {
|
protected void initHttpClient() {
|
||||||
initHttpClient(Collections.<Interceptor>emptyList());
|
initHttpClient(Collections.<Interceptor>emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initHttpClient(List<Interceptor> interceptors) {
|
protected void initHttpClient(List<Interceptor> interceptors) {
|
||||||
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
||||||
builder.addNetworkInterceptor(getProgressInterceptor());
|
builder.addNetworkInterceptor(getProgressInterceptor());
|
||||||
for (Interceptor interceptor: interceptors) {
|
for (Interceptor interceptor: interceptors) {
|
||||||
@ -213,7 +213,7 @@ public class ApiClient {
|
|||||||
httpClient = builder.build();
|
httpClient = builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init() {
|
protected void init() {
|
||||||
verifyingSsl = true;
|
verifyingSsl = true;
|
||||||
|
|
||||||
json = new JSON();
|
json = new JSON();
|
||||||
@ -1550,7 +1550,7 @@ public class ApiClient {
|
|||||||
* @param key The key of the Header element
|
* @param key The key of the Header element
|
||||||
* @param file The file to add to the Header
|
* @param file The file to add to the Header
|
||||||
*/
|
*/
|
||||||
private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) {
|
protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) {
|
||||||
Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\"");
|
Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\"");
|
||||||
MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file));
|
MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file));
|
||||||
mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType));
|
mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType));
|
||||||
@ -1563,7 +1563,7 @@ public class ApiClient {
|
|||||||
* @param key The key of the Header element
|
* @param key The key of the Header element
|
||||||
* @param obj The complex object to add to the Header
|
* @param obj The complex object to add to the Header
|
||||||
*/
|
*/
|
||||||
private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) {
|
protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) {
|
||||||
RequestBody requestBody;
|
RequestBody requestBody;
|
||||||
if (obj instanceof String) {
|
if (obj instanceof String) {
|
||||||
requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain"));
|
requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain"));
|
||||||
@ -1585,7 +1585,7 @@ public class ApiClient {
|
|||||||
* Get network interceptor to add it to the httpClient to track download progress for
|
* Get network interceptor to add it to the httpClient to track download progress for
|
||||||
* async requests.
|
* async requests.
|
||||||
*/
|
*/
|
||||||
private Interceptor getProgressInterceptor() {
|
protected Interceptor getProgressInterceptor() {
|
||||||
return new Interceptor() {
|
return new Interceptor() {
|
||||||
@Override
|
@Override
|
||||||
public Response intercept(Interceptor.Chain chain) throws IOException {
|
public Response intercept(Interceptor.Chain chain) throws IOException {
|
||||||
@ -1606,7 +1606,7 @@ public class ApiClient {
|
|||||||
* Apply SSL related settings to httpClient according to the current values of
|
* Apply SSL related settings to httpClient according to the current values of
|
||||||
* verifyingSsl and sslCaCert.
|
* verifyingSsl and sslCaCert.
|
||||||
*/
|
*/
|
||||||
private void applySslSettings() {
|
protected void applySslSettings() {
|
||||||
try {
|
try {
|
||||||
TrustManager[] trustManagers;
|
TrustManager[] trustManagers;
|
||||||
HostnameVerifier hostnameVerifier;
|
HostnameVerifier hostnameVerifier;
|
||||||
@ -1668,7 +1668,7 @@ public class ApiClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException {
|
protected KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException {
|
||||||
try {
|
try {
|
||||||
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
|
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
|
||||||
keyStore.load(null, password);
|
keyStore.load(null, password);
|
||||||
@ -1685,7 +1685,7 @@ public class ApiClient {
|
|||||||
* @return The string representation of the HTTP request body
|
* @return The string representation of the HTTP request body
|
||||||
* @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string
|
* @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string
|
||||||
*/
|
*/
|
||||||
private String requestBodyToString(RequestBody requestBody) throws ApiException {
|
protected String requestBodyToString(RequestBody requestBody) throws ApiException {
|
||||||
if (requestBody != null) {
|
if (requestBody != null) {
|
||||||
try {
|
try {
|
||||||
final Buffer buffer = new Buffer();
|
final Buffer buffer = new Buffer();
|
||||||
|
@ -72,7 +72,7 @@ import org.openapitools.client.auth.OAuthFlow;
|
|||||||
*/
|
*/
|
||||||
public class ApiClient {
|
public class ApiClient {
|
||||||
|
|
||||||
private String basePath = "http://petstore.swagger.io:80/v2";
|
protected String basePath = "http://petstore.swagger.io:80/v2";
|
||||||
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>(Arrays.asList(
|
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>(Arrays.asList(
|
||||||
new ServerConfiguration(
|
new ServerConfiguration(
|
||||||
"http://petstore.swagger.io:80/v2",
|
"http://petstore.swagger.io:80/v2",
|
||||||
@ -82,28 +82,28 @@ public class ApiClient {
|
|||||||
));
|
));
|
||||||
protected Integer serverIndex = 0;
|
protected Integer serverIndex = 0;
|
||||||
protected Map<String, String> serverVariables = null;
|
protected Map<String, String> serverVariables = null;
|
||||||
private boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
protected Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||||
private Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
protected Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
||||||
private String tempFolderPath = null;
|
protected String tempFolderPath = null;
|
||||||
|
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
private DateFormat dateFormat;
|
protected DateFormat dateFormat;
|
||||||
private DateFormat datetimeFormat;
|
protected DateFormat datetimeFormat;
|
||||||
private boolean lenientDatetimeFormat;
|
protected boolean lenientDatetimeFormat;
|
||||||
private int dateLength;
|
protected int dateLength;
|
||||||
|
|
||||||
private InputStream sslCaCert;
|
protected InputStream sslCaCert;
|
||||||
private boolean verifyingSsl;
|
protected boolean verifyingSsl;
|
||||||
private KeyManager[] keyManagers;
|
protected KeyManager[] keyManagers;
|
||||||
|
|
||||||
private OkHttpClient httpClient;
|
protected OkHttpClient httpClient;
|
||||||
private JSON json;
|
protected JSON json;
|
||||||
|
|
||||||
private HttpLoggingInterceptor loggingInterceptor;
|
protected HttpLoggingInterceptor loggingInterceptor;
|
||||||
|
|
||||||
private Map<String, ApiOperation> operationLookupMap = new HashMap<>();
|
protected Map<String, ApiOperation> operationLookupMap = new HashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Basic constructor for ApiClient
|
* Basic constructor for ApiClient
|
||||||
@ -209,11 +209,11 @@ public class ApiClient {
|
|||||||
authentications = Collections.unmodifiableMap(authentications);
|
authentications = Collections.unmodifiableMap(authentications);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initHttpClient() {
|
protected void initHttpClient() {
|
||||||
initHttpClient(Collections.<Interceptor>emptyList());
|
initHttpClient(Collections.<Interceptor>emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initHttpClient(List<Interceptor> interceptors) {
|
protected void initHttpClient(List<Interceptor> interceptors) {
|
||||||
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
||||||
builder.addNetworkInterceptor(getProgressInterceptor());
|
builder.addNetworkInterceptor(getProgressInterceptor());
|
||||||
for (Interceptor interceptor: interceptors) {
|
for (Interceptor interceptor: interceptors) {
|
||||||
@ -223,7 +223,7 @@ public class ApiClient {
|
|||||||
httpClient = builder.build();
|
httpClient = builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init() {
|
protected void init() {
|
||||||
verifyingSsl = true;
|
verifyingSsl = true;
|
||||||
|
|
||||||
json = new JSON();
|
json = new JSON();
|
||||||
@ -1535,7 +1535,7 @@ public class ApiClient {
|
|||||||
* @param key The key of the Header element
|
* @param key The key of the Header element
|
||||||
* @param file The file to add to the Header
|
* @param file The file to add to the Header
|
||||||
*/
|
*/
|
||||||
private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) {
|
protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) {
|
||||||
Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\"");
|
Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\"");
|
||||||
MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file));
|
MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file));
|
||||||
mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType));
|
mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType));
|
||||||
@ -1548,7 +1548,7 @@ public class ApiClient {
|
|||||||
* @param key The key of the Header element
|
* @param key The key of the Header element
|
||||||
* @param obj The complex object to add to the Header
|
* @param obj The complex object to add to the Header
|
||||||
*/
|
*/
|
||||||
private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) {
|
protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) {
|
||||||
RequestBody requestBody;
|
RequestBody requestBody;
|
||||||
if (obj instanceof String) {
|
if (obj instanceof String) {
|
||||||
requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain"));
|
requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain"));
|
||||||
@ -1570,7 +1570,7 @@ public class ApiClient {
|
|||||||
* Get network interceptor to add it to the httpClient to track download progress for
|
* Get network interceptor to add it to the httpClient to track download progress for
|
||||||
* async requests.
|
* async requests.
|
||||||
*/
|
*/
|
||||||
private Interceptor getProgressInterceptor() {
|
protected Interceptor getProgressInterceptor() {
|
||||||
return new Interceptor() {
|
return new Interceptor() {
|
||||||
@Override
|
@Override
|
||||||
public Response intercept(Interceptor.Chain chain) throws IOException {
|
public Response intercept(Interceptor.Chain chain) throws IOException {
|
||||||
@ -1591,7 +1591,7 @@ public class ApiClient {
|
|||||||
* Apply SSL related settings to httpClient according to the current values of
|
* Apply SSL related settings to httpClient according to the current values of
|
||||||
* verifyingSsl and sslCaCert.
|
* verifyingSsl and sslCaCert.
|
||||||
*/
|
*/
|
||||||
private void applySslSettings() {
|
protected void applySslSettings() {
|
||||||
try {
|
try {
|
||||||
TrustManager[] trustManagers;
|
TrustManager[] trustManagers;
|
||||||
HostnameVerifier hostnameVerifier;
|
HostnameVerifier hostnameVerifier;
|
||||||
@ -1653,7 +1653,7 @@ public class ApiClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException {
|
protected KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException {
|
||||||
try {
|
try {
|
||||||
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
|
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
|
||||||
keyStore.load(null, password);
|
keyStore.load(null, password);
|
||||||
@ -1680,7 +1680,7 @@ public class ApiClient {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addOperationLookupEntry(String path, String method, Operation operation) {
|
protected void addOperationLookupEntry(String path, String method, Operation operation) {
|
||||||
if ( operation != null && operation.getOperationId() != null) {
|
if ( operation != null && operation.getOperationId() != null) {
|
||||||
operationLookupMap.put(
|
operationLookupMap.put(
|
||||||
operation.getOperationId(),
|
operation.getOperationId(),
|
||||||
@ -1739,7 +1739,7 @@ public class ApiClient {
|
|||||||
* @return The string representation of the HTTP request body
|
* @return The string representation of the HTTP request body
|
||||||
* @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string
|
* @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string
|
||||||
*/
|
*/
|
||||||
private String requestBodyToString(RequestBody requestBody) throws ApiException {
|
protected String requestBodyToString(RequestBody requestBody) throws ApiException {
|
||||||
if (requestBody != null) {
|
if (requestBody != null) {
|
||||||
try {
|
try {
|
||||||
final Buffer buffer = new Buffer();
|
final Buffer buffer = new Buffer();
|
||||||
|
@ -66,7 +66,7 @@ import org.openapitools.client.auth.OAuthFlow;
|
|||||||
*/
|
*/
|
||||||
public class ApiClient {
|
public class ApiClient {
|
||||||
|
|
||||||
private String basePath = "http://petstore.swagger.io/v2";
|
protected String basePath = "http://petstore.swagger.io/v2";
|
||||||
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>(Arrays.asList(
|
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>(Arrays.asList(
|
||||||
new ServerConfiguration(
|
new ServerConfiguration(
|
||||||
"http://petstore.swagger.io/v2",
|
"http://petstore.swagger.io/v2",
|
||||||
@ -76,26 +76,26 @@ public class ApiClient {
|
|||||||
));
|
));
|
||||||
protected Integer serverIndex = 0;
|
protected Integer serverIndex = 0;
|
||||||
protected Map<String, String> serverVariables = null;
|
protected Map<String, String> serverVariables = null;
|
||||||
private boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
protected Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||||
private Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
protected Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
||||||
private String tempFolderPath = null;
|
protected String tempFolderPath = null;
|
||||||
|
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
private DateFormat dateFormat;
|
protected DateFormat dateFormat;
|
||||||
private DateFormat datetimeFormat;
|
protected DateFormat datetimeFormat;
|
||||||
private boolean lenientDatetimeFormat;
|
protected boolean lenientDatetimeFormat;
|
||||||
private int dateLength;
|
protected int dateLength;
|
||||||
|
|
||||||
private InputStream sslCaCert;
|
protected InputStream sslCaCert;
|
||||||
private boolean verifyingSsl;
|
protected boolean verifyingSsl;
|
||||||
private KeyManager[] keyManagers;
|
protected KeyManager[] keyManagers;
|
||||||
|
|
||||||
private OkHttpClient httpClient;
|
protected OkHttpClient httpClient;
|
||||||
private JSON json;
|
protected JSON json;
|
||||||
|
|
||||||
private HttpLoggingInterceptor loggingInterceptor;
|
protected HttpLoggingInterceptor loggingInterceptor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Basic constructor for ApiClient
|
* Basic constructor for ApiClient
|
||||||
@ -195,11 +195,11 @@ public class ApiClient {
|
|||||||
authentications = Collections.unmodifiableMap(authentications);
|
authentications = Collections.unmodifiableMap(authentications);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initHttpClient() {
|
protected void initHttpClient() {
|
||||||
initHttpClient(Collections.<Interceptor>emptyList());
|
initHttpClient(Collections.<Interceptor>emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initHttpClient(List<Interceptor> interceptors) {
|
protected void initHttpClient(List<Interceptor> interceptors) {
|
||||||
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
||||||
builder.addNetworkInterceptor(getProgressInterceptor());
|
builder.addNetworkInterceptor(getProgressInterceptor());
|
||||||
for (Interceptor interceptor: interceptors) {
|
for (Interceptor interceptor: interceptors) {
|
||||||
@ -209,7 +209,7 @@ public class ApiClient {
|
|||||||
httpClient = builder.build();
|
httpClient = builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init() {
|
protected void init() {
|
||||||
verifyingSsl = true;
|
verifyingSsl = true;
|
||||||
|
|
||||||
json = new JSON();
|
json = new JSON();
|
||||||
@ -1530,7 +1530,7 @@ public class ApiClient {
|
|||||||
* @param key The key of the Header element
|
* @param key The key of the Header element
|
||||||
* @param file The file to add to the Header
|
* @param file The file to add to the Header
|
||||||
*/
|
*/
|
||||||
private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) {
|
protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) {
|
||||||
Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\"");
|
Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\"");
|
||||||
MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file));
|
MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file));
|
||||||
mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType));
|
mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType));
|
||||||
@ -1543,7 +1543,7 @@ public class ApiClient {
|
|||||||
* @param key The key of the Header element
|
* @param key The key of the Header element
|
||||||
* @param obj The complex object to add to the Header
|
* @param obj The complex object to add to the Header
|
||||||
*/
|
*/
|
||||||
private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) {
|
protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) {
|
||||||
RequestBody requestBody;
|
RequestBody requestBody;
|
||||||
if (obj instanceof String) {
|
if (obj instanceof String) {
|
||||||
requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain"));
|
requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain"));
|
||||||
@ -1565,7 +1565,7 @@ public class ApiClient {
|
|||||||
* Get network interceptor to add it to the httpClient to track download progress for
|
* Get network interceptor to add it to the httpClient to track download progress for
|
||||||
* async requests.
|
* async requests.
|
||||||
*/
|
*/
|
||||||
private Interceptor getProgressInterceptor() {
|
protected Interceptor getProgressInterceptor() {
|
||||||
return new Interceptor() {
|
return new Interceptor() {
|
||||||
@Override
|
@Override
|
||||||
public Response intercept(Interceptor.Chain chain) throws IOException {
|
public Response intercept(Interceptor.Chain chain) throws IOException {
|
||||||
@ -1586,7 +1586,7 @@ public class ApiClient {
|
|||||||
* Apply SSL related settings to httpClient according to the current values of
|
* Apply SSL related settings to httpClient according to the current values of
|
||||||
* verifyingSsl and sslCaCert.
|
* verifyingSsl and sslCaCert.
|
||||||
*/
|
*/
|
||||||
private void applySslSettings() {
|
protected void applySslSettings() {
|
||||||
try {
|
try {
|
||||||
TrustManager[] trustManagers;
|
TrustManager[] trustManagers;
|
||||||
HostnameVerifier hostnameVerifier;
|
HostnameVerifier hostnameVerifier;
|
||||||
@ -1648,7 +1648,7 @@ public class ApiClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException {
|
protected KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException {
|
||||||
try {
|
try {
|
||||||
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
|
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
|
||||||
keyStore.load(null, password);
|
keyStore.load(null, password);
|
||||||
@ -1665,7 +1665,7 @@ public class ApiClient {
|
|||||||
* @return The string representation of the HTTP request body
|
* @return The string representation of the HTTP request body
|
||||||
* @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string
|
* @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string
|
||||||
*/
|
*/
|
||||||
private String requestBodyToString(RequestBody requestBody) throws ApiException {
|
protected String requestBodyToString(RequestBody requestBody) throws ApiException {
|
||||||
if (requestBody != null) {
|
if (requestBody != null) {
|
||||||
try {
|
try {
|
||||||
final Buffer buffer = new Buffer();
|
final Buffer buffer = new Buffer();
|
||||||
|
@ -66,7 +66,7 @@ import org.openapitools.client.auth.OAuthFlow;
|
|||||||
*/
|
*/
|
||||||
public class ApiClient {
|
public class ApiClient {
|
||||||
|
|
||||||
private String basePath = "http://petstore.swagger.io/v2";
|
protected String basePath = "http://petstore.swagger.io/v2";
|
||||||
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>(Arrays.asList(
|
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>(Arrays.asList(
|
||||||
new ServerConfiguration(
|
new ServerConfiguration(
|
||||||
"http://petstore.swagger.io/v2",
|
"http://petstore.swagger.io/v2",
|
||||||
@ -76,26 +76,26 @@ public class ApiClient {
|
|||||||
));
|
));
|
||||||
protected Integer serverIndex = 0;
|
protected Integer serverIndex = 0;
|
||||||
protected Map<String, String> serverVariables = null;
|
protected Map<String, String> serverVariables = null;
|
||||||
private boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
protected Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||||
private Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
protected Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
||||||
private String tempFolderPath = null;
|
protected String tempFolderPath = null;
|
||||||
|
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
private DateFormat dateFormat;
|
protected DateFormat dateFormat;
|
||||||
private DateFormat datetimeFormat;
|
protected DateFormat datetimeFormat;
|
||||||
private boolean lenientDatetimeFormat;
|
protected boolean lenientDatetimeFormat;
|
||||||
private int dateLength;
|
protected int dateLength;
|
||||||
|
|
||||||
private InputStream sslCaCert;
|
protected InputStream sslCaCert;
|
||||||
private boolean verifyingSsl;
|
protected boolean verifyingSsl;
|
||||||
private KeyManager[] keyManagers;
|
protected KeyManager[] keyManagers;
|
||||||
|
|
||||||
private OkHttpClient httpClient;
|
protected OkHttpClient httpClient;
|
||||||
private JSON json;
|
protected JSON json;
|
||||||
|
|
||||||
private HttpLoggingInterceptor loggingInterceptor;
|
protected HttpLoggingInterceptor loggingInterceptor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Basic constructor for ApiClient
|
* Basic constructor for ApiClient
|
||||||
@ -198,11 +198,11 @@ public class ApiClient {
|
|||||||
authentications = Collections.unmodifiableMap(authentications);
|
authentications = Collections.unmodifiableMap(authentications);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initHttpClient() {
|
protected void initHttpClient() {
|
||||||
initHttpClient(Collections.<Interceptor>emptyList());
|
initHttpClient(Collections.<Interceptor>emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initHttpClient(List<Interceptor> interceptors) {
|
protected void initHttpClient(List<Interceptor> interceptors) {
|
||||||
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
||||||
builder.addNetworkInterceptor(getProgressInterceptor());
|
builder.addNetworkInterceptor(getProgressInterceptor());
|
||||||
for (Interceptor interceptor: interceptors) {
|
for (Interceptor interceptor: interceptors) {
|
||||||
@ -212,7 +212,7 @@ public class ApiClient {
|
|||||||
httpClient = builder.build();
|
httpClient = builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init() {
|
protected void init() {
|
||||||
verifyingSsl = true;
|
verifyingSsl = true;
|
||||||
|
|
||||||
json = new JSON();
|
json = new JSON();
|
||||||
@ -1533,7 +1533,7 @@ public class ApiClient {
|
|||||||
* @param key The key of the Header element
|
* @param key The key of the Header element
|
||||||
* @param file The file to add to the Header
|
* @param file The file to add to the Header
|
||||||
*/
|
*/
|
||||||
private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) {
|
protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) {
|
||||||
Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\"");
|
Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\"");
|
||||||
MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file));
|
MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file));
|
||||||
mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType));
|
mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType));
|
||||||
@ -1546,7 +1546,7 @@ public class ApiClient {
|
|||||||
* @param key The key of the Header element
|
* @param key The key of the Header element
|
||||||
* @param obj The complex object to add to the Header
|
* @param obj The complex object to add to the Header
|
||||||
*/
|
*/
|
||||||
private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) {
|
protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) {
|
||||||
RequestBody requestBody;
|
RequestBody requestBody;
|
||||||
if (obj instanceof String) {
|
if (obj instanceof String) {
|
||||||
requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain"));
|
requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain"));
|
||||||
@ -1568,7 +1568,7 @@ public class ApiClient {
|
|||||||
* Get network interceptor to add it to the httpClient to track download progress for
|
* Get network interceptor to add it to the httpClient to track download progress for
|
||||||
* async requests.
|
* async requests.
|
||||||
*/
|
*/
|
||||||
private Interceptor getProgressInterceptor() {
|
protected Interceptor getProgressInterceptor() {
|
||||||
return new Interceptor() {
|
return new Interceptor() {
|
||||||
@Override
|
@Override
|
||||||
public Response intercept(Interceptor.Chain chain) throws IOException {
|
public Response intercept(Interceptor.Chain chain) throws IOException {
|
||||||
@ -1589,7 +1589,7 @@ public class ApiClient {
|
|||||||
* Apply SSL related settings to httpClient according to the current values of
|
* Apply SSL related settings to httpClient according to the current values of
|
||||||
* verifyingSsl and sslCaCert.
|
* verifyingSsl and sslCaCert.
|
||||||
*/
|
*/
|
||||||
private void applySslSettings() {
|
protected void applySslSettings() {
|
||||||
try {
|
try {
|
||||||
TrustManager[] trustManagers;
|
TrustManager[] trustManagers;
|
||||||
HostnameVerifier hostnameVerifier;
|
HostnameVerifier hostnameVerifier;
|
||||||
@ -1651,7 +1651,7 @@ public class ApiClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException {
|
protected KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException {
|
||||||
try {
|
try {
|
||||||
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
|
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
|
||||||
keyStore.load(null, password);
|
keyStore.load(null, password);
|
||||||
@ -1668,7 +1668,7 @@ public class ApiClient {
|
|||||||
* @return The string representation of the HTTP request body
|
* @return The string representation of the HTTP request body
|
||||||
* @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string
|
* @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string
|
||||||
*/
|
*/
|
||||||
private String requestBodyToString(RequestBody requestBody) throws ApiException {
|
protected String requestBodyToString(RequestBody requestBody) throws ApiException {
|
||||||
if (requestBody != null) {
|
if (requestBody != null) {
|
||||||
try {
|
try {
|
||||||
final Buffer buffer = new Buffer();
|
final Buffer buffer = new Buffer();
|
||||||
|
@ -66,7 +66,7 @@ import org.openapitools.client.auth.OAuthFlow;
|
|||||||
*/
|
*/
|
||||||
public class ApiClient {
|
public class ApiClient {
|
||||||
|
|
||||||
private String basePath = "http://petstore.swagger.io:80/v2";
|
protected String basePath = "http://petstore.swagger.io:80/v2";
|
||||||
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>(Arrays.asList(
|
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>(Arrays.asList(
|
||||||
new ServerConfiguration(
|
new ServerConfiguration(
|
||||||
"http://petstore.swagger.io:80/v2",
|
"http://petstore.swagger.io:80/v2",
|
||||||
@ -76,26 +76,26 @@ public class ApiClient {
|
|||||||
));
|
));
|
||||||
protected Integer serverIndex = 0;
|
protected Integer serverIndex = 0;
|
||||||
protected Map<String, String> serverVariables = null;
|
protected Map<String, String> serverVariables = null;
|
||||||
private boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
protected Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||||
private Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
protected Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
||||||
private String tempFolderPath = null;
|
protected String tempFolderPath = null;
|
||||||
|
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
private DateFormat dateFormat;
|
protected DateFormat dateFormat;
|
||||||
private DateFormat datetimeFormat;
|
protected DateFormat datetimeFormat;
|
||||||
private boolean lenientDatetimeFormat;
|
protected boolean lenientDatetimeFormat;
|
||||||
private int dateLength;
|
protected int dateLength;
|
||||||
|
|
||||||
private InputStream sslCaCert;
|
protected InputStream sslCaCert;
|
||||||
private boolean verifyingSsl;
|
protected boolean verifyingSsl;
|
||||||
private KeyManager[] keyManagers;
|
protected KeyManager[] keyManagers;
|
||||||
|
|
||||||
private OkHttpClient httpClient;
|
protected OkHttpClient httpClient;
|
||||||
private JSON json;
|
protected JSON json;
|
||||||
|
|
||||||
private HttpLoggingInterceptor loggingInterceptor;
|
protected HttpLoggingInterceptor loggingInterceptor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Basic constructor for ApiClient
|
* Basic constructor for ApiClient
|
||||||
@ -201,11 +201,11 @@ public class ApiClient {
|
|||||||
authentications = Collections.unmodifiableMap(authentications);
|
authentications = Collections.unmodifiableMap(authentications);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initHttpClient() {
|
protected void initHttpClient() {
|
||||||
initHttpClient(Collections.<Interceptor>emptyList());
|
initHttpClient(Collections.<Interceptor>emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initHttpClient(List<Interceptor> interceptors) {
|
protected void initHttpClient(List<Interceptor> interceptors) {
|
||||||
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
||||||
builder.addNetworkInterceptor(getProgressInterceptor());
|
builder.addNetworkInterceptor(getProgressInterceptor());
|
||||||
for (Interceptor interceptor: interceptors) {
|
for (Interceptor interceptor: interceptors) {
|
||||||
@ -215,7 +215,7 @@ public class ApiClient {
|
|||||||
httpClient = builder.build();
|
httpClient = builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init() {
|
protected void init() {
|
||||||
verifyingSsl = true;
|
verifyingSsl = true;
|
||||||
|
|
||||||
json = new JSON();
|
json = new JSON();
|
||||||
@ -1536,7 +1536,7 @@ public class ApiClient {
|
|||||||
* @param key The key of the Header element
|
* @param key The key of the Header element
|
||||||
* @param file The file to add to the Header
|
* @param file The file to add to the Header
|
||||||
*/
|
*/
|
||||||
private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) {
|
protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) {
|
||||||
Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\"");
|
Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\"");
|
||||||
MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file));
|
MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file));
|
||||||
mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType));
|
mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType));
|
||||||
@ -1549,7 +1549,7 @@ public class ApiClient {
|
|||||||
* @param key The key of the Header element
|
* @param key The key of the Header element
|
||||||
* @param obj The complex object to add to the Header
|
* @param obj The complex object to add to the Header
|
||||||
*/
|
*/
|
||||||
private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) {
|
protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) {
|
||||||
RequestBody requestBody;
|
RequestBody requestBody;
|
||||||
if (obj instanceof String) {
|
if (obj instanceof String) {
|
||||||
requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain"));
|
requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain"));
|
||||||
@ -1571,7 +1571,7 @@ public class ApiClient {
|
|||||||
* Get network interceptor to add it to the httpClient to track download progress for
|
* Get network interceptor to add it to the httpClient to track download progress for
|
||||||
* async requests.
|
* async requests.
|
||||||
*/
|
*/
|
||||||
private Interceptor getProgressInterceptor() {
|
protected Interceptor getProgressInterceptor() {
|
||||||
return new Interceptor() {
|
return new Interceptor() {
|
||||||
@Override
|
@Override
|
||||||
public Response intercept(Interceptor.Chain chain) throws IOException {
|
public Response intercept(Interceptor.Chain chain) throws IOException {
|
||||||
@ -1592,7 +1592,7 @@ public class ApiClient {
|
|||||||
* Apply SSL related settings to httpClient according to the current values of
|
* Apply SSL related settings to httpClient according to the current values of
|
||||||
* verifyingSsl and sslCaCert.
|
* verifyingSsl and sslCaCert.
|
||||||
*/
|
*/
|
||||||
private void applySslSettings() {
|
protected void applySslSettings() {
|
||||||
try {
|
try {
|
||||||
TrustManager[] trustManagers;
|
TrustManager[] trustManagers;
|
||||||
HostnameVerifier hostnameVerifier;
|
HostnameVerifier hostnameVerifier;
|
||||||
@ -1654,7 +1654,7 @@ public class ApiClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException {
|
protected KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException {
|
||||||
try {
|
try {
|
||||||
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
|
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
|
||||||
keyStore.load(null, password);
|
keyStore.load(null, password);
|
||||||
@ -1671,7 +1671,7 @@ public class ApiClient {
|
|||||||
* @return The string representation of the HTTP request body
|
* @return The string representation of the HTTP request body
|
||||||
* @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string
|
* @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string
|
||||||
*/
|
*/
|
||||||
private String requestBodyToString(RequestBody requestBody) throws ApiException {
|
protected String requestBodyToString(RequestBody requestBody) throws ApiException {
|
||||||
if (requestBody != null) {
|
if (requestBody != null) {
|
||||||
try {
|
try {
|
||||||
final Buffer buffer = new Buffer();
|
final Buffer buffer = new Buffer();
|
||||||
|
@ -66,7 +66,7 @@ import org.openapitools.client.auth.OAuthFlow;
|
|||||||
*/
|
*/
|
||||||
public class ApiClient {
|
public class ApiClient {
|
||||||
|
|
||||||
private String basePath = "http://petstore.swagger.io/v2";
|
protected String basePath = "http://petstore.swagger.io/v2";
|
||||||
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>(Arrays.asList(
|
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>(Arrays.asList(
|
||||||
new ServerConfiguration(
|
new ServerConfiguration(
|
||||||
"http://petstore.swagger.io/v2",
|
"http://petstore.swagger.io/v2",
|
||||||
@ -76,26 +76,26 @@ public class ApiClient {
|
|||||||
));
|
));
|
||||||
protected Integer serverIndex = 0;
|
protected Integer serverIndex = 0;
|
||||||
protected Map<String, String> serverVariables = null;
|
protected Map<String, String> serverVariables = null;
|
||||||
private boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
protected Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||||
private Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
protected Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
||||||
private String tempFolderPath = null;
|
protected String tempFolderPath = null;
|
||||||
|
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
private DateFormat dateFormat;
|
protected DateFormat dateFormat;
|
||||||
private DateFormat datetimeFormat;
|
protected DateFormat datetimeFormat;
|
||||||
private boolean lenientDatetimeFormat;
|
protected boolean lenientDatetimeFormat;
|
||||||
private int dateLength;
|
protected int dateLength;
|
||||||
|
|
||||||
private InputStream sslCaCert;
|
protected InputStream sslCaCert;
|
||||||
private boolean verifyingSsl;
|
protected boolean verifyingSsl;
|
||||||
private KeyManager[] keyManagers;
|
protected KeyManager[] keyManagers;
|
||||||
|
|
||||||
private OkHttpClient httpClient;
|
protected OkHttpClient httpClient;
|
||||||
private JSON json;
|
protected JSON json;
|
||||||
|
|
||||||
private HttpLoggingInterceptor loggingInterceptor;
|
protected HttpLoggingInterceptor loggingInterceptor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Basic constructor for ApiClient
|
* Basic constructor for ApiClient
|
||||||
@ -195,11 +195,11 @@ public class ApiClient {
|
|||||||
authentications = Collections.unmodifiableMap(authentications);
|
authentications = Collections.unmodifiableMap(authentications);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initHttpClient() {
|
protected void initHttpClient() {
|
||||||
initHttpClient(Collections.<Interceptor>emptyList());
|
initHttpClient(Collections.<Interceptor>emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initHttpClient(List<Interceptor> interceptors) {
|
protected void initHttpClient(List<Interceptor> interceptors) {
|
||||||
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
||||||
builder.addNetworkInterceptor(getProgressInterceptor());
|
builder.addNetworkInterceptor(getProgressInterceptor());
|
||||||
for (Interceptor interceptor: interceptors) {
|
for (Interceptor interceptor: interceptors) {
|
||||||
@ -209,7 +209,7 @@ public class ApiClient {
|
|||||||
httpClient = builder.build();
|
httpClient = builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init() {
|
protected void init() {
|
||||||
verifyingSsl = true;
|
verifyingSsl = true;
|
||||||
|
|
||||||
json = new JSON();
|
json = new JSON();
|
||||||
@ -1530,7 +1530,7 @@ public class ApiClient {
|
|||||||
* @param key The key of the Header element
|
* @param key The key of the Header element
|
||||||
* @param file The file to add to the Header
|
* @param file The file to add to the Header
|
||||||
*/
|
*/
|
||||||
private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) {
|
protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) {
|
||||||
Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\"");
|
Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\"");
|
||||||
MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file));
|
MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file));
|
||||||
mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType));
|
mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType));
|
||||||
@ -1543,7 +1543,7 @@ public class ApiClient {
|
|||||||
* @param key The key of the Header element
|
* @param key The key of the Header element
|
||||||
* @param obj The complex object to add to the Header
|
* @param obj The complex object to add to the Header
|
||||||
*/
|
*/
|
||||||
private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) {
|
protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) {
|
||||||
RequestBody requestBody;
|
RequestBody requestBody;
|
||||||
if (obj instanceof String) {
|
if (obj instanceof String) {
|
||||||
requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain"));
|
requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain"));
|
||||||
@ -1565,7 +1565,7 @@ public class ApiClient {
|
|||||||
* Get network interceptor to add it to the httpClient to track download progress for
|
* Get network interceptor to add it to the httpClient to track download progress for
|
||||||
* async requests.
|
* async requests.
|
||||||
*/
|
*/
|
||||||
private Interceptor getProgressInterceptor() {
|
protected Interceptor getProgressInterceptor() {
|
||||||
return new Interceptor() {
|
return new Interceptor() {
|
||||||
@Override
|
@Override
|
||||||
public Response intercept(Interceptor.Chain chain) throws IOException {
|
public Response intercept(Interceptor.Chain chain) throws IOException {
|
||||||
@ -1586,7 +1586,7 @@ public class ApiClient {
|
|||||||
* Apply SSL related settings to httpClient according to the current values of
|
* Apply SSL related settings to httpClient according to the current values of
|
||||||
* verifyingSsl and sslCaCert.
|
* verifyingSsl and sslCaCert.
|
||||||
*/
|
*/
|
||||||
private void applySslSettings() {
|
protected void applySslSettings() {
|
||||||
try {
|
try {
|
||||||
TrustManager[] trustManagers;
|
TrustManager[] trustManagers;
|
||||||
HostnameVerifier hostnameVerifier;
|
HostnameVerifier hostnameVerifier;
|
||||||
@ -1648,7 +1648,7 @@ public class ApiClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException {
|
protected KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException {
|
||||||
try {
|
try {
|
||||||
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
|
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
|
||||||
keyStore.load(null, password);
|
keyStore.load(null, password);
|
||||||
@ -1665,7 +1665,7 @@ public class ApiClient {
|
|||||||
* @return The string representation of the HTTP request body
|
* @return The string representation of the HTTP request body
|
||||||
* @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string
|
* @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string
|
||||||
*/
|
*/
|
||||||
private String requestBodyToString(RequestBody requestBody) throws ApiException {
|
protected String requestBodyToString(RequestBody requestBody) throws ApiException {
|
||||||
if (requestBody != null) {
|
if (requestBody != null) {
|
||||||
try {
|
try {
|
||||||
final Buffer buffer = new Buffer();
|
final Buffer buffer = new Buffer();
|
||||||
|
@ -66,7 +66,7 @@ import org.openapitools.client.auth.OAuthFlow;
|
|||||||
*/
|
*/
|
||||||
public class ApiClient {
|
public class ApiClient {
|
||||||
|
|
||||||
private String basePath = "http://petstore.swagger.io/v2";
|
protected String basePath = "http://petstore.swagger.io/v2";
|
||||||
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>(Arrays.asList(
|
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>(Arrays.asList(
|
||||||
new ServerConfiguration(
|
new ServerConfiguration(
|
||||||
"http://petstore.swagger.io/v2",
|
"http://petstore.swagger.io/v2",
|
||||||
@ -76,26 +76,26 @@ public class ApiClient {
|
|||||||
));
|
));
|
||||||
protected Integer serverIndex = 0;
|
protected Integer serverIndex = 0;
|
||||||
protected Map<String, String> serverVariables = null;
|
protected Map<String, String> serverVariables = null;
|
||||||
private boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
protected Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||||
private Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
protected Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
||||||
private String tempFolderPath = null;
|
protected String tempFolderPath = null;
|
||||||
|
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
private DateFormat dateFormat;
|
protected DateFormat dateFormat;
|
||||||
private DateFormat datetimeFormat;
|
protected DateFormat datetimeFormat;
|
||||||
private boolean lenientDatetimeFormat;
|
protected boolean lenientDatetimeFormat;
|
||||||
private int dateLength;
|
protected int dateLength;
|
||||||
|
|
||||||
private InputStream sslCaCert;
|
protected InputStream sslCaCert;
|
||||||
private boolean verifyingSsl;
|
protected boolean verifyingSsl;
|
||||||
private KeyManager[] keyManagers;
|
protected KeyManager[] keyManagers;
|
||||||
|
|
||||||
private OkHttpClient httpClient;
|
protected OkHttpClient httpClient;
|
||||||
private JSON json;
|
protected JSON json;
|
||||||
|
|
||||||
private HttpLoggingInterceptor loggingInterceptor;
|
protected HttpLoggingInterceptor loggingInterceptor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Basic constructor for ApiClient
|
* Basic constructor for ApiClient
|
||||||
@ -195,11 +195,11 @@ public class ApiClient {
|
|||||||
authentications = Collections.unmodifiableMap(authentications);
|
authentications = Collections.unmodifiableMap(authentications);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initHttpClient() {
|
protected void initHttpClient() {
|
||||||
initHttpClient(Collections.<Interceptor>emptyList());
|
initHttpClient(Collections.<Interceptor>emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initHttpClient(List<Interceptor> interceptors) {
|
protected void initHttpClient(List<Interceptor> interceptors) {
|
||||||
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
||||||
builder.addNetworkInterceptor(getProgressInterceptor());
|
builder.addNetworkInterceptor(getProgressInterceptor());
|
||||||
for (Interceptor interceptor: interceptors) {
|
for (Interceptor interceptor: interceptors) {
|
||||||
@ -209,7 +209,7 @@ public class ApiClient {
|
|||||||
httpClient = builder.build();
|
httpClient = builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init() {
|
protected void init() {
|
||||||
verifyingSsl = true;
|
verifyingSsl = true;
|
||||||
|
|
||||||
json = new JSON();
|
json = new JSON();
|
||||||
@ -1530,7 +1530,7 @@ public class ApiClient {
|
|||||||
* @param key The key of the Header element
|
* @param key The key of the Header element
|
||||||
* @param file The file to add to the Header
|
* @param file The file to add to the Header
|
||||||
*/
|
*/
|
||||||
private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) {
|
protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) {
|
||||||
Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\"");
|
Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\"");
|
||||||
MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file));
|
MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file));
|
||||||
mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType));
|
mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType));
|
||||||
@ -1543,7 +1543,7 @@ public class ApiClient {
|
|||||||
* @param key The key of the Header element
|
* @param key The key of the Header element
|
||||||
* @param obj The complex object to add to the Header
|
* @param obj The complex object to add to the Header
|
||||||
*/
|
*/
|
||||||
private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) {
|
protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) {
|
||||||
RequestBody requestBody;
|
RequestBody requestBody;
|
||||||
if (obj instanceof String) {
|
if (obj instanceof String) {
|
||||||
requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain"));
|
requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain"));
|
||||||
@ -1565,7 +1565,7 @@ public class ApiClient {
|
|||||||
* Get network interceptor to add it to the httpClient to track download progress for
|
* Get network interceptor to add it to the httpClient to track download progress for
|
||||||
* async requests.
|
* async requests.
|
||||||
*/
|
*/
|
||||||
private Interceptor getProgressInterceptor() {
|
protected Interceptor getProgressInterceptor() {
|
||||||
return new Interceptor() {
|
return new Interceptor() {
|
||||||
@Override
|
@Override
|
||||||
public Response intercept(Interceptor.Chain chain) throws IOException {
|
public Response intercept(Interceptor.Chain chain) throws IOException {
|
||||||
@ -1586,7 +1586,7 @@ public class ApiClient {
|
|||||||
* Apply SSL related settings to httpClient according to the current values of
|
* Apply SSL related settings to httpClient according to the current values of
|
||||||
* verifyingSsl and sslCaCert.
|
* verifyingSsl and sslCaCert.
|
||||||
*/
|
*/
|
||||||
private void applySslSettings() {
|
protected void applySslSettings() {
|
||||||
try {
|
try {
|
||||||
TrustManager[] trustManagers;
|
TrustManager[] trustManagers;
|
||||||
HostnameVerifier hostnameVerifier;
|
HostnameVerifier hostnameVerifier;
|
||||||
@ -1648,7 +1648,7 @@ public class ApiClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException {
|
protected KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException {
|
||||||
try {
|
try {
|
||||||
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
|
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
|
||||||
keyStore.load(null, password);
|
keyStore.load(null, password);
|
||||||
@ -1665,7 +1665,7 @@ public class ApiClient {
|
|||||||
* @return The string representation of the HTTP request body
|
* @return The string representation of the HTTP request body
|
||||||
* @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string
|
* @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string
|
||||||
*/
|
*/
|
||||||
private String requestBodyToString(RequestBody requestBody) throws ApiException {
|
protected String requestBodyToString(RequestBody requestBody) throws ApiException {
|
||||||
if (requestBody != null) {
|
if (requestBody != null) {
|
||||||
try {
|
try {
|
||||||
final Buffer buffer = new Buffer();
|
final Buffer buffer = new Buffer();
|
||||||
|
@ -66,7 +66,7 @@ import org.openapitools.client.auth.OAuthFlow;
|
|||||||
*/
|
*/
|
||||||
public class ApiClient {
|
public class ApiClient {
|
||||||
|
|
||||||
private String basePath = "http://petstore.swagger.io:80/v2";
|
protected String basePath = "http://petstore.swagger.io:80/v2";
|
||||||
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>(Arrays.asList(
|
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>(Arrays.asList(
|
||||||
new ServerConfiguration(
|
new ServerConfiguration(
|
||||||
"http://{server}.swagger.io:{port}/v2",
|
"http://{server}.swagger.io:{port}/v2",
|
||||||
@ -119,26 +119,26 @@ public class ApiClient {
|
|||||||
));
|
));
|
||||||
protected Integer serverIndex = 0;
|
protected Integer serverIndex = 0;
|
||||||
protected Map<String, String> serverVariables = null;
|
protected Map<String, String> serverVariables = null;
|
||||||
private boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
protected Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||||
private Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
protected Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
||||||
private String tempFolderPath = null;
|
protected String tempFolderPath = null;
|
||||||
|
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
private DateFormat dateFormat;
|
protected DateFormat dateFormat;
|
||||||
private DateFormat datetimeFormat;
|
protected DateFormat datetimeFormat;
|
||||||
private boolean lenientDatetimeFormat;
|
protected boolean lenientDatetimeFormat;
|
||||||
private int dateLength;
|
protected int dateLength;
|
||||||
|
|
||||||
private InputStream sslCaCert;
|
protected InputStream sslCaCert;
|
||||||
private boolean verifyingSsl;
|
protected boolean verifyingSsl;
|
||||||
private KeyManager[] keyManagers;
|
protected KeyManager[] keyManagers;
|
||||||
|
|
||||||
private OkHttpClient httpClient;
|
protected OkHttpClient httpClient;
|
||||||
private JSON json;
|
protected JSON json;
|
||||||
|
|
||||||
private HttpLoggingInterceptor loggingInterceptor;
|
protected HttpLoggingInterceptor loggingInterceptor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Basic constructor for ApiClient
|
* Basic constructor for ApiClient
|
||||||
@ -247,11 +247,11 @@ public class ApiClient {
|
|||||||
authentications = Collections.unmodifiableMap(authentications);
|
authentications = Collections.unmodifiableMap(authentications);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initHttpClient() {
|
protected void initHttpClient() {
|
||||||
initHttpClient(Collections.<Interceptor>emptyList());
|
initHttpClient(Collections.<Interceptor>emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initHttpClient(List<Interceptor> interceptors) {
|
protected void initHttpClient(List<Interceptor> interceptors) {
|
||||||
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
||||||
builder.addNetworkInterceptor(getProgressInterceptor());
|
builder.addNetworkInterceptor(getProgressInterceptor());
|
||||||
for (Interceptor interceptor: interceptors) {
|
for (Interceptor interceptor: interceptors) {
|
||||||
@ -261,7 +261,7 @@ public class ApiClient {
|
|||||||
httpClient = builder.build();
|
httpClient = builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init() {
|
protected void init() {
|
||||||
verifyingSsl = true;
|
verifyingSsl = true;
|
||||||
|
|
||||||
json = new JSON();
|
json = new JSON();
|
||||||
@ -1604,7 +1604,7 @@ public class ApiClient {
|
|||||||
* @param key The key of the Header element
|
* @param key The key of the Header element
|
||||||
* @param file The file to add to the Header
|
* @param file The file to add to the Header
|
||||||
*/
|
*/
|
||||||
private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) {
|
protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) {
|
||||||
Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\"");
|
Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\"");
|
||||||
MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file));
|
MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file));
|
||||||
mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType));
|
mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType));
|
||||||
@ -1617,7 +1617,7 @@ public class ApiClient {
|
|||||||
* @param key The key of the Header element
|
* @param key The key of the Header element
|
||||||
* @param obj The complex object to add to the Header
|
* @param obj The complex object to add to the Header
|
||||||
*/
|
*/
|
||||||
private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) {
|
protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) {
|
||||||
RequestBody requestBody;
|
RequestBody requestBody;
|
||||||
if (obj instanceof String) {
|
if (obj instanceof String) {
|
||||||
requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain"));
|
requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain"));
|
||||||
@ -1639,7 +1639,7 @@ public class ApiClient {
|
|||||||
* Get network interceptor to add it to the httpClient to track download progress for
|
* Get network interceptor to add it to the httpClient to track download progress for
|
||||||
* async requests.
|
* async requests.
|
||||||
*/
|
*/
|
||||||
private Interceptor getProgressInterceptor() {
|
protected Interceptor getProgressInterceptor() {
|
||||||
return new Interceptor() {
|
return new Interceptor() {
|
||||||
@Override
|
@Override
|
||||||
public Response intercept(Interceptor.Chain chain) throws IOException {
|
public Response intercept(Interceptor.Chain chain) throws IOException {
|
||||||
@ -1660,7 +1660,7 @@ public class ApiClient {
|
|||||||
* Apply SSL related settings to httpClient according to the current values of
|
* Apply SSL related settings to httpClient according to the current values of
|
||||||
* verifyingSsl and sslCaCert.
|
* verifyingSsl and sslCaCert.
|
||||||
*/
|
*/
|
||||||
private void applySslSettings() {
|
protected void applySslSettings() {
|
||||||
try {
|
try {
|
||||||
TrustManager[] trustManagers;
|
TrustManager[] trustManagers;
|
||||||
HostnameVerifier hostnameVerifier;
|
HostnameVerifier hostnameVerifier;
|
||||||
@ -1722,7 +1722,7 @@ public class ApiClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException {
|
protected KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException {
|
||||||
try {
|
try {
|
||||||
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
|
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
|
||||||
keyStore.load(null, password);
|
keyStore.load(null, password);
|
||||||
@ -1739,7 +1739,7 @@ public class ApiClient {
|
|||||||
* @return The string representation of the HTTP request body
|
* @return The string representation of the HTTP request body
|
||||||
* @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string
|
* @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string
|
||||||
*/
|
*/
|
||||||
private String requestBodyToString(RequestBody requestBody) throws ApiException {
|
protected String requestBodyToString(RequestBody requestBody) throws ApiException {
|
||||||
if (requestBody != null) {
|
if (requestBody != null) {
|
||||||
try {
|
try {
|
||||||
final Buffer buffer = new Buffer();
|
final Buffer buffer = new Buffer();
|
||||||
|
@ -26,9 +26,9 @@ import static org.openapitools.client.JacksonObjectMapper.jackson;
|
|||||||
public class ApiClient {
|
public class ApiClient {
|
||||||
public static final String BASE_URI = "http://petstore.swagger.io:80/v2";
|
public static final String BASE_URI = "http://petstore.swagger.io:80/v2";
|
||||||
|
|
||||||
private final Config config;
|
protected final Config config;
|
||||||
|
|
||||||
private ApiClient(Config config) {
|
protected ApiClient(Config config) {
|
||||||
this.config = config;
|
this.config = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ public class ApiClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class Config {
|
public static class Config {
|
||||||
private Supplier<RequestSpecBuilder> reqSpecSupplier = () -> new RequestSpecBuilder()
|
protected Supplier<RequestSpecBuilder> reqSpecSupplier = () -> new RequestSpecBuilder()
|
||||||
.setBaseUri(BASE_URI)
|
.setBaseUri(BASE_URI)
|
||||||
.setConfig(config().objectMapperConfig(objectMapperConfig().defaultObjectMapper(jackson())));
|
.setConfig(config().objectMapperConfig(objectMapperConfig().defaultObjectMapper(jackson())));
|
||||||
|
|
||||||
|
@ -26,9 +26,9 @@ import static org.openapitools.client.GsonObjectMapper.gson;
|
|||||||
public class ApiClient {
|
public class ApiClient {
|
||||||
public static final String BASE_URI = "http://petstore.swagger.io:80/v2";
|
public static final String BASE_URI = "http://petstore.swagger.io:80/v2";
|
||||||
|
|
||||||
private final Config config;
|
protected final Config config;
|
||||||
|
|
||||||
private ApiClient(Config config) {
|
protected ApiClient(Config config) {
|
||||||
this.config = config;
|
this.config = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ public class ApiClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class Config {
|
public static class Config {
|
||||||
private Supplier<RequestSpecBuilder> reqSpecSupplier = () -> new RequestSpecBuilder()
|
protected Supplier<RequestSpecBuilder> reqSpecSupplier = () -> new RequestSpecBuilder()
|
||||||
.setBaseUri(BASE_URI)
|
.setBaseUri(BASE_URI)
|
||||||
.setConfig(config().objectMapperConfig(objectMapperConfig().defaultObjectMapper(gson())));
|
.setConfig(config().objectMapperConfig(objectMapperConfig().defaultObjectMapper(gson())));
|
||||||
|
|
||||||
|
@ -62,26 +62,26 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
public enum CollectionFormat {
|
public enum CollectionFormat {
|
||||||
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
||||||
|
|
||||||
private final String separator;
|
protected final String separator;
|
||||||
CollectionFormat(String separator) {
|
CollectionFormat(String separator) {
|
||||||
this.separator = separator;
|
this.separator = separator;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String collectionToString(Collection<?> collection) {
|
protected String collectionToString(Collection<?> collection) {
|
||||||
return StringUtils.collectionToDelimitedString(collection, separator);
|
return StringUtils.collectionToDelimitedString(collection, separator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final HttpHeaders defaultHeaders = new HttpHeaders();
|
protected final HttpHeaders defaultHeaders = new HttpHeaders();
|
||||||
private final MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<>();
|
protected final MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<>();
|
||||||
|
|
||||||
private String basePath = "http://localhost";
|
protected String basePath = "http://localhost";
|
||||||
|
|
||||||
private final RestClient restClient;
|
protected final RestClient restClient;
|
||||||
private final DateFormat dateFormat;
|
protected final DateFormat dateFormat;
|
||||||
private final ObjectMapper objectMapper;
|
protected final ObjectMapper objectMapper;
|
||||||
|
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
|
|
||||||
public ApiClient() {
|
public ApiClient() {
|
||||||
@ -103,7 +103,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
this.init();
|
this.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
private ApiClient(RestClient restClient, DateFormat format) {
|
protected ApiClient(RestClient restClient, DateFormat format) {
|
||||||
this(restClient, createDefaultObjectMapper(format), format);
|
this(restClient, createDefaultObjectMapper(format), format);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -578,7 +578,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
* @param uriParams The path parameters
|
* @param uriParams The path parameters
|
||||||
* return templatized query string
|
* return templatized query string
|
||||||
*/
|
*/
|
||||||
private String generateQueryUri(MultiValueMap<String, String> queryParams, Map<String, Object> uriParams) {
|
protected String generateQueryUri(MultiValueMap<String, String> queryParams, Map<String, Object> uriParams) {
|
||||||
StringBuilder queryBuilder = new StringBuilder();
|
StringBuilder queryBuilder = new StringBuilder();
|
||||||
queryParams.forEach((name, values) -> {
|
queryParams.forEach((name, values) -> {
|
||||||
if (CollectionUtils.isEmpty(values)) {
|
if (CollectionUtils.isEmpty(values)) {
|
||||||
@ -604,7 +604,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return queryBuilder.toString();
|
return queryBuilder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private RestClient.RequestBodySpec prepareRequest(String path, HttpMethod method, Map<String, Object> pathParams,
|
protected RestClient.RequestBodySpec prepareRequest(String path, HttpMethod method, Map<String, Object> pathParams,
|
||||||
MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams,
|
MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams,
|
||||||
MultiValueMap<String, String> cookieParams, MultiValueMap<String, Object> formParams, List<MediaType> accept,
|
MultiValueMap<String, String> cookieParams, MultiValueMap<String, Object> formParams, List<MediaType> accept,
|
||||||
MediaType contentType, String[] authNames) {
|
MediaType contentType, String[] authNames) {
|
||||||
@ -680,7 +680,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
* @param cookies map all cookies
|
* @param cookies map all cookies
|
||||||
* @return header string for cookies.
|
* @return header string for cookies.
|
||||||
*/
|
*/
|
||||||
private String buildCookieHeader(MultiValueMap<String, String> cookies) {
|
protected String buildCookieHeader(MultiValueMap<String, String> cookies) {
|
||||||
final StringBuilder cookieValue = new StringBuilder();
|
final StringBuilder cookieValue = new StringBuilder();
|
||||||
String delimiter = "";
|
String delimiter = "";
|
||||||
for (final Map.Entry<String, List<String>> entry : cookies.entrySet()) {
|
for (final Map.Entry<String, List<String>> entry : cookies.entrySet()) {
|
||||||
|
@ -63,26 +63,26 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
public enum CollectionFormat {
|
public enum CollectionFormat {
|
||||||
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
||||||
|
|
||||||
private final String separator;
|
protected final String separator;
|
||||||
CollectionFormat(String separator) {
|
CollectionFormat(String separator) {
|
||||||
this.separator = separator;
|
this.separator = separator;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String collectionToString(Collection<?> collection) {
|
protected String collectionToString(Collection<?> collection) {
|
||||||
return StringUtils.collectionToDelimitedString(collection, separator);
|
return StringUtils.collectionToDelimitedString(collection, separator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final HttpHeaders defaultHeaders = new HttpHeaders();
|
protected final HttpHeaders defaultHeaders = new HttpHeaders();
|
||||||
private final MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<>();
|
protected final MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<>();
|
||||||
|
|
||||||
private String basePath = "http://petstore.swagger.io:80/v2";
|
protected String basePath = "http://petstore.swagger.io:80/v2";
|
||||||
|
|
||||||
private final RestClient restClient;
|
protected final RestClient restClient;
|
||||||
private final DateFormat dateFormat;
|
protected final DateFormat dateFormat;
|
||||||
private final ObjectMapper objectMapper;
|
protected final ObjectMapper objectMapper;
|
||||||
|
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
|
|
||||||
public ApiClient() {
|
public ApiClient() {
|
||||||
@ -104,7 +104,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
this.init();
|
this.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
private ApiClient(RestClient restClient, DateFormat format) {
|
protected ApiClient(RestClient restClient, DateFormat format) {
|
||||||
this(restClient, createDefaultObjectMapper(format), format);
|
this(restClient, createDefaultObjectMapper(format), format);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -598,7 +598,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
* @param uriParams The path parameters
|
* @param uriParams The path parameters
|
||||||
* return templatized query string
|
* return templatized query string
|
||||||
*/
|
*/
|
||||||
private String generateQueryUri(MultiValueMap<String, String> queryParams, Map<String, Object> uriParams) {
|
protected String generateQueryUri(MultiValueMap<String, String> queryParams, Map<String, Object> uriParams) {
|
||||||
StringBuilder queryBuilder = new StringBuilder();
|
StringBuilder queryBuilder = new StringBuilder();
|
||||||
queryParams.forEach((name, values) -> {
|
queryParams.forEach((name, values) -> {
|
||||||
if (CollectionUtils.isEmpty(values)) {
|
if (CollectionUtils.isEmpty(values)) {
|
||||||
@ -624,7 +624,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return queryBuilder.toString();
|
return queryBuilder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private RestClient.RequestBodySpec prepareRequest(String path, HttpMethod method, Map<String, Object> pathParams,
|
protected RestClient.RequestBodySpec prepareRequest(String path, HttpMethod method, Map<String, Object> pathParams,
|
||||||
MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams,
|
MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams,
|
||||||
MultiValueMap<String, String> cookieParams, MultiValueMap<String, Object> formParams, List<MediaType> accept,
|
MultiValueMap<String, String> cookieParams, MultiValueMap<String, Object> formParams, List<MediaType> accept,
|
||||||
MediaType contentType, String[] authNames) {
|
MediaType contentType, String[] authNames) {
|
||||||
@ -700,7 +700,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
* @param cookies map all cookies
|
* @param cookies map all cookies
|
||||||
* @return header string for cookies.
|
* @return header string for cookies.
|
||||||
*/
|
*/
|
||||||
private String buildCookieHeader(MultiValueMap<String, String> cookies) {
|
protected String buildCookieHeader(MultiValueMap<String, String> cookies) {
|
||||||
final StringBuilder cookieValue = new StringBuilder();
|
final StringBuilder cookieValue = new StringBuilder();
|
||||||
String delimiter = "";
|
String delimiter = "";
|
||||||
for (final Map.Entry<String, List<String>> entry : cookies.entrySet()) {
|
for (final Map.Entry<String, List<String>> entry : cookies.entrySet()) {
|
||||||
|
@ -63,26 +63,26 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
public enum CollectionFormat {
|
public enum CollectionFormat {
|
||||||
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
||||||
|
|
||||||
private final String separator;
|
protected final String separator;
|
||||||
CollectionFormat(String separator) {
|
CollectionFormat(String separator) {
|
||||||
this.separator = separator;
|
this.separator = separator;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String collectionToString(Collection<?> collection) {
|
protected String collectionToString(Collection<?> collection) {
|
||||||
return StringUtils.collectionToDelimitedString(collection, separator);
|
return StringUtils.collectionToDelimitedString(collection, separator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final HttpHeaders defaultHeaders = new HttpHeaders();
|
protected final HttpHeaders defaultHeaders = new HttpHeaders();
|
||||||
private final MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<>();
|
protected final MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<>();
|
||||||
|
|
||||||
private String basePath = "http://petstore.swagger.io:80/v2";
|
protected String basePath = "http://petstore.swagger.io:80/v2";
|
||||||
|
|
||||||
private final RestClient restClient;
|
protected final RestClient restClient;
|
||||||
private final DateFormat dateFormat;
|
protected final DateFormat dateFormat;
|
||||||
private final ObjectMapper objectMapper;
|
protected final ObjectMapper objectMapper;
|
||||||
|
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
|
|
||||||
public ApiClient() {
|
public ApiClient() {
|
||||||
@ -104,7 +104,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
this.init();
|
this.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
private ApiClient(RestClient restClient, DateFormat format) {
|
protected ApiClient(RestClient restClient, DateFormat format) {
|
||||||
this(restClient, createDefaultObjectMapper(format), format);
|
this(restClient, createDefaultObjectMapper(format), format);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -598,7 +598,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
* @param uriParams The path parameters
|
* @param uriParams The path parameters
|
||||||
* return templatized query string
|
* return templatized query string
|
||||||
*/
|
*/
|
||||||
private String generateQueryUri(MultiValueMap<String, String> queryParams, Map<String, Object> uriParams) {
|
protected String generateQueryUri(MultiValueMap<String, String> queryParams, Map<String, Object> uriParams) {
|
||||||
StringBuilder queryBuilder = new StringBuilder();
|
StringBuilder queryBuilder = new StringBuilder();
|
||||||
queryParams.forEach((name, values) -> {
|
queryParams.forEach((name, values) -> {
|
||||||
if (CollectionUtils.isEmpty(values)) {
|
if (CollectionUtils.isEmpty(values)) {
|
||||||
@ -624,7 +624,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return queryBuilder.toString();
|
return queryBuilder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private RestClient.RequestBodySpec prepareRequest(String path, HttpMethod method, Map<String, Object> pathParams,
|
protected RestClient.RequestBodySpec prepareRequest(String path, HttpMethod method, Map<String, Object> pathParams,
|
||||||
MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams,
|
MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams,
|
||||||
MultiValueMap<String, String> cookieParams, MultiValueMap<String, Object> formParams, List<MediaType> accept,
|
MultiValueMap<String, String> cookieParams, MultiValueMap<String, Object> formParams, List<MediaType> accept,
|
||||||
MediaType contentType, String[] authNames) {
|
MediaType contentType, String[] authNames) {
|
||||||
@ -700,7 +700,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
* @param cookies map all cookies
|
* @param cookies map all cookies
|
||||||
* @return header string for cookies.
|
* @return header string for cookies.
|
||||||
*/
|
*/
|
||||||
private String buildCookieHeader(MultiValueMap<String, String> cookies) {
|
protected String buildCookieHeader(MultiValueMap<String, String> cookies) {
|
||||||
final StringBuilder cookieValue = new StringBuilder();
|
final StringBuilder cookieValue = new StringBuilder();
|
||||||
String delimiter = "";
|
String delimiter = "";
|
||||||
for (final Map.Entry<String, List<String>> entry : cookies.entrySet()) {
|
for (final Map.Entry<String, List<String>> entry : cookies.entrySet()) {
|
||||||
|
@ -63,26 +63,26 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
public enum CollectionFormat {
|
public enum CollectionFormat {
|
||||||
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
||||||
|
|
||||||
private final String separator;
|
protected final String separator;
|
||||||
CollectionFormat(String separator) {
|
CollectionFormat(String separator) {
|
||||||
this.separator = separator;
|
this.separator = separator;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String collectionToString(Collection<?> collection) {
|
protected String collectionToString(Collection<?> collection) {
|
||||||
return StringUtils.collectionToDelimitedString(collection, separator);
|
return StringUtils.collectionToDelimitedString(collection, separator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final HttpHeaders defaultHeaders = new HttpHeaders();
|
protected final HttpHeaders defaultHeaders = new HttpHeaders();
|
||||||
private final MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<>();
|
protected final MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<>();
|
||||||
|
|
||||||
private String basePath = "http://petstore.swagger.io:80/v2";
|
protected String basePath = "http://petstore.swagger.io:80/v2";
|
||||||
|
|
||||||
private final RestClient restClient;
|
protected final RestClient restClient;
|
||||||
private final DateFormat dateFormat;
|
protected final DateFormat dateFormat;
|
||||||
private final ObjectMapper objectMapper;
|
protected final ObjectMapper objectMapper;
|
||||||
|
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
|
|
||||||
public ApiClient() {
|
public ApiClient() {
|
||||||
@ -104,7 +104,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
this.init();
|
this.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
private ApiClient(RestClient restClient, DateFormat format) {
|
protected ApiClient(RestClient restClient, DateFormat format) {
|
||||||
this(restClient, createDefaultObjectMapper(format), format);
|
this(restClient, createDefaultObjectMapper(format), format);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -598,7 +598,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
* @param uriParams The path parameters
|
* @param uriParams The path parameters
|
||||||
* return templatized query string
|
* return templatized query string
|
||||||
*/
|
*/
|
||||||
private String generateQueryUri(MultiValueMap<String, String> queryParams, Map<String, Object> uriParams) {
|
protected String generateQueryUri(MultiValueMap<String, String> queryParams, Map<String, Object> uriParams) {
|
||||||
StringBuilder queryBuilder = new StringBuilder();
|
StringBuilder queryBuilder = new StringBuilder();
|
||||||
queryParams.forEach((name, values) -> {
|
queryParams.forEach((name, values) -> {
|
||||||
if (CollectionUtils.isEmpty(values)) {
|
if (CollectionUtils.isEmpty(values)) {
|
||||||
@ -624,7 +624,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return queryBuilder.toString();
|
return queryBuilder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private RestClient.RequestBodySpec prepareRequest(String path, HttpMethod method, Map<String, Object> pathParams,
|
protected RestClient.RequestBodySpec prepareRequest(String path, HttpMethod method, Map<String, Object> pathParams,
|
||||||
MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams,
|
MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams,
|
||||||
MultiValueMap<String, String> cookieParams, MultiValueMap<String, Object> formParams, List<MediaType> accept,
|
MultiValueMap<String, String> cookieParams, MultiValueMap<String, Object> formParams, List<MediaType> accept,
|
||||||
MediaType contentType, String[] authNames) {
|
MediaType contentType, String[] authNames) {
|
||||||
@ -700,7 +700,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
* @param cookies map all cookies
|
* @param cookies map all cookies
|
||||||
* @return header string for cookies.
|
* @return header string for cookies.
|
||||||
*/
|
*/
|
||||||
private String buildCookieHeader(MultiValueMap<String, String> cookies) {
|
protected String buildCookieHeader(MultiValueMap<String, String> cookies) {
|
||||||
final StringBuilder cookieValue = new StringBuilder();
|
final StringBuilder cookieValue = new StringBuilder();
|
||||||
String delimiter = "";
|
String delimiter = "";
|
||||||
for (final Map.Entry<String, List<String>> entry : cookies.entrySet()) {
|
for (final Map.Entry<String, List<String>> entry : cookies.entrySet()) {
|
||||||
|
@ -63,26 +63,26 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
public enum CollectionFormat {
|
public enum CollectionFormat {
|
||||||
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
||||||
|
|
||||||
private final String separator;
|
protected final String separator;
|
||||||
CollectionFormat(String separator) {
|
CollectionFormat(String separator) {
|
||||||
this.separator = separator;
|
this.separator = separator;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String collectionToString(Collection<?> collection) {
|
protected String collectionToString(Collection<?> collection) {
|
||||||
return StringUtils.collectionToDelimitedString(collection, separator);
|
return StringUtils.collectionToDelimitedString(collection, separator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final HttpHeaders defaultHeaders = new HttpHeaders();
|
protected final HttpHeaders defaultHeaders = new HttpHeaders();
|
||||||
private final MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<>();
|
protected final MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<>();
|
||||||
|
|
||||||
private String basePath = "http://petstore.swagger.io:80/v2";
|
protected String basePath = "http://petstore.swagger.io:80/v2";
|
||||||
|
|
||||||
private final RestClient restClient;
|
protected final RestClient restClient;
|
||||||
private final DateFormat dateFormat;
|
protected final DateFormat dateFormat;
|
||||||
private final ObjectMapper objectMapper;
|
protected final ObjectMapper objectMapper;
|
||||||
|
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
|
|
||||||
public ApiClient() {
|
public ApiClient() {
|
||||||
@ -104,7 +104,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
this.init();
|
this.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
private ApiClient(RestClient restClient, DateFormat format) {
|
protected ApiClient(RestClient restClient, DateFormat format) {
|
||||||
this(restClient, createDefaultObjectMapper(format), format);
|
this(restClient, createDefaultObjectMapper(format), format);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -598,7 +598,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
* @param uriParams The path parameters
|
* @param uriParams The path parameters
|
||||||
* return templatized query string
|
* return templatized query string
|
||||||
*/
|
*/
|
||||||
private String generateQueryUri(MultiValueMap<String, String> queryParams, Map<String, Object> uriParams) {
|
protected String generateQueryUri(MultiValueMap<String, String> queryParams, Map<String, Object> uriParams) {
|
||||||
StringBuilder queryBuilder = new StringBuilder();
|
StringBuilder queryBuilder = new StringBuilder();
|
||||||
queryParams.forEach((name, values) -> {
|
queryParams.forEach((name, values) -> {
|
||||||
if (CollectionUtils.isEmpty(values)) {
|
if (CollectionUtils.isEmpty(values)) {
|
||||||
@ -624,7 +624,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return queryBuilder.toString();
|
return queryBuilder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private RestClient.RequestBodySpec prepareRequest(String path, HttpMethod method, Map<String, Object> pathParams,
|
protected RestClient.RequestBodySpec prepareRequest(String path, HttpMethod method, Map<String, Object> pathParams,
|
||||||
MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams,
|
MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams,
|
||||||
MultiValueMap<String, String> cookieParams, MultiValueMap<String, Object> formParams, List<MediaType> accept,
|
MultiValueMap<String, String> cookieParams, MultiValueMap<String, Object> formParams, List<MediaType> accept,
|
||||||
MediaType contentType, String[] authNames) {
|
MediaType contentType, String[] authNames) {
|
||||||
@ -700,7 +700,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
* @param cookies map all cookies
|
* @param cookies map all cookies
|
||||||
* @return header string for cookies.
|
* @return header string for cookies.
|
||||||
*/
|
*/
|
||||||
private String buildCookieHeader(MultiValueMap<String, String> cookies) {
|
protected String buildCookieHeader(MultiValueMap<String, String> cookies) {
|
||||||
final StringBuilder cookieValue = new StringBuilder();
|
final StringBuilder cookieValue = new StringBuilder();
|
||||||
String delimiter = "";
|
String delimiter = "";
|
||||||
for (final Map.Entry<String, List<String>> entry : cookies.entrySet()) {
|
for (final Map.Entry<String, List<String>> entry : cookies.entrySet()) {
|
||||||
|
@ -63,21 +63,21 @@ import org.openapitools.client.auth.OAuth;
|
|||||||
|
|
||||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
||||||
public class ApiClient extends JavaTimeFormatter {
|
public class ApiClient extends JavaTimeFormatter {
|
||||||
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
protected Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||||
private Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
protected Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
||||||
private String basePath = "http://petstore.swagger.io:80/v2";
|
protected String basePath = "http://petstore.swagger.io:80/v2";
|
||||||
private boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
|
|
||||||
private Client httpClient;
|
protected Client httpClient;
|
||||||
private JSON json;
|
protected JSON json;
|
||||||
private String tempFolderPath = null;
|
protected String tempFolderPath = null;
|
||||||
|
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
private int statusCode;
|
protected int statusCode;
|
||||||
private Map<String, List<String>> responseHeaders;
|
protected Map<String, List<String>> responseHeaders;
|
||||||
|
|
||||||
private DateFormat dateFormat;
|
protected DateFormat dateFormat;
|
||||||
|
|
||||||
public ApiClient() {
|
public ApiClient() {
|
||||||
json = new JSON();
|
json = new JSON();
|
||||||
@ -713,7 +713,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Response invoke(Invocation.Builder invocationBuilder, String method, Entity<?> entity) throws ApiException {
|
protected Response invoke(Invocation.Builder invocationBuilder, String method, Entity<?> entity) throws ApiException {
|
||||||
Response response = null;
|
Response response = null;
|
||||||
|
|
||||||
if ("GET".equals(method)) {
|
if ("GET".equals(method)) {
|
||||||
@ -742,7 +742,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
/**
|
/**
|
||||||
* Build the Client used to make HTTP requests.
|
* Build the Client used to make HTTP requests.
|
||||||
*/
|
*/
|
||||||
private Client buildHttpClient(boolean debugging) {
|
protected Client buildHttpClient(boolean debugging) {
|
||||||
final ClientConfiguration clientConfig = new ClientConfiguration(ResteasyProviderFactory.getInstance());
|
final ClientConfiguration clientConfig = new ClientConfiguration(ResteasyProviderFactory.getInstance());
|
||||||
clientConfig.register(json);
|
clientConfig.register(json);
|
||||||
if(debugging){
|
if(debugging){
|
||||||
@ -750,7 +750,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
}
|
}
|
||||||
return ClientBuilder.newClient(clientConfig);
|
return ClientBuilder.newClient(clientConfig);
|
||||||
}
|
}
|
||||||
private Map<String, List<String>> buildResponseHeaders(Response response) {
|
protected Map<String, List<String>> buildResponseHeaders(Response response) {
|
||||||
Map<String, List<String>> responseHeaders = new HashMap<String, List<String>>();
|
Map<String, List<String>> responseHeaders = new HashMap<String, List<String>>();
|
||||||
for (Entry<String, List<Object>> entry: response.getHeaders().entrySet()) {
|
for (Entry<String, List<Object>> entry: response.getHeaders().entrySet()) {
|
||||||
List<Object> values = entry.getValue();
|
List<Object> values = entry.getValue();
|
||||||
@ -768,7 +768,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
*
|
*
|
||||||
* @param authNames The authentications to apply
|
* @param authNames The authentications to apply
|
||||||
*/
|
*/
|
||||||
private void updateParamsForAuth(String[] authNames, List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams) {
|
protected void updateParamsForAuth(String[] authNames, List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams) {
|
||||||
for (String authName : authNames) {
|
for (String authName : authNames) {
|
||||||
Authentication auth = authentications.get(authName);
|
Authentication auth = authentications.get(authName);
|
||||||
if (auth == null) throw new RuntimeException("Authentication undefined: " + authName);
|
if (auth == null) throw new RuntimeException("Authentication undefined: " + authName);
|
||||||
|
@ -78,33 +78,33 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
public enum CollectionFormat {
|
public enum CollectionFormat {
|
||||||
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
||||||
|
|
||||||
private final String separator;
|
protected final String separator;
|
||||||
|
|
||||||
private CollectionFormat(String separator) {
|
CollectionFormat(String separator) {
|
||||||
this.separator = separator;
|
this.separator = separator;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String collectionToString(Collection<?> collection) {
|
protected String collectionToString(Collection<?> collection) {
|
||||||
return StringUtils.collectionToDelimitedString(collection, separator);
|
return StringUtils.collectionToDelimitedString(collection, separator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
|
|
||||||
private HttpHeaders defaultHeaders = new HttpHeaders();
|
protected HttpHeaders defaultHeaders = new HttpHeaders();
|
||||||
private MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<String, String>();
|
protected MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<String, String>();
|
||||||
|
|
||||||
private int maxAttemptsForRetry = 1;
|
protected int maxAttemptsForRetry = 1;
|
||||||
|
|
||||||
private long waitTimeMillis = 10;
|
protected long waitTimeMillis = 10;
|
||||||
|
|
||||||
private String basePath = "http://petstore.swagger.io/v2";
|
protected String basePath = "http://petstore.swagger.io/v2";
|
||||||
|
|
||||||
private RestTemplate restTemplate;
|
protected RestTemplate restTemplate;
|
||||||
|
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
private DateFormat dateFormat;
|
protected DateFormat dateFormat;
|
||||||
|
|
||||||
public ApiClient() {
|
public ApiClient() {
|
||||||
this.restTemplate = buildRestTemplate();
|
this.restTemplate = buildRestTemplate();
|
||||||
@ -771,7 +771,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
* @param cookies map all cookies
|
* @param cookies map all cookies
|
||||||
* @return header string for cookies.
|
* @return header string for cookies.
|
||||||
*/
|
*/
|
||||||
private String buildCookieHeader(MultiValueMap<String, String> cookies) {
|
protected String buildCookieHeader(MultiValueMap<String, String> cookies) {
|
||||||
final StringBuilder cookieValue = new StringBuilder();
|
final StringBuilder cookieValue = new StringBuilder();
|
||||||
String delimiter = "";
|
String delimiter = "";
|
||||||
for (final Map.Entry<String, List<String>> entry : cookies.entrySet()) {
|
for (final Map.Entry<String, List<String>> entry : cookies.entrySet()) {
|
||||||
@ -815,8 +815,8 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ApiClientHttpRequestInterceptor implements ClientHttpRequestInterceptor {
|
protected class ApiClientHttpRequestInterceptor implements ClientHttpRequestInterceptor {
|
||||||
private final Log log = LogFactory.getLog(ApiClientHttpRequestInterceptor.class);
|
protected final Log log = LogFactory.getLog(ApiClientHttpRequestInterceptor.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException {
|
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException {
|
||||||
@ -826,21 +826,21 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void logRequest(HttpRequest request, byte[] body) throws UnsupportedEncodingException {
|
protected void logRequest(HttpRequest request, byte[] body) throws UnsupportedEncodingException {
|
||||||
log.info("URI: " + request.getURI());
|
log.info("URI: " + request.getURI());
|
||||||
log.info("HTTP Method: " + request.getMethod());
|
log.info("HTTP Method: " + request.getMethod());
|
||||||
log.info("HTTP Headers: " + headersToString(request.getHeaders()));
|
log.info("HTTP Headers: " + headersToString(request.getHeaders()));
|
||||||
log.info("Request Body: " + new String(body, StandardCharsets.UTF_8));
|
log.info("Request Body: " + new String(body, StandardCharsets.UTF_8));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void logResponse(ClientHttpResponse response) throws IOException {
|
protected void logResponse(ClientHttpResponse response) throws IOException {
|
||||||
log.info("HTTP Status Code: " + response.getStatusCode().value());
|
log.info("HTTP Status Code: " + response.getStatusCode().value());
|
||||||
log.info("Status Text: " + response.getStatusText());
|
log.info("Status Text: " + response.getStatusText());
|
||||||
log.info("HTTP Headers: " + headersToString(response.getHeaders()));
|
log.info("HTTP Headers: " + headersToString(response.getHeaders()));
|
||||||
log.info("Response Body: " + bodyToString(response.getBody()));
|
log.info("Response Body: " + bodyToString(response.getBody()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private String headersToString(HttpHeaders headers) {
|
protected String headersToString(HttpHeaders headers) {
|
||||||
if(headers == null || headers.isEmpty()) {
|
if(headers == null || headers.isEmpty()) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@ -857,7 +857,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String bodyToString(InputStream body) throws IOException {
|
protected String bodyToString(InputStream body) throws IOException {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(body, StandardCharsets.UTF_8));
|
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(body, StandardCharsets.UTF_8));
|
||||||
String line = bufferedReader.readLine();
|
String line = bufferedReader.readLine();
|
||||||
|
@ -78,33 +78,33 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
public enum CollectionFormat {
|
public enum CollectionFormat {
|
||||||
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
||||||
|
|
||||||
private final String separator;
|
protected final String separator;
|
||||||
|
|
||||||
private CollectionFormat(String separator) {
|
CollectionFormat(String separator) {
|
||||||
this.separator = separator;
|
this.separator = separator;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String collectionToString(Collection<?> collection) {
|
protected String collectionToString(Collection<?> collection) {
|
||||||
return StringUtils.collectionToDelimitedString(collection, separator);
|
return StringUtils.collectionToDelimitedString(collection, separator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
|
|
||||||
private HttpHeaders defaultHeaders = new HttpHeaders();
|
protected HttpHeaders defaultHeaders = new HttpHeaders();
|
||||||
private MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<String, String>();
|
protected MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<String, String>();
|
||||||
|
|
||||||
private int maxAttemptsForRetry = 1;
|
protected int maxAttemptsForRetry = 1;
|
||||||
|
|
||||||
private long waitTimeMillis = 10;
|
protected long waitTimeMillis = 10;
|
||||||
|
|
||||||
private String basePath = "http://petstore.swagger.io/v2";
|
protected String basePath = "http://petstore.swagger.io/v2";
|
||||||
|
|
||||||
private RestTemplate restTemplate;
|
protected RestTemplate restTemplate;
|
||||||
|
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
private DateFormat dateFormat;
|
protected DateFormat dateFormat;
|
||||||
|
|
||||||
public ApiClient() {
|
public ApiClient() {
|
||||||
this.restTemplate = buildRestTemplate();
|
this.restTemplate = buildRestTemplate();
|
||||||
@ -771,7 +771,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
* @param cookies map all cookies
|
* @param cookies map all cookies
|
||||||
* @return header string for cookies.
|
* @return header string for cookies.
|
||||||
*/
|
*/
|
||||||
private String buildCookieHeader(MultiValueMap<String, String> cookies) {
|
protected String buildCookieHeader(MultiValueMap<String, String> cookies) {
|
||||||
final StringBuilder cookieValue = new StringBuilder();
|
final StringBuilder cookieValue = new StringBuilder();
|
||||||
String delimiter = "";
|
String delimiter = "";
|
||||||
for (final Map.Entry<String, List<String>> entry : cookies.entrySet()) {
|
for (final Map.Entry<String, List<String>> entry : cookies.entrySet()) {
|
||||||
@ -815,8 +815,8 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ApiClientHttpRequestInterceptor implements ClientHttpRequestInterceptor {
|
protected class ApiClientHttpRequestInterceptor implements ClientHttpRequestInterceptor {
|
||||||
private final Log log = LogFactory.getLog(ApiClientHttpRequestInterceptor.class);
|
protected final Log log = LogFactory.getLog(ApiClientHttpRequestInterceptor.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException {
|
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException {
|
||||||
@ -826,21 +826,21 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void logRequest(HttpRequest request, byte[] body) throws UnsupportedEncodingException {
|
protected void logRequest(HttpRequest request, byte[] body) throws UnsupportedEncodingException {
|
||||||
log.info("URI: " + request.getURI());
|
log.info("URI: " + request.getURI());
|
||||||
log.info("HTTP Method: " + request.getMethod());
|
log.info("HTTP Method: " + request.getMethod());
|
||||||
log.info("HTTP Headers: " + headersToString(request.getHeaders()));
|
log.info("HTTP Headers: " + headersToString(request.getHeaders()));
|
||||||
log.info("Request Body: " + new String(body, StandardCharsets.UTF_8));
|
log.info("Request Body: " + new String(body, StandardCharsets.UTF_8));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void logResponse(ClientHttpResponse response) throws IOException {
|
protected void logResponse(ClientHttpResponse response) throws IOException {
|
||||||
log.info("HTTP Status Code: " + response.getStatusCode().value());
|
log.info("HTTP Status Code: " + response.getStatusCode().value());
|
||||||
log.info("Status Text: " + response.getStatusText());
|
log.info("Status Text: " + response.getStatusText());
|
||||||
log.info("HTTP Headers: " + headersToString(response.getHeaders()));
|
log.info("HTTP Headers: " + headersToString(response.getHeaders()));
|
||||||
log.info("Response Body: " + bodyToString(response.getBody()));
|
log.info("Response Body: " + bodyToString(response.getBody()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private String headersToString(HttpHeaders headers) {
|
protected String headersToString(HttpHeaders headers) {
|
||||||
if(headers == null || headers.isEmpty()) {
|
if(headers == null || headers.isEmpty()) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@ -857,7 +857,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String bodyToString(InputStream body) throws IOException {
|
protected String bodyToString(InputStream body) throws IOException {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(body, StandardCharsets.UTF_8));
|
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(body, StandardCharsets.UTF_8));
|
||||||
String line = bufferedReader.readLine();
|
String line = bufferedReader.readLine();
|
||||||
|
@ -78,33 +78,33 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
public enum CollectionFormat {
|
public enum CollectionFormat {
|
||||||
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
||||||
|
|
||||||
private final String separator;
|
protected final String separator;
|
||||||
|
|
||||||
private CollectionFormat(String separator) {
|
CollectionFormat(String separator) {
|
||||||
this.separator = separator;
|
this.separator = separator;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String collectionToString(Collection<?> collection) {
|
protected String collectionToString(Collection<?> collection) {
|
||||||
return StringUtils.collectionToDelimitedString(collection, separator);
|
return StringUtils.collectionToDelimitedString(collection, separator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
|
|
||||||
private HttpHeaders defaultHeaders = new HttpHeaders();
|
protected HttpHeaders defaultHeaders = new HttpHeaders();
|
||||||
private MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<String, String>();
|
protected MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<String, String>();
|
||||||
|
|
||||||
private int maxAttemptsForRetry = 1;
|
protected int maxAttemptsForRetry = 1;
|
||||||
|
|
||||||
private long waitTimeMillis = 10;
|
protected long waitTimeMillis = 10;
|
||||||
|
|
||||||
private String basePath = "http://petstore.swagger.io/v2";
|
protected String basePath = "http://petstore.swagger.io/v2";
|
||||||
|
|
||||||
private RestTemplate restTemplate;
|
protected RestTemplate restTemplate;
|
||||||
|
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
private DateFormat dateFormat;
|
protected DateFormat dateFormat;
|
||||||
|
|
||||||
public ApiClient() {
|
public ApiClient() {
|
||||||
this.restTemplate = buildRestTemplate();
|
this.restTemplate = buildRestTemplate();
|
||||||
@ -771,7 +771,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
* @param cookies map all cookies
|
* @param cookies map all cookies
|
||||||
* @return header string for cookies.
|
* @return header string for cookies.
|
||||||
*/
|
*/
|
||||||
private String buildCookieHeader(MultiValueMap<String, String> cookies) {
|
protected String buildCookieHeader(MultiValueMap<String, String> cookies) {
|
||||||
final StringBuilder cookieValue = new StringBuilder();
|
final StringBuilder cookieValue = new StringBuilder();
|
||||||
String delimiter = "";
|
String delimiter = "";
|
||||||
for (final Map.Entry<String, List<String>> entry : cookies.entrySet()) {
|
for (final Map.Entry<String, List<String>> entry : cookies.entrySet()) {
|
||||||
@ -815,8 +815,8 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ApiClientHttpRequestInterceptor implements ClientHttpRequestInterceptor {
|
protected class ApiClientHttpRequestInterceptor implements ClientHttpRequestInterceptor {
|
||||||
private final Log log = LogFactory.getLog(ApiClientHttpRequestInterceptor.class);
|
protected final Log log = LogFactory.getLog(ApiClientHttpRequestInterceptor.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException {
|
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException {
|
||||||
@ -826,21 +826,21 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void logRequest(HttpRequest request, byte[] body) throws UnsupportedEncodingException {
|
protected void logRequest(HttpRequest request, byte[] body) throws UnsupportedEncodingException {
|
||||||
log.info("URI: " + request.getURI());
|
log.info("URI: " + request.getURI());
|
||||||
log.info("HTTP Method: " + request.getMethod());
|
log.info("HTTP Method: " + request.getMethod());
|
||||||
log.info("HTTP Headers: " + headersToString(request.getHeaders()));
|
log.info("HTTP Headers: " + headersToString(request.getHeaders()));
|
||||||
log.info("Request Body: " + new String(body, StandardCharsets.UTF_8));
|
log.info("Request Body: " + new String(body, StandardCharsets.UTF_8));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void logResponse(ClientHttpResponse response) throws IOException {
|
protected void logResponse(ClientHttpResponse response) throws IOException {
|
||||||
log.info("HTTP Status Code: " + response.getStatusCode().value());
|
log.info("HTTP Status Code: " + response.getStatusCode().value());
|
||||||
log.info("Status Text: " + response.getStatusText());
|
log.info("Status Text: " + response.getStatusText());
|
||||||
log.info("HTTP Headers: " + headersToString(response.getHeaders()));
|
log.info("HTTP Headers: " + headersToString(response.getHeaders()));
|
||||||
log.info("Response Body: " + bodyToString(response.getBody()));
|
log.info("Response Body: " + bodyToString(response.getBody()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private String headersToString(HttpHeaders headers) {
|
protected String headersToString(HttpHeaders headers) {
|
||||||
if(headers == null || headers.isEmpty()) {
|
if(headers == null || headers.isEmpty()) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@ -857,7 +857,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String bodyToString(InputStream body) throws IOException {
|
protected String bodyToString(InputStream body) throws IOException {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(body, StandardCharsets.UTF_8));
|
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(body, StandardCharsets.UTF_8));
|
||||||
String line = bufferedReader.readLine();
|
String line = bufferedReader.readLine();
|
||||||
|
@ -85,33 +85,33 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
public enum CollectionFormat {
|
public enum CollectionFormat {
|
||||||
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
||||||
|
|
||||||
private final String separator;
|
protected final String separator;
|
||||||
|
|
||||||
private CollectionFormat(String separator) {
|
CollectionFormat(String separator) {
|
||||||
this.separator = separator;
|
this.separator = separator;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String collectionToString(Collection<?> collection) {
|
protected String collectionToString(Collection<?> collection) {
|
||||||
return StringUtils.collectionToDelimitedString(collection, separator);
|
return StringUtils.collectionToDelimitedString(collection, separator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
|
|
||||||
private HttpHeaders defaultHeaders = new HttpHeaders();
|
protected HttpHeaders defaultHeaders = new HttpHeaders();
|
||||||
private MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<String, String>();
|
protected MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<String, String>();
|
||||||
|
|
||||||
private int maxAttemptsForRetry = 1;
|
protected int maxAttemptsForRetry = 1;
|
||||||
|
|
||||||
private long waitTimeMillis = 10;
|
protected long waitTimeMillis = 10;
|
||||||
|
|
||||||
private String basePath = "http://petstore.swagger.io:80/v2";
|
protected String basePath = "http://petstore.swagger.io:80/v2";
|
||||||
|
|
||||||
private RestTemplate restTemplate;
|
protected RestTemplate restTemplate;
|
||||||
|
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
private DateFormat dateFormat;
|
protected DateFormat dateFormat;
|
||||||
|
|
||||||
public ApiClient() {
|
public ApiClient() {
|
||||||
this.restTemplate = buildRestTemplate();
|
this.restTemplate = buildRestTemplate();
|
||||||
@ -834,7 +834,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
* @param cookies map all cookies
|
* @param cookies map all cookies
|
||||||
* @return header string for cookies.
|
* @return header string for cookies.
|
||||||
*/
|
*/
|
||||||
private String buildCookieHeader(MultiValueMap<String, String> cookies) {
|
protected String buildCookieHeader(MultiValueMap<String, String> cookies) {
|
||||||
final StringBuilder cookieValue = new StringBuilder();
|
final StringBuilder cookieValue = new StringBuilder();
|
||||||
String delimiter = "";
|
String delimiter = "";
|
||||||
for (final Map.Entry<String, List<String>> entry : cookies.entrySet()) {
|
for (final Map.Entry<String, List<String>> entry : cookies.entrySet()) {
|
||||||
@ -886,8 +886,8 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ApiClientHttpRequestInterceptor implements ClientHttpRequestInterceptor {
|
protected class ApiClientHttpRequestInterceptor implements ClientHttpRequestInterceptor {
|
||||||
private final Log log = LogFactory.getLog(ApiClientHttpRequestInterceptor.class);
|
protected final Log log = LogFactory.getLog(ApiClientHttpRequestInterceptor.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException {
|
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException {
|
||||||
@ -897,21 +897,21 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void logRequest(HttpRequest request, byte[] body) throws UnsupportedEncodingException {
|
protected void logRequest(HttpRequest request, byte[] body) throws UnsupportedEncodingException {
|
||||||
log.info("URI: " + request.getURI());
|
log.info("URI: " + request.getURI());
|
||||||
log.info("HTTP Method: " + request.getMethod());
|
log.info("HTTP Method: " + request.getMethod());
|
||||||
log.info("HTTP Headers: " + headersToString(request.getHeaders()));
|
log.info("HTTP Headers: " + headersToString(request.getHeaders()));
|
||||||
log.info("Request Body: " + new String(body, StandardCharsets.UTF_8));
|
log.info("Request Body: " + new String(body, StandardCharsets.UTF_8));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void logResponse(ClientHttpResponse response) throws IOException {
|
protected void logResponse(ClientHttpResponse response) throws IOException {
|
||||||
log.info("HTTP Status Code: " + response.getStatusCode().value());
|
log.info("HTTP Status Code: " + response.getStatusCode().value());
|
||||||
log.info("Status Text: " + response.getStatusText());
|
log.info("Status Text: " + response.getStatusText());
|
||||||
log.info("HTTP Headers: " + headersToString(response.getHeaders()));
|
log.info("HTTP Headers: " + headersToString(response.getHeaders()));
|
||||||
log.info("Response Body: " + bodyToString(response.getBody()));
|
log.info("Response Body: " + bodyToString(response.getBody()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private String headersToString(HttpHeaders headers) {
|
protected String headersToString(HttpHeaders headers) {
|
||||||
if(headers == null || headers.isEmpty()) {
|
if(headers == null || headers.isEmpty()) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@ -928,7 +928,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String bodyToString(InputStream body) throws IOException {
|
protected String bodyToString(InputStream body) throws IOException {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(body, StandardCharsets.UTF_8));
|
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(body, StandardCharsets.UTF_8));
|
||||||
String line = bufferedReader.readLine();
|
String line = bufferedReader.readLine();
|
||||||
|
@ -80,33 +80,33 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
public enum CollectionFormat {
|
public enum CollectionFormat {
|
||||||
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
||||||
|
|
||||||
private final String separator;
|
protected final String separator;
|
||||||
|
|
||||||
private CollectionFormat(String separator) {
|
CollectionFormat(String separator) {
|
||||||
this.separator = separator;
|
this.separator = separator;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String collectionToString(Collection<?> collection) {
|
protected String collectionToString(Collection<?> collection) {
|
||||||
return StringUtils.collectionToDelimitedString(collection, separator);
|
return StringUtils.collectionToDelimitedString(collection, separator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
|
|
||||||
private HttpHeaders defaultHeaders = new HttpHeaders();
|
protected HttpHeaders defaultHeaders = new HttpHeaders();
|
||||||
private MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<String, String>();
|
protected MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<String, String>();
|
||||||
|
|
||||||
private int maxAttemptsForRetry = 1;
|
protected int maxAttemptsForRetry = 1;
|
||||||
|
|
||||||
private long waitTimeMillis = 10;
|
protected long waitTimeMillis = 10;
|
||||||
|
|
||||||
private String basePath = "http://petstore.swagger.io:80/v2";
|
protected String basePath = "http://petstore.swagger.io:80/v2";
|
||||||
|
|
||||||
private RestTemplate restTemplate;
|
protected RestTemplate restTemplate;
|
||||||
|
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
private DateFormat dateFormat;
|
protected DateFormat dateFormat;
|
||||||
|
|
||||||
public ApiClient() {
|
public ApiClient() {
|
||||||
this.restTemplate = buildRestTemplate();
|
this.restTemplate = buildRestTemplate();
|
||||||
@ -829,7 +829,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
* @param cookies map all cookies
|
* @param cookies map all cookies
|
||||||
* @return header string for cookies.
|
* @return header string for cookies.
|
||||||
*/
|
*/
|
||||||
private String buildCookieHeader(MultiValueMap<String, String> cookies) {
|
protected String buildCookieHeader(MultiValueMap<String, String> cookies) {
|
||||||
final StringBuilder cookieValue = new StringBuilder();
|
final StringBuilder cookieValue = new StringBuilder();
|
||||||
String delimiter = "";
|
String delimiter = "";
|
||||||
for (final Map.Entry<String, List<String>> entry : cookies.entrySet()) {
|
for (final Map.Entry<String, List<String>> entry : cookies.entrySet()) {
|
||||||
@ -873,8 +873,8 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ApiClientHttpRequestInterceptor implements ClientHttpRequestInterceptor {
|
protected class ApiClientHttpRequestInterceptor implements ClientHttpRequestInterceptor {
|
||||||
private final Log log = LogFactory.getLog(ApiClientHttpRequestInterceptor.class);
|
protected final Log log = LogFactory.getLog(ApiClientHttpRequestInterceptor.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException {
|
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException {
|
||||||
@ -884,21 +884,21 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void logRequest(HttpRequest request, byte[] body) throws UnsupportedEncodingException {
|
protected void logRequest(HttpRequest request, byte[] body) throws UnsupportedEncodingException {
|
||||||
log.info("URI: " + request.getURI());
|
log.info("URI: " + request.getURI());
|
||||||
log.info("HTTP Method: " + request.getMethod());
|
log.info("HTTP Method: " + request.getMethod());
|
||||||
log.info("HTTP Headers: " + headersToString(request.getHeaders()));
|
log.info("HTTP Headers: " + headersToString(request.getHeaders()));
|
||||||
log.info("Request Body: " + new String(body, StandardCharsets.UTF_8));
|
log.info("Request Body: " + new String(body, StandardCharsets.UTF_8));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void logResponse(ClientHttpResponse response) throws IOException {
|
protected void logResponse(ClientHttpResponse response) throws IOException {
|
||||||
log.info("HTTP Status Code: " + response.getStatusCode().value());
|
log.info("HTTP Status Code: " + response.getStatusCode().value());
|
||||||
log.info("Status Text: " + response.getStatusText());
|
log.info("Status Text: " + response.getStatusText());
|
||||||
log.info("HTTP Headers: " + headersToString(response.getHeaders()));
|
log.info("HTTP Headers: " + headersToString(response.getHeaders()));
|
||||||
log.info("Response Body: " + bodyToString(response.getBody()));
|
log.info("Response Body: " + bodyToString(response.getBody()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private String headersToString(HttpHeaders headers) {
|
protected String headersToString(HttpHeaders headers) {
|
||||||
if(headers == null || headers.isEmpty()) {
|
if(headers == null || headers.isEmpty()) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@ -915,7 +915,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String bodyToString(InputStream body) throws IOException {
|
protected String bodyToString(InputStream body) throws IOException {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(body, StandardCharsets.UTF_8));
|
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(body, StandardCharsets.UTF_8));
|
||||||
String line = bufferedReader.readLine();
|
String line = bufferedReader.readLine();
|
||||||
|
@ -46,22 +46,22 @@ import org.openapitools.client.auth.Authentication;
|
|||||||
public class ApiClient {
|
public class ApiClient {
|
||||||
|
|
||||||
/** Underlying HTTP-client */
|
/** Underlying HTTP-client */
|
||||||
private WSClient wsClient;
|
protected WSClient wsClient;
|
||||||
|
|
||||||
/** Creates HTTP call instances */
|
/** Creates HTTP call instances */
|
||||||
private Play26CallFactory callFactory;
|
protected Play26CallFactory callFactory;
|
||||||
|
|
||||||
/** Create {@link java.util.concurrent.CompletionStage} instances from HTTP calls */
|
/** Create {@link java.util.concurrent.CompletionStage} instances from HTTP calls */
|
||||||
private Play26CallAdapterFactory callAdapterFactory;
|
protected Play26CallAdapterFactory callAdapterFactory;
|
||||||
|
|
||||||
/** Supported auths */
|
/** Supported auths */
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
/** API base path */
|
/** API base path */
|
||||||
private String basePath = "http://petstore.swagger.io:80/v2";
|
protected String basePath = "http://petstore.swagger.io:80/v2";
|
||||||
|
|
||||||
/** Default ObjectMapper */
|
/** Default ObjectMapper */
|
||||||
private ObjectMapper defaultMapper;
|
protected ObjectMapper defaultMapper;
|
||||||
|
|
||||||
public ApiClient(WSClient wsClient) {
|
public ApiClient(WSClient wsClient) {
|
||||||
this();
|
this();
|
||||||
|
@ -44,11 +44,11 @@ import java.util.HashMap;
|
|||||||
|
|
||||||
public class ApiClient {
|
public class ApiClient {
|
||||||
|
|
||||||
private Map<String, Interceptor> apiAuthorizations;
|
protected Map<String, Interceptor> apiAuthorizations;
|
||||||
private OkHttpClient.Builder okBuilder;
|
protected OkHttpClient.Builder okBuilder;
|
||||||
private Retrofit.Builder adapterBuilder;
|
protected Retrofit.Builder adapterBuilder;
|
||||||
private JSON json;
|
protected JSON json;
|
||||||
private OkHttpClient okHttpClient;
|
protected OkHttpClient okHttpClient;
|
||||||
|
|
||||||
public ApiClient() {
|
public ApiClient() {
|
||||||
apiAuthorizations = new LinkedHashMap<String, Interceptor>();
|
apiAuthorizations = new LinkedHashMap<String, Interceptor>();
|
||||||
@ -372,8 +372,8 @@ public class ApiClient {
|
|||||||
* expected type is String, then just return the body string.
|
* expected type is String, then just return the body string.
|
||||||
*/
|
*/
|
||||||
class GsonResponseBodyConverterToString<T> implements Converter<ResponseBody, T> {
|
class GsonResponseBodyConverterToString<T> implements Converter<ResponseBody, T> {
|
||||||
private final Gson gson;
|
protected final Gson gson;
|
||||||
private final Type type;
|
protected final Type type;
|
||||||
|
|
||||||
GsonResponseBodyConverterToString(Gson gson, Type type) {
|
GsonResponseBodyConverterToString(Gson gson, Type type) {
|
||||||
this.gson = gson;
|
this.gson = gson;
|
||||||
@ -393,14 +393,14 @@ class GsonResponseBodyConverterToString<T> implements Converter<ResponseBody, T>
|
|||||||
|
|
||||||
class GsonCustomConverterFactory extends Converter.Factory
|
class GsonCustomConverterFactory extends Converter.Factory
|
||||||
{
|
{
|
||||||
private final Gson gson;
|
protected final Gson gson;
|
||||||
private final GsonConverterFactory gsonConverterFactory;
|
protected final GsonConverterFactory gsonConverterFactory;
|
||||||
|
|
||||||
public static GsonCustomConverterFactory create(Gson gson) {
|
public static GsonCustomConverterFactory create(Gson gson) {
|
||||||
return new GsonCustomConverterFactory(gson);
|
return new GsonCustomConverterFactory(gson);
|
||||||
}
|
}
|
||||||
|
|
||||||
private GsonCustomConverterFactory(Gson gson) {
|
protected GsonCustomConverterFactory(Gson gson) {
|
||||||
if (gson == null)
|
if (gson == null)
|
||||||
throw new NullPointerException("gson == null");
|
throw new NullPointerException("gson == null");
|
||||||
this.gson = gson;
|
this.gson = gson;
|
||||||
|
@ -45,11 +45,11 @@ import java.util.HashMap;
|
|||||||
|
|
||||||
public class ApiClient {
|
public class ApiClient {
|
||||||
|
|
||||||
private Map<String, Interceptor> apiAuthorizations;
|
protected Map<String, Interceptor> apiAuthorizations;
|
||||||
private OkHttpClient.Builder okBuilder;
|
protected OkHttpClient.Builder okBuilder;
|
||||||
private Retrofit.Builder adapterBuilder;
|
protected Retrofit.Builder adapterBuilder;
|
||||||
private JSON json;
|
protected JSON json;
|
||||||
private OkHttpClient okHttpClient;
|
protected OkHttpClient okHttpClient;
|
||||||
|
|
||||||
public ApiClient() {
|
public ApiClient() {
|
||||||
apiAuthorizations = new LinkedHashMap<String, Interceptor>();
|
apiAuthorizations = new LinkedHashMap<String, Interceptor>();
|
||||||
@ -374,8 +374,8 @@ public class ApiClient {
|
|||||||
* expected type is String, then just return the body string.
|
* expected type is String, then just return the body string.
|
||||||
*/
|
*/
|
||||||
class GsonResponseBodyConverterToString<T> implements Converter<ResponseBody, T> {
|
class GsonResponseBodyConverterToString<T> implements Converter<ResponseBody, T> {
|
||||||
private final Gson gson;
|
protected final Gson gson;
|
||||||
private final Type type;
|
protected final Type type;
|
||||||
|
|
||||||
GsonResponseBodyConverterToString(Gson gson, Type type) {
|
GsonResponseBodyConverterToString(Gson gson, Type type) {
|
||||||
this.gson = gson;
|
this.gson = gson;
|
||||||
@ -395,14 +395,14 @@ class GsonResponseBodyConverterToString<T> implements Converter<ResponseBody, T>
|
|||||||
|
|
||||||
class GsonCustomConverterFactory extends Converter.Factory
|
class GsonCustomConverterFactory extends Converter.Factory
|
||||||
{
|
{
|
||||||
private final Gson gson;
|
protected final Gson gson;
|
||||||
private final GsonConverterFactory gsonConverterFactory;
|
protected final GsonConverterFactory gsonConverterFactory;
|
||||||
|
|
||||||
public static GsonCustomConverterFactory create(Gson gson) {
|
public static GsonCustomConverterFactory create(Gson gson) {
|
||||||
return new GsonCustomConverterFactory(gson);
|
return new GsonCustomConverterFactory(gson);
|
||||||
}
|
}
|
||||||
|
|
||||||
private GsonCustomConverterFactory(Gson gson) {
|
protected GsonCustomConverterFactory(Gson gson) {
|
||||||
if (gson == null)
|
if (gson == null)
|
||||||
throw new NullPointerException("gson == null");
|
throw new NullPointerException("gson == null");
|
||||||
this.gson = gson;
|
this.gson = gson;
|
||||||
|
@ -45,11 +45,11 @@ import java.util.HashMap;
|
|||||||
|
|
||||||
public class ApiClient {
|
public class ApiClient {
|
||||||
|
|
||||||
private Map<String, Interceptor> apiAuthorizations;
|
protected Map<String, Interceptor> apiAuthorizations;
|
||||||
private OkHttpClient.Builder okBuilder;
|
protected OkHttpClient.Builder okBuilder;
|
||||||
private Retrofit.Builder adapterBuilder;
|
protected Retrofit.Builder adapterBuilder;
|
||||||
private JSON json;
|
protected JSON json;
|
||||||
private OkHttpClient okHttpClient;
|
protected OkHttpClient okHttpClient;
|
||||||
|
|
||||||
public ApiClient() {
|
public ApiClient() {
|
||||||
apiAuthorizations = new LinkedHashMap<String, Interceptor>();
|
apiAuthorizations = new LinkedHashMap<String, Interceptor>();
|
||||||
@ -374,8 +374,8 @@ public class ApiClient {
|
|||||||
* expected type is String, then just return the body string.
|
* expected type is String, then just return the body string.
|
||||||
*/
|
*/
|
||||||
class GsonResponseBodyConverterToString<T> implements Converter<ResponseBody, T> {
|
class GsonResponseBodyConverterToString<T> implements Converter<ResponseBody, T> {
|
||||||
private final Gson gson;
|
protected final Gson gson;
|
||||||
private final Type type;
|
protected final Type type;
|
||||||
|
|
||||||
GsonResponseBodyConverterToString(Gson gson, Type type) {
|
GsonResponseBodyConverterToString(Gson gson, Type type) {
|
||||||
this.gson = gson;
|
this.gson = gson;
|
||||||
@ -395,14 +395,14 @@ class GsonResponseBodyConverterToString<T> implements Converter<ResponseBody, T>
|
|||||||
|
|
||||||
class GsonCustomConverterFactory extends Converter.Factory
|
class GsonCustomConverterFactory extends Converter.Factory
|
||||||
{
|
{
|
||||||
private final Gson gson;
|
protected final Gson gson;
|
||||||
private final GsonConverterFactory gsonConverterFactory;
|
protected final GsonConverterFactory gsonConverterFactory;
|
||||||
|
|
||||||
public static GsonCustomConverterFactory create(Gson gson) {
|
public static GsonCustomConverterFactory create(Gson gson) {
|
||||||
return new GsonCustomConverterFactory(gson);
|
return new GsonCustomConverterFactory(gson);
|
||||||
}
|
}
|
||||||
|
|
||||||
private GsonCustomConverterFactory(Gson gson) {
|
protected GsonCustomConverterFactory(Gson gson) {
|
||||||
if (gson == null)
|
if (gson == null)
|
||||||
throw new NullPointerException("gson == null");
|
throw new NullPointerException("gson == null");
|
||||||
this.gson = gson;
|
this.gson = gson;
|
||||||
|
@ -53,21 +53,21 @@ import static java.util.stream.Collectors.toMap;
|
|||||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
||||||
public class ApiClient extends JavaTimeFormatter {
|
public class ApiClient extends JavaTimeFormatter {
|
||||||
|
|
||||||
private static final Pattern CONTENT_DISPOSITION_PATTERN = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?");
|
protected static final Pattern CONTENT_DISPOSITION_PATTERN = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?");
|
||||||
private static final OpenOptions FILE_DOWNLOAD_OPTIONS = new OpenOptions().setCreate(true).setTruncateExisting(true);
|
protected static final OpenOptions FILE_DOWNLOAD_OPTIONS = new OpenOptions().setCreate(true).setTruncateExisting(true);
|
||||||
|
|
||||||
private final Vertx vertx;
|
protected final Vertx vertx;
|
||||||
private final JsonObject config;
|
protected final JsonObject config;
|
||||||
private final String identifier;
|
protected final String identifier;
|
||||||
|
|
||||||
private MultiMap defaultHeaders = MultiMap.caseInsensitiveMultiMap();
|
protected MultiMap defaultHeaders = MultiMap.caseInsensitiveMultiMap();
|
||||||
private MultiMap defaultCookies = MultiMap.caseInsensitiveMultiMap();
|
protected MultiMap defaultCookies = MultiMap.caseInsensitiveMultiMap();
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
private String basePath = "http://petstore.swagger.io:80/v2";
|
protected String basePath = "http://petstore.swagger.io:80/v2";
|
||||||
private DateFormat dateFormat;
|
protected DateFormat dateFormat;
|
||||||
private ObjectMapper objectMapper;
|
protected ObjectMapper objectMapper;
|
||||||
private String downloadsDir = "";
|
protected String downloadsDir = "";
|
||||||
private int timeout = -1;
|
protected int timeout = -1;
|
||||||
|
|
||||||
public ApiClient(Vertx vertx, JsonObject config) {
|
public ApiClient(Vertx vertx, JsonObject config) {
|
||||||
Objects.requireNonNull(vertx, "Vertx must not be null");
|
Objects.requireNonNull(vertx, "Vertx must not be null");
|
||||||
@ -383,7 +383,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
* @param mime MIME
|
* @param mime MIME
|
||||||
* @return True if the MIME type is JSON
|
* @return True if the MIME type is JSON
|
||||||
*/
|
*/
|
||||||
private boolean isJsonMime(String mime) {
|
protected boolean isJsonMime(String mime) {
|
||||||
String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$";
|
String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$";
|
||||||
return mime != null && (mime.matches(jsonMime) || mime.equalsIgnoreCase("application/json-patch+json"));
|
return mime != null && (mime.matches(jsonMime) || mime.equalsIgnoreCase("application/json-patch+json"));
|
||||||
}
|
}
|
||||||
@ -521,7 +521,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String buildCookieHeader(MultiMap cookies) {
|
protected String buildCookieHeader(MultiMap cookies) {
|
||||||
final StringBuilder cookieValue = new StringBuilder();
|
final StringBuilder cookieValue = new StringBuilder();
|
||||||
String delimiter = "";
|
String delimiter = "";
|
||||||
for (final Map.Entry<String, String> entry : cookies.entries()) {
|
for (final Map.Entry<String, String> entry : cookies.entries()) {
|
||||||
@ -678,7 +678,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
|
|
||||||
public static class AuthInfo {
|
public static class AuthInfo {
|
||||||
|
|
||||||
private final Map<String, Authentication> authentications = new LinkedHashMap<>();
|
protected final Map<String, Authentication> authentications = new LinkedHashMap<>();
|
||||||
|
|
||||||
public void addPetstoreAuthAuthentication(String accessToken) {
|
public void addPetstoreAuthAuthentication(String accessToken) {
|
||||||
OAuth auth = new OAuth();
|
OAuth auth = new OAuth();
|
||||||
|
@ -54,21 +54,21 @@ import static java.util.stream.Collectors.toMap;
|
|||||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
||||||
public class ApiClient extends JavaTimeFormatter {
|
public class ApiClient extends JavaTimeFormatter {
|
||||||
|
|
||||||
private static final Pattern CONTENT_DISPOSITION_PATTERN = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?");
|
protected static final Pattern CONTENT_DISPOSITION_PATTERN = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?");
|
||||||
private static final OpenOptions FILE_DOWNLOAD_OPTIONS = new OpenOptions().setCreate(true).setTruncateExisting(true);
|
protected static final OpenOptions FILE_DOWNLOAD_OPTIONS = new OpenOptions().setCreate(true).setTruncateExisting(true);
|
||||||
|
|
||||||
private final Vertx vertx;
|
protected final Vertx vertx;
|
||||||
private final JsonObject config;
|
protected final JsonObject config;
|
||||||
private final String identifier;
|
protected final String identifier;
|
||||||
|
|
||||||
private MultiMap defaultHeaders = MultiMap.caseInsensitiveMultiMap();
|
protected MultiMap defaultHeaders = MultiMap.caseInsensitiveMultiMap();
|
||||||
private MultiMap defaultCookies = MultiMap.caseInsensitiveMultiMap();
|
protected MultiMap defaultCookies = MultiMap.caseInsensitiveMultiMap();
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
private String basePath = "http://petstore.swagger.io:80/v2";
|
protected String basePath = "http://petstore.swagger.io:80/v2";
|
||||||
private DateFormat dateFormat;
|
protected DateFormat dateFormat;
|
||||||
private ObjectMapper objectMapper;
|
protected ObjectMapper objectMapper;
|
||||||
private String downloadsDir = "";
|
protected String downloadsDir = "";
|
||||||
private int timeout = -1;
|
protected int timeout = -1;
|
||||||
|
|
||||||
public ApiClient(Vertx vertx, JsonObject config) {
|
public ApiClient(Vertx vertx, JsonObject config) {
|
||||||
Objects.requireNonNull(vertx, "Vertx must not be null");
|
Objects.requireNonNull(vertx, "Vertx must not be null");
|
||||||
@ -387,7 +387,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
* @param mime MIME
|
* @param mime MIME
|
||||||
* @return True if the MIME type is JSON
|
* @return True if the MIME type is JSON
|
||||||
*/
|
*/
|
||||||
private boolean isJsonMime(String mime) {
|
protected boolean isJsonMime(String mime) {
|
||||||
String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$";
|
String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$";
|
||||||
return mime != null && (mime.matches(jsonMime) || mime.equalsIgnoreCase("application/json-patch+json"));
|
return mime != null && (mime.matches(jsonMime) || mime.equalsIgnoreCase("application/json-patch+json"));
|
||||||
}
|
}
|
||||||
@ -525,7 +525,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String buildCookieHeader(MultiMap cookies) {
|
protected String buildCookieHeader(MultiMap cookies) {
|
||||||
final StringBuilder cookieValue = new StringBuilder();
|
final StringBuilder cookieValue = new StringBuilder();
|
||||||
String delimiter = "";
|
String delimiter = "";
|
||||||
for (final Map.Entry<String, String> entry : cookies.entries()) {
|
for (final Map.Entry<String, String> entry : cookies.entries()) {
|
||||||
@ -682,7 +682,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
|
|
||||||
public static class AuthInfo {
|
public static class AuthInfo {
|
||||||
|
|
||||||
private final Map<String, Authentication> authentications = new LinkedHashMap<>();
|
protected final Map<String, Authentication> authentications = new LinkedHashMap<>();
|
||||||
|
|
||||||
public void addPetstoreAuthAuthentication(String accessToken) {
|
public void addPetstoreAuthAuthentication(String accessToken) {
|
||||||
OAuth auth = new OAuth();
|
OAuth auth = new OAuth();
|
||||||
|
@ -54,21 +54,21 @@ import static java.util.stream.Collectors.toMap;
|
|||||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
||||||
public class ApiClient extends JavaTimeFormatter {
|
public class ApiClient extends JavaTimeFormatter {
|
||||||
|
|
||||||
private static final Pattern CONTENT_DISPOSITION_PATTERN = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?");
|
protected static final Pattern CONTENT_DISPOSITION_PATTERN = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?");
|
||||||
private static final OpenOptions FILE_DOWNLOAD_OPTIONS = new OpenOptions().setCreate(true).setTruncateExisting(true);
|
protected static final OpenOptions FILE_DOWNLOAD_OPTIONS = new OpenOptions().setCreate(true).setTruncateExisting(true);
|
||||||
|
|
||||||
private final Vertx vertx;
|
protected final Vertx vertx;
|
||||||
private final JsonObject config;
|
protected final JsonObject config;
|
||||||
private final String identifier;
|
protected final String identifier;
|
||||||
|
|
||||||
private MultiMap defaultHeaders = MultiMap.caseInsensitiveMultiMap();
|
protected MultiMap defaultHeaders = MultiMap.caseInsensitiveMultiMap();
|
||||||
private MultiMap defaultCookies = MultiMap.caseInsensitiveMultiMap();
|
protected MultiMap defaultCookies = MultiMap.caseInsensitiveMultiMap();
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
private String basePath = "http://petstore.swagger.io:80/v2";
|
protected String basePath = "http://petstore.swagger.io:80/v2";
|
||||||
private DateFormat dateFormat;
|
protected DateFormat dateFormat;
|
||||||
private ObjectMapper objectMapper;
|
protected ObjectMapper objectMapper;
|
||||||
private String downloadsDir = "";
|
protected String downloadsDir = "";
|
||||||
private int timeout = -1;
|
protected int timeout = -1;
|
||||||
|
|
||||||
public ApiClient(Vertx vertx, JsonObject config) {
|
public ApiClient(Vertx vertx, JsonObject config) {
|
||||||
Objects.requireNonNull(vertx, "Vertx must not be null");
|
Objects.requireNonNull(vertx, "Vertx must not be null");
|
||||||
@ -387,7 +387,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
* @param mime MIME
|
* @param mime MIME
|
||||||
* @return True if the MIME type is JSON
|
* @return True if the MIME type is JSON
|
||||||
*/
|
*/
|
||||||
private boolean isJsonMime(String mime) {
|
protected boolean isJsonMime(String mime) {
|
||||||
String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$";
|
String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$";
|
||||||
return mime != null && (mime.matches(jsonMime) || mime.equalsIgnoreCase("application/json-patch+json"));
|
return mime != null && (mime.matches(jsonMime) || mime.equalsIgnoreCase("application/json-patch+json"));
|
||||||
}
|
}
|
||||||
@ -525,7 +525,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String buildCookieHeader(MultiMap cookies) {
|
protected String buildCookieHeader(MultiMap cookies) {
|
||||||
final StringBuilder cookieValue = new StringBuilder();
|
final StringBuilder cookieValue = new StringBuilder();
|
||||||
String delimiter = "";
|
String delimiter = "";
|
||||||
for (final Map.Entry<String, String> entry : cookies.entries()) {
|
for (final Map.Entry<String, String> entry : cookies.entries()) {
|
||||||
@ -682,7 +682,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
|
|
||||||
public static class AuthInfo {
|
public static class AuthInfo {
|
||||||
|
|
||||||
private final Map<String, Authentication> authentications = new LinkedHashMap<>();
|
protected final Map<String, Authentication> authentications = new LinkedHashMap<>();
|
||||||
|
|
||||||
public void addPetstoreAuthAuthentication(String accessToken) {
|
public void addPetstoreAuthAuthentication(String accessToken) {
|
||||||
OAuth auth = new OAuth();
|
OAuth auth = new OAuth();
|
||||||
|
@ -85,28 +85,28 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
public enum CollectionFormat {
|
public enum CollectionFormat {
|
||||||
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
||||||
|
|
||||||
private final String separator;
|
protected final String separator;
|
||||||
private CollectionFormat(String separator) {
|
CollectionFormat(String separator) {
|
||||||
this.separator = separator;
|
this.separator = separator;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String collectionToString(Collection<?> collection) {
|
protected String collectionToString(Collection<?> collection) {
|
||||||
return StringUtils.collectionToDelimitedString(collection, separator);
|
return StringUtils.collectionToDelimitedString(collection, separator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String URI_TEMPLATE_ATTRIBUTE = WebClient.class.getName() + ".uriTemplate";
|
protected static final String URI_TEMPLATE_ATTRIBUTE = WebClient.class.getName() + ".uriTemplate";
|
||||||
|
|
||||||
private HttpHeaders defaultHeaders = new HttpHeaders();
|
protected HttpHeaders defaultHeaders = new HttpHeaders();
|
||||||
private MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<String, String>();
|
protected MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<String, String>();
|
||||||
|
|
||||||
private String basePath = "http://petstore.swagger.io:80/v2";
|
protected String basePath = "http://petstore.swagger.io:80/v2";
|
||||||
|
|
||||||
private final WebClient webClient;
|
protected final WebClient webClient;
|
||||||
private final DateFormat dateFormat;
|
protected final DateFormat dateFormat;
|
||||||
private final ObjectMapper objectMapper;
|
protected final ObjectMapper objectMapper;
|
||||||
|
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
|
|
||||||
public ApiClient() {
|
public ApiClient() {
|
||||||
@ -128,7 +128,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
this(Optional.ofNullable(webClient).orElseGet(() -> buildWebClient(mapper.copy())), format);
|
this(Optional.ofNullable(webClient).orElseGet(() -> buildWebClient(mapper.copy())), format);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ApiClient(WebClient webClient, DateFormat format) {
|
protected ApiClient(WebClient webClient, DateFormat format) {
|
||||||
this.webClient = webClient;
|
this.webClient = webClient;
|
||||||
this.dateFormat = format;
|
this.dateFormat = format;
|
||||||
this.objectMapper = createDefaultObjectMapper(format);
|
this.objectMapper = createDefaultObjectMapper(format);
|
||||||
@ -624,7 +624,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
* @param uriParams The path parameters
|
* @param uriParams The path parameters
|
||||||
* return templatized query string
|
* return templatized query string
|
||||||
*/
|
*/
|
||||||
private String generateQueryUri(MultiValueMap<String, String> queryParams, Map<String, Object> uriParams) {
|
protected String generateQueryUri(MultiValueMap<String, String> queryParams, Map<String, Object> uriParams) {
|
||||||
StringBuilder queryBuilder = new StringBuilder();
|
StringBuilder queryBuilder = new StringBuilder();
|
||||||
queryParams.forEach((name, values) -> {
|
queryParams.forEach((name, values) -> {
|
||||||
if (CollectionUtils.isEmpty(values)) {
|
if (CollectionUtils.isEmpty(values)) {
|
||||||
@ -650,7 +650,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return queryBuilder.toString();
|
return queryBuilder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private WebClient.RequestBodySpec prepareRequest(String path, HttpMethod method, Map<String, Object> pathParams,
|
protected WebClient.RequestBodySpec prepareRequest(String path, HttpMethod method, Map<String, Object> pathParams,
|
||||||
MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams,
|
MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams,
|
||||||
MultiValueMap<String, String> cookieParams, MultiValueMap<String, Object> formParams, List<MediaType> accept,
|
MultiValueMap<String, String> cookieParams, MultiValueMap<String, Object> formParams, List<MediaType> accept,
|
||||||
MediaType contentType, String[] authNames) {
|
MediaType contentType, String[] authNames) {
|
||||||
|
@ -84,28 +84,28 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
public enum CollectionFormat {
|
public enum CollectionFormat {
|
||||||
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
||||||
|
|
||||||
private final String separator;
|
protected final String separator;
|
||||||
private CollectionFormat(String separator) {
|
CollectionFormat(String separator) {
|
||||||
this.separator = separator;
|
this.separator = separator;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String collectionToString(Collection<?> collection) {
|
protected String collectionToString(Collection<?> collection) {
|
||||||
return StringUtils.collectionToDelimitedString(collection, separator);
|
return StringUtils.collectionToDelimitedString(collection, separator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String URI_TEMPLATE_ATTRIBUTE = WebClient.class.getName() + ".uriTemplate";
|
protected static final String URI_TEMPLATE_ATTRIBUTE = WebClient.class.getName() + ".uriTemplate";
|
||||||
|
|
||||||
private HttpHeaders defaultHeaders = new HttpHeaders();
|
protected HttpHeaders defaultHeaders = new HttpHeaders();
|
||||||
private MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<String, String>();
|
protected MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<String, String>();
|
||||||
|
|
||||||
private String basePath = "http://localhost";
|
protected String basePath = "http://localhost";
|
||||||
|
|
||||||
private final WebClient webClient;
|
protected final WebClient webClient;
|
||||||
private final DateFormat dateFormat;
|
protected final DateFormat dateFormat;
|
||||||
private final ObjectMapper objectMapper;
|
protected final ObjectMapper objectMapper;
|
||||||
|
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
|
|
||||||
public ApiClient() {
|
public ApiClient() {
|
||||||
@ -127,7 +127,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
this(Optional.ofNullable(webClient).orElseGet(() -> buildWebClient(mapper.copy())), format);
|
this(Optional.ofNullable(webClient).orElseGet(() -> buildWebClient(mapper.copy())), format);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ApiClient(WebClient webClient, DateFormat format) {
|
protected ApiClient(WebClient webClient, DateFormat format) {
|
||||||
this.webClient = webClient;
|
this.webClient = webClient;
|
||||||
this.dateFormat = format;
|
this.dateFormat = format;
|
||||||
this.objectMapper = createDefaultObjectMapper(format);
|
this.objectMapper = createDefaultObjectMapper(format);
|
||||||
@ -604,7 +604,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
* @param uriParams The path parameters
|
* @param uriParams The path parameters
|
||||||
* return templatized query string
|
* return templatized query string
|
||||||
*/
|
*/
|
||||||
private String generateQueryUri(MultiValueMap<String, String> queryParams, Map<String, Object> uriParams) {
|
protected String generateQueryUri(MultiValueMap<String, String> queryParams, Map<String, Object> uriParams) {
|
||||||
StringBuilder queryBuilder = new StringBuilder();
|
StringBuilder queryBuilder = new StringBuilder();
|
||||||
queryParams.forEach((name, values) -> {
|
queryParams.forEach((name, values) -> {
|
||||||
if (CollectionUtils.isEmpty(values)) {
|
if (CollectionUtils.isEmpty(values)) {
|
||||||
@ -630,7 +630,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return queryBuilder.toString();
|
return queryBuilder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private WebClient.RequestBodySpec prepareRequest(String path, HttpMethod method, Map<String, Object> pathParams,
|
protected WebClient.RequestBodySpec prepareRequest(String path, HttpMethod method, Map<String, Object> pathParams,
|
||||||
MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams,
|
MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams,
|
||||||
MultiValueMap<String, String> cookieParams, MultiValueMap<String, Object> formParams, List<MediaType> accept,
|
MultiValueMap<String, String> cookieParams, MultiValueMap<String, Object> formParams, List<MediaType> accept,
|
||||||
MediaType contentType, String[] authNames) {
|
MediaType contentType, String[] authNames) {
|
||||||
|
@ -85,28 +85,28 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
public enum CollectionFormat {
|
public enum CollectionFormat {
|
||||||
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
||||||
|
|
||||||
private final String separator;
|
protected final String separator;
|
||||||
private CollectionFormat(String separator) {
|
CollectionFormat(String separator) {
|
||||||
this.separator = separator;
|
this.separator = separator;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String collectionToString(Collection<?> collection) {
|
protected String collectionToString(Collection<?> collection) {
|
||||||
return StringUtils.collectionToDelimitedString(collection, separator);
|
return StringUtils.collectionToDelimitedString(collection, separator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String URI_TEMPLATE_ATTRIBUTE = WebClient.class.getName() + ".uriTemplate";
|
protected static final String URI_TEMPLATE_ATTRIBUTE = WebClient.class.getName() + ".uriTemplate";
|
||||||
|
|
||||||
private HttpHeaders defaultHeaders = new HttpHeaders();
|
protected HttpHeaders defaultHeaders = new HttpHeaders();
|
||||||
private MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<String, String>();
|
protected MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<String, String>();
|
||||||
|
|
||||||
private String basePath = "http://petstore.swagger.io:80/v2";
|
protected String basePath = "http://petstore.swagger.io:80/v2";
|
||||||
|
|
||||||
private final WebClient webClient;
|
protected final WebClient webClient;
|
||||||
private final DateFormat dateFormat;
|
protected final DateFormat dateFormat;
|
||||||
private final ObjectMapper objectMapper;
|
protected final ObjectMapper objectMapper;
|
||||||
|
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
|
|
||||||
public ApiClient() {
|
public ApiClient() {
|
||||||
@ -128,7 +128,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
this(Optional.ofNullable(webClient).orElseGet(() -> buildWebClient(mapper.copy())), format);
|
this(Optional.ofNullable(webClient).orElseGet(() -> buildWebClient(mapper.copy())), format);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ApiClient(WebClient webClient, DateFormat format) {
|
protected ApiClient(WebClient webClient, DateFormat format) {
|
||||||
this.webClient = webClient;
|
this.webClient = webClient;
|
||||||
this.dateFormat = format;
|
this.dateFormat = format;
|
||||||
this.objectMapper = createDefaultObjectMapper(format);
|
this.objectMapper = createDefaultObjectMapper(format);
|
||||||
@ -624,7 +624,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
* @param uriParams The path parameters
|
* @param uriParams The path parameters
|
||||||
* return templatized query string
|
* return templatized query string
|
||||||
*/
|
*/
|
||||||
private String generateQueryUri(MultiValueMap<String, String> queryParams, Map<String, Object> uriParams) {
|
protected String generateQueryUri(MultiValueMap<String, String> queryParams, Map<String, Object> uriParams) {
|
||||||
StringBuilder queryBuilder = new StringBuilder();
|
StringBuilder queryBuilder = new StringBuilder();
|
||||||
queryParams.forEach((name, values) -> {
|
queryParams.forEach((name, values) -> {
|
||||||
if (CollectionUtils.isEmpty(values)) {
|
if (CollectionUtils.isEmpty(values)) {
|
||||||
@ -650,7 +650,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return queryBuilder.toString();
|
return queryBuilder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private WebClient.RequestBodySpec prepareRequest(String path, HttpMethod method, Map<String, Object> pathParams,
|
protected WebClient.RequestBodySpec prepareRequest(String path, HttpMethod method, Map<String, Object> pathParams,
|
||||||
MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams,
|
MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams,
|
||||||
MultiValueMap<String, String> cookieParams, MultiValueMap<String, Object> formParams, List<MediaType> accept,
|
MultiValueMap<String, String> cookieParams, MultiValueMap<String, Object> formParams, List<MediaType> accept,
|
||||||
MediaType contentType, String[] authNames) {
|
MediaType contentType, String[] authNames) {
|
||||||
|
@ -85,28 +85,28 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
public enum CollectionFormat {
|
public enum CollectionFormat {
|
||||||
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
||||||
|
|
||||||
private final String separator;
|
protected final String separator;
|
||||||
private CollectionFormat(String separator) {
|
CollectionFormat(String separator) {
|
||||||
this.separator = separator;
|
this.separator = separator;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String collectionToString(Collection<?> collection) {
|
protected String collectionToString(Collection<?> collection) {
|
||||||
return StringUtils.collectionToDelimitedString(collection, separator);
|
return StringUtils.collectionToDelimitedString(collection, separator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String URI_TEMPLATE_ATTRIBUTE = WebClient.class.getName() + ".uriTemplate";
|
protected static final String URI_TEMPLATE_ATTRIBUTE = WebClient.class.getName() + ".uriTemplate";
|
||||||
|
|
||||||
private HttpHeaders defaultHeaders = new HttpHeaders();
|
protected HttpHeaders defaultHeaders = new HttpHeaders();
|
||||||
private MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<String, String>();
|
protected MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<String, String>();
|
||||||
|
|
||||||
private String basePath = "http://petstore.swagger.io:80/v2";
|
protected String basePath = "http://petstore.swagger.io:80/v2";
|
||||||
|
|
||||||
private final WebClient webClient;
|
protected final WebClient webClient;
|
||||||
private final DateFormat dateFormat;
|
protected final DateFormat dateFormat;
|
||||||
private final ObjectMapper objectMapper;
|
protected final ObjectMapper objectMapper;
|
||||||
|
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
|
|
||||||
public ApiClient() {
|
public ApiClient() {
|
||||||
@ -128,7 +128,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
this(Optional.ofNullable(webClient).orElseGet(() -> buildWebClient(mapper.copy())), format);
|
this(Optional.ofNullable(webClient).orElseGet(() -> buildWebClient(mapper.copy())), format);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ApiClient(WebClient webClient, DateFormat format) {
|
protected ApiClient(WebClient webClient, DateFormat format) {
|
||||||
this.webClient = webClient;
|
this.webClient = webClient;
|
||||||
this.dateFormat = format;
|
this.dateFormat = format;
|
||||||
this.objectMapper = createDefaultObjectMapper(format);
|
this.objectMapper = createDefaultObjectMapper(format);
|
||||||
@ -624,7 +624,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
* @param uriParams The path parameters
|
* @param uriParams The path parameters
|
||||||
* return templatized query string
|
* return templatized query string
|
||||||
*/
|
*/
|
||||||
private String generateQueryUri(MultiValueMap<String, String> queryParams, Map<String, Object> uriParams) {
|
protected String generateQueryUri(MultiValueMap<String, String> queryParams, Map<String, Object> uriParams) {
|
||||||
StringBuilder queryBuilder = new StringBuilder();
|
StringBuilder queryBuilder = new StringBuilder();
|
||||||
queryParams.forEach((name, values) -> {
|
queryParams.forEach((name, values) -> {
|
||||||
if (CollectionUtils.isEmpty(values)) {
|
if (CollectionUtils.isEmpty(values)) {
|
||||||
@ -650,7 +650,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return queryBuilder.toString();
|
return queryBuilder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private WebClient.RequestBodySpec prepareRequest(String path, HttpMethod method, Map<String, Object> pathParams,
|
protected WebClient.RequestBodySpec prepareRequest(String path, HttpMethod method, Map<String, Object> pathParams,
|
||||||
MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams,
|
MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams,
|
||||||
MultiValueMap<String, String> cookieParams, MultiValueMap<String, Object> formParams, List<MediaType> accept,
|
MultiValueMap<String, String> cookieParams, MultiValueMap<String, Object> formParams, List<MediaType> accept,
|
||||||
MediaType contentType, String[] authNames) {
|
MediaType contentType, String[] authNames) {
|
||||||
|
@ -85,28 +85,28 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
public enum CollectionFormat {
|
public enum CollectionFormat {
|
||||||
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
||||||
|
|
||||||
private final String separator;
|
protected final String separator;
|
||||||
private CollectionFormat(String separator) {
|
CollectionFormat(String separator) {
|
||||||
this.separator = separator;
|
this.separator = separator;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String collectionToString(Collection<?> collection) {
|
protected String collectionToString(Collection<?> collection) {
|
||||||
return StringUtils.collectionToDelimitedString(collection, separator);
|
return StringUtils.collectionToDelimitedString(collection, separator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String URI_TEMPLATE_ATTRIBUTE = WebClient.class.getName() + ".uriTemplate";
|
protected static final String URI_TEMPLATE_ATTRIBUTE = WebClient.class.getName() + ".uriTemplate";
|
||||||
|
|
||||||
private HttpHeaders defaultHeaders = new HttpHeaders();
|
protected HttpHeaders defaultHeaders = new HttpHeaders();
|
||||||
private MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<String, String>();
|
protected MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<String, String>();
|
||||||
|
|
||||||
private String basePath = "http://petstore.swagger.io:80/v2";
|
protected String basePath = "http://petstore.swagger.io:80/v2";
|
||||||
|
|
||||||
private final WebClient webClient;
|
protected final WebClient webClient;
|
||||||
private final DateFormat dateFormat;
|
protected final DateFormat dateFormat;
|
||||||
private final ObjectMapper objectMapper;
|
protected final ObjectMapper objectMapper;
|
||||||
|
|
||||||
private Map<String, Authentication> authentications;
|
protected Map<String, Authentication> authentications;
|
||||||
|
|
||||||
|
|
||||||
public ApiClient() {
|
public ApiClient() {
|
||||||
@ -128,7 +128,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
this(Optional.ofNullable(webClient).orElseGet(() -> buildWebClient(mapper.copy())), format);
|
this(Optional.ofNullable(webClient).orElseGet(() -> buildWebClient(mapper.copy())), format);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ApiClient(WebClient webClient, DateFormat format) {
|
protected ApiClient(WebClient webClient, DateFormat format) {
|
||||||
this.webClient = webClient;
|
this.webClient = webClient;
|
||||||
this.dateFormat = format;
|
this.dateFormat = format;
|
||||||
this.objectMapper = createDefaultObjectMapper(format);
|
this.objectMapper = createDefaultObjectMapper(format);
|
||||||
@ -624,7 +624,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
* @param uriParams The path parameters
|
* @param uriParams The path parameters
|
||||||
* return templatized query string
|
* return templatized query string
|
||||||
*/
|
*/
|
||||||
private String generateQueryUri(MultiValueMap<String, String> queryParams, Map<String, Object> uriParams) {
|
protected String generateQueryUri(MultiValueMap<String, String> queryParams, Map<String, Object> uriParams) {
|
||||||
StringBuilder queryBuilder = new StringBuilder();
|
StringBuilder queryBuilder = new StringBuilder();
|
||||||
queryParams.forEach((name, values) -> {
|
queryParams.forEach((name, values) -> {
|
||||||
if (CollectionUtils.isEmpty(values)) {
|
if (CollectionUtils.isEmpty(values)) {
|
||||||
@ -650,7 +650,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return queryBuilder.toString();
|
return queryBuilder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private WebClient.RequestBodySpec prepareRequest(String path, HttpMethod method, Map<String, Object> pathParams,
|
protected WebClient.RequestBodySpec prepareRequest(String path, HttpMethod method, Map<String, Object> pathParams,
|
||||||
MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams,
|
MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams,
|
||||||
MultiValueMap<String, String> cookieParams, MultiValueMap<String, Object> formParams, List<MediaType> accept,
|
MultiValueMap<String, String> cookieParams, MultiValueMap<String, Object> formParams, List<MediaType> accept,
|
||||||
MediaType contentType, String[] authNames) {
|
MediaType contentType, String[] authNames) {
|
||||||
|
@ -85,13 +85,13 @@ import org.openapitools.client.auth.ApiKeyAuth;
|
|||||||
*/
|
*/
|
||||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
||||||
public class ApiClient extends JavaTimeFormatter {
|
public class ApiClient extends JavaTimeFormatter {
|
||||||
private static final Pattern JSON_MIME_PATTERN = Pattern.compile("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
|
protected static final Pattern JSON_MIME_PATTERN = Pattern.compile("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
|
||||||
|
|
||||||
protected Map<String, String> defaultHeaderMap = new HashMap<>();
|
protected Map<String, String> defaultHeaderMap = new HashMap<>();
|
||||||
protected Map<String, String> defaultCookieMap = new HashMap<>();
|
protected Map<String, String> defaultCookieMap = new HashMap<>();
|
||||||
protected String basePath = "http://petstore.swagger.io:80/v2";
|
protected String basePath = "http://petstore.swagger.io:80/v2";
|
||||||
protected String userAgent;
|
protected String userAgent;
|
||||||
private static final Logger log = Logger.getLogger(ApiClient.class.getName());
|
protected static final Logger log = Logger.getLogger(ApiClient.class.getName());
|
||||||
|
|
||||||
protected List<ServerConfiguration> servers = new ArrayList<>(Arrays.asList(
|
protected List<ServerConfiguration> servers = new ArrayList<>(Arrays.asList(
|
||||||
new ServerConfiguration(
|
new ServerConfiguration(
|
||||||
@ -140,7 +140,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
protected boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
protected ClientConfig clientConfig;
|
protected ClientConfig clientConfig;
|
||||||
protected int connectionTimeout = 0;
|
protected int connectionTimeout = 0;
|
||||||
private int readTimeout = 0;
|
protected int readTimeout = 0;
|
||||||
|
|
||||||
protected Client httpClient;
|
protected Client httpClient;
|
||||||
protected JSON json;
|
protected JSON json;
|
||||||
@ -311,7 +311,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateBasePath() {
|
protected void updateBasePath() {
|
||||||
if (serverIndex != null) {
|
if (serverIndex != null) {
|
||||||
setBasePath(servers.get(serverIndex).URL(serverVariables));
|
setBasePath(servers.get(serverIndex).URL(serverVariables));
|
||||||
}
|
}
|
||||||
@ -857,7 +857,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
* @param key Key of the object
|
* @param key Key of the object
|
||||||
* @param multiPart MultiPart to add the form param to
|
* @param multiPart MultiPart to add the form param to
|
||||||
*/
|
*/
|
||||||
private void addParamToMultipart(Object value, String key, MultiPart multiPart) {
|
protected void addParamToMultipart(Object value, String key, MultiPart multiPart) {
|
||||||
if (value instanceof File) {
|
if (value instanceof File) {
|
||||||
File file = (File) value;
|
File file = (File) value;
|
||||||
FormDataContentDisposition contentDisp = FormDataContentDisposition.name(key)
|
FormDataContentDisposition contentDisp = FormDataContentDisposition.name(key)
|
||||||
@ -1155,7 +1155,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Response sendRequest(String method, Invocation.Builder invocationBuilder, Entity<?> entity) {
|
protected Response sendRequest(String method, Invocation.Builder invocationBuilder, Entity<?> entity) {
|
||||||
Response response;
|
Response response;
|
||||||
if ("POST".equals(method)) {
|
if ("POST".equals(method)) {
|
||||||
response = invocationBuilder.post(entity);
|
response = invocationBuilder.post(entity);
|
||||||
@ -1217,7 +1217,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return clientConfig;
|
return clientConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyDebugSetting(ClientConfig clientConfig) {
|
protected void applyDebugSetting(ClientConfig clientConfig) {
|
||||||
if (debugging) {
|
if (debugging) {
|
||||||
clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */));
|
clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */));
|
||||||
clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY);
|
clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY);
|
||||||
|
@ -85,13 +85,13 @@ import org.openapitools.client.auth.ApiKeyAuth;
|
|||||||
*/
|
*/
|
||||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
||||||
public class ApiClient extends JavaTimeFormatter {
|
public class ApiClient extends JavaTimeFormatter {
|
||||||
private static final Pattern JSON_MIME_PATTERN = Pattern.compile("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
|
protected static final Pattern JSON_MIME_PATTERN = Pattern.compile("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
|
||||||
|
|
||||||
protected Map<String, String> defaultHeaderMap = new HashMap<>();
|
protected Map<String, String> defaultHeaderMap = new HashMap<>();
|
||||||
protected Map<String, String> defaultCookieMap = new HashMap<>();
|
protected Map<String, String> defaultCookieMap = new HashMap<>();
|
||||||
protected String basePath = "http://localhost";
|
protected String basePath = "http://localhost";
|
||||||
protected String userAgent;
|
protected String userAgent;
|
||||||
private static final Logger log = Logger.getLogger(ApiClient.class.getName());
|
protected static final Logger log = Logger.getLogger(ApiClient.class.getName());
|
||||||
|
|
||||||
protected List<ServerConfiguration> servers = new ArrayList<>(Arrays.asList(
|
protected List<ServerConfiguration> servers = new ArrayList<>(Arrays.asList(
|
||||||
new ServerConfiguration(
|
new ServerConfiguration(
|
||||||
@ -108,7 +108,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
protected boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
protected ClientConfig clientConfig;
|
protected ClientConfig clientConfig;
|
||||||
protected int connectionTimeout = 0;
|
protected int connectionTimeout = 0;
|
||||||
private int readTimeout = 0;
|
protected int readTimeout = 0;
|
||||||
|
|
||||||
protected Client httpClient;
|
protected Client httpClient;
|
||||||
protected JSON json;
|
protected JSON json;
|
||||||
@ -262,7 +262,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateBasePath() {
|
protected void updateBasePath() {
|
||||||
if (serverIndex != null) {
|
if (serverIndex != null) {
|
||||||
setBasePath(servers.get(serverIndex).URL(serverVariables));
|
setBasePath(servers.get(serverIndex).URL(serverVariables));
|
||||||
}
|
}
|
||||||
@ -808,7 +808,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
* @param key Key of the object
|
* @param key Key of the object
|
||||||
* @param multiPart MultiPart to add the form param to
|
* @param multiPart MultiPart to add the form param to
|
||||||
*/
|
*/
|
||||||
private void addParamToMultipart(Object value, String key, MultiPart multiPart) {
|
protected void addParamToMultipart(Object value, String key, MultiPart multiPart) {
|
||||||
if (value instanceof File) {
|
if (value instanceof File) {
|
||||||
File file = (File) value;
|
File file = (File) value;
|
||||||
FormDataContentDisposition contentDisp = FormDataContentDisposition.name(key)
|
FormDataContentDisposition contentDisp = FormDataContentDisposition.name(key)
|
||||||
@ -1106,7 +1106,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Response sendRequest(String method, Invocation.Builder invocationBuilder, Entity<?> entity) {
|
protected Response sendRequest(String method, Invocation.Builder invocationBuilder, Entity<?> entity) {
|
||||||
Response response;
|
Response response;
|
||||||
if ("POST".equals(method)) {
|
if ("POST".equals(method)) {
|
||||||
response = invocationBuilder.post(entity);
|
response = invocationBuilder.post(entity);
|
||||||
@ -1168,7 +1168,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return clientConfig;
|
return clientConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyDebugSetting(ClientConfig clientConfig) {
|
protected void applyDebugSetting(ClientConfig clientConfig) {
|
||||||
if (debugging) {
|
if (debugging) {
|
||||||
clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */));
|
clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */));
|
||||||
clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY);
|
clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY);
|
||||||
|
@ -87,13 +87,13 @@ import org.openapitools.client.auth.OAuth;
|
|||||||
*/
|
*/
|
||||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
||||||
public class ApiClient extends JavaTimeFormatter {
|
public class ApiClient extends JavaTimeFormatter {
|
||||||
private static final Pattern JSON_MIME_PATTERN = Pattern.compile("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
|
protected static final Pattern JSON_MIME_PATTERN = Pattern.compile("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
|
||||||
|
|
||||||
protected Map<String, String> defaultHeaderMap = new HashMap<>();
|
protected Map<String, String> defaultHeaderMap = new HashMap<>();
|
||||||
protected Map<String, String> defaultCookieMap = new HashMap<>();
|
protected Map<String, String> defaultCookieMap = new HashMap<>();
|
||||||
protected String basePath = "http://petstore.swagger.io/v2";
|
protected String basePath = "http://petstore.swagger.io/v2";
|
||||||
protected String userAgent;
|
protected String userAgent;
|
||||||
private static final Logger log = Logger.getLogger(ApiClient.class.getName());
|
protected static final Logger log = Logger.getLogger(ApiClient.class.getName());
|
||||||
|
|
||||||
protected List<ServerConfiguration> servers = new ArrayList<>(Arrays.asList(
|
protected List<ServerConfiguration> servers = new ArrayList<>(Arrays.asList(
|
||||||
new ServerConfiguration(
|
new ServerConfiguration(
|
||||||
@ -110,7 +110,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
protected boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
protected ClientConfig clientConfig;
|
protected ClientConfig clientConfig;
|
||||||
protected int connectionTimeout = 0;
|
protected int connectionTimeout = 0;
|
||||||
private int readTimeout = 0;
|
protected int readTimeout = 0;
|
||||||
|
|
||||||
protected Client httpClient;
|
protected Client httpClient;
|
||||||
protected JSON json;
|
protected JSON json;
|
||||||
@ -281,13 +281,13 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateBasePath() {
|
protected void updateBasePath() {
|
||||||
if (serverIndex != null) {
|
if (serverIndex != null) {
|
||||||
setBasePath(servers.get(serverIndex).URL(serverVariables));
|
setBasePath(servers.get(serverIndex).URL(serverVariables));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setOauthBasePath(String basePath) {
|
protected void setOauthBasePath(String basePath) {
|
||||||
for(Authentication auth : authentications.values()) {
|
for(Authentication auth : authentications.values()) {
|
||||||
if (auth instanceof OAuth) {
|
if (auth instanceof OAuth) {
|
||||||
((OAuth) auth).setBasePath(basePath);
|
((OAuth) auth).setBasePath(basePath);
|
||||||
@ -933,7 +933,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
* @param key Key of the object
|
* @param key Key of the object
|
||||||
* @param multiPart MultiPart to add the form param to
|
* @param multiPart MultiPart to add the form param to
|
||||||
*/
|
*/
|
||||||
private void addParamToMultipart(Object value, String key, MultiPart multiPart) {
|
protected void addParamToMultipart(Object value, String key, MultiPart multiPart) {
|
||||||
if (value instanceof File) {
|
if (value instanceof File) {
|
||||||
File file = (File) value;
|
File file = (File) value;
|
||||||
FormDataContentDisposition contentDisp = FormDataContentDisposition.name(key)
|
FormDataContentDisposition contentDisp = FormDataContentDisposition.name(key)
|
||||||
@ -1247,7 +1247,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Response sendRequest(String method, Invocation.Builder invocationBuilder, Entity<?> entity) {
|
protected Response sendRequest(String method, Invocation.Builder invocationBuilder, Entity<?> entity) {
|
||||||
Response response;
|
Response response;
|
||||||
if ("POST".equals(method)) {
|
if ("POST".equals(method)) {
|
||||||
response = invocationBuilder.post(entity);
|
response = invocationBuilder.post(entity);
|
||||||
@ -1309,7 +1309,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return clientConfig;
|
return clientConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyDebugSetting(ClientConfig clientConfig) {
|
protected void applyDebugSetting(ClientConfig clientConfig) {
|
||||||
if (debugging) {
|
if (debugging) {
|
||||||
clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */));
|
clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */));
|
||||||
clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY);
|
clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY);
|
||||||
|
@ -87,13 +87,13 @@ import org.openapitools.client.auth.OAuth;
|
|||||||
*/
|
*/
|
||||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
||||||
public class ApiClient extends JavaTimeFormatter {
|
public class ApiClient extends JavaTimeFormatter {
|
||||||
private static final Pattern JSON_MIME_PATTERN = Pattern.compile("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
|
protected static final Pattern JSON_MIME_PATTERN = Pattern.compile("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
|
||||||
|
|
||||||
protected Map<String, String> defaultHeaderMap = new HashMap<>();
|
protected Map<String, String> defaultHeaderMap = new HashMap<>();
|
||||||
protected Map<String, String> defaultCookieMap = new HashMap<>();
|
protected Map<String, String> defaultCookieMap = new HashMap<>();
|
||||||
protected String basePath = "http://petstore.swagger.io/v2";
|
protected String basePath = "http://petstore.swagger.io/v2";
|
||||||
protected String userAgent;
|
protected String userAgent;
|
||||||
private static final Logger log = Logger.getLogger(ApiClient.class.getName());
|
protected static final Logger log = Logger.getLogger(ApiClient.class.getName());
|
||||||
|
|
||||||
protected List<ServerConfiguration> servers = new ArrayList<>(Arrays.asList(
|
protected List<ServerConfiguration> servers = new ArrayList<>(Arrays.asList(
|
||||||
new ServerConfiguration(
|
new ServerConfiguration(
|
||||||
@ -110,7 +110,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
protected boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
protected ClientConfig clientConfig;
|
protected ClientConfig clientConfig;
|
||||||
protected int connectionTimeout = 0;
|
protected int connectionTimeout = 0;
|
||||||
private int readTimeout = 0;
|
protected int readTimeout = 0;
|
||||||
|
|
||||||
protected Client httpClient;
|
protected Client httpClient;
|
||||||
protected JSON json;
|
protected JSON json;
|
||||||
@ -281,13 +281,13 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateBasePath() {
|
protected void updateBasePath() {
|
||||||
if (serverIndex != null) {
|
if (serverIndex != null) {
|
||||||
setBasePath(servers.get(serverIndex).URL(serverVariables));
|
setBasePath(servers.get(serverIndex).URL(serverVariables));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setOauthBasePath(String basePath) {
|
protected void setOauthBasePath(String basePath) {
|
||||||
for(Authentication auth : authentications.values()) {
|
for(Authentication auth : authentications.values()) {
|
||||||
if (auth instanceof OAuth) {
|
if (auth instanceof OAuth) {
|
||||||
((OAuth) auth).setBasePath(basePath);
|
((OAuth) auth).setBasePath(basePath);
|
||||||
@ -933,7 +933,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
* @param key Key of the object
|
* @param key Key of the object
|
||||||
* @param multiPart MultiPart to add the form param to
|
* @param multiPart MultiPart to add the form param to
|
||||||
*/
|
*/
|
||||||
private void addParamToMultipart(Object value, String key, MultiPart multiPart) {
|
protected void addParamToMultipart(Object value, String key, MultiPart multiPart) {
|
||||||
if (value instanceof File) {
|
if (value instanceof File) {
|
||||||
File file = (File) value;
|
File file = (File) value;
|
||||||
FormDataContentDisposition contentDisp = FormDataContentDisposition.name(key)
|
FormDataContentDisposition contentDisp = FormDataContentDisposition.name(key)
|
||||||
@ -1247,7 +1247,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Response sendRequest(String method, Invocation.Builder invocationBuilder, Entity<?> entity) {
|
protected Response sendRequest(String method, Invocation.Builder invocationBuilder, Entity<?> entity) {
|
||||||
Response response;
|
Response response;
|
||||||
if ("POST".equals(method)) {
|
if ("POST".equals(method)) {
|
||||||
response = invocationBuilder.post(entity);
|
response = invocationBuilder.post(entity);
|
||||||
@ -1309,7 +1309,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return clientConfig;
|
return clientConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyDebugSetting(ClientConfig clientConfig) {
|
protected void applyDebugSetting(ClientConfig clientConfig) {
|
||||||
if (debugging) {
|
if (debugging) {
|
||||||
clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */));
|
clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */));
|
||||||
clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY);
|
clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY);
|
||||||
|
@ -88,13 +88,13 @@ import org.openapitools.client.auth.OAuth;
|
|||||||
*/
|
*/
|
||||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
|
||||||
public class ApiClient extends JavaTimeFormatter {
|
public class ApiClient extends JavaTimeFormatter {
|
||||||
private static final Pattern JSON_MIME_PATTERN = Pattern.compile("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
|
protected static final Pattern JSON_MIME_PATTERN = Pattern.compile("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
|
||||||
|
|
||||||
protected Map<String, String> defaultHeaderMap = new HashMap<>();
|
protected Map<String, String> defaultHeaderMap = new HashMap<>();
|
||||||
protected Map<String, String> defaultCookieMap = new HashMap<>();
|
protected Map<String, String> defaultCookieMap = new HashMap<>();
|
||||||
protected String basePath = "http://petstore.swagger.io:80/v2";
|
protected String basePath = "http://petstore.swagger.io:80/v2";
|
||||||
protected String userAgent;
|
protected String userAgent;
|
||||||
private static final Logger log = Logger.getLogger(ApiClient.class.getName());
|
protected static final Logger log = Logger.getLogger(ApiClient.class.getName());
|
||||||
|
|
||||||
protected List<ServerConfiguration> servers = new ArrayList<>(Arrays.asList(
|
protected List<ServerConfiguration> servers = new ArrayList<>(Arrays.asList(
|
||||||
new ServerConfiguration(
|
new ServerConfiguration(
|
||||||
@ -178,7 +178,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
protected boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
protected ClientConfig clientConfig;
|
protected ClientConfig clientConfig;
|
||||||
protected int connectionTimeout = 0;
|
protected int connectionTimeout = 0;
|
||||||
private int readTimeout = 0;
|
protected int readTimeout = 0;
|
||||||
|
|
||||||
protected Client httpClient;
|
protected Client httpClient;
|
||||||
protected JSON json;
|
protected JSON json;
|
||||||
@ -379,13 +379,13 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateBasePath() {
|
protected void updateBasePath() {
|
||||||
if (serverIndex != null) {
|
if (serverIndex != null) {
|
||||||
setBasePath(servers.get(serverIndex).URL(serverVariables));
|
setBasePath(servers.get(serverIndex).URL(serverVariables));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setOauthBasePath(String basePath) {
|
protected void setOauthBasePath(String basePath) {
|
||||||
for(Authentication auth : authentications.values()) {
|
for(Authentication auth : authentications.values()) {
|
||||||
if (auth instanceof OAuth) {
|
if (auth instanceof OAuth) {
|
||||||
((OAuth) auth).setBasePath(basePath);
|
((OAuth) auth).setBasePath(basePath);
|
||||||
@ -1031,7 +1031,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
* @param key Key of the object
|
* @param key Key of the object
|
||||||
* @param multiPart MultiPart to add the form param to
|
* @param multiPart MultiPart to add the form param to
|
||||||
*/
|
*/
|
||||||
private void addParamToMultipart(Object value, String key, MultiPart multiPart) {
|
protected void addParamToMultipart(Object value, String key, MultiPart multiPart) {
|
||||||
if (value instanceof File) {
|
if (value instanceof File) {
|
||||||
File file = (File) value;
|
File file = (File) value;
|
||||||
FormDataContentDisposition contentDisp = FormDataContentDisposition.name(key)
|
FormDataContentDisposition contentDisp = FormDataContentDisposition.name(key)
|
||||||
@ -1345,7 +1345,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Response sendRequest(String method, Invocation.Builder invocationBuilder, Entity<?> entity) {
|
protected Response sendRequest(String method, Invocation.Builder invocationBuilder, Entity<?> entity) {
|
||||||
Response response;
|
Response response;
|
||||||
if ("POST".equals(method)) {
|
if ("POST".equals(method)) {
|
||||||
response = invocationBuilder.post(entity);
|
response = invocationBuilder.post(entity);
|
||||||
@ -1407,7 +1407,7 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
return clientConfig;
|
return clientConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyDebugSetting(ClientConfig clientConfig) {
|
protected void applyDebugSetting(ClientConfig clientConfig) {
|
||||||
if (debugging) {
|
if (debugging) {
|
||||||
clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */));
|
clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */));
|
||||||
clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY);
|
clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user