forked from loafle/openapi-generator-original
[java] Support templated servers (#4998)
* [java] Support templated servers * Deprecate old signature of invokeAPI method * throw ArrayIndexOutOfBoundsException * Update modules/openapi-generator/src/main/resources/Java/ServerConfiguration.mustache * [java] Regenerate samples Co-authored-by: Jim Schubert <james.schubert@gmail.com>
This commit is contained in:
parent
6cd3fc5429
commit
a09271e76d
@ -288,6 +288,8 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
|||||||
writeOptional(outputFolder, new SupportingFile("manifest.mustache", projectFolder, "AndroidManifest.xml"));
|
writeOptional(outputFolder, new SupportingFile("manifest.mustache", projectFolder, "AndroidManifest.xml"));
|
||||||
supportingFiles.add(new SupportingFile("travis.mustache", "", ".travis.yml"));
|
supportingFiles.add(new SupportingFile("travis.mustache", "", ".travis.yml"));
|
||||||
supportingFiles.add(new SupportingFile("ApiClient.mustache", invokerFolder, "ApiClient.java"));
|
supportingFiles.add(new SupportingFile("ApiClient.mustache", invokerFolder, "ApiClient.java"));
|
||||||
|
supportingFiles.add(new SupportingFile("ServerConfiguration.mustache", invokerFolder, "ServerConfiguration.java"));
|
||||||
|
supportingFiles.add(new SupportingFile("ServerVariable.mustache", invokerFolder, "ServerVariable.java"));
|
||||||
if (!(RESTTEMPLATE.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()) || NATIVE.equals(getLibrary()) || MICROPROFILE.equals(getLibrary()))) {
|
if (!(RESTTEMPLATE.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()) || NATIVE.equals(getLibrary()) || MICROPROFILE.equals(getLibrary()))) {
|
||||||
supportingFiles.add(new SupportingFile("StringUtil.mustache", invokerFolder, "StringUtil.java"));
|
supportingFiles.add(new SupportingFile("StringUtil.mustache", invokerFolder, "StringUtil.java"));
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,9 @@ import java.util.Collections;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
@ -63,6 +65,33 @@ public class ApiClient {
|
|||||||
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||||
private Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
private Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
||||||
private String basePath = "{{{basePath}}}";
|
private String basePath = "{{{basePath}}}";
|
||||||
|
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>({{#servers}}{{#-first}}Arrays.asList(
|
||||||
|
{{/-first}} new ServerConfiguration(
|
||||||
|
"{{{url}}}",
|
||||||
|
"{{{description}}}{{^description}}No description provided{{/description}}",
|
||||||
|
new HashMap<String, ServerVariable>(){{#variables}}{{#-first}} {{
|
||||||
|
{{/-first}} put("{{{name}}}", new ServerVariable(
|
||||||
|
"{{{description}}}{{^description}}No description provided{{/description}}",
|
||||||
|
"{{{defaultValue}}}",
|
||||||
|
new HashSet<String>(
|
||||||
|
{{#enumValues}}
|
||||||
|
{{#-first}}
|
||||||
|
Arrays.asList(
|
||||||
|
{{/-first}}
|
||||||
|
"{{{.}}}"{{^-last}},{{/-last}}
|
||||||
|
{{#-last}}
|
||||||
|
)
|
||||||
|
{{/-last}}
|
||||||
|
{{/enumValues}}
|
||||||
|
)
|
||||||
|
));
|
||||||
|
{{#-last}}
|
||||||
|
}}{{/-last}}{{/variables}}
|
||||||
|
){{^-last}},{{/-last}}
|
||||||
|
{{#-last}}
|
||||||
|
){{/-last}}{{/servers}});
|
||||||
|
protected Integer serverIndex = 0;
|
||||||
|
protected Map<String, String> serverVariables = null;
|
||||||
private boolean debugging = false;
|
private boolean debugging = false;
|
||||||
private int connectionTimeout = 0;
|
private int connectionTimeout = 0;
|
||||||
|
|
||||||
@ -177,6 +206,33 @@ public class ApiClient {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<ServerConfiguration> getServers() {
|
||||||
|
return servers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiClient setServers(List<ServerConfiguration> servers) {
|
||||||
|
this.servers = servers;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getServerIndex() {
|
||||||
|
return serverIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiClient setServerIndex(Integer serverIndex) {
|
||||||
|
this.serverIndex = serverIndex;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, String> getServerVariables() {
|
||||||
|
return serverVariables;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiClient setServerVariables(Map<String, String> serverVariables) {
|
||||||
|
this.serverVariables = serverVariables;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the status code of the previous request
|
* Gets the status code of the previous request
|
||||||
* @return Status code
|
* @return Status code
|
||||||
@ -626,8 +682,20 @@ public class ApiClient {
|
|||||||
* @return The full URL
|
* @return The full URL
|
||||||
*/
|
*/
|
||||||
private String buildUrl(String path, List<Pair> queryParams, List<Pair> collectionQueryParams) {
|
private String buildUrl(String path, List<Pair> queryParams, List<Pair> collectionQueryParams) {
|
||||||
|
String baseURL;
|
||||||
|
if (serverIndex != null) {
|
||||||
|
if (serverIndex < 0 || serverIndex >= servers.size()) {
|
||||||
|
throw new ArrayIndexOutOfBoundsException(String.format(
|
||||||
|
"Invalid index %d when selecting the host settings. Must be less than %d", serverIndex, servers.size()
|
||||||
|
));
|
||||||
|
}
|
||||||
|
baseURL = servers.get(serverIndex).URL(serverVariables);
|
||||||
|
} else {
|
||||||
|
baseURL = basePath;
|
||||||
|
}
|
||||||
|
|
||||||
final StringBuilder url = new StringBuilder();
|
final StringBuilder url = new StringBuilder();
|
||||||
url.append(basePath).append(path);
|
url.append(baseURL).append(path);
|
||||||
|
|
||||||
if (queryParams != null && !queryParams.isEmpty()) {
|
if (queryParams != null && !queryParams.isEmpty()) {
|
||||||
// support (constant) query string in `path`, e.g. "/posts?draft=1"
|
// support (constant) query string in `path`, e.g. "/posts?draft=1"
|
||||||
|
58
modules/openapi-generator/src/main/resources/Java/ServerConfiguration.mustache
vendored
Normal file
58
modules/openapi-generator/src/main/resources/Java/ServerConfiguration.mustache
vendored
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
package {{invokerPackage}};
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server configuration.
|
||||||
|
*/
|
||||||
|
public class ServerConfiguration {
|
||||||
|
public String URL;
|
||||||
|
public String description;
|
||||||
|
public Map<String, ServerVariable> variables;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param URL A URL to the target host.
|
||||||
|
* @param description A describtion of the host designated by the URL.
|
||||||
|
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||||
|
*/
|
||||||
|
public ServerConfiguration(String URL, String description, Map<String, ServerVariable> variables) {
|
||||||
|
this.URL = URL;
|
||||||
|
this.description = description;
|
||||||
|
this.variables = variables;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using given variables.
|
||||||
|
*
|
||||||
|
* @param variables A map between a variable name and its value.
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL(Map<String, String> variables) {
|
||||||
|
String url = this.URL;
|
||||||
|
|
||||||
|
// go through variables and replace placeholders
|
||||||
|
for (Map.Entry<String, ServerVariable> variable: this.variables.entrySet()) {
|
||||||
|
String name = variable.getKey();
|
||||||
|
ServerVariable serverVariable = variable.getValue();
|
||||||
|
String value = serverVariable.defaultValue;
|
||||||
|
|
||||||
|
if (variables != null && variables.containsKey(name)) {
|
||||||
|
value = variables.get(name);
|
||||||
|
if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) {
|
||||||
|
throw new RuntimeException("The variable " + name + " in the server URL has invalid value " + value + ".");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
url = url.replaceAll("\\{" + name + "\\}", value);
|
||||||
|
}
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using default server variables.
|
||||||
|
*
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL() {
|
||||||
|
return URL(null);
|
||||||
|
}
|
||||||
|
}
|
23
modules/openapi-generator/src/main/resources/Java/ServerVariable.mustache
vendored
Normal file
23
modules/openapi-generator/src/main/resources/Java/ServerVariable.mustache
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
package {{invokerPackage}};
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server Variable for server URL template substitution.
|
||||||
|
*/
|
||||||
|
public class ServerVariable {
|
||||||
|
public String description;
|
||||||
|
public String defaultValue;
|
||||||
|
public HashSet<String> enumValues = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param description A description for the server variable.
|
||||||
|
* @param defaultValue The default value to use for substitution.
|
||||||
|
* @param enumValues An enumeration of string values to be used if the substitution options are from a limited set.
|
||||||
|
*/
|
||||||
|
public ServerVariable(String description, String defaultValue, HashSet<String> enumValues) {
|
||||||
|
this.description = description;
|
||||||
|
this.defaultValue = defaultValue;
|
||||||
|
this.enumValues = enumValues;
|
||||||
|
}
|
||||||
|
}
|
@ -37,7 +37,9 @@ import java.util.Collections;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
@ -55,6 +57,7 @@ import {{invokerPackage}}.auth.Authentication;
|
|||||||
import {{invokerPackage}}.auth.HttpBasicAuth;
|
import {{invokerPackage}}.auth.HttpBasicAuth;
|
||||||
import {{invokerPackage}}.auth.HttpBearerAuth;
|
import {{invokerPackage}}.auth.HttpBearerAuth;
|
||||||
import {{invokerPackage}}.auth.ApiKeyAuth;
|
import {{invokerPackage}}.auth.ApiKeyAuth;
|
||||||
|
|
||||||
{{#hasOAuthMethods}}
|
{{#hasOAuthMethods}}
|
||||||
import {{invokerPackage}}.auth.OAuth;
|
import {{invokerPackage}}.auth.OAuth;
|
||||||
{{/hasOAuthMethods}}
|
{{/hasOAuthMethods}}
|
||||||
@ -64,6 +67,74 @@ public class ApiClient {
|
|||||||
protected Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
protected Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||||
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 List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>({{#servers}}{{#-first}}Arrays.asList(
|
||||||
|
{{/-first}} new ServerConfiguration(
|
||||||
|
"{{{url}}}",
|
||||||
|
"{{{description}}}{{^description}}No description provided{{/description}}",
|
||||||
|
new HashMap<String, ServerVariable>(){{#variables}}{{#-first}} {{
|
||||||
|
{{/-first}} put("{{{name}}}", new ServerVariable(
|
||||||
|
"{{{description}}}{{^description}}No description provided{{/description}}",
|
||||||
|
"{{{defaultValue}}}",
|
||||||
|
new HashSet<String>(
|
||||||
|
{{#enumValues}}
|
||||||
|
{{#-first}}
|
||||||
|
Arrays.asList(
|
||||||
|
{{/-first}}
|
||||||
|
"{{{.}}}"{{^-last}},{{/-last}}
|
||||||
|
{{#-last}}
|
||||||
|
)
|
||||||
|
{{/-last}}
|
||||||
|
{{/enumValues}}
|
||||||
|
)
|
||||||
|
));
|
||||||
|
{{#-last}}
|
||||||
|
}}{{/-last}}{{/variables}}
|
||||||
|
){{^-last}},{{/-last}}
|
||||||
|
{{#-last}}
|
||||||
|
){{/-last}}{{/servers}});
|
||||||
|
protected Integer serverIndex = 0;
|
||||||
|
protected Map<String, String> serverVariables = null;
|
||||||
|
protected Map<String, List<ServerConfiguration>> operationServers = new HashMap<String, List<ServerConfiguration>>() {{
|
||||||
|
{{#apiInfo}}
|
||||||
|
{{#apis}}
|
||||||
|
{{#operations}}
|
||||||
|
{{#operation}}
|
||||||
|
{{#servers}}
|
||||||
|
{{#-first}}
|
||||||
|
put("{{{classname}}}.{{{operationId}}}", new ArrayList<ServerConfiguration>(Arrays.asList(
|
||||||
|
{{/-first}}
|
||||||
|
new ServerConfiguration(
|
||||||
|
"{{{url}}}",
|
||||||
|
"{{{description}}}{{^description}}No description provided{{/description}}",
|
||||||
|
new HashMap<String, ServerVariable>(){{#variables}}{{#-first}} {{
|
||||||
|
{{/-first}} put("{{{name}}}", new ServerVariable(
|
||||||
|
"{{{description}}}{{^description}}No description provided{{/description}}",
|
||||||
|
"{{{defaultValue}}}",
|
||||||
|
new HashSet<String>(
|
||||||
|
{{#enumValues}}
|
||||||
|
{{#-first}}
|
||||||
|
Arrays.asList(
|
||||||
|
{{/-first}}
|
||||||
|
"{{{.}}}"{{^-last}},{{/-last}}
|
||||||
|
{{#-last}}
|
||||||
|
)
|
||||||
|
{{/-last}}
|
||||||
|
{{/enumValues}}
|
||||||
|
)
|
||||||
|
));
|
||||||
|
{{#-last}}
|
||||||
|
}}{{/-last}}{{/variables}}
|
||||||
|
){{^-last}},{{/-last}}
|
||||||
|
{{#-last}}
|
||||||
|
)));{{/-last}}
|
||||||
|
{{/servers}}
|
||||||
|
{{/operation}}
|
||||||
|
{{/operations}}
|
||||||
|
{{/apis}}
|
||||||
|
{{/apiInfo}}
|
||||||
|
}};
|
||||||
|
protected Map<String, Integer> operationServerIndex = new HashMap<String, Integer>();
|
||||||
|
protected Map<String, Map<String, String>> operationServerVariables = new HashMap<String, Map<String, String>>();
|
||||||
protected boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
protected int connectionTimeout = 0;
|
protected int connectionTimeout = 0;
|
||||||
private int readTimeout = 0;
|
private int readTimeout = 0;
|
||||||
@ -121,6 +192,33 @@ public class ApiClient {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<ServerConfiguration> getServers() {
|
||||||
|
return servers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiClient setServers(List<ServerConfiguration> servers) {
|
||||||
|
this.servers = servers;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getServerIndex() {
|
||||||
|
return serverIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiClient setServerIndex(Integer serverIndex) {
|
||||||
|
this.serverIndex = serverIndex;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, String> getServerVariables() {
|
||||||
|
return serverVariables;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiClient setServerVariables(Map<String, String> serverVariables) {
|
||||||
|
this.serverVariables = serverVariables;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get authentications (key: authentication name, value: authentication).
|
* Get authentications (key: authentication name, value: authentication).
|
||||||
* @return Map of authentication object
|
* @return Map of authentication object
|
||||||
@ -670,6 +768,7 @@ public class ApiClient {
|
|||||||
* Invoke API by sending HTTP request with the given options.
|
* Invoke API by sending HTTP request with the given options.
|
||||||
*
|
*
|
||||||
* @param <T> Type
|
* @param <T> Type
|
||||||
|
* @param operation The qualified name of the operation
|
||||||
* @param path The sub-path of the HTTP URL
|
* @param path The sub-path of the HTTP URL
|
||||||
* @param method The request method, one of "GET", "POST", "PUT", "HEAD" and "DELETE"
|
* @param method The request method, one of "GET", "POST", "PUT", "HEAD" and "DELETE"
|
||||||
* @param queryParams The query parameters
|
* @param queryParams The query parameters
|
||||||
@ -684,12 +783,36 @@ public class ApiClient {
|
|||||||
* @return The response body in type of string
|
* @return The response body in type of string
|
||||||
* @throws ApiException API exception
|
* @throws ApiException API exception
|
||||||
*/
|
*/
|
||||||
public <T> ApiResponse<T> invokeAPI(String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String accept, String contentType, String[] authNames, GenericType<T> returnType) throws ApiException {
|
public <T> ApiResponse<T> invokeAPI(String operation, String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String accept, String contentType, String[] authNames, GenericType<T> returnType) throws ApiException {
|
||||||
updateParamsForAuth(authNames, queryParams, headerParams, cookieParams);
|
updateParamsForAuth(authNames, queryParams, headerParams, cookieParams);
|
||||||
|
|
||||||
// Not using `.target(this.basePath).path(path)` below,
|
// Not using `.target(targetURL).path(path)` below,
|
||||||
// to support (constant) query string in `path`, e.g. "/posts?draft=1"
|
// to support (constant) query string in `path`, e.g. "/posts?draft=1"
|
||||||
WebTarget target = httpClient.target(this.basePath + path);
|
String targetURL;
|
||||||
|
if (serverIndex != null) {
|
||||||
|
Integer index;
|
||||||
|
List<ServerConfiguration> serverConfigurations;
|
||||||
|
Map<String, String> variables;
|
||||||
|
|
||||||
|
if (operationServers.containsKey(operation)) {
|
||||||
|
index = operationServerIndex.getOrDefault(operation, serverIndex);
|
||||||
|
variables = operationServerVariables.getOrDefault(operation, serverVariables);
|
||||||
|
serverConfigurations = operationServers.get(operation);
|
||||||
|
} else {
|
||||||
|
index = serverIndex;
|
||||||
|
variables = serverVariables;
|
||||||
|
serverConfigurations = servers;
|
||||||
|
}
|
||||||
|
if (index < 0 || index >= serverConfigurations.size()) {
|
||||||
|
throw new ArrayIndexOutOfBoundsException(String.format(
|
||||||
|
"Invalid index %d when selecting the host settings. Must be less than %d", index, serverConfigurations.size()
|
||||||
|
));
|
||||||
|
}
|
||||||
|
targetURL = serverConfigurations.get(index).URL(variables) + path;
|
||||||
|
} else {
|
||||||
|
targetURL = this.basePath + path;
|
||||||
|
}
|
||||||
|
WebTarget target = httpClient.target(targetURL);
|
||||||
|
|
||||||
if (queryParams != null) {
|
if (queryParams != null) {
|
||||||
for (Pair queryParam : queryParams) {
|
for (Pair queryParam : queryParams) {
|
||||||
@ -793,6 +916,14 @@ public class ApiClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Add qualified name of the operation as a first parameter.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public <T> ApiResponse<T> invokeAPI(String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String accept, String contentType, String[] authNames, GenericType<T> returnType) throws ApiException {
|
||||||
|
return invokeAPI(null, path, method, queryParams, body, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build the Client used to make HTTP requests.
|
* Build the Client used to make HTTP requests.
|
||||||
* @param debugging Debug setting
|
* @param debugging Debug setting
|
||||||
|
@ -151,7 +151,7 @@ public class {{classname}} {
|
|||||||
String[] localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{#hasMore}}, {{/hasMore}}{{/authMethods}} };
|
String[] localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{#hasMore}}, {{/hasMore}}{{/authMethods}} };
|
||||||
|
|
||||||
{{#returnType}}GenericType<{{{returnType}}}> localVarReturnType = new GenericType<{{{returnType}}}>() {};{{/returnType}}
|
{{#returnType}}GenericType<{{{returnType}}}> localVarReturnType = new GenericType<{{{returnType}}}>() {};{{/returnType}}
|
||||||
return apiClient.invokeAPI(localVarPath, "{{httpMethod}}", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, {{#returnType}}localVarReturnType{{/returnType}}{{^returnType}}null{{/returnType}});
|
return apiClient.invokeAPI("{{classname}}.{{operationId}}", localVarPath, "{{httpMethod}}", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, {{#returnType}}localVarReturnType{{/returnType}}{{^returnType}}null{{/returnType}});
|
||||||
}
|
}
|
||||||
{{#vendorExtensions.x-group-parameters}}
|
{{#vendorExtensions.x-group-parameters}}
|
||||||
|
|
||||||
|
@ -267,7 +267,7 @@ public class JavaClientCodegenTest {
|
|||||||
generator.opts(clientOptInput).generate();
|
generator.opts(clientOptInput).generate();
|
||||||
|
|
||||||
Map<String, String> generatedFiles = generator.getFiles();
|
Map<String, String> generatedFiles = generator.getFiles();
|
||||||
Assert.assertEquals(generatedFiles.size(), 34);
|
Assert.assertEquals(generatedFiles.size(), 36);
|
||||||
TestUtils.ensureContainsFile(generatedFiles, output, ".gitignore");
|
TestUtils.ensureContainsFile(generatedFiles, output, ".gitignore");
|
||||||
TestUtils.ensureContainsFile(generatedFiles, output, ".openapi-generator-ignore");
|
TestUtils.ensureContainsFile(generatedFiles, output, ".openapi-generator-ignore");
|
||||||
TestUtils.ensureContainsFile(generatedFiles, output, ".openapi-generator/VERSION");
|
TestUtils.ensureContainsFile(generatedFiles, output, ".openapi-generator/VERSION");
|
||||||
@ -340,7 +340,7 @@ public class JavaClientCodegenTest {
|
|||||||
generator.opts(clientOptInput).generate();
|
generator.opts(clientOptInput).generate();
|
||||||
|
|
||||||
Map<String, String> generatedFiles = generator.getFiles();
|
Map<String, String> generatedFiles = generator.getFiles();
|
||||||
Assert.assertEquals(generatedFiles.size(), 37);
|
Assert.assertEquals(generatedFiles.size(), 39);
|
||||||
TestUtils.ensureContainsFile(generatedFiles, output, ".gitignore");
|
TestUtils.ensureContainsFile(generatedFiles, output, ".gitignore");
|
||||||
TestUtils.ensureContainsFile(generatedFiles, output, ".openapi-generator-ignore");
|
TestUtils.ensureContainsFile(generatedFiles, output, ".openapi-generator-ignore");
|
||||||
TestUtils.ensureContainsFile(generatedFiles, output, ".openapi-generator/VERSION");
|
TestUtils.ensureContainsFile(generatedFiles, output, ".openapi-generator/VERSION");
|
||||||
@ -410,7 +410,7 @@ public class JavaClientCodegenTest {
|
|||||||
generator.opts(clientOptInput).generate();
|
generator.opts(clientOptInput).generate();
|
||||||
|
|
||||||
Map<String, String> generatedFiles = generator.getFiles();
|
Map<String, String> generatedFiles = generator.getFiles();
|
||||||
Assert.assertEquals(generatedFiles.size(), 23);
|
Assert.assertEquals(generatedFiles.size(), 25);
|
||||||
validateJavaSourceFiles(generatedFiles);
|
validateJavaSourceFiles(generatedFiles);
|
||||||
|
|
||||||
String defaultApiFilename = new File(output, "src/main/java/xyz/abcdef/api/DefaultApi.java").getAbsolutePath().replace("\\", "/");
|
String defaultApiFilename = new File(output, "src/main/java/xyz/abcdef/api/DefaultApi.java").getAbsolutePath().replace("\\", "/");
|
||||||
|
@ -0,0 +1,58 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server configuration.
|
||||||
|
*/
|
||||||
|
public class ServerConfiguration {
|
||||||
|
public String URL;
|
||||||
|
public String description;
|
||||||
|
public Map<String, ServerVariable> variables;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param URL A URL to the target host.
|
||||||
|
* @param description A describtion of the host designated by the URL.
|
||||||
|
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||||
|
*/
|
||||||
|
public ServerConfiguration(String URL, String description, Map<String, ServerVariable> variables) {
|
||||||
|
this.URL = URL;
|
||||||
|
this.description = description;
|
||||||
|
this.variables = variables;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using given variables.
|
||||||
|
*
|
||||||
|
* @param variables A map between a variable name and its value.
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL(Map<String, String> variables) {
|
||||||
|
String url = this.URL;
|
||||||
|
|
||||||
|
// go through variables and replace placeholders
|
||||||
|
for (Map.Entry<String, ServerVariable> variable: this.variables.entrySet()) {
|
||||||
|
String name = variable.getKey();
|
||||||
|
ServerVariable serverVariable = variable.getValue();
|
||||||
|
String value = serverVariable.defaultValue;
|
||||||
|
|
||||||
|
if (variables != null && variables.containsKey(name)) {
|
||||||
|
value = variables.get(name);
|
||||||
|
if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) {
|
||||||
|
throw new RuntimeException("The variable " + name + " in the server URL has invalid value " + value + ".");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
url = url.replaceAll("\\{" + name + "\\}", value);
|
||||||
|
}
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using default server variables.
|
||||||
|
*
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL() {
|
||||||
|
return URL(null);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server Variable for server URL template substitution.
|
||||||
|
*/
|
||||||
|
public class ServerVariable {
|
||||||
|
public String description;
|
||||||
|
public String defaultValue;
|
||||||
|
public HashSet<String> enumValues = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param description A description for the server variable.
|
||||||
|
* @param defaultValue The default value to use for substitution.
|
||||||
|
* @param enumValues An enumeration of string values to be used if the substitution options are from a limited set.
|
||||||
|
*/
|
||||||
|
public ServerVariable(String description, String defaultValue, HashSet<String> enumValues) {
|
||||||
|
this.description = description;
|
||||||
|
this.defaultValue = defaultValue;
|
||||||
|
this.enumValues = enumValues;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,58 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server configuration.
|
||||||
|
*/
|
||||||
|
public class ServerConfiguration {
|
||||||
|
public String URL;
|
||||||
|
public String description;
|
||||||
|
public Map<String, ServerVariable> variables;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param URL A URL to the target host.
|
||||||
|
* @param description A describtion of the host designated by the URL.
|
||||||
|
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||||
|
*/
|
||||||
|
public ServerConfiguration(String URL, String description, Map<String, ServerVariable> variables) {
|
||||||
|
this.URL = URL;
|
||||||
|
this.description = description;
|
||||||
|
this.variables = variables;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using given variables.
|
||||||
|
*
|
||||||
|
* @param variables A map between a variable name and its value.
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL(Map<String, String> variables) {
|
||||||
|
String url = this.URL;
|
||||||
|
|
||||||
|
// go through variables and replace placeholders
|
||||||
|
for (Map.Entry<String, ServerVariable> variable: this.variables.entrySet()) {
|
||||||
|
String name = variable.getKey();
|
||||||
|
ServerVariable serverVariable = variable.getValue();
|
||||||
|
String value = serverVariable.defaultValue;
|
||||||
|
|
||||||
|
if (variables != null && variables.containsKey(name)) {
|
||||||
|
value = variables.get(name);
|
||||||
|
if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) {
|
||||||
|
throw new RuntimeException("The variable " + name + " in the server URL has invalid value " + value + ".");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
url = url.replaceAll("\\{" + name + "\\}", value);
|
||||||
|
}
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using default server variables.
|
||||||
|
*
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL() {
|
||||||
|
return URL(null);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server Variable for server URL template substitution.
|
||||||
|
*/
|
||||||
|
public class ServerVariable {
|
||||||
|
public String description;
|
||||||
|
public String defaultValue;
|
||||||
|
public HashSet<String> enumValues = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param description A description for the server variable.
|
||||||
|
* @param defaultValue The default value to use for substitution.
|
||||||
|
* @param enumValues An enumeration of string values to be used if the substitution options are from a limited set.
|
||||||
|
*/
|
||||||
|
public ServerVariable(String description, String defaultValue, HashSet<String> enumValues) {
|
||||||
|
this.description = description;
|
||||||
|
this.defaultValue = defaultValue;
|
||||||
|
this.enumValues = enumValues;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,58 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server configuration.
|
||||||
|
*/
|
||||||
|
public class ServerConfiguration {
|
||||||
|
public String URL;
|
||||||
|
public String description;
|
||||||
|
public Map<String, ServerVariable> variables;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param URL A URL to the target host.
|
||||||
|
* @param description A describtion of the host designated by the URL.
|
||||||
|
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||||
|
*/
|
||||||
|
public ServerConfiguration(String URL, String description, Map<String, ServerVariable> variables) {
|
||||||
|
this.URL = URL;
|
||||||
|
this.description = description;
|
||||||
|
this.variables = variables;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using given variables.
|
||||||
|
*
|
||||||
|
* @param variables A map between a variable name and its value.
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL(Map<String, String> variables) {
|
||||||
|
String url = this.URL;
|
||||||
|
|
||||||
|
// go through variables and replace placeholders
|
||||||
|
for (Map.Entry<String, ServerVariable> variable: this.variables.entrySet()) {
|
||||||
|
String name = variable.getKey();
|
||||||
|
ServerVariable serverVariable = variable.getValue();
|
||||||
|
String value = serverVariable.defaultValue;
|
||||||
|
|
||||||
|
if (variables != null && variables.containsKey(name)) {
|
||||||
|
value = variables.get(name);
|
||||||
|
if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) {
|
||||||
|
throw new RuntimeException("The variable " + name + " in the server URL has invalid value " + value + ".");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
url = url.replaceAll("\\{" + name + "\\}", value);
|
||||||
|
}
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using default server variables.
|
||||||
|
*
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL() {
|
||||||
|
return URL(null);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server Variable for server URL template substitution.
|
||||||
|
*/
|
||||||
|
public class ServerVariable {
|
||||||
|
public String description;
|
||||||
|
public String defaultValue;
|
||||||
|
public HashSet<String> enumValues = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param description A description for the server variable.
|
||||||
|
* @param defaultValue The default value to use for substitution.
|
||||||
|
* @param enumValues An enumeration of string values to be used if the substitution options are from a limited set.
|
||||||
|
*/
|
||||||
|
public ServerVariable(String description, String defaultValue, HashSet<String> enumValues) {
|
||||||
|
this.description = description;
|
||||||
|
this.defaultValue = defaultValue;
|
||||||
|
this.enumValues = enumValues;
|
||||||
|
}
|
||||||
|
}
|
@ -39,7 +39,9 @@ import java.util.Collections;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
@ -62,6 +64,15 @@ public class ApiClient {
|
|||||||
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||||
private Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
private Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
||||||
private String basePath = "http://petstore.swagger.io:80/v2";
|
private String basePath = "http://petstore.swagger.io:80/v2";
|
||||||
|
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>(Arrays.asList(
|
||||||
|
new ServerConfiguration(
|
||||||
|
"http://petstore.swagger.io:80/v2",
|
||||||
|
"No description provided",
|
||||||
|
new HashMap<String, ServerVariable>()
|
||||||
|
)
|
||||||
|
));
|
||||||
|
protected Integer serverIndex = 0;
|
||||||
|
protected Map<String, String> serverVariables = null;
|
||||||
private boolean debugging = false;
|
private boolean debugging = false;
|
||||||
private int connectionTimeout = 0;
|
private int connectionTimeout = 0;
|
||||||
|
|
||||||
@ -168,6 +179,33 @@ public class ApiClient {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<ServerConfiguration> getServers() {
|
||||||
|
return servers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiClient setServers(List<ServerConfiguration> servers) {
|
||||||
|
this.servers = servers;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getServerIndex() {
|
||||||
|
return serverIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiClient setServerIndex(Integer serverIndex) {
|
||||||
|
this.serverIndex = serverIndex;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, String> getServerVariables() {
|
||||||
|
return serverVariables;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiClient setServerVariables(Map<String, String> serverVariables) {
|
||||||
|
this.serverVariables = serverVariables;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the status code of the previous request
|
* Gets the status code of the previous request
|
||||||
* @return Status code
|
* @return Status code
|
||||||
@ -615,8 +653,20 @@ public class ApiClient {
|
|||||||
* @return The full URL
|
* @return The full URL
|
||||||
*/
|
*/
|
||||||
private String buildUrl(String path, List<Pair> queryParams, List<Pair> collectionQueryParams) {
|
private String buildUrl(String path, List<Pair> queryParams, List<Pair> collectionQueryParams) {
|
||||||
|
String baseURL;
|
||||||
|
if (serverIndex != null) {
|
||||||
|
if (serverIndex < 0 || serverIndex >= servers.size()) {
|
||||||
|
throw new ArrayIndexOutOfBoundsException(String.format(
|
||||||
|
"Invalid index %d when selecting the host settings. Must be less than %d", serverIndex, servers.size()
|
||||||
|
));
|
||||||
|
}
|
||||||
|
baseURL = servers.get(serverIndex).URL(serverVariables);
|
||||||
|
} else {
|
||||||
|
baseURL = basePath;
|
||||||
|
}
|
||||||
|
|
||||||
final StringBuilder url = new StringBuilder();
|
final StringBuilder url = new StringBuilder();
|
||||||
url.append(basePath).append(path);
|
url.append(baseURL).append(path);
|
||||||
|
|
||||||
if (queryParams != null && !queryParams.isEmpty()) {
|
if (queryParams != null && !queryParams.isEmpty()) {
|
||||||
// support (constant) query string in `path`, e.g. "/posts?draft=1"
|
// support (constant) query string in `path`, e.g. "/posts?draft=1"
|
||||||
|
@ -0,0 +1,58 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server configuration.
|
||||||
|
*/
|
||||||
|
public class ServerConfiguration {
|
||||||
|
public String URL;
|
||||||
|
public String description;
|
||||||
|
public Map<String, ServerVariable> variables;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param URL A URL to the target host.
|
||||||
|
* @param description A describtion of the host designated by the URL.
|
||||||
|
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||||
|
*/
|
||||||
|
public ServerConfiguration(String URL, String description, Map<String, ServerVariable> variables) {
|
||||||
|
this.URL = URL;
|
||||||
|
this.description = description;
|
||||||
|
this.variables = variables;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using given variables.
|
||||||
|
*
|
||||||
|
* @param variables A map between a variable name and its value.
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL(Map<String, String> variables) {
|
||||||
|
String url = this.URL;
|
||||||
|
|
||||||
|
// go through variables and replace placeholders
|
||||||
|
for (Map.Entry<String, ServerVariable> variable: this.variables.entrySet()) {
|
||||||
|
String name = variable.getKey();
|
||||||
|
ServerVariable serverVariable = variable.getValue();
|
||||||
|
String value = serverVariable.defaultValue;
|
||||||
|
|
||||||
|
if (variables != null && variables.containsKey(name)) {
|
||||||
|
value = variables.get(name);
|
||||||
|
if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) {
|
||||||
|
throw new RuntimeException("The variable " + name + " in the server URL has invalid value " + value + ".");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
url = url.replaceAll("\\{" + name + "\\}", value);
|
||||||
|
}
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using default server variables.
|
||||||
|
*
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL() {
|
||||||
|
return URL(null);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server Variable for server URL template substitution.
|
||||||
|
*/
|
||||||
|
public class ServerVariable {
|
||||||
|
public String description;
|
||||||
|
public String defaultValue;
|
||||||
|
public HashSet<String> enumValues = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param description A description for the server variable.
|
||||||
|
* @param defaultValue The default value to use for substitution.
|
||||||
|
* @param enumValues An enumeration of string values to be used if the substitution options are from a limited set.
|
||||||
|
*/
|
||||||
|
public ServerVariable(String description, String defaultValue, HashSet<String> enumValues) {
|
||||||
|
this.description = description;
|
||||||
|
this.defaultValue = defaultValue;
|
||||||
|
this.enumValues = enumValues;
|
||||||
|
}
|
||||||
|
}
|
@ -30,7 +30,9 @@ import java.util.Collections;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
@ -48,6 +50,7 @@ import org.openapitools.client.auth.Authentication;
|
|||||||
import org.openapitools.client.auth.HttpBasicAuth;
|
import org.openapitools.client.auth.HttpBasicAuth;
|
||||||
import org.openapitools.client.auth.HttpBearerAuth;
|
import org.openapitools.client.auth.HttpBearerAuth;
|
||||||
import org.openapitools.client.auth.ApiKeyAuth;
|
import org.openapitools.client.auth.ApiKeyAuth;
|
||||||
|
|
||||||
import org.openapitools.client.auth.OAuth;
|
import org.openapitools.client.auth.OAuth;
|
||||||
|
|
||||||
|
|
||||||
@ -55,6 +58,19 @@ public class ApiClient {
|
|||||||
protected Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
protected Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||||
protected Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
protected Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
||||||
protected 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(
|
||||||
|
new ServerConfiguration(
|
||||||
|
"http://petstore.swagger.io:80/v2",
|
||||||
|
"No description provided",
|
||||||
|
new HashMap<String, ServerVariable>()
|
||||||
|
)
|
||||||
|
));
|
||||||
|
protected Integer serverIndex = 0;
|
||||||
|
protected Map<String, String> serverVariables = null;
|
||||||
|
protected Map<String, List<ServerConfiguration>> operationServers = new HashMap<String, List<ServerConfiguration>>() {{
|
||||||
|
}};
|
||||||
|
protected Map<String, Integer> operationServerIndex = new HashMap<String, Integer>();
|
||||||
|
protected Map<String, Map<String, String>> operationServerVariables = new HashMap<String, Map<String, String>>();
|
||||||
protected boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
protected int connectionTimeout = 0;
|
protected int connectionTimeout = 0;
|
||||||
private int readTimeout = 0;
|
private int readTimeout = 0;
|
||||||
@ -112,6 +128,33 @@ public class ApiClient {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<ServerConfiguration> getServers() {
|
||||||
|
return servers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiClient setServers(List<ServerConfiguration> servers) {
|
||||||
|
this.servers = servers;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getServerIndex() {
|
||||||
|
return serverIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiClient setServerIndex(Integer serverIndex) {
|
||||||
|
this.serverIndex = serverIndex;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, String> getServerVariables() {
|
||||||
|
return serverVariables;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiClient setServerVariables(Map<String, String> serverVariables) {
|
||||||
|
this.serverVariables = serverVariables;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get authentications (key: authentication name, value: authentication).
|
* Get authentications (key: authentication name, value: authentication).
|
||||||
* @return Map of authentication object
|
* @return Map of authentication object
|
||||||
@ -654,6 +697,7 @@ public class ApiClient {
|
|||||||
* Invoke API by sending HTTP request with the given options.
|
* Invoke API by sending HTTP request with the given options.
|
||||||
*
|
*
|
||||||
* @param <T> Type
|
* @param <T> Type
|
||||||
|
* @param operation The qualified name of the operation
|
||||||
* @param path The sub-path of the HTTP URL
|
* @param path The sub-path of the HTTP URL
|
||||||
* @param method The request method, one of "GET", "POST", "PUT", "HEAD" and "DELETE"
|
* @param method The request method, one of "GET", "POST", "PUT", "HEAD" and "DELETE"
|
||||||
* @param queryParams The query parameters
|
* @param queryParams The query parameters
|
||||||
@ -668,12 +712,36 @@ public class ApiClient {
|
|||||||
* @return The response body in type of string
|
* @return The response body in type of string
|
||||||
* @throws ApiException API exception
|
* @throws ApiException API exception
|
||||||
*/
|
*/
|
||||||
public <T> ApiResponse<T> invokeAPI(String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String accept, String contentType, String[] authNames, GenericType<T> returnType) throws ApiException {
|
public <T> ApiResponse<T> invokeAPI(String operation, String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String accept, String contentType, String[] authNames, GenericType<T> returnType) throws ApiException {
|
||||||
updateParamsForAuth(authNames, queryParams, headerParams, cookieParams);
|
updateParamsForAuth(authNames, queryParams, headerParams, cookieParams);
|
||||||
|
|
||||||
// Not using `.target(this.basePath).path(path)` below,
|
// Not using `.target(targetURL).path(path)` below,
|
||||||
// to support (constant) query string in `path`, e.g. "/posts?draft=1"
|
// to support (constant) query string in `path`, e.g. "/posts?draft=1"
|
||||||
WebTarget target = httpClient.target(this.basePath + path);
|
String targetURL;
|
||||||
|
if (serverIndex != null) {
|
||||||
|
Integer index;
|
||||||
|
List<ServerConfiguration> serverConfigurations;
|
||||||
|
Map<String, String> variables;
|
||||||
|
|
||||||
|
if (operationServers.containsKey(operation)) {
|
||||||
|
index = operationServerIndex.getOrDefault(operation, serverIndex);
|
||||||
|
variables = operationServerVariables.getOrDefault(operation, serverVariables);
|
||||||
|
serverConfigurations = operationServers.get(operation);
|
||||||
|
} else {
|
||||||
|
index = serverIndex;
|
||||||
|
variables = serverVariables;
|
||||||
|
serverConfigurations = servers;
|
||||||
|
}
|
||||||
|
if (index < 0 || index >= serverConfigurations.size()) {
|
||||||
|
throw new ArrayIndexOutOfBoundsException(String.format(
|
||||||
|
"Invalid index %d when selecting the host settings. Must be less than %d", index, serverConfigurations.size()
|
||||||
|
));
|
||||||
|
}
|
||||||
|
targetURL = serverConfigurations.get(index).URL(variables) + path;
|
||||||
|
} else {
|
||||||
|
targetURL = this.basePath + path;
|
||||||
|
}
|
||||||
|
WebTarget target = httpClient.target(targetURL);
|
||||||
|
|
||||||
if (queryParams != null) {
|
if (queryParams != null) {
|
||||||
for (Pair queryParam : queryParams) {
|
for (Pair queryParam : queryParams) {
|
||||||
@ -777,6 +845,14 @@ public class ApiClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Add qualified name of the operation as a first parameter.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public <T> ApiResponse<T> invokeAPI(String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String accept, String contentType, String[] authNames, GenericType<T> returnType) throws ApiException {
|
||||||
|
return invokeAPI(null, path, method, queryParams, body, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build the Client used to make HTTP requests.
|
* Build the Client used to make HTTP requests.
|
||||||
* @param debugging Debug setting
|
* @param debugging Debug setting
|
||||||
|
@ -0,0 +1,58 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server configuration.
|
||||||
|
*/
|
||||||
|
public class ServerConfiguration {
|
||||||
|
public String URL;
|
||||||
|
public String description;
|
||||||
|
public Map<String, ServerVariable> variables;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param URL A URL to the target host.
|
||||||
|
* @param description A describtion of the host designated by the URL.
|
||||||
|
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||||
|
*/
|
||||||
|
public ServerConfiguration(String URL, String description, Map<String, ServerVariable> variables) {
|
||||||
|
this.URL = URL;
|
||||||
|
this.description = description;
|
||||||
|
this.variables = variables;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using given variables.
|
||||||
|
*
|
||||||
|
* @param variables A map between a variable name and its value.
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL(Map<String, String> variables) {
|
||||||
|
String url = this.URL;
|
||||||
|
|
||||||
|
// go through variables and replace placeholders
|
||||||
|
for (Map.Entry<String, ServerVariable> variable: this.variables.entrySet()) {
|
||||||
|
String name = variable.getKey();
|
||||||
|
ServerVariable serverVariable = variable.getValue();
|
||||||
|
String value = serverVariable.defaultValue;
|
||||||
|
|
||||||
|
if (variables != null && variables.containsKey(name)) {
|
||||||
|
value = variables.get(name);
|
||||||
|
if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) {
|
||||||
|
throw new RuntimeException("The variable " + name + " in the server URL has invalid value " + value + ".");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
url = url.replaceAll("\\{" + name + "\\}", value);
|
||||||
|
}
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using default server variables.
|
||||||
|
*
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL() {
|
||||||
|
return URL(null);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server Variable for server URL template substitution.
|
||||||
|
*/
|
||||||
|
public class ServerVariable {
|
||||||
|
public String description;
|
||||||
|
public String defaultValue;
|
||||||
|
public HashSet<String> enumValues = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param description A description for the server variable.
|
||||||
|
* @param defaultValue The default value to use for substitution.
|
||||||
|
* @param enumValues An enumeration of string values to be used if the substitution options are from a limited set.
|
||||||
|
*/
|
||||||
|
public ServerVariable(String description, String defaultValue, HashSet<String> enumValues) {
|
||||||
|
this.description = description;
|
||||||
|
this.defaultValue = defaultValue;
|
||||||
|
this.enumValues = enumValues;
|
||||||
|
}
|
||||||
|
}
|
@ -96,6 +96,6 @@ public class AnotherFakeApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
GenericType<Client> localVarReturnType = new GenericType<Client>() {};
|
GenericType<Client> localVarReturnType = new GenericType<Client>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("AnotherFakeApi.call123testSpecialTags", localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ public class FakeApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("FakeApi.createXmlItem", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -162,7 +162,7 @@ public class FakeApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
GenericType<Boolean> localVarReturnType = new GenericType<Boolean>() {};
|
GenericType<Boolean> localVarReturnType = new GenericType<Boolean>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("FakeApi.fakeOuterBooleanSerialize", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -221,7 +221,7 @@ public class FakeApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
GenericType<OuterComposite> localVarReturnType = new GenericType<OuterComposite>() {};
|
GenericType<OuterComposite> localVarReturnType = new GenericType<OuterComposite>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("FakeApi.fakeOuterCompositeSerialize", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -280,7 +280,7 @@ public class FakeApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
GenericType<BigDecimal> localVarReturnType = new GenericType<BigDecimal>() {};
|
GenericType<BigDecimal> localVarReturnType = new GenericType<BigDecimal>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("FakeApi.fakeOuterNumberSerialize", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -339,7 +339,7 @@ public class FakeApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
GenericType<String> localVarReturnType = new GenericType<String>() {};
|
GenericType<String> localVarReturnType = new GenericType<String>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("FakeApi.fakeOuterStringSerialize", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -402,7 +402,7 @@ public class FakeApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("FakeApi.testBodyWithFileSchema", localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -473,7 +473,7 @@ public class FakeApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("FakeApi.testBodyWithQueryParams", localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* To test \"client\" model
|
* To test \"client\" model
|
||||||
@ -537,7 +537,7 @@ public class FakeApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
GenericType<Client> localVarReturnType = new GenericType<Client>() {};
|
GenericType<Client> localVarReturnType = new GenericType<Client>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("FakeApi.testClientModel", localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||||
@ -671,7 +671,7 @@ if (paramCallback != null)
|
|||||||
String[] localVarAuthNames = new String[] { "http_basic_test" };
|
String[] localVarAuthNames = new String[] { "http_basic_test" };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("FakeApi.testEndpointParameters", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* To test enum parameters
|
* To test enum parameters
|
||||||
@ -757,7 +757,7 @@ if (enumFormString != null)
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("FakeApi.testEnumParameters", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ApiResponse<Void> testGroupParametersWithHttpInfo(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group) throws ApiException {
|
private ApiResponse<Void> testGroupParametersWithHttpInfo(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group) throws ApiException {
|
||||||
@ -812,7 +812,7 @@ if (booleanGroup != null)
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("FakeApi.testGroupParameters", localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class APItestGroupParametersRequest {
|
public class APItestGroupParametersRequest {
|
||||||
@ -999,7 +999,7 @@ if (booleanGroup != null)
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("FakeApi.testInlineAdditionalProperties", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* test json serialization of form data
|
* test json serialization of form data
|
||||||
@ -1073,7 +1073,7 @@ if (param2 != null)
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("FakeApi.testJsonFormData", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -1169,6 +1169,6 @@ if (param2 != null)
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("FakeApi.testQueryParameterCollectionFormat", localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,6 +96,6 @@ public class FakeClassnameTags123Api {
|
|||||||
String[] localVarAuthNames = new String[] { "api_key_query" };
|
String[] localVarAuthNames = new String[] { "api_key_query" };
|
||||||
|
|
||||||
GenericType<Client> localVarReturnType = new GenericType<Client>() {};
|
GenericType<Client> localVarReturnType = new GenericType<Client>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("FakeClassnameTags123Api.testClassname", localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ public class PetApi {
|
|||||||
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("PetApi.addPet", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Deletes a pet
|
* Deletes a pet
|
||||||
@ -169,7 +169,7 @@ public class PetApi {
|
|||||||
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("PetApi.deletePet", localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Finds Pets by status
|
* Finds Pets by status
|
||||||
@ -236,7 +236,7 @@ public class PetApi {
|
|||||||
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
||||||
|
|
||||||
GenericType<List<Pet>> localVarReturnType = new GenericType<List<Pet>>() {};
|
GenericType<List<Pet>> localVarReturnType = new GenericType<List<Pet>>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("PetApi.findPetsByStatus", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Finds Pets by tags
|
* Finds Pets by tags
|
||||||
@ -307,7 +307,7 @@ public class PetApi {
|
|||||||
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
||||||
|
|
||||||
GenericType<List<Pet>> localVarReturnType = new GenericType<List<Pet>>() {};
|
GenericType<List<Pet>> localVarReturnType = new GenericType<List<Pet>>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("PetApi.findPetsByTags", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Find pet by ID
|
* Find pet by ID
|
||||||
@ -376,7 +376,7 @@ public class PetApi {
|
|||||||
String[] localVarAuthNames = new String[] { "api_key" };
|
String[] localVarAuthNames = new String[] { "api_key" };
|
||||||
|
|
||||||
GenericType<Pet> localVarReturnType = new GenericType<Pet>() {};
|
GenericType<Pet> localVarReturnType = new GenericType<Pet>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("PetApi.getPetById", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Update an existing pet
|
* Update an existing pet
|
||||||
@ -445,7 +445,7 @@ public class PetApi {
|
|||||||
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("PetApi.updatePet", localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Updates a pet in the store with form data
|
* Updates a pet in the store with form data
|
||||||
@ -517,7 +517,7 @@ if (status != null)
|
|||||||
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("PetApi.updatePetWithForm", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* uploads an image
|
* uploads an image
|
||||||
@ -590,7 +590,7 @@ if (file != null)
|
|||||||
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
||||||
|
|
||||||
GenericType<ModelApiResponse> localVarReturnType = new GenericType<ModelApiResponse>() {};
|
GenericType<ModelApiResponse> localVarReturnType = new GenericType<ModelApiResponse>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("PetApi.uploadFile", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* uploads an image (required)
|
* uploads an image (required)
|
||||||
@ -668,6 +668,6 @@ if (requiredFile != null)
|
|||||||
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
||||||
|
|
||||||
GenericType<ModelApiResponse> localVarReturnType = new GenericType<ModelApiResponse>() {};
|
GenericType<ModelApiResponse> localVarReturnType = new GenericType<ModelApiResponse>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("PetApi.uploadFileWithRequiredFile", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ public class StoreApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("StoreApi.deleteOrder", localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Returns pet inventories by status
|
* Returns pet inventories by status
|
||||||
@ -155,7 +155,7 @@ public class StoreApi {
|
|||||||
String[] localVarAuthNames = new String[] { "api_key" };
|
String[] localVarAuthNames = new String[] { "api_key" };
|
||||||
|
|
||||||
GenericType<Map<String, Integer>> localVarReturnType = new GenericType<Map<String, Integer>>() {};
|
GenericType<Map<String, Integer>> localVarReturnType = new GenericType<Map<String, Integer>>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("StoreApi.getInventory", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Find purchase order by ID
|
* Find purchase order by ID
|
||||||
@ -224,7 +224,7 @@ public class StoreApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
GenericType<Order> localVarReturnType = new GenericType<Order>() {};
|
GenericType<Order> localVarReturnType = new GenericType<Order>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("StoreApi.getOrderById", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Place an order for a pet
|
* Place an order for a pet
|
||||||
@ -290,6 +290,6 @@ public class StoreApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
GenericType<Order> localVarReturnType = new GenericType<Order>() {};
|
GenericType<Order> localVarReturnType = new GenericType<Order>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("StoreApi.placeOrder", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@ public class UserApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("UserApi.createUser", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Creates list of users with given input array
|
* Creates list of users with given input array
|
||||||
@ -158,7 +158,7 @@ public class UserApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("UserApi.createUsersWithArrayInput", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Creates list of users with given input array
|
* Creates list of users with given input array
|
||||||
@ -221,7 +221,7 @@ public class UserApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("UserApi.createUsersWithListInput", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Delete user
|
* Delete user
|
||||||
@ -287,7 +287,7 @@ public class UserApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("UserApi.deleteUser", localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Get user by user name
|
* Get user by user name
|
||||||
@ -356,7 +356,7 @@ public class UserApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
GenericType<User> localVarReturnType = new GenericType<User>() {};
|
GenericType<User> localVarReturnType = new GenericType<User>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("UserApi.getUserByName", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Logs user into the system
|
* Logs user into the system
|
||||||
@ -431,7 +431,7 @@ public class UserApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
GenericType<String> localVarReturnType = new GenericType<String>() {};
|
GenericType<String> localVarReturnType = new GenericType<String>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("UserApi.loginUser", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Logs out current logged in user session
|
* Logs out current logged in user session
|
||||||
@ -487,7 +487,7 @@ public class UserApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("UserApi.logoutUser", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Updated user
|
* Updated user
|
||||||
@ -560,6 +560,6 @@ public class UserApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("UserApi.updateUser", localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,9 @@ import java.util.Collections;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
@ -49,6 +51,7 @@ import org.openapitools.client.auth.Authentication;
|
|||||||
import org.openapitools.client.auth.HttpBasicAuth;
|
import org.openapitools.client.auth.HttpBasicAuth;
|
||||||
import org.openapitools.client.auth.HttpBearerAuth;
|
import org.openapitools.client.auth.HttpBearerAuth;
|
||||||
import org.openapitools.client.auth.ApiKeyAuth;
|
import org.openapitools.client.auth.ApiKeyAuth;
|
||||||
|
|
||||||
import org.openapitools.client.auth.OAuth;
|
import org.openapitools.client.auth.OAuth;
|
||||||
|
|
||||||
|
|
||||||
@ -56,6 +59,19 @@ public class ApiClient {
|
|||||||
protected Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
protected Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||||
protected Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
protected Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
||||||
protected 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(
|
||||||
|
new ServerConfiguration(
|
||||||
|
"http://petstore.swagger.io:80/v2",
|
||||||
|
"No description provided",
|
||||||
|
new HashMap<String, ServerVariable>()
|
||||||
|
)
|
||||||
|
));
|
||||||
|
protected Integer serverIndex = 0;
|
||||||
|
protected Map<String, String> serverVariables = null;
|
||||||
|
protected Map<String, List<ServerConfiguration>> operationServers = new HashMap<String, List<ServerConfiguration>>() {{
|
||||||
|
}};
|
||||||
|
protected Map<String, Integer> operationServerIndex = new HashMap<String, Integer>();
|
||||||
|
protected Map<String, Map<String, String>> operationServerVariables = new HashMap<String, Map<String, String>>();
|
||||||
protected boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
protected int connectionTimeout = 0;
|
protected int connectionTimeout = 0;
|
||||||
private int readTimeout = 0;
|
private int readTimeout = 0;
|
||||||
@ -113,6 +129,33 @@ public class ApiClient {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<ServerConfiguration> getServers() {
|
||||||
|
return servers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiClient setServers(List<ServerConfiguration> servers) {
|
||||||
|
this.servers = servers;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getServerIndex() {
|
||||||
|
return serverIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiClient setServerIndex(Integer serverIndex) {
|
||||||
|
this.serverIndex = serverIndex;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, String> getServerVariables() {
|
||||||
|
return serverVariables;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiClient setServerVariables(Map<String, String> serverVariables) {
|
||||||
|
this.serverVariables = serverVariables;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get authentications (key: authentication name, value: authentication).
|
* Get authentications (key: authentication name, value: authentication).
|
||||||
* @return Map of authentication object
|
* @return Map of authentication object
|
||||||
@ -654,6 +697,7 @@ public class ApiClient {
|
|||||||
* Invoke API by sending HTTP request with the given options.
|
* Invoke API by sending HTTP request with the given options.
|
||||||
*
|
*
|
||||||
* @param <T> Type
|
* @param <T> Type
|
||||||
|
* @param operation The qualified name of the operation
|
||||||
* @param path The sub-path of the HTTP URL
|
* @param path The sub-path of the HTTP URL
|
||||||
* @param method The request method, one of "GET", "POST", "PUT", "HEAD" and "DELETE"
|
* @param method The request method, one of "GET", "POST", "PUT", "HEAD" and "DELETE"
|
||||||
* @param queryParams The query parameters
|
* @param queryParams The query parameters
|
||||||
@ -668,12 +712,36 @@ public class ApiClient {
|
|||||||
* @return The response body in type of string
|
* @return The response body in type of string
|
||||||
* @throws ApiException API exception
|
* @throws ApiException API exception
|
||||||
*/
|
*/
|
||||||
public <T> ApiResponse<T> invokeAPI(String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String accept, String contentType, String[] authNames, GenericType<T> returnType) throws ApiException {
|
public <T> ApiResponse<T> invokeAPI(String operation, String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String accept, String contentType, String[] authNames, GenericType<T> returnType) throws ApiException {
|
||||||
updateParamsForAuth(authNames, queryParams, headerParams, cookieParams);
|
updateParamsForAuth(authNames, queryParams, headerParams, cookieParams);
|
||||||
|
|
||||||
// Not using `.target(this.basePath).path(path)` below,
|
// Not using `.target(targetURL).path(path)` below,
|
||||||
// to support (constant) query string in `path`, e.g. "/posts?draft=1"
|
// to support (constant) query string in `path`, e.g. "/posts?draft=1"
|
||||||
WebTarget target = httpClient.target(this.basePath + path);
|
String targetURL;
|
||||||
|
if (serverIndex != null) {
|
||||||
|
Integer index;
|
||||||
|
List<ServerConfiguration> serverConfigurations;
|
||||||
|
Map<String, String> variables;
|
||||||
|
|
||||||
|
if (operationServers.containsKey(operation)) {
|
||||||
|
index = operationServerIndex.getOrDefault(operation, serverIndex);
|
||||||
|
variables = operationServerVariables.getOrDefault(operation, serverVariables);
|
||||||
|
serverConfigurations = operationServers.get(operation);
|
||||||
|
} else {
|
||||||
|
index = serverIndex;
|
||||||
|
variables = serverVariables;
|
||||||
|
serverConfigurations = servers;
|
||||||
|
}
|
||||||
|
if (index < 0 || index >= serverConfigurations.size()) {
|
||||||
|
throw new ArrayIndexOutOfBoundsException(String.format(
|
||||||
|
"Invalid index %d when selecting the host settings. Must be less than %d", index, serverConfigurations.size()
|
||||||
|
));
|
||||||
|
}
|
||||||
|
targetURL = serverConfigurations.get(index).URL(variables) + path;
|
||||||
|
} else {
|
||||||
|
targetURL = this.basePath + path;
|
||||||
|
}
|
||||||
|
WebTarget target = httpClient.target(targetURL);
|
||||||
|
|
||||||
if (queryParams != null) {
|
if (queryParams != null) {
|
||||||
for (Pair queryParam : queryParams) {
|
for (Pair queryParam : queryParams) {
|
||||||
@ -777,6 +845,14 @@ public class ApiClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Add qualified name of the operation as a first parameter.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public <T> ApiResponse<T> invokeAPI(String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String accept, String contentType, String[] authNames, GenericType<T> returnType) throws ApiException {
|
||||||
|
return invokeAPI(null, path, method, queryParams, body, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build the Client used to make HTTP requests.
|
* Build the Client used to make HTTP requests.
|
||||||
* @param debugging Debug setting
|
* @param debugging Debug setting
|
||||||
|
@ -0,0 +1,58 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server configuration.
|
||||||
|
*/
|
||||||
|
public class ServerConfiguration {
|
||||||
|
public String URL;
|
||||||
|
public String description;
|
||||||
|
public Map<String, ServerVariable> variables;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param URL A URL to the target host.
|
||||||
|
* @param description A describtion of the host designated by the URL.
|
||||||
|
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||||
|
*/
|
||||||
|
public ServerConfiguration(String URL, String description, Map<String, ServerVariable> variables) {
|
||||||
|
this.URL = URL;
|
||||||
|
this.description = description;
|
||||||
|
this.variables = variables;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using given variables.
|
||||||
|
*
|
||||||
|
* @param variables A map between a variable name and its value.
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL(Map<String, String> variables) {
|
||||||
|
String url = this.URL;
|
||||||
|
|
||||||
|
// go through variables and replace placeholders
|
||||||
|
for (Map.Entry<String, ServerVariable> variable: this.variables.entrySet()) {
|
||||||
|
String name = variable.getKey();
|
||||||
|
ServerVariable serverVariable = variable.getValue();
|
||||||
|
String value = serverVariable.defaultValue;
|
||||||
|
|
||||||
|
if (variables != null && variables.containsKey(name)) {
|
||||||
|
value = variables.get(name);
|
||||||
|
if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) {
|
||||||
|
throw new RuntimeException("The variable " + name + " in the server URL has invalid value " + value + ".");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
url = url.replaceAll("\\{" + name + "\\}", value);
|
||||||
|
}
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using default server variables.
|
||||||
|
*
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL() {
|
||||||
|
return URL(null);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server Variable for server URL template substitution.
|
||||||
|
*/
|
||||||
|
public class ServerVariable {
|
||||||
|
public String description;
|
||||||
|
public String defaultValue;
|
||||||
|
public HashSet<String> enumValues = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param description A description for the server variable.
|
||||||
|
* @param defaultValue The default value to use for substitution.
|
||||||
|
* @param enumValues An enumeration of string values to be used if the substitution options are from a limited set.
|
||||||
|
*/
|
||||||
|
public ServerVariable(String description, String defaultValue, HashSet<String> enumValues) {
|
||||||
|
this.description = description;
|
||||||
|
this.defaultValue = defaultValue;
|
||||||
|
this.enumValues = enumValues;
|
||||||
|
}
|
||||||
|
}
|
@ -96,6 +96,6 @@ public class AnotherFakeApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
GenericType<Client> localVarReturnType = new GenericType<Client>() {};
|
GenericType<Client> localVarReturnType = new GenericType<Client>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("AnotherFakeApi.call123testSpecialTags", localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ public class FakeApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("FakeApi.createXmlItem", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -162,7 +162,7 @@ public class FakeApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
GenericType<Boolean> localVarReturnType = new GenericType<Boolean>() {};
|
GenericType<Boolean> localVarReturnType = new GenericType<Boolean>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("FakeApi.fakeOuterBooleanSerialize", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -221,7 +221,7 @@ public class FakeApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
GenericType<OuterComposite> localVarReturnType = new GenericType<OuterComposite>() {};
|
GenericType<OuterComposite> localVarReturnType = new GenericType<OuterComposite>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("FakeApi.fakeOuterCompositeSerialize", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -280,7 +280,7 @@ public class FakeApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
GenericType<BigDecimal> localVarReturnType = new GenericType<BigDecimal>() {};
|
GenericType<BigDecimal> localVarReturnType = new GenericType<BigDecimal>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("FakeApi.fakeOuterNumberSerialize", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -339,7 +339,7 @@ public class FakeApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
GenericType<String> localVarReturnType = new GenericType<String>() {};
|
GenericType<String> localVarReturnType = new GenericType<String>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("FakeApi.fakeOuterStringSerialize", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -402,7 +402,7 @@ public class FakeApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("FakeApi.testBodyWithFileSchema", localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -473,7 +473,7 @@ public class FakeApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("FakeApi.testBodyWithQueryParams", localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* To test \"client\" model
|
* To test \"client\" model
|
||||||
@ -537,7 +537,7 @@ public class FakeApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
GenericType<Client> localVarReturnType = new GenericType<Client>() {};
|
GenericType<Client> localVarReturnType = new GenericType<Client>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("FakeApi.testClientModel", localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||||
@ -671,7 +671,7 @@ if (paramCallback != null)
|
|||||||
String[] localVarAuthNames = new String[] { "http_basic_test" };
|
String[] localVarAuthNames = new String[] { "http_basic_test" };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("FakeApi.testEndpointParameters", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* To test enum parameters
|
* To test enum parameters
|
||||||
@ -757,7 +757,7 @@ if (enumFormString != null)
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("FakeApi.testEnumParameters", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ApiResponse<Void> testGroupParametersWithHttpInfo(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group) throws ApiException {
|
private ApiResponse<Void> testGroupParametersWithHttpInfo(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group) throws ApiException {
|
||||||
@ -812,7 +812,7 @@ if (booleanGroup != null)
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("FakeApi.testGroupParameters", localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class APItestGroupParametersRequest {
|
public class APItestGroupParametersRequest {
|
||||||
@ -999,7 +999,7 @@ if (booleanGroup != null)
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("FakeApi.testInlineAdditionalProperties", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* test json serialization of form data
|
* test json serialization of form data
|
||||||
@ -1073,7 +1073,7 @@ if (param2 != null)
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("FakeApi.testJsonFormData", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -1169,6 +1169,6 @@ if (param2 != null)
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("FakeApi.testQueryParameterCollectionFormat", localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,6 +96,6 @@ public class FakeClassnameTags123Api {
|
|||||||
String[] localVarAuthNames = new String[] { "api_key_query" };
|
String[] localVarAuthNames = new String[] { "api_key_query" };
|
||||||
|
|
||||||
GenericType<Client> localVarReturnType = new GenericType<Client>() {};
|
GenericType<Client> localVarReturnType = new GenericType<Client>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("FakeClassnameTags123Api.testClassname", localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ public class PetApi {
|
|||||||
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("PetApi.addPet", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Deletes a pet
|
* Deletes a pet
|
||||||
@ -169,7 +169,7 @@ public class PetApi {
|
|||||||
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("PetApi.deletePet", localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Finds Pets by status
|
* Finds Pets by status
|
||||||
@ -236,7 +236,7 @@ public class PetApi {
|
|||||||
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
||||||
|
|
||||||
GenericType<List<Pet>> localVarReturnType = new GenericType<List<Pet>>() {};
|
GenericType<List<Pet>> localVarReturnType = new GenericType<List<Pet>>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("PetApi.findPetsByStatus", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Finds Pets by tags
|
* Finds Pets by tags
|
||||||
@ -307,7 +307,7 @@ public class PetApi {
|
|||||||
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
||||||
|
|
||||||
GenericType<List<Pet>> localVarReturnType = new GenericType<List<Pet>>() {};
|
GenericType<List<Pet>> localVarReturnType = new GenericType<List<Pet>>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("PetApi.findPetsByTags", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Find pet by ID
|
* Find pet by ID
|
||||||
@ -376,7 +376,7 @@ public class PetApi {
|
|||||||
String[] localVarAuthNames = new String[] { "api_key" };
|
String[] localVarAuthNames = new String[] { "api_key" };
|
||||||
|
|
||||||
GenericType<Pet> localVarReturnType = new GenericType<Pet>() {};
|
GenericType<Pet> localVarReturnType = new GenericType<Pet>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("PetApi.getPetById", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Update an existing pet
|
* Update an existing pet
|
||||||
@ -445,7 +445,7 @@ public class PetApi {
|
|||||||
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("PetApi.updatePet", localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Updates a pet in the store with form data
|
* Updates a pet in the store with form data
|
||||||
@ -517,7 +517,7 @@ if (status != null)
|
|||||||
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("PetApi.updatePetWithForm", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* uploads an image
|
* uploads an image
|
||||||
@ -590,7 +590,7 @@ if (file != null)
|
|||||||
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
||||||
|
|
||||||
GenericType<ModelApiResponse> localVarReturnType = new GenericType<ModelApiResponse>() {};
|
GenericType<ModelApiResponse> localVarReturnType = new GenericType<ModelApiResponse>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("PetApi.uploadFile", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* uploads an image (required)
|
* uploads an image (required)
|
||||||
@ -668,6 +668,6 @@ if (requiredFile != null)
|
|||||||
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
||||||
|
|
||||||
GenericType<ModelApiResponse> localVarReturnType = new GenericType<ModelApiResponse>() {};
|
GenericType<ModelApiResponse> localVarReturnType = new GenericType<ModelApiResponse>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("PetApi.uploadFileWithRequiredFile", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ public class StoreApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("StoreApi.deleteOrder", localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Returns pet inventories by status
|
* Returns pet inventories by status
|
||||||
@ -155,7 +155,7 @@ public class StoreApi {
|
|||||||
String[] localVarAuthNames = new String[] { "api_key" };
|
String[] localVarAuthNames = new String[] { "api_key" };
|
||||||
|
|
||||||
GenericType<Map<String, Integer>> localVarReturnType = new GenericType<Map<String, Integer>>() {};
|
GenericType<Map<String, Integer>> localVarReturnType = new GenericType<Map<String, Integer>>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("StoreApi.getInventory", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Find purchase order by ID
|
* Find purchase order by ID
|
||||||
@ -224,7 +224,7 @@ public class StoreApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
GenericType<Order> localVarReturnType = new GenericType<Order>() {};
|
GenericType<Order> localVarReturnType = new GenericType<Order>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("StoreApi.getOrderById", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Place an order for a pet
|
* Place an order for a pet
|
||||||
@ -290,6 +290,6 @@ public class StoreApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
GenericType<Order> localVarReturnType = new GenericType<Order>() {};
|
GenericType<Order> localVarReturnType = new GenericType<Order>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("StoreApi.placeOrder", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@ public class UserApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("UserApi.createUser", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Creates list of users with given input array
|
* Creates list of users with given input array
|
||||||
@ -158,7 +158,7 @@ public class UserApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("UserApi.createUsersWithArrayInput", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Creates list of users with given input array
|
* Creates list of users with given input array
|
||||||
@ -221,7 +221,7 @@ public class UserApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("UserApi.createUsersWithListInput", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Delete user
|
* Delete user
|
||||||
@ -287,7 +287,7 @@ public class UserApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("UserApi.deleteUser", localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Get user by user name
|
* Get user by user name
|
||||||
@ -356,7 +356,7 @@ public class UserApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
GenericType<User> localVarReturnType = new GenericType<User>() {};
|
GenericType<User> localVarReturnType = new GenericType<User>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("UserApi.getUserByName", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Logs user into the system
|
* Logs user into the system
|
||||||
@ -431,7 +431,7 @@ public class UserApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
GenericType<String> localVarReturnType = new GenericType<String>() {};
|
GenericType<String> localVarReturnType = new GenericType<String>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("UserApi.loginUser", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Logs out current logged in user session
|
* Logs out current logged in user session
|
||||||
@ -487,7 +487,7 @@ public class UserApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("UserApi.logoutUser", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Updated user
|
* Updated user
|
||||||
@ -560,6 +560,6 @@ public class UserApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("UserApi.updateUser", localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,9 @@ import java.util.Collections;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
@ -49,6 +51,7 @@ import org.openapitools.client.auth.Authentication;
|
|||||||
import org.openapitools.client.auth.HttpBasicAuth;
|
import org.openapitools.client.auth.HttpBasicAuth;
|
||||||
import org.openapitools.client.auth.HttpBearerAuth;
|
import org.openapitools.client.auth.HttpBearerAuth;
|
||||||
import org.openapitools.client.auth.ApiKeyAuth;
|
import org.openapitools.client.auth.ApiKeyAuth;
|
||||||
|
|
||||||
import org.openapitools.client.auth.OAuth;
|
import org.openapitools.client.auth.OAuth;
|
||||||
|
|
||||||
|
|
||||||
@ -56,6 +59,19 @@ public class ApiClient {
|
|||||||
protected Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
protected Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||||
protected Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
protected Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
||||||
protected 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(
|
||||||
|
new ServerConfiguration(
|
||||||
|
"http://petstore.swagger.io:80/v2",
|
||||||
|
"No description provided",
|
||||||
|
new HashMap<String, ServerVariable>()
|
||||||
|
)
|
||||||
|
));
|
||||||
|
protected Integer serverIndex = 0;
|
||||||
|
protected Map<String, String> serverVariables = null;
|
||||||
|
protected Map<String, List<ServerConfiguration>> operationServers = new HashMap<String, List<ServerConfiguration>>() {{
|
||||||
|
}};
|
||||||
|
protected Map<String, Integer> operationServerIndex = new HashMap<String, Integer>();
|
||||||
|
protected Map<String, Map<String, String>> operationServerVariables = new HashMap<String, Map<String, String>>();
|
||||||
protected boolean debugging = false;
|
protected boolean debugging = false;
|
||||||
protected int connectionTimeout = 0;
|
protected int connectionTimeout = 0;
|
||||||
private int readTimeout = 0;
|
private int readTimeout = 0;
|
||||||
@ -113,6 +129,33 @@ public class ApiClient {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<ServerConfiguration> getServers() {
|
||||||
|
return servers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiClient setServers(List<ServerConfiguration> servers) {
|
||||||
|
this.servers = servers;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getServerIndex() {
|
||||||
|
return serverIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiClient setServerIndex(Integer serverIndex) {
|
||||||
|
this.serverIndex = serverIndex;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, String> getServerVariables() {
|
||||||
|
return serverVariables;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiClient setServerVariables(Map<String, String> serverVariables) {
|
||||||
|
this.serverVariables = serverVariables;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get authentications (key: authentication name, value: authentication).
|
* Get authentications (key: authentication name, value: authentication).
|
||||||
* @return Map of authentication object
|
* @return Map of authentication object
|
||||||
@ -654,6 +697,7 @@ public class ApiClient {
|
|||||||
* Invoke API by sending HTTP request with the given options.
|
* Invoke API by sending HTTP request with the given options.
|
||||||
*
|
*
|
||||||
* @param <T> Type
|
* @param <T> Type
|
||||||
|
* @param operation The qualified name of the operation
|
||||||
* @param path The sub-path of the HTTP URL
|
* @param path The sub-path of the HTTP URL
|
||||||
* @param method The request method, one of "GET", "POST", "PUT", "HEAD" and "DELETE"
|
* @param method The request method, one of "GET", "POST", "PUT", "HEAD" and "DELETE"
|
||||||
* @param queryParams The query parameters
|
* @param queryParams The query parameters
|
||||||
@ -668,12 +712,36 @@ public class ApiClient {
|
|||||||
* @return The response body in type of string
|
* @return The response body in type of string
|
||||||
* @throws ApiException API exception
|
* @throws ApiException API exception
|
||||||
*/
|
*/
|
||||||
public <T> ApiResponse<T> invokeAPI(String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String accept, String contentType, String[] authNames, GenericType<T> returnType) throws ApiException {
|
public <T> ApiResponse<T> invokeAPI(String operation, String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String accept, String contentType, String[] authNames, GenericType<T> returnType) throws ApiException {
|
||||||
updateParamsForAuth(authNames, queryParams, headerParams, cookieParams);
|
updateParamsForAuth(authNames, queryParams, headerParams, cookieParams);
|
||||||
|
|
||||||
// Not using `.target(this.basePath).path(path)` below,
|
// Not using `.target(targetURL).path(path)` below,
|
||||||
// to support (constant) query string in `path`, e.g. "/posts?draft=1"
|
// to support (constant) query string in `path`, e.g. "/posts?draft=1"
|
||||||
WebTarget target = httpClient.target(this.basePath + path);
|
String targetURL;
|
||||||
|
if (serverIndex != null) {
|
||||||
|
Integer index;
|
||||||
|
List<ServerConfiguration> serverConfigurations;
|
||||||
|
Map<String, String> variables;
|
||||||
|
|
||||||
|
if (operationServers.containsKey(operation)) {
|
||||||
|
index = operationServerIndex.getOrDefault(operation, serverIndex);
|
||||||
|
variables = operationServerVariables.getOrDefault(operation, serverVariables);
|
||||||
|
serverConfigurations = operationServers.get(operation);
|
||||||
|
} else {
|
||||||
|
index = serverIndex;
|
||||||
|
variables = serverVariables;
|
||||||
|
serverConfigurations = servers;
|
||||||
|
}
|
||||||
|
if (index < 0 || index >= serverConfigurations.size()) {
|
||||||
|
throw new ArrayIndexOutOfBoundsException(String.format(
|
||||||
|
"Invalid index %d when selecting the host settings. Must be less than %d", index, serverConfigurations.size()
|
||||||
|
));
|
||||||
|
}
|
||||||
|
targetURL = serverConfigurations.get(index).URL(variables) + path;
|
||||||
|
} else {
|
||||||
|
targetURL = this.basePath + path;
|
||||||
|
}
|
||||||
|
WebTarget target = httpClient.target(targetURL);
|
||||||
|
|
||||||
if (queryParams != null) {
|
if (queryParams != null) {
|
||||||
for (Pair queryParam : queryParams) {
|
for (Pair queryParam : queryParams) {
|
||||||
@ -777,6 +845,14 @@ public class ApiClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Add qualified name of the operation as a first parameter.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public <T> ApiResponse<T> invokeAPI(String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String accept, String contentType, String[] authNames, GenericType<T> returnType) throws ApiException {
|
||||||
|
return invokeAPI(null, path, method, queryParams, body, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build the Client used to make HTTP requests.
|
* Build the Client used to make HTTP requests.
|
||||||
* @param debugging Debug setting
|
* @param debugging Debug setting
|
||||||
|
@ -0,0 +1,58 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server configuration.
|
||||||
|
*/
|
||||||
|
public class ServerConfiguration {
|
||||||
|
public String URL;
|
||||||
|
public String description;
|
||||||
|
public Map<String, ServerVariable> variables;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param URL A URL to the target host.
|
||||||
|
* @param description A describtion of the host designated by the URL.
|
||||||
|
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||||
|
*/
|
||||||
|
public ServerConfiguration(String URL, String description, Map<String, ServerVariable> variables) {
|
||||||
|
this.URL = URL;
|
||||||
|
this.description = description;
|
||||||
|
this.variables = variables;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using given variables.
|
||||||
|
*
|
||||||
|
* @param variables A map between a variable name and its value.
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL(Map<String, String> variables) {
|
||||||
|
String url = this.URL;
|
||||||
|
|
||||||
|
// go through variables and replace placeholders
|
||||||
|
for (Map.Entry<String, ServerVariable> variable: this.variables.entrySet()) {
|
||||||
|
String name = variable.getKey();
|
||||||
|
ServerVariable serverVariable = variable.getValue();
|
||||||
|
String value = serverVariable.defaultValue;
|
||||||
|
|
||||||
|
if (variables != null && variables.containsKey(name)) {
|
||||||
|
value = variables.get(name);
|
||||||
|
if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) {
|
||||||
|
throw new RuntimeException("The variable " + name + " in the server URL has invalid value " + value + ".");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
url = url.replaceAll("\\{" + name + "\\}", value);
|
||||||
|
}
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using default server variables.
|
||||||
|
*
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL() {
|
||||||
|
return URL(null);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server Variable for server URL template substitution.
|
||||||
|
*/
|
||||||
|
public class ServerVariable {
|
||||||
|
public String description;
|
||||||
|
public String defaultValue;
|
||||||
|
public HashSet<String> enumValues = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param description A description for the server variable.
|
||||||
|
* @param defaultValue The default value to use for substitution.
|
||||||
|
* @param enumValues An enumeration of string values to be used if the substitution options are from a limited set.
|
||||||
|
*/
|
||||||
|
public ServerVariable(String description, String defaultValue, HashSet<String> enumValues) {
|
||||||
|
this.description = description;
|
||||||
|
this.defaultValue = defaultValue;
|
||||||
|
this.enumValues = enumValues;
|
||||||
|
}
|
||||||
|
}
|
@ -96,6 +96,6 @@ public class AnotherFakeApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
GenericType<Client> localVarReturnType = new GenericType<Client>() {};
|
GenericType<Client> localVarReturnType = new GenericType<Client>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("AnotherFakeApi.call123testSpecialTags", localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ public class FakeApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("FakeApi.createXmlItem", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -162,7 +162,7 @@ public class FakeApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
GenericType<Boolean> localVarReturnType = new GenericType<Boolean>() {};
|
GenericType<Boolean> localVarReturnType = new GenericType<Boolean>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("FakeApi.fakeOuterBooleanSerialize", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -221,7 +221,7 @@ public class FakeApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
GenericType<OuterComposite> localVarReturnType = new GenericType<OuterComposite>() {};
|
GenericType<OuterComposite> localVarReturnType = new GenericType<OuterComposite>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("FakeApi.fakeOuterCompositeSerialize", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -280,7 +280,7 @@ public class FakeApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
GenericType<BigDecimal> localVarReturnType = new GenericType<BigDecimal>() {};
|
GenericType<BigDecimal> localVarReturnType = new GenericType<BigDecimal>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("FakeApi.fakeOuterNumberSerialize", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -339,7 +339,7 @@ public class FakeApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
GenericType<String> localVarReturnType = new GenericType<String>() {};
|
GenericType<String> localVarReturnType = new GenericType<String>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("FakeApi.fakeOuterStringSerialize", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -402,7 +402,7 @@ public class FakeApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("FakeApi.testBodyWithFileSchema", localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -473,7 +473,7 @@ public class FakeApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("FakeApi.testBodyWithQueryParams", localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* To test \"client\" model
|
* To test \"client\" model
|
||||||
@ -537,7 +537,7 @@ public class FakeApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
GenericType<Client> localVarReturnType = new GenericType<Client>() {};
|
GenericType<Client> localVarReturnType = new GenericType<Client>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("FakeApi.testClientModel", localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||||
@ -671,7 +671,7 @@ if (paramCallback != null)
|
|||||||
String[] localVarAuthNames = new String[] { "http_basic_test" };
|
String[] localVarAuthNames = new String[] { "http_basic_test" };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("FakeApi.testEndpointParameters", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* To test enum parameters
|
* To test enum parameters
|
||||||
@ -757,7 +757,7 @@ if (enumFormString != null)
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("FakeApi.testEnumParameters", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ApiResponse<Void> testGroupParametersWithHttpInfo(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group) throws ApiException {
|
private ApiResponse<Void> testGroupParametersWithHttpInfo(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group) throws ApiException {
|
||||||
@ -812,7 +812,7 @@ if (booleanGroup != null)
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("FakeApi.testGroupParameters", localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class APItestGroupParametersRequest {
|
public class APItestGroupParametersRequest {
|
||||||
@ -999,7 +999,7 @@ if (booleanGroup != null)
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("FakeApi.testInlineAdditionalProperties", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* test json serialization of form data
|
* test json serialization of form data
|
||||||
@ -1073,7 +1073,7 @@ if (param2 != null)
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("FakeApi.testJsonFormData", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -1169,6 +1169,6 @@ if (param2 != null)
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("FakeApi.testQueryParameterCollectionFormat", localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,6 +96,6 @@ public class FakeClassnameTags123Api {
|
|||||||
String[] localVarAuthNames = new String[] { "api_key_query" };
|
String[] localVarAuthNames = new String[] { "api_key_query" };
|
||||||
|
|
||||||
GenericType<Client> localVarReturnType = new GenericType<Client>() {};
|
GenericType<Client> localVarReturnType = new GenericType<Client>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("FakeClassnameTags123Api.testClassname", localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ public class PetApi {
|
|||||||
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("PetApi.addPet", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Deletes a pet
|
* Deletes a pet
|
||||||
@ -169,7 +169,7 @@ public class PetApi {
|
|||||||
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("PetApi.deletePet", localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Finds Pets by status
|
* Finds Pets by status
|
||||||
@ -236,7 +236,7 @@ public class PetApi {
|
|||||||
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
||||||
|
|
||||||
GenericType<List<Pet>> localVarReturnType = new GenericType<List<Pet>>() {};
|
GenericType<List<Pet>> localVarReturnType = new GenericType<List<Pet>>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("PetApi.findPetsByStatus", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Finds Pets by tags
|
* Finds Pets by tags
|
||||||
@ -307,7 +307,7 @@ public class PetApi {
|
|||||||
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
||||||
|
|
||||||
GenericType<List<Pet>> localVarReturnType = new GenericType<List<Pet>>() {};
|
GenericType<List<Pet>> localVarReturnType = new GenericType<List<Pet>>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("PetApi.findPetsByTags", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Find pet by ID
|
* Find pet by ID
|
||||||
@ -376,7 +376,7 @@ public class PetApi {
|
|||||||
String[] localVarAuthNames = new String[] { "api_key" };
|
String[] localVarAuthNames = new String[] { "api_key" };
|
||||||
|
|
||||||
GenericType<Pet> localVarReturnType = new GenericType<Pet>() {};
|
GenericType<Pet> localVarReturnType = new GenericType<Pet>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("PetApi.getPetById", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Update an existing pet
|
* Update an existing pet
|
||||||
@ -445,7 +445,7 @@ public class PetApi {
|
|||||||
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("PetApi.updatePet", localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Updates a pet in the store with form data
|
* Updates a pet in the store with form data
|
||||||
@ -517,7 +517,7 @@ if (status != null)
|
|||||||
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("PetApi.updatePetWithForm", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* uploads an image
|
* uploads an image
|
||||||
@ -590,7 +590,7 @@ if (file != null)
|
|||||||
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
||||||
|
|
||||||
GenericType<ModelApiResponse> localVarReturnType = new GenericType<ModelApiResponse>() {};
|
GenericType<ModelApiResponse> localVarReturnType = new GenericType<ModelApiResponse>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("PetApi.uploadFile", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* uploads an image (required)
|
* uploads an image (required)
|
||||||
@ -668,6 +668,6 @@ if (requiredFile != null)
|
|||||||
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
||||||
|
|
||||||
GenericType<ModelApiResponse> localVarReturnType = new GenericType<ModelApiResponse>() {};
|
GenericType<ModelApiResponse> localVarReturnType = new GenericType<ModelApiResponse>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("PetApi.uploadFileWithRequiredFile", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ public class StoreApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("StoreApi.deleteOrder", localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Returns pet inventories by status
|
* Returns pet inventories by status
|
||||||
@ -155,7 +155,7 @@ public class StoreApi {
|
|||||||
String[] localVarAuthNames = new String[] { "api_key" };
|
String[] localVarAuthNames = new String[] { "api_key" };
|
||||||
|
|
||||||
GenericType<Map<String, Integer>> localVarReturnType = new GenericType<Map<String, Integer>>() {};
|
GenericType<Map<String, Integer>> localVarReturnType = new GenericType<Map<String, Integer>>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("StoreApi.getInventory", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Find purchase order by ID
|
* Find purchase order by ID
|
||||||
@ -224,7 +224,7 @@ public class StoreApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
GenericType<Order> localVarReturnType = new GenericType<Order>() {};
|
GenericType<Order> localVarReturnType = new GenericType<Order>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("StoreApi.getOrderById", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Place an order for a pet
|
* Place an order for a pet
|
||||||
@ -290,6 +290,6 @@ public class StoreApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
GenericType<Order> localVarReturnType = new GenericType<Order>() {};
|
GenericType<Order> localVarReturnType = new GenericType<Order>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("StoreApi.placeOrder", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@ public class UserApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("UserApi.createUser", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Creates list of users with given input array
|
* Creates list of users with given input array
|
||||||
@ -158,7 +158,7 @@ public class UserApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("UserApi.createUsersWithArrayInput", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Creates list of users with given input array
|
* Creates list of users with given input array
|
||||||
@ -221,7 +221,7 @@ public class UserApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("UserApi.createUsersWithListInput", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Delete user
|
* Delete user
|
||||||
@ -287,7 +287,7 @@ public class UserApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("UserApi.deleteUser", localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Get user by user name
|
* Get user by user name
|
||||||
@ -356,7 +356,7 @@ public class UserApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
GenericType<User> localVarReturnType = new GenericType<User>() {};
|
GenericType<User> localVarReturnType = new GenericType<User>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("UserApi.getUserByName", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Logs user into the system
|
* Logs user into the system
|
||||||
@ -431,7 +431,7 @@ public class UserApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
GenericType<String> localVarReturnType = new GenericType<String>() {};
|
GenericType<String> localVarReturnType = new GenericType<String>() {};
|
||||||
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
return apiClient.invokeAPI("UserApi.loginUser", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Logs out current logged in user session
|
* Logs out current logged in user session
|
||||||
@ -487,7 +487,7 @@ public class UserApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("UserApi.logoutUser", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Updated user
|
* Updated user
|
||||||
@ -560,6 +560,6 @@ public class UserApi {
|
|||||||
String[] localVarAuthNames = new String[] { };
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
return apiClient.invokeAPI("UserApi.updateUser", localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,58 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server configuration.
|
||||||
|
*/
|
||||||
|
public class ServerConfiguration {
|
||||||
|
public String URL;
|
||||||
|
public String description;
|
||||||
|
public Map<String, ServerVariable> variables;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param URL A URL to the target host.
|
||||||
|
* @param description A describtion of the host designated by the URL.
|
||||||
|
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||||
|
*/
|
||||||
|
public ServerConfiguration(String URL, String description, Map<String, ServerVariable> variables) {
|
||||||
|
this.URL = URL;
|
||||||
|
this.description = description;
|
||||||
|
this.variables = variables;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using given variables.
|
||||||
|
*
|
||||||
|
* @param variables A map between a variable name and its value.
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL(Map<String, String> variables) {
|
||||||
|
String url = this.URL;
|
||||||
|
|
||||||
|
// go through variables and replace placeholders
|
||||||
|
for (Map.Entry<String, ServerVariable> variable: this.variables.entrySet()) {
|
||||||
|
String name = variable.getKey();
|
||||||
|
ServerVariable serverVariable = variable.getValue();
|
||||||
|
String value = serverVariable.defaultValue;
|
||||||
|
|
||||||
|
if (variables != null && variables.containsKey(name)) {
|
||||||
|
value = variables.get(name);
|
||||||
|
if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) {
|
||||||
|
throw new RuntimeException("The variable " + name + " in the server URL has invalid value " + value + ".");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
url = url.replaceAll("\\{" + name + "\\}", value);
|
||||||
|
}
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using default server variables.
|
||||||
|
*
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL() {
|
||||||
|
return URL(null);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server Variable for server URL template substitution.
|
||||||
|
*/
|
||||||
|
public class ServerVariable {
|
||||||
|
public String description;
|
||||||
|
public String defaultValue;
|
||||||
|
public HashSet<String> enumValues = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param description A description for the server variable.
|
||||||
|
* @param defaultValue The default value to use for substitution.
|
||||||
|
* @param enumValues An enumeration of string values to be used if the substitution options are from a limited set.
|
||||||
|
*/
|
||||||
|
public ServerVariable(String description, String defaultValue, HashSet<String> enumValues) {
|
||||||
|
this.description = description;
|
||||||
|
this.defaultValue = defaultValue;
|
||||||
|
this.enumValues = enumValues;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,58 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server configuration.
|
||||||
|
*/
|
||||||
|
public class ServerConfiguration {
|
||||||
|
public String URL;
|
||||||
|
public String description;
|
||||||
|
public Map<String, ServerVariable> variables;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param URL A URL to the target host.
|
||||||
|
* @param description A describtion of the host designated by the URL.
|
||||||
|
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||||
|
*/
|
||||||
|
public ServerConfiguration(String URL, String description, Map<String, ServerVariable> variables) {
|
||||||
|
this.URL = URL;
|
||||||
|
this.description = description;
|
||||||
|
this.variables = variables;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using given variables.
|
||||||
|
*
|
||||||
|
* @param variables A map between a variable name and its value.
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL(Map<String, String> variables) {
|
||||||
|
String url = this.URL;
|
||||||
|
|
||||||
|
// go through variables and replace placeholders
|
||||||
|
for (Map.Entry<String, ServerVariable> variable: this.variables.entrySet()) {
|
||||||
|
String name = variable.getKey();
|
||||||
|
ServerVariable serverVariable = variable.getValue();
|
||||||
|
String value = serverVariable.defaultValue;
|
||||||
|
|
||||||
|
if (variables != null && variables.containsKey(name)) {
|
||||||
|
value = variables.get(name);
|
||||||
|
if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) {
|
||||||
|
throw new RuntimeException("The variable " + name + " in the server URL has invalid value " + value + ".");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
url = url.replaceAll("\\{" + name + "\\}", value);
|
||||||
|
}
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using default server variables.
|
||||||
|
*
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL() {
|
||||||
|
return URL(null);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server Variable for server URL template substitution.
|
||||||
|
*/
|
||||||
|
public class ServerVariable {
|
||||||
|
public String description;
|
||||||
|
public String defaultValue;
|
||||||
|
public HashSet<String> enumValues = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param description A description for the server variable.
|
||||||
|
* @param defaultValue The default value to use for substitution.
|
||||||
|
* @param enumValues An enumeration of string values to be used if the substitution options are from a limited set.
|
||||||
|
*/
|
||||||
|
public ServerVariable(String description, String defaultValue, HashSet<String> enumValues) {
|
||||||
|
this.description = description;
|
||||||
|
this.defaultValue = defaultValue;
|
||||||
|
this.enumValues = enumValues;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,58 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server configuration.
|
||||||
|
*/
|
||||||
|
public class ServerConfiguration {
|
||||||
|
public String URL;
|
||||||
|
public String description;
|
||||||
|
public Map<String, ServerVariable> variables;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param URL A URL to the target host.
|
||||||
|
* @param description A describtion of the host designated by the URL.
|
||||||
|
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||||
|
*/
|
||||||
|
public ServerConfiguration(String URL, String description, Map<String, ServerVariable> variables) {
|
||||||
|
this.URL = URL;
|
||||||
|
this.description = description;
|
||||||
|
this.variables = variables;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using given variables.
|
||||||
|
*
|
||||||
|
* @param variables A map between a variable name and its value.
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL(Map<String, String> variables) {
|
||||||
|
String url = this.URL;
|
||||||
|
|
||||||
|
// go through variables and replace placeholders
|
||||||
|
for (Map.Entry<String, ServerVariable> variable: this.variables.entrySet()) {
|
||||||
|
String name = variable.getKey();
|
||||||
|
ServerVariable serverVariable = variable.getValue();
|
||||||
|
String value = serverVariable.defaultValue;
|
||||||
|
|
||||||
|
if (variables != null && variables.containsKey(name)) {
|
||||||
|
value = variables.get(name);
|
||||||
|
if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) {
|
||||||
|
throw new RuntimeException("The variable " + name + " in the server URL has invalid value " + value + ".");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
url = url.replaceAll("\\{" + name + "\\}", value);
|
||||||
|
}
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using default server variables.
|
||||||
|
*
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL() {
|
||||||
|
return URL(null);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server Variable for server URL template substitution.
|
||||||
|
*/
|
||||||
|
public class ServerVariable {
|
||||||
|
public String description;
|
||||||
|
public String defaultValue;
|
||||||
|
public HashSet<String> enumValues = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param description A description for the server variable.
|
||||||
|
* @param defaultValue The default value to use for substitution.
|
||||||
|
* @param enumValues An enumeration of string values to be used if the substitution options are from a limited set.
|
||||||
|
*/
|
||||||
|
public ServerVariable(String description, String defaultValue, HashSet<String> enumValues) {
|
||||||
|
this.description = description;
|
||||||
|
this.defaultValue = defaultValue;
|
||||||
|
this.enumValues = enumValues;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,58 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server configuration.
|
||||||
|
*/
|
||||||
|
public class ServerConfiguration {
|
||||||
|
public String URL;
|
||||||
|
public String description;
|
||||||
|
public Map<String, ServerVariable> variables;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param URL A URL to the target host.
|
||||||
|
* @param description A describtion of the host designated by the URL.
|
||||||
|
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||||
|
*/
|
||||||
|
public ServerConfiguration(String URL, String description, Map<String, ServerVariable> variables) {
|
||||||
|
this.URL = URL;
|
||||||
|
this.description = description;
|
||||||
|
this.variables = variables;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using given variables.
|
||||||
|
*
|
||||||
|
* @param variables A map between a variable name and its value.
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL(Map<String, String> variables) {
|
||||||
|
String url = this.URL;
|
||||||
|
|
||||||
|
// go through variables and replace placeholders
|
||||||
|
for (Map.Entry<String, ServerVariable> variable: this.variables.entrySet()) {
|
||||||
|
String name = variable.getKey();
|
||||||
|
ServerVariable serverVariable = variable.getValue();
|
||||||
|
String value = serverVariable.defaultValue;
|
||||||
|
|
||||||
|
if (variables != null && variables.containsKey(name)) {
|
||||||
|
value = variables.get(name);
|
||||||
|
if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) {
|
||||||
|
throw new RuntimeException("The variable " + name + " in the server URL has invalid value " + value + ".");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
url = url.replaceAll("\\{" + name + "\\}", value);
|
||||||
|
}
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using default server variables.
|
||||||
|
*
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL() {
|
||||||
|
return URL(null);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server Variable for server URL template substitution.
|
||||||
|
*/
|
||||||
|
public class ServerVariable {
|
||||||
|
public String description;
|
||||||
|
public String defaultValue;
|
||||||
|
public HashSet<String> enumValues = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param description A description for the server variable.
|
||||||
|
* @param defaultValue The default value to use for substitution.
|
||||||
|
* @param enumValues An enumeration of string values to be used if the substitution options are from a limited set.
|
||||||
|
*/
|
||||||
|
public ServerVariable(String description, String defaultValue, HashSet<String> enumValues) {
|
||||||
|
this.description = description;
|
||||||
|
this.defaultValue = defaultValue;
|
||||||
|
this.enumValues = enumValues;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,58 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server configuration.
|
||||||
|
*/
|
||||||
|
public class ServerConfiguration {
|
||||||
|
public String URL;
|
||||||
|
public String description;
|
||||||
|
public Map<String, ServerVariable> variables;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param URL A URL to the target host.
|
||||||
|
* @param description A describtion of the host designated by the URL.
|
||||||
|
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||||
|
*/
|
||||||
|
public ServerConfiguration(String URL, String description, Map<String, ServerVariable> variables) {
|
||||||
|
this.URL = URL;
|
||||||
|
this.description = description;
|
||||||
|
this.variables = variables;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using given variables.
|
||||||
|
*
|
||||||
|
* @param variables A map between a variable name and its value.
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL(Map<String, String> variables) {
|
||||||
|
String url = this.URL;
|
||||||
|
|
||||||
|
// go through variables and replace placeholders
|
||||||
|
for (Map.Entry<String, ServerVariable> variable: this.variables.entrySet()) {
|
||||||
|
String name = variable.getKey();
|
||||||
|
ServerVariable serverVariable = variable.getValue();
|
||||||
|
String value = serverVariable.defaultValue;
|
||||||
|
|
||||||
|
if (variables != null && variables.containsKey(name)) {
|
||||||
|
value = variables.get(name);
|
||||||
|
if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) {
|
||||||
|
throw new RuntimeException("The variable " + name + " in the server URL has invalid value " + value + ".");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
url = url.replaceAll("\\{" + name + "\\}", value);
|
||||||
|
}
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using default server variables.
|
||||||
|
*
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL() {
|
||||||
|
return URL(null);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server Variable for server URL template substitution.
|
||||||
|
*/
|
||||||
|
public class ServerVariable {
|
||||||
|
public String description;
|
||||||
|
public String defaultValue;
|
||||||
|
public HashSet<String> enumValues = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param description A description for the server variable.
|
||||||
|
* @param defaultValue The default value to use for substitution.
|
||||||
|
* @param enumValues An enumeration of string values to be used if the substitution options are from a limited set.
|
||||||
|
*/
|
||||||
|
public ServerVariable(String description, String defaultValue, HashSet<String> enumValues) {
|
||||||
|
this.description = description;
|
||||||
|
this.defaultValue = defaultValue;
|
||||||
|
this.enumValues = enumValues;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,58 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server configuration.
|
||||||
|
*/
|
||||||
|
public class ServerConfiguration {
|
||||||
|
public String URL;
|
||||||
|
public String description;
|
||||||
|
public Map<String, ServerVariable> variables;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param URL A URL to the target host.
|
||||||
|
* @param description A describtion of the host designated by the URL.
|
||||||
|
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||||
|
*/
|
||||||
|
public ServerConfiguration(String URL, String description, Map<String, ServerVariable> variables) {
|
||||||
|
this.URL = URL;
|
||||||
|
this.description = description;
|
||||||
|
this.variables = variables;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using given variables.
|
||||||
|
*
|
||||||
|
* @param variables A map between a variable name and its value.
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL(Map<String, String> variables) {
|
||||||
|
String url = this.URL;
|
||||||
|
|
||||||
|
// go through variables and replace placeholders
|
||||||
|
for (Map.Entry<String, ServerVariable> variable: this.variables.entrySet()) {
|
||||||
|
String name = variable.getKey();
|
||||||
|
ServerVariable serverVariable = variable.getValue();
|
||||||
|
String value = serverVariable.defaultValue;
|
||||||
|
|
||||||
|
if (variables != null && variables.containsKey(name)) {
|
||||||
|
value = variables.get(name);
|
||||||
|
if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) {
|
||||||
|
throw new RuntimeException("The variable " + name + " in the server URL has invalid value " + value + ".");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
url = url.replaceAll("\\{" + name + "\\}", value);
|
||||||
|
}
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using default server variables.
|
||||||
|
*
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL() {
|
||||||
|
return URL(null);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server Variable for server URL template substitution.
|
||||||
|
*/
|
||||||
|
public class ServerVariable {
|
||||||
|
public String description;
|
||||||
|
public String defaultValue;
|
||||||
|
public HashSet<String> enumValues = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param description A description for the server variable.
|
||||||
|
* @param defaultValue The default value to use for substitution.
|
||||||
|
* @param enumValues An enumeration of string values to be used if the substitution options are from a limited set.
|
||||||
|
*/
|
||||||
|
public ServerVariable(String description, String defaultValue, HashSet<String> enumValues) {
|
||||||
|
this.description = description;
|
||||||
|
this.defaultValue = defaultValue;
|
||||||
|
this.enumValues = enumValues;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,58 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server configuration.
|
||||||
|
*/
|
||||||
|
public class ServerConfiguration {
|
||||||
|
public String URL;
|
||||||
|
public String description;
|
||||||
|
public Map<String, ServerVariable> variables;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param URL A URL to the target host.
|
||||||
|
* @param description A describtion of the host designated by the URL.
|
||||||
|
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||||
|
*/
|
||||||
|
public ServerConfiguration(String URL, String description, Map<String, ServerVariable> variables) {
|
||||||
|
this.URL = URL;
|
||||||
|
this.description = description;
|
||||||
|
this.variables = variables;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using given variables.
|
||||||
|
*
|
||||||
|
* @param variables A map between a variable name and its value.
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL(Map<String, String> variables) {
|
||||||
|
String url = this.URL;
|
||||||
|
|
||||||
|
// go through variables and replace placeholders
|
||||||
|
for (Map.Entry<String, ServerVariable> variable: this.variables.entrySet()) {
|
||||||
|
String name = variable.getKey();
|
||||||
|
ServerVariable serverVariable = variable.getValue();
|
||||||
|
String value = serverVariable.defaultValue;
|
||||||
|
|
||||||
|
if (variables != null && variables.containsKey(name)) {
|
||||||
|
value = variables.get(name);
|
||||||
|
if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) {
|
||||||
|
throw new RuntimeException("The variable " + name + " in the server URL has invalid value " + value + ".");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
url = url.replaceAll("\\{" + name + "\\}", value);
|
||||||
|
}
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using default server variables.
|
||||||
|
*
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL() {
|
||||||
|
return URL(null);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server Variable for server URL template substitution.
|
||||||
|
*/
|
||||||
|
public class ServerVariable {
|
||||||
|
public String description;
|
||||||
|
public String defaultValue;
|
||||||
|
public HashSet<String> enumValues = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param description A description for the server variable.
|
||||||
|
* @param defaultValue The default value to use for substitution.
|
||||||
|
* @param enumValues An enumeration of string values to be used if the substitution options are from a limited set.
|
||||||
|
*/
|
||||||
|
public ServerVariable(String description, String defaultValue, HashSet<String> enumValues) {
|
||||||
|
this.description = description;
|
||||||
|
this.defaultValue = defaultValue;
|
||||||
|
this.enumValues = enumValues;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,58 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server configuration.
|
||||||
|
*/
|
||||||
|
public class ServerConfiguration {
|
||||||
|
public String URL;
|
||||||
|
public String description;
|
||||||
|
public Map<String, ServerVariable> variables;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param URL A URL to the target host.
|
||||||
|
* @param description A describtion of the host designated by the URL.
|
||||||
|
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||||
|
*/
|
||||||
|
public ServerConfiguration(String URL, String description, Map<String, ServerVariable> variables) {
|
||||||
|
this.URL = URL;
|
||||||
|
this.description = description;
|
||||||
|
this.variables = variables;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using given variables.
|
||||||
|
*
|
||||||
|
* @param variables A map between a variable name and its value.
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL(Map<String, String> variables) {
|
||||||
|
String url = this.URL;
|
||||||
|
|
||||||
|
// go through variables and replace placeholders
|
||||||
|
for (Map.Entry<String, ServerVariable> variable: this.variables.entrySet()) {
|
||||||
|
String name = variable.getKey();
|
||||||
|
ServerVariable serverVariable = variable.getValue();
|
||||||
|
String value = serverVariable.defaultValue;
|
||||||
|
|
||||||
|
if (variables != null && variables.containsKey(name)) {
|
||||||
|
value = variables.get(name);
|
||||||
|
if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) {
|
||||||
|
throw new RuntimeException("The variable " + name + " in the server URL has invalid value " + value + ".");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
url = url.replaceAll("\\{" + name + "\\}", value);
|
||||||
|
}
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using default server variables.
|
||||||
|
*
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL() {
|
||||||
|
return URL(null);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server Variable for server URL template substitution.
|
||||||
|
*/
|
||||||
|
public class ServerVariable {
|
||||||
|
public String description;
|
||||||
|
public String defaultValue;
|
||||||
|
public HashSet<String> enumValues = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param description A description for the server variable.
|
||||||
|
* @param defaultValue The default value to use for substitution.
|
||||||
|
* @param enumValues An enumeration of string values to be used if the substitution options are from a limited set.
|
||||||
|
*/
|
||||||
|
public ServerVariable(String description, String defaultValue, HashSet<String> enumValues) {
|
||||||
|
this.description = description;
|
||||||
|
this.defaultValue = defaultValue;
|
||||||
|
this.enumValues = enumValues;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,58 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server configuration.
|
||||||
|
*/
|
||||||
|
public class ServerConfiguration {
|
||||||
|
public String URL;
|
||||||
|
public String description;
|
||||||
|
public Map<String, ServerVariable> variables;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param URL A URL to the target host.
|
||||||
|
* @param description A describtion of the host designated by the URL.
|
||||||
|
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||||
|
*/
|
||||||
|
public ServerConfiguration(String URL, String description, Map<String, ServerVariable> variables) {
|
||||||
|
this.URL = URL;
|
||||||
|
this.description = description;
|
||||||
|
this.variables = variables;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using given variables.
|
||||||
|
*
|
||||||
|
* @param variables A map between a variable name and its value.
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL(Map<String, String> variables) {
|
||||||
|
String url = this.URL;
|
||||||
|
|
||||||
|
// go through variables and replace placeholders
|
||||||
|
for (Map.Entry<String, ServerVariable> variable: this.variables.entrySet()) {
|
||||||
|
String name = variable.getKey();
|
||||||
|
ServerVariable serverVariable = variable.getValue();
|
||||||
|
String value = serverVariable.defaultValue;
|
||||||
|
|
||||||
|
if (variables != null && variables.containsKey(name)) {
|
||||||
|
value = variables.get(name);
|
||||||
|
if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) {
|
||||||
|
throw new RuntimeException("The variable " + name + " in the server URL has invalid value " + value + ".");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
url = url.replaceAll("\\{" + name + "\\}", value);
|
||||||
|
}
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using default server variables.
|
||||||
|
*
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL() {
|
||||||
|
return URL(null);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server Variable for server URL template substitution.
|
||||||
|
*/
|
||||||
|
public class ServerVariable {
|
||||||
|
public String description;
|
||||||
|
public String defaultValue;
|
||||||
|
public HashSet<String> enumValues = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param description A description for the server variable.
|
||||||
|
* @param defaultValue The default value to use for substitution.
|
||||||
|
* @param enumValues An enumeration of string values to be used if the substitution options are from a limited set.
|
||||||
|
*/
|
||||||
|
public ServerVariable(String description, String defaultValue, HashSet<String> enumValues) {
|
||||||
|
this.description = description;
|
||||||
|
this.defaultValue = defaultValue;
|
||||||
|
this.enumValues = enumValues;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,58 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server configuration.
|
||||||
|
*/
|
||||||
|
public class ServerConfiguration {
|
||||||
|
public String URL;
|
||||||
|
public String description;
|
||||||
|
public Map<String, ServerVariable> variables;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param URL A URL to the target host.
|
||||||
|
* @param description A describtion of the host designated by the URL.
|
||||||
|
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||||
|
*/
|
||||||
|
public ServerConfiguration(String URL, String description, Map<String, ServerVariable> variables) {
|
||||||
|
this.URL = URL;
|
||||||
|
this.description = description;
|
||||||
|
this.variables = variables;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using given variables.
|
||||||
|
*
|
||||||
|
* @param variables A map between a variable name and its value.
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL(Map<String, String> variables) {
|
||||||
|
String url = this.URL;
|
||||||
|
|
||||||
|
// go through variables and replace placeholders
|
||||||
|
for (Map.Entry<String, ServerVariable> variable: this.variables.entrySet()) {
|
||||||
|
String name = variable.getKey();
|
||||||
|
ServerVariable serverVariable = variable.getValue();
|
||||||
|
String value = serverVariable.defaultValue;
|
||||||
|
|
||||||
|
if (variables != null && variables.containsKey(name)) {
|
||||||
|
value = variables.get(name);
|
||||||
|
if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) {
|
||||||
|
throw new RuntimeException("The variable " + name + " in the server URL has invalid value " + value + ".");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
url = url.replaceAll("\\{" + name + "\\}", value);
|
||||||
|
}
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using default server variables.
|
||||||
|
*
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL() {
|
||||||
|
return URL(null);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server Variable for server URL template substitution.
|
||||||
|
*/
|
||||||
|
public class ServerVariable {
|
||||||
|
public String description;
|
||||||
|
public String defaultValue;
|
||||||
|
public HashSet<String> enumValues = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param description A description for the server variable.
|
||||||
|
* @param defaultValue The default value to use for substitution.
|
||||||
|
* @param enumValues An enumeration of string values to be used if the substitution options are from a limited set.
|
||||||
|
*/
|
||||||
|
public ServerVariable(String description, String defaultValue, HashSet<String> enumValues) {
|
||||||
|
this.description = description;
|
||||||
|
this.defaultValue = defaultValue;
|
||||||
|
this.enumValues = enumValues;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,58 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server configuration.
|
||||||
|
*/
|
||||||
|
public class ServerConfiguration {
|
||||||
|
public String URL;
|
||||||
|
public String description;
|
||||||
|
public Map<String, ServerVariable> variables;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param URL A URL to the target host.
|
||||||
|
* @param description A describtion of the host designated by the URL.
|
||||||
|
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||||
|
*/
|
||||||
|
public ServerConfiguration(String URL, String description, Map<String, ServerVariable> variables) {
|
||||||
|
this.URL = URL;
|
||||||
|
this.description = description;
|
||||||
|
this.variables = variables;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using given variables.
|
||||||
|
*
|
||||||
|
* @param variables A map between a variable name and its value.
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL(Map<String, String> variables) {
|
||||||
|
String url = this.URL;
|
||||||
|
|
||||||
|
// go through variables and replace placeholders
|
||||||
|
for (Map.Entry<String, ServerVariable> variable: this.variables.entrySet()) {
|
||||||
|
String name = variable.getKey();
|
||||||
|
ServerVariable serverVariable = variable.getValue();
|
||||||
|
String value = serverVariable.defaultValue;
|
||||||
|
|
||||||
|
if (variables != null && variables.containsKey(name)) {
|
||||||
|
value = variables.get(name);
|
||||||
|
if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) {
|
||||||
|
throw new RuntimeException("The variable " + name + " in the server URL has invalid value " + value + ".");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
url = url.replaceAll("\\{" + name + "\\}", value);
|
||||||
|
}
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using default server variables.
|
||||||
|
*
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL() {
|
||||||
|
return URL(null);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server Variable for server URL template substitution.
|
||||||
|
*/
|
||||||
|
public class ServerVariable {
|
||||||
|
public String description;
|
||||||
|
public String defaultValue;
|
||||||
|
public HashSet<String> enumValues = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param description A description for the server variable.
|
||||||
|
* @param defaultValue The default value to use for substitution.
|
||||||
|
* @param enumValues An enumeration of string values to be used if the substitution options are from a limited set.
|
||||||
|
*/
|
||||||
|
public ServerVariable(String description, String defaultValue, HashSet<String> enumValues) {
|
||||||
|
this.description = description;
|
||||||
|
this.defaultValue = defaultValue;
|
||||||
|
this.enumValues = enumValues;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,58 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server configuration.
|
||||||
|
*/
|
||||||
|
public class ServerConfiguration {
|
||||||
|
public String URL;
|
||||||
|
public String description;
|
||||||
|
public Map<String, ServerVariable> variables;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param URL A URL to the target host.
|
||||||
|
* @param description A describtion of the host designated by the URL.
|
||||||
|
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||||
|
*/
|
||||||
|
public ServerConfiguration(String URL, String description, Map<String, ServerVariable> variables) {
|
||||||
|
this.URL = URL;
|
||||||
|
this.description = description;
|
||||||
|
this.variables = variables;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using given variables.
|
||||||
|
*
|
||||||
|
* @param variables A map between a variable name and its value.
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL(Map<String, String> variables) {
|
||||||
|
String url = this.URL;
|
||||||
|
|
||||||
|
// go through variables and replace placeholders
|
||||||
|
for (Map.Entry<String, ServerVariable> variable: this.variables.entrySet()) {
|
||||||
|
String name = variable.getKey();
|
||||||
|
ServerVariable serverVariable = variable.getValue();
|
||||||
|
String value = serverVariable.defaultValue;
|
||||||
|
|
||||||
|
if (variables != null && variables.containsKey(name)) {
|
||||||
|
value = variables.get(name);
|
||||||
|
if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) {
|
||||||
|
throw new RuntimeException("The variable " + name + " in the server URL has invalid value " + value + ".");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
url = url.replaceAll("\\{" + name + "\\}", value);
|
||||||
|
}
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using default server variables.
|
||||||
|
*
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL() {
|
||||||
|
return URL(null);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server Variable for server URL template substitution.
|
||||||
|
*/
|
||||||
|
public class ServerVariable {
|
||||||
|
public String description;
|
||||||
|
public String defaultValue;
|
||||||
|
public HashSet<String> enumValues = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param description A description for the server variable.
|
||||||
|
* @param defaultValue The default value to use for substitution.
|
||||||
|
* @param enumValues An enumeration of string values to be used if the substitution options are from a limited set.
|
||||||
|
*/
|
||||||
|
public ServerVariable(String description, String defaultValue, HashSet<String> enumValues) {
|
||||||
|
this.description = description;
|
||||||
|
this.defaultValue = defaultValue;
|
||||||
|
this.enumValues = enumValues;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,58 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server configuration.
|
||||||
|
*/
|
||||||
|
public class ServerConfiguration {
|
||||||
|
public String URL;
|
||||||
|
public String description;
|
||||||
|
public Map<String, ServerVariable> variables;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param URL A URL to the target host.
|
||||||
|
* @param description A describtion of the host designated by the URL.
|
||||||
|
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||||
|
*/
|
||||||
|
public ServerConfiguration(String URL, String description, Map<String, ServerVariable> variables) {
|
||||||
|
this.URL = URL;
|
||||||
|
this.description = description;
|
||||||
|
this.variables = variables;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using given variables.
|
||||||
|
*
|
||||||
|
* @param variables A map between a variable name and its value.
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL(Map<String, String> variables) {
|
||||||
|
String url = this.URL;
|
||||||
|
|
||||||
|
// go through variables and replace placeholders
|
||||||
|
for (Map.Entry<String, ServerVariable> variable: this.variables.entrySet()) {
|
||||||
|
String name = variable.getKey();
|
||||||
|
ServerVariable serverVariable = variable.getValue();
|
||||||
|
String value = serverVariable.defaultValue;
|
||||||
|
|
||||||
|
if (variables != null && variables.containsKey(name)) {
|
||||||
|
value = variables.get(name);
|
||||||
|
if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) {
|
||||||
|
throw new RuntimeException("The variable " + name + " in the server URL has invalid value " + value + ".");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
url = url.replaceAll("\\{" + name + "\\}", value);
|
||||||
|
}
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using default server variables.
|
||||||
|
*
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL() {
|
||||||
|
return URL(null);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server Variable for server URL template substitution.
|
||||||
|
*/
|
||||||
|
public class ServerVariable {
|
||||||
|
public String description;
|
||||||
|
public String defaultValue;
|
||||||
|
public HashSet<String> enumValues = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param description A description for the server variable.
|
||||||
|
* @param defaultValue The default value to use for substitution.
|
||||||
|
* @param enumValues An enumeration of string values to be used if the substitution options are from a limited set.
|
||||||
|
*/
|
||||||
|
public ServerVariable(String description, String defaultValue, HashSet<String> enumValues) {
|
||||||
|
this.description = description;
|
||||||
|
this.defaultValue = defaultValue;
|
||||||
|
this.enumValues = enumValues;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,58 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server configuration.
|
||||||
|
*/
|
||||||
|
public class ServerConfiguration {
|
||||||
|
public String URL;
|
||||||
|
public String description;
|
||||||
|
public Map<String, ServerVariable> variables;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param URL A URL to the target host.
|
||||||
|
* @param description A describtion of the host designated by the URL.
|
||||||
|
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||||
|
*/
|
||||||
|
public ServerConfiguration(String URL, String description, Map<String, ServerVariable> variables) {
|
||||||
|
this.URL = URL;
|
||||||
|
this.description = description;
|
||||||
|
this.variables = variables;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using given variables.
|
||||||
|
*
|
||||||
|
* @param variables A map between a variable name and its value.
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL(Map<String, String> variables) {
|
||||||
|
String url = this.URL;
|
||||||
|
|
||||||
|
// go through variables and replace placeholders
|
||||||
|
for (Map.Entry<String, ServerVariable> variable: this.variables.entrySet()) {
|
||||||
|
String name = variable.getKey();
|
||||||
|
ServerVariable serverVariable = variable.getValue();
|
||||||
|
String value = serverVariable.defaultValue;
|
||||||
|
|
||||||
|
if (variables != null && variables.containsKey(name)) {
|
||||||
|
value = variables.get(name);
|
||||||
|
if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) {
|
||||||
|
throw new RuntimeException("The variable " + name + " in the server URL has invalid value " + value + ".");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
url = url.replaceAll("\\{" + name + "\\}", value);
|
||||||
|
}
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using default server variables.
|
||||||
|
*
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL() {
|
||||||
|
return URL(null);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server Variable for server URL template substitution.
|
||||||
|
*/
|
||||||
|
public class ServerVariable {
|
||||||
|
public String description;
|
||||||
|
public String defaultValue;
|
||||||
|
public HashSet<String> enumValues = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param description A description for the server variable.
|
||||||
|
* @param defaultValue The default value to use for substitution.
|
||||||
|
* @param enumValues An enumeration of string values to be used if the substitution options are from a limited set.
|
||||||
|
*/
|
||||||
|
public ServerVariable(String description, String defaultValue, HashSet<String> enumValues) {
|
||||||
|
this.description = description;
|
||||||
|
this.defaultValue = defaultValue;
|
||||||
|
this.enumValues = enumValues;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,58 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server configuration.
|
||||||
|
*/
|
||||||
|
public class ServerConfiguration {
|
||||||
|
public String URL;
|
||||||
|
public String description;
|
||||||
|
public Map<String, ServerVariable> variables;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param URL A URL to the target host.
|
||||||
|
* @param description A describtion of the host designated by the URL.
|
||||||
|
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||||
|
*/
|
||||||
|
public ServerConfiguration(String URL, String description, Map<String, ServerVariable> variables) {
|
||||||
|
this.URL = URL;
|
||||||
|
this.description = description;
|
||||||
|
this.variables = variables;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using given variables.
|
||||||
|
*
|
||||||
|
* @param variables A map between a variable name and its value.
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL(Map<String, String> variables) {
|
||||||
|
String url = this.URL;
|
||||||
|
|
||||||
|
// go through variables and replace placeholders
|
||||||
|
for (Map.Entry<String, ServerVariable> variable: this.variables.entrySet()) {
|
||||||
|
String name = variable.getKey();
|
||||||
|
ServerVariable serverVariable = variable.getValue();
|
||||||
|
String value = serverVariable.defaultValue;
|
||||||
|
|
||||||
|
if (variables != null && variables.containsKey(name)) {
|
||||||
|
value = variables.get(name);
|
||||||
|
if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) {
|
||||||
|
throw new RuntimeException("The variable " + name + " in the server URL has invalid value " + value + ".");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
url = url.replaceAll("\\{" + name + "\\}", value);
|
||||||
|
}
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using default server variables.
|
||||||
|
*
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL() {
|
||||||
|
return URL(null);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server Variable for server URL template substitution.
|
||||||
|
*/
|
||||||
|
public class ServerVariable {
|
||||||
|
public String description;
|
||||||
|
public String defaultValue;
|
||||||
|
public HashSet<String> enumValues = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param description A description for the server variable.
|
||||||
|
* @param defaultValue The default value to use for substitution.
|
||||||
|
* @param enumValues An enumeration of string values to be used if the substitution options are from a limited set.
|
||||||
|
*/
|
||||||
|
public ServerVariable(String description, String defaultValue, HashSet<String> enumValues) {
|
||||||
|
this.description = description;
|
||||||
|
this.defaultValue = defaultValue;
|
||||||
|
this.enumValues = enumValues;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,58 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server configuration.
|
||||||
|
*/
|
||||||
|
public class ServerConfiguration {
|
||||||
|
public String URL;
|
||||||
|
public String description;
|
||||||
|
public Map<String, ServerVariable> variables;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param URL A URL to the target host.
|
||||||
|
* @param description A describtion of the host designated by the URL.
|
||||||
|
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||||
|
*/
|
||||||
|
public ServerConfiguration(String URL, String description, Map<String, ServerVariable> variables) {
|
||||||
|
this.URL = URL;
|
||||||
|
this.description = description;
|
||||||
|
this.variables = variables;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using given variables.
|
||||||
|
*
|
||||||
|
* @param variables A map between a variable name and its value.
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL(Map<String, String> variables) {
|
||||||
|
String url = this.URL;
|
||||||
|
|
||||||
|
// go through variables and replace placeholders
|
||||||
|
for (Map.Entry<String, ServerVariable> variable: this.variables.entrySet()) {
|
||||||
|
String name = variable.getKey();
|
||||||
|
ServerVariable serverVariable = variable.getValue();
|
||||||
|
String value = serverVariable.defaultValue;
|
||||||
|
|
||||||
|
if (variables != null && variables.containsKey(name)) {
|
||||||
|
value = variables.get(name);
|
||||||
|
if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) {
|
||||||
|
throw new RuntimeException("The variable " + name + " in the server URL has invalid value " + value + ".");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
url = url.replaceAll("\\{" + name + "\\}", value);
|
||||||
|
}
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using default server variables.
|
||||||
|
*
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL() {
|
||||||
|
return URL(null);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server Variable for server URL template substitution.
|
||||||
|
*/
|
||||||
|
public class ServerVariable {
|
||||||
|
public String description;
|
||||||
|
public String defaultValue;
|
||||||
|
public HashSet<String> enumValues = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param description A description for the server variable.
|
||||||
|
* @param defaultValue The default value to use for substitution.
|
||||||
|
* @param enumValues An enumeration of string values to be used if the substitution options are from a limited set.
|
||||||
|
*/
|
||||||
|
public ServerVariable(String description, String defaultValue, HashSet<String> enumValues) {
|
||||||
|
this.description = description;
|
||||||
|
this.defaultValue = defaultValue;
|
||||||
|
this.enumValues = enumValues;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user