1010import java .util .Optional ;
1111import okhttp3 .OkHttpClient ;
1212
13- public class AsyncBaseClientBuilder < T extends AsyncBaseClientBuilder < T >> {
13+ public class AsyncBaseClientBuilder {
1414 private Optional <Integer > timeout = Optional .empty ();
1515
1616 private Optional <Integer > maxRetries = Optional .empty ();
@@ -29,68 +29,65 @@ public class AsyncBaseClientBuilder<T extends AsyncBaseClientBuilder<T>> {
2929 * Sets clientId.
3030 * Defaults to the PIPEDREAM_CLIENT_ID environment variable.
3131 */
32- @ SuppressWarnings ("unchecked" )
33- public T clientId (String clientId ) {
32+ public AsyncBaseClientBuilder clientId (String clientId ) {
3433 this .clientId = clientId ;
35- return ( T ) this ;
34+ return this ;
3635 }
3736
3837 /**
3938 * Sets clientSecret.
4039 * Defaults to the PIPEDREAM_CLIENT_SECRET environment variable.
4140 */
42- @ SuppressWarnings ("unchecked" )
43- public T clientSecret (String clientSecret ) {
41+ public AsyncBaseClientBuilder clientSecret (String clientSecret ) {
4442 this .clientSecret = clientSecret ;
45- return ( T ) this ;
43+ return this ;
4644 }
4745
4846 /**
4947 * Sets projectEnvironment
5048 */
51- @ SuppressWarnings ("unchecked" )
52- public T projectEnvironment (String projectEnvironment ) {
49+ public AsyncBaseClientBuilder projectEnvironment (String projectEnvironment ) {
5350 this .projectEnvironment = projectEnvironment ;
54- return ( T ) this ;
51+ return this ;
5552 }
5653
57- @ SuppressWarnings ("unchecked" )
58- public T environment (Environment environment ) {
54+ public AsyncBaseClientBuilder environment (Environment environment ) {
5955 this .environment = environment ;
60- return ( T ) this ;
56+ return this ;
6157 }
6258
63- @ SuppressWarnings ("unchecked" )
64- public T url (String url ) {
59+ public AsyncBaseClientBuilder url (String url ) {
6560 this .environment = Environment .custom (url );
66- return ( T ) this ;
61+ return this ;
6762 }
6863
6964 /**
7065 * Sets the timeout (in seconds) for the client. Defaults to 60 seconds.
7166 */
72- @ SuppressWarnings ("unchecked" )
73- public T timeout (int timeout ) {
67+ public AsyncBaseClientBuilder timeout (int timeout ) {
7468 this .timeout = Optional .of (timeout );
75- return ( T ) this ;
69+ return this ;
7670 }
7771
7872 /**
7973 * Sets the maximum number of retries for the client. Defaults to 2 retries.
8074 */
81- @ SuppressWarnings ("unchecked" )
82- public T maxRetries (int maxRetries ) {
75+ public AsyncBaseClientBuilder maxRetries (int maxRetries ) {
8376 this .maxRetries = Optional .of (maxRetries );
84- return ( T ) this ;
77+ return this ;
8578 }
8679
8780 /**
8881 * Sets the underlying OkHttp client
8982 */
90- @ SuppressWarnings ("unchecked" )
91- public T httpClient (OkHttpClient httpClient ) {
83+ public AsyncBaseClientBuilder httpClient (OkHttpClient httpClient ) {
9284 this .httpClient = httpClient ;
93- return (T ) this ;
85+ return this ;
86+ }
87+
88+ public AsyncBaseClientBuilder projectId (String projectId ) {
89+ clientOptionsBuilder .projectId (projectId );
90+ return this ;
9491 }
9592
9693 protected ClientOptions buildClientOptions () {
@@ -124,7 +121,7 @@ protected void setEnvironment(ClientOptions.Builder builder) {
124121 *
125122 * Example:
126123 * <pre>{@code
127- * @ Override
124+ * @ Override
128125 * protected void setAuthentication(ClientOptions.Builder builder) {
129126 * super.setAuthentication(builder); // Keep existing auth
130127 * builder.addHeader("X-API-Key", this.apiKey);
@@ -149,7 +146,7 @@ protected void setAuthentication(ClientOptions.Builder builder) {
149146 *
150147 * Example:
151148 * <pre>{@code
152- * @ Override
149+ * @ Override
153150 * protected void setCustomHeaders(ClientOptions.Builder builder) {
154151 * super.setCustomHeaders(builder); // Keep existing headers
155152 * builder.addHeader("X-Trace-ID", generateTraceId());
@@ -215,9 +212,9 @@ protected void setHttpClient(ClientOptions.Builder builder) {
215212 *
216213 * Example:
217214 * <pre>{@code
218- * @ Override
215+ * @ Override
219216 * protected void setAdditional(ClientOptions.Builder builder) {
220- * builder.addHeader("X-Request-ID", () -> UUID.randomUUID().toString());
217+ * builder.addHeader("X-Request-ID", () -> UUID.randomUUID().toString());
221218 * builder.addHeader("X-Client-Version", "1.0.0");
222219 * }
223220 * }</pre>
@@ -231,7 +228,7 @@ protected void setAdditional(ClientOptions.Builder builder) {}
231228 *
232229 * Example:
233230 * <pre>{@code
234- * @ Override
231+ * @ Override
235232 * protected void validateConfiguration() {
236233 * super.validateConfiguration(); // Run parent validations
237234 * if (tenantId == null || tenantId.isEmpty()) {
0 commit comments