-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DOCS-297: Update Rev AI java sdk to support different base url (#66)
- Loading branch information
1 parent
1b58d4f
commit fd52684
Showing
8 changed files
with
194 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
src/main/java/ai/rev/helpers/RevAiApiDeploymentConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package ai.rev.helpers; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class RevAiApiDeploymentConfiguration { | ||
|
||
// Enum for API deployment regions | ||
public enum RevAiApiDeployment { | ||
US("US"), | ||
EU("EU"); | ||
|
||
private final String value; | ||
|
||
RevAiApiDeployment(String value) { | ||
this.value = value; | ||
} | ||
|
||
public String getValue() { | ||
return value; | ||
} | ||
} | ||
|
||
// Configuration map for deployment URLs | ||
private static final Map<RevAiApiDeployment, DeploymentConfig> RevAiApiDeploymentConfigMap; | ||
|
||
static { | ||
RevAiApiDeploymentConfigMap = new HashMap<>(); | ||
RevAiApiDeploymentConfigMap.put( | ||
RevAiApiDeployment.US, | ||
new DeploymentConfig("https://api.rev.ai", "wss://api.rev.ai") | ||
); | ||
RevAiApiDeploymentConfigMap.put( | ||
RevAiApiDeployment.EU, | ||
new DeploymentConfig("https://ec1.api.rev.ai", "wss://ec1.api.rev.ai") | ||
); | ||
} | ||
|
||
// Inner class for deployment configurations | ||
public static class DeploymentConfig { | ||
private final String baseUrl; | ||
private final String baseWebsocketUrl; | ||
|
||
public DeploymentConfig(String baseUrl, String baseWebsocketUrl) { | ||
this.baseUrl = baseUrl; | ||
this.baseWebsocketUrl = baseWebsocketUrl; | ||
} | ||
|
||
public String getBaseUrl() { | ||
return baseUrl; | ||
} | ||
|
||
public String getBaseWebsocketUrl() { | ||
return baseWebsocketUrl; | ||
} | ||
} | ||
|
||
// Method to get the configuration for a specific deployment | ||
public static DeploymentConfig getConfig(RevAiApiDeployment deployment) { | ||
return RevAiApiDeploymentConfigMap.get(deployment); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters