fix enum name in okhttp-gson-nextgen (#11210)

This commit is contained in:
William Cheng
2022-01-02 16:37:16 +08:00
committed by GitHub
parent 12e03b1937
commit 5f5a83a592
5 changed files with 11 additions and 11 deletions

View File

@@ -197,7 +197,7 @@ public class ApiClient {
throw new IllegalArgumentException("OAuth2 token URL must be an absolute URL");
}
}
RetryingOAuth retryingOAuth = new RetryingOAuth(tokenUrl, clientId, OAuthFlow.{{flow}}, clientSecret, parameters);
RetryingOAuth retryingOAuth = new RetryingOAuth(tokenUrl, clientId, OAuthFlow.{{#lambda.uppercase}}{{#lambda.snakecase}}{{flow}}{{/lambda.snakecase}}{{/lambda.uppercase}}, clientSecret, parameters);
authentications.put(
"{{name}}",
retryingOAuth

View File

@@ -65,16 +65,16 @@ public class RetryingOAuth extends OAuth implements Interceptor {
public void setFlow(OAuthFlow flow) {
switch(flow) {
case accessCode:
case ACCESS_CODE:
tokenRequestBuilder.setGrantType(GrantType.AUTHORIZATION_CODE);
break;
case implicit:
case IMPLICIT:
tokenRequestBuilder.setGrantType(GrantType.IMPLICIT);
break;
case password:
case PASSWORD:
tokenRequestBuilder.setGrantType(GrantType.PASSWORD);
break;
case application:
case APPLICATION:
tokenRequestBuilder.setGrantType(GrantType.CLIENT_CREDENTIALS);
break;
default:

View File

@@ -180,7 +180,7 @@ public class ApiClient {
throw new IllegalArgumentException("OAuth2 token URL must be an absolute URL");
}
}
RetryingOAuth retryingOAuth = new RetryingOAuth(tokenUrl, clientId, OAuthFlow.implicit, clientSecret, parameters);
RetryingOAuth retryingOAuth = new RetryingOAuth(tokenUrl, clientId, OAuthFlow.IMPLICIT, clientSecret, parameters);
authentications.put(
"petstore_auth",
retryingOAuth

View File

@@ -64,16 +64,16 @@ public class RetryingOAuth extends OAuth implements Interceptor {
public void setFlow(OAuthFlow flow) {
switch(flow) {
case accessCode:
case ACCESS_CODE:
tokenRequestBuilder.setGrantType(GrantType.AUTHORIZATION_CODE);
break;
case implicit:
case IMPLICIT:
tokenRequestBuilder.setGrantType(GrantType.IMPLICIT);
break;
case password:
case PASSWORD:
tokenRequestBuilder.setGrantType(GrantType.PASSWORD);
break;
case application:
case APPLICATION:
tokenRequestBuilder.setGrantType(GrantType.CLIENT_CREDENTIALS);
break;
default:

View File

@@ -36,7 +36,7 @@ public class RetryingOAuthTest {
new RetryingOAuth(
"_clientId",
"_clientSecret",
OAuthFlow.accessCode,
OAuthFlow.ACCESS_CODE,
"https://token.example.com",
Collections.<String, String>emptyMap());
oauth.setAccessToken("expired-access-token");