Skip to content

Commit

Permalink
moving constant references to enum file
Browse files Browse the repository at this point in the history
  • Loading branch information
AsabuHere committed Sep 17, 2024
1 parent 622f931 commit e3bc20b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ public IApiResourceBuilder setImports(DirectoryStructureService directoryStructu
}
});

if(this.authMethod == "BearerToken"){
if(this.authMethod == EnumConstants.AuthType.BEARER_TOKEN.getValue()){
metaAPIProperties.put("auth_method-bearer-token", true);
}
else if(this.authMethod == "NoAuth"){
else if(this.authMethod == EnumConstants.AuthType.NOAUTH.getValue()){
metaAPIProperties.put("auth_method-no-auth", true);
}
if (OperationStore.getInstance().isEnumPresentInOptions())
Expand Down Expand Up @@ -104,12 +104,12 @@ public void processAuthMethods(List<CodegenOperation> opList) {
if(authMethods != null){
for(CodegenSecurity c : authMethods){
if(c.isOAuth == true){
this.authMethod = "BearerToken";
this.authMethod = EnumConstants.AuthType.BEARER_TOKEN.getValue();
}
}
}
else{
this.authMethod = "NoAuth";
this.authMethod = EnumConstants.AuthType.NOAUTH.getValue();
}
}
}
Expand Down
9 changes: 9 additions & 0 deletions src/main/java/com/twilio/oai/common/EnumConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ public enum PathType {
private final String value;
}

@Getter
@RequiredArgsConstructor
public enum AuthType {
BEARER_TOKEN("BearerToken"),
NOAUTH("NoAuth");

private final String value;
}

@Getter
@RequiredArgsConstructor
public enum CsharpDataTypes implements LanguageDataType {
Expand Down

0 comments on commit e3bc20b

Please sign in to comment.