forked from loafle/openapi-generator-original
remove trailing whitespaces in java api client (#4784)
This commit is contained in:
parent
74da89c6ac
commit
8f2e9bce6d
@ -45,17 +45,27 @@ public class ApiClient {
|
|||||||
|
|
||||||
public ApiClient(String[] authNames) {
|
public ApiClient(String[] authNames) {
|
||||||
this();
|
this();
|
||||||
for(String authName : authNames) { {{#hasAuthMethods}}
|
for(String authName : authNames) {
|
||||||
|
{{#hasAuthMethods}}
|
||||||
RequestInterceptor auth;
|
RequestInterceptor auth;
|
||||||
{{#authMethods}}if ("{{name}}".equals(authName)) { {{#isBasic}}
|
{{#authMethods}}if ("{{name}}".equals(authName)) {
|
||||||
auth = new HttpBasicAuth();{{/isBasic}}{{#isApiKey}}
|
{{#isBasic}}
|
||||||
auth = new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}");{{/isApiKey}}{{#isOAuth}}
|
auth = new HttpBasicAuth();
|
||||||
auth = new OAuth(OAuthFlow.{{flow}}, "{{authorizationUrl}}", "{{tokenUrl}}", "{{#scopes}}{{scope}}{{#hasMore}}, {{/hasMore}}{{/scopes}}");{{/isOAuth}}
|
{{/isBasic}}
|
||||||
|
{{#isApiKey}}
|
||||||
|
auth = new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}");
|
||||||
|
{{/isApiKey}}
|
||||||
|
{{#isOAuth}}
|
||||||
|
auth = new OAuth(OAuthFlow.{{flow}}, "{{authorizationUrl}}", "{{tokenUrl}}", "{{#scopes}}{{scope}}{{#hasMore}}, {{/hasMore}}{{/scopes}}");
|
||||||
|
{{/isOAuth}}
|
||||||
} else {{/authMethods}}{
|
} else {{/authMethods}}{
|
||||||
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
|
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
|
||||||
}
|
}
|
||||||
addAuthorization(authName, auth);{{/hasAuthMethods}}{{^hasAuthMethods}}
|
addAuthorization(authName, auth);
|
||||||
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");{{/hasAuthMethods}}
|
{{/hasAuthMethods}}
|
||||||
|
{{^hasAuthMethods}}
|
||||||
|
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
|
||||||
|
{{/hasAuthMethods}}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,17 +52,26 @@ public class ApiClient {
|
|||||||
|
|
||||||
public ApiClient(String[] authNames) {
|
public ApiClient(String[] authNames) {
|
||||||
this();
|
this();
|
||||||
for(String authName : authNames) { {{#hasAuthMethods}}
|
for(String authName : authNames) {
|
||||||
|
{{#hasAuthMethods}}
|
||||||
Interceptor auth;
|
Interceptor auth;
|
||||||
{{#authMethods}}if ("{{name}}".equals(authName)) { {{#isBasic}}
|
{{#authMethods}}if ("{{name}}".equals(authName)) {
|
||||||
auth = new HttpBasicAuth();{{/isBasic}}{{#isApiKey}}
|
{{#isBasic}}
|
||||||
auth = new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}");{{/isApiKey}}{{#isOAuth}}
|
auth = new HttpBasicAuth();
|
||||||
auth = new OAuth(OAuthFlow.{{flow}}, "{{authorizationUrl}}", "{{tokenUrl}}", "{{#scopes}}{{scope}}{{#hasMore}}, {{/hasMore}}{{/scopes}}");{{/isOAuth}}
|
{{/isBasic}}
|
||||||
|
{{#isApiKey}}
|
||||||
|
auth = new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}");{{/isApiKey}}
|
||||||
|
{{#isOAuth}}
|
||||||
|
auth = new OAuth(OAuthFlow.{{flow}}, "{{authorizationUrl}}", "{{tokenUrl}}", "{{#scopes}}{{scope}}{{#hasMore}}, {{/hasMore}}{{/scopes}}");
|
||||||
|
{{/isOAuth}}
|
||||||
} else {{/authMethods}}{
|
} else {{/authMethods}}{
|
||||||
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
|
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
|
||||||
}
|
}
|
||||||
addAuthorization(authName, auth);{{/hasAuthMethods}}{{^hasAuthMethods}}
|
addAuthorization(authName, auth);
|
||||||
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");{{/hasAuthMethods}}
|
{{/hasAuthMethods}}
|
||||||
|
{{^hasAuthMethods}}
|
||||||
|
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
|
||||||
|
{{/hasAuthMethods}}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,17 +58,27 @@ public class ApiClient {
|
|||||||
|
|
||||||
public ApiClient(String[] authNames) {
|
public ApiClient(String[] authNames) {
|
||||||
this();
|
this();
|
||||||
for(String authName : authNames) { {{#hasAuthMethods}}
|
for(String authName : authNames) {
|
||||||
|
{{#hasAuthMethods}}
|
||||||
Interceptor auth;
|
Interceptor auth;
|
||||||
{{#authMethods}}if ("{{name}}".equals(authName)) { {{#isBasic}}
|
{{#authMethods}}if ("{{name}}".equals(authName)) {
|
||||||
auth = new HttpBasicAuth();{{/isBasic}}{{#isApiKey}}
|
{{#isBasic}}
|
||||||
auth = new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}");{{/isApiKey}}{{#isOAuth}}
|
auth = new HttpBasicAuth();
|
||||||
auth = new OAuth(OAuthFlow.{{flow}}, "{{authorizationUrl}}", "{{tokenUrl}}", "{{#scopes}}{{scope}}{{#hasMore}}, {{/hasMore}}{{/scopes}}");{{/isOAuth}}
|
{{/isBasic}}
|
||||||
|
{{#isApiKey}}
|
||||||
|
auth = new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}");
|
||||||
|
{{/isApiKey}}
|
||||||
|
{{#isOAuth}}
|
||||||
|
auth = new OAuth(OAuthFlow.{{flow}}, "{{authorizationUrl}}", "{{tokenUrl}}", "{{#scopes}}{{scope}}{{#hasMore}}, {{/hasMore}}{{/scopes}}");
|
||||||
|
{{/isOAuth}}
|
||||||
} else {{/authMethods}}{
|
} else {{/authMethods}}{
|
||||||
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
|
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
|
||||||
}
|
}
|
||||||
addAuthorization(authName, auth);{{/hasAuthMethods}}{{^hasAuthMethods}}
|
addAuthorization(authName, auth);
|
||||||
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");{{/hasAuthMethods}}
|
{{/hasAuthMethods}}
|
||||||
|
{{^hasAuthMethods}}
|
||||||
|
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
|
||||||
|
{{/hasAuthMethods}}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +58,9 @@ public class ApiClient {
|
|||||||
auth = new ApiKeyAuth("header", "api_key");
|
auth = new ApiKeyAuth("header", "api_key");
|
||||||
} else if ("http_basic_test".equals(authName)) {
|
} else if ("http_basic_test".equals(authName)) {
|
||||||
auth = new HttpBasicAuth();
|
auth = new HttpBasicAuth();
|
||||||
|
|
||||||
} else if ("petstore_auth".equals(authName)) {
|
} else if ("petstore_auth".equals(authName)) {
|
||||||
|
|
||||||
auth = new OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets");
|
auth = new OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets");
|
||||||
} else {
|
} else {
|
||||||
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
|
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
|
||||||
|
@ -53,11 +53,11 @@ public class ApiClient {
|
|||||||
this();
|
this();
|
||||||
for(String authName : authNames) {
|
for(String authName : authNames) {
|
||||||
Interceptor auth;
|
Interceptor auth;
|
||||||
if (authName == "api_key") {
|
if ("api_key".equals(authName)) {
|
||||||
auth = new ApiKeyAuth("header", "api_key");
|
auth = new ApiKeyAuth("header", "api_key");
|
||||||
} else if (authName == "http_basic_test") {
|
} else if ("http_basic_test".equals(authName)) {
|
||||||
auth = new HttpBasicAuth();
|
auth = new HttpBasicAuth();
|
||||||
} else if (authName == "petstore_auth") {
|
} else if ("petstore_auth".equals(authName)) {
|
||||||
auth = new OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets");
|
auth = new OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets");
|
||||||
} else {
|
} else {
|
||||||
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
|
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user