Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,33 @@ import {{invokerPackage}}.auth.OAuthFlow;
public class ApiClient {

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 Map<String, String> defaultHeaderMap = new HashMap<String, String>();
private Map<String, String> defaultCookieMap = new HashMap<String, String>();
Expand Down Expand Up @@ -261,6 +288,33 @@ public class ApiClient {
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 HTTP client
*
Expand Down Expand Up @@ -1399,7 +1453,18 @@ public class ApiClient {
if (baseUrl != null) {
url.append(baseUrl).append(path);
} else {
url.append(basePath).append(path);
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;
}
url.append(baseURL).append(path);
}

if (queryParams != null && !queryParams.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@
public class ApiClient {

private String basePath = "http://localhost:8082";
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>(Arrays.asList(
new ServerConfiguration(
"http://localhost:8082",
"No description provided",
new HashMap<String, ServerVariable>()
)
));
protected Integer serverIndex = 0;
protected Map<String, String> serverVariables = null;
private boolean debugging = false;
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
private Map<String, String> defaultCookieMap = new HashMap<String, String>();
Expand Down Expand Up @@ -154,6 +163,33 @@ public ApiClient setBasePath(String basePath) {
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 HTTP client
*
Expand Down Expand Up @@ -1196,7 +1232,18 @@ public String buildUrl(String baseUrl, String path, List<Pair> queryParams, List
if (baseUrl != null) {
url.append(baseUrl).append(path);
} else {
url.append(basePath).append(path);
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;
}
url.append(baseURL).append(path);
}

if (queryParams != null && !queryParams.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,15 @@
public class ApiClient {

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 Map<String, String> defaultHeaderMap = new HashMap<String, String>();
private Map<String, String> defaultCookieMap = new HashMap<String, String>();
Expand Down Expand Up @@ -247,6 +256,33 @@ public ApiClient setBasePath(String basePath) {
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 HTTP client
*
Expand Down Expand Up @@ -1274,7 +1310,18 @@ public String buildUrl(String baseUrl, String path, List<Pair> queryParams, List
if (baseUrl != null) {
url.append(baseUrl).append(path);
} else {
url.append(basePath).append(path);
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;
}
url.append(baseURL).append(path);
}

if (queryParams != null && !queryParams.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@
public class ApiClient {

private String basePath = "http://petstore.swagger.io/v2";
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>(Arrays.asList(
new ServerConfiguration(
"http://petstore.swagger.io/v2",
"No description provided",
new HashMap<String, ServerVariable>()
)
));
protected Integer serverIndex = 0;
protected Map<String, String> serverVariables = null;
private boolean debugging = false;
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
private Map<String, String> defaultCookieMap = new HashMap<String, String>();
Expand Down Expand Up @@ -230,6 +239,33 @@ public ApiClient setBasePath(String basePath) {
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 HTTP client
*
Expand Down Expand Up @@ -1269,7 +1305,18 @@ public String buildUrl(String baseUrl, String path, List<Pair> queryParams, List
if (baseUrl != null) {
url.append(baseUrl).append(path);
} else {
url.append(basePath).append(path);
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;
}
url.append(baseURL).append(path);
}

if (queryParams != null && !queryParams.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@
public class ApiClient {

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 Map<String, String> defaultHeaderMap = new HashMap<String, String>();
private Map<String, String> defaultCookieMap = new HashMap<String, String>();
Expand Down Expand Up @@ -236,6 +245,33 @@ public ApiClient setBasePath(String basePath) {
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 HTTP client
*
Expand Down Expand Up @@ -1275,7 +1311,18 @@ public String buildUrl(String baseUrl, String path, List<Pair> queryParams, List
if (baseUrl != null) {
url.append(baseUrl).append(path);
} else {
url.append(basePath).append(path);
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;
}
url.append(baseURL).append(path);
}

if (queryParams != null && !queryParams.isEmpty()) {
Expand Down
Loading