11package ai .rev .speechtotext ;
22
3- import ai .rev .helpers .ClientHelper ;
4- import ai .rev .speechtotext .models .asynchronous .*;
5- import okhttp3 .MediaType ;
6- import okhttp3 .MultipartBody ;
7- import okhttp3 .OkHttpClient ;
8- import okhttp3 .RequestBody ;
9- import retrofit2 .Retrofit ;
10-
113import java .io .File ;
124import java .io .FileInputStream ;
135import java .io .IOException ;
168import java .util .List ;
179import java .util .Map ;
1810
11+ import ai .rev .helpers .ClientHelper ;
12+ import ai .rev .helpers .RevAiApiDeploymentConfiguration ;
13+ import ai .rev .speechtotext .models .asynchronous .RevAiAccount ;
14+ import ai .rev .speechtotext .models .asynchronous .RevAiCaptionType ;
15+ import ai .rev .speechtotext .models .asynchronous .RevAiJob ;
16+ import ai .rev .speechtotext .models .asynchronous .RevAiJobOptions ;
17+ import ai .rev .speechtotext .models .asynchronous .RevAiTranscript ;
18+ import ai .rev .speechtotext .models .asynchronous .Summary ;
19+ import okhttp3 .MediaType ;
20+ import okhttp3 .MultipartBody ;
21+ import okhttp3 .OkHttpClient ;
22+ import okhttp3 .RequestBody ;
23+ import retrofit2 .Retrofit ;
24+
1925/**
2026 * The ApiClient object provides methods to send and retrieve information from all the Rev AI API
2127 * endpoints using the Retrofit HTTP client.
@@ -33,6 +39,34 @@ public class ApiClient {
3339 * href="https://www.rev.ai/access_token">https://www.rev.ai/access_token</a>.
3440 *
3541 * @param accessToken Rev AI authorization token associate with the account.
42+ * @param baseUrl Optional url of the Rev AI API deployment to use, defaults to the US
43+ deployement, i.e. 'https://api.rev.ai', which can be referenced as
44+ RevAiApiDeploymentConfiguration.getConfig(RevAiApiDeploymentConfiguration.RevAiApiDeployment.US).getBaseUrl().
45+ * @throws IllegalArgumentException If the access token is null or empty.
46+ */
47+ public ApiClient (String accessToken , String baseUrl ) {
48+ if (accessToken == null || accessToken .isEmpty ()) {
49+ throw new IllegalArgumentException ("Access token must be provided" );
50+ }
51+ this .client = ClientHelper .createOkHttpClient (accessToken );
52+ Retrofit retrofit = ClientHelper .createRetrofitInstance (
53+ client ,
54+ "speechtotext" ,
55+ "v1" ,
56+ baseUrl != null ? baseUrl : RevAiApiDeploymentConfiguration .getConfig (RevAiApiDeploymentConfiguration .RevAiApiDeployment .US ).getBaseUrl ()
57+ );
58+ this .apiInterface = retrofit .create (ApiInterface .class );
59+ }
60+
61+ /**
62+ * Constructs the API client used to send HTTP requests to Rev AI. The user access token can be
63+ * generated on the website at <a
64+ * href="https://www.rev.ai/access_token">https://www.rev.ai/access_token</a>.
65+ *
66+ * @param accessToken Rev AI authorization token associate with the account.
67+ * @param baseUrl Optional url of the Rev AI API deployment to use, defaults to the US
68+ deployement, i.e. 'https://api.rev.ai', which can be referenced as
69+ RevAiApiDeploymentConfiguration.getConfig(RevAiApiDeploymentConfiguration.RevAiApiDeployment.US).getBaseUrl().
3670 * @throws IllegalArgumentException If the access token is null or empty.
3771 */
3872 public ApiClient (String accessToken ) {
0 commit comments