forked from Camb-ai/cambai-java-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAsyncCambApiClientBuilder.java
More file actions
59 lines (49 loc) · 1.47 KB
/
Copy pathAsyncCambApiClientBuilder.java
File metadata and controls
59 lines (49 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/**
* This file was auto-generated by Fern from our API Definition.
*/
import core.ClientOptions;
import core.Environment;
import java.lang.String;
import okhttp3.OkHttpClient;
public final class AsyncCambApiClientBuilder {
private ClientOptions.Builder clientOptionsBuilder = ClientOptions.builder();
private String apiKey = null;
private Environment environment = Environment.DEFAULT;
/**
* Sets apiKey
*/
public AsyncCambApiClientBuilder apiKey(String apiKey) {
this.apiKey = apiKey;
return this;
}
public AsyncCambApiClientBuilder environment(Environment environment) {
this.environment = environment;
return this;
}
public AsyncCambApiClientBuilder url(String url) {
this.environment = Environment.custom(url);
return this;
}
/**
* Sets the timeout (in seconds) for the client
*/
public AsyncCambApiClientBuilder timeout(int timeout) {
this.clientOptionsBuilder.timeout(timeout);
return this;
}
/**
* Sets the underlying OkHttp client
*/
public AsyncCambApiClientBuilder httpClient(OkHttpClient httpClient) {
this.clientOptionsBuilder.httpClient(httpClient);
return this;
}
public AsyncCambApiClient build() {
if (apiKey == null) {
throw new RuntimeException("Please provide apiKey");
}
this.clientOptionsBuilder.addHeader("x-api-key", this.apiKey);
clientOptionsBuilder.environment(this.environment);
return new AsyncCambApiClient(clientOptionsBuilder.build());
}
}