1+ /**
2+ * This file was auto-generated by Fern from our API Definition.
3+ */
14package com .pipedream .api ;
25
36import com .pipedream .api .core .ClientOptions ;
1013import java .util .Optional ;
1114import okhttp3 .OkHttpClient ;
1215
13- public class AsyncBaseClientBuilder < T extends AsyncBaseClientBuilder < T >> {
16+ public class AsyncBaseClientBuilder {
1417 private Optional <Integer > timeout = Optional .empty ();
1518
1619 private Optional <Integer > maxRetries = Optional .empty ();
@@ -64,51 +67,51 @@ public static _Builder builder() {
6467 /**
6568 * Sets projectEnvironment
6669 */
67- public T projectEnvironment (String projectEnvironment ) {
70+ public AsyncBaseClientBuilder projectEnvironment (String projectEnvironment ) {
6871 this .projectEnvironment = projectEnvironment ;
69- return ( T ) this ;
72+ return this ;
7073 }
7174
72- public T environment (Environment environment ) {
75+ public AsyncBaseClientBuilder environment (Environment environment ) {
7376 this .environment = environment ;
74- return ( T ) this ;
77+ return this ;
7578 }
7679
77- public T url (String url ) {
80+ public AsyncBaseClientBuilder url (String url ) {
7881 this .environment = Environment .custom (url );
79- return ( T ) this ;
82+ return this ;
8083 }
8184
8285 /**
8386 * Sets the timeout (in seconds) for the client. Defaults to 60 seconds.
8487 */
85- public T timeout (int timeout ) {
88+ public AsyncBaseClientBuilder timeout (int timeout ) {
8689 this .timeout = Optional .of (timeout );
87- return ( T ) this ;
90+ return this ;
8891 }
8992
9093 /**
9194 * Sets the maximum number of retries for the client. Defaults to 2 retries.
9295 */
93- public T maxRetries (int maxRetries ) {
96+ public AsyncBaseClientBuilder maxRetries (int maxRetries ) {
9497 this .maxRetries = Optional .of (maxRetries );
95- return ( T ) this ;
98+ return this ;
9699 }
97100
98101 /**
99102 * Sets the underlying OkHttp client
100103 */
101- public T httpClient (OkHttpClient httpClient ) {
104+ public AsyncBaseClientBuilder httpClient (OkHttpClient httpClient ) {
102105 this .httpClient = httpClient ;
103- return ( T ) this ;
106+ return this ;
104107 }
105108
106109 /**
107110 * Configure logging for the SDK. Silent by default — no log output unless explicitly configured.
108111 */
109- public T logging (LogConfig logging ) {
112+ public AsyncBaseClientBuilder logging (LogConfig logging ) {
110113 this .logging = Optional .of (logging );
111- return ( T ) this ;
114+ return this ;
112115 }
113116
114117 /**
@@ -119,14 +122,14 @@ public T logging(LogConfig logging) {
119122 * @param value The header value
120123 * @return This builder for method chaining
121124 */
122- public T addHeader (String name , String value ) {
125+ public AsyncBaseClientBuilder addHeader (String name , String value ) {
123126 this .customHeaders .put (name , value );
124- return ( T ) this ;
127+ return this ;
125128 }
126129
127- public T projectId (String projectId ) {
130+ public AsyncBaseClientBuilder projectId (String projectId ) {
128131 this .projectId = projectId ;
129- return ( T ) this ;
132+ return this ;
130133 }
131134
132135 protected ClientOptions buildClientOptions () {
@@ -295,7 +298,7 @@ public AsyncBaseClient build() {
295298 return new AsyncBaseClient (buildClientOptions ());
296299 }
297300
298- public static final class _TokenAuth extends AsyncBaseClientBuilder < _TokenAuth > {
301+ public static final class _TokenAuth extends AsyncBaseClientBuilder {
299302 private final String token ;
300303
301304 _TokenAuth (String token ) {
@@ -308,7 +311,7 @@ protected void setAuthentication(ClientOptions.Builder builder) {
308311 }
309312 }
310313
311- public static final class _CredentialsAuth extends AsyncBaseClientBuilder < _CredentialsAuth > {
314+ public static final class _CredentialsAuth extends AsyncBaseClientBuilder {
312315 private final String clientId ;
313316
314317 private final String clientSecret ;
@@ -348,8 +351,6 @@ public static final class _Builder {
348351
349352 private OkHttpClient httpClient ;
350353
351- private Optional <LogConfig > logging = Optional .empty ();
352-
353354 private final Map <String , String > headers = new HashMap <>();
354355
355356 public _Builder environment (Environment environment ) {
@@ -386,14 +387,6 @@ public _Builder httpClient(OkHttpClient httpClient) {
386387 return this ;
387388 }
388389
389- /**
390- * Configure logging for the SDK. Silent by default — no log output unless explicitly configured.
391- */
392- public _Builder logging (LogConfig logging ) {
393- this .logging = Optional .of (logging );
394- return this ;
395- }
396-
397390 /**
398391 * Add a custom header to be sent with all requests.
399392 * @param name The header name
@@ -415,7 +408,21 @@ public _Builder addHeader(String name, String value) {
415408 */
416409 public _TokenAuth token (String token ) {
417410 _TokenAuth auth = new _TokenAuth (token );
418- applyTo (auth );
411+ if (this .environment != null ) {
412+ auth .environment = this .environment ;
413+ }
414+ if (this .timeout .isPresent ()) {
415+ auth .timeout (this .timeout .get ());
416+ }
417+ if (this .maxRetries .isPresent ()) {
418+ auth .maxRetries (this .maxRetries .get ());
419+ }
420+ if (this .httpClient != null ) {
421+ auth .httpClient (this .httpClient );
422+ }
423+ for (Map .Entry <String , String > header : this .headers .entrySet ()) {
424+ auth .addHeader (header .getKey (), header .getValue ());
425+ }
419426 return auth ;
420427 }
421428
@@ -429,11 +436,6 @@ public _TokenAuth token(String token) {
429436 */
430437 public _CredentialsAuth credentials (String clientId , String clientSecret ) {
431438 _CredentialsAuth auth = new _CredentialsAuth (clientId , clientSecret );
432- applyTo (auth );
433- return auth ;
434- }
435-
436- private <B extends AsyncBaseClientBuilder <B >> void applyTo (B auth ) {
437439 if (this .environment != null ) {
438440 auth .environment = this .environment ;
439441 }
@@ -446,12 +448,10 @@ private <B extends AsyncBaseClientBuilder<B>> void applyTo(B auth) {
446448 if (this .httpClient != null ) {
447449 auth .httpClient (this .httpClient );
448450 }
449- if (this .logging .isPresent ()) {
450- auth .logging (this .logging .get ());
451- }
452451 for (Map .Entry <String , String > header : this .headers .entrySet ()) {
453452 auth .addHeader (header .getKey (), header .getValue ());
454453 }
454+ return auth ;
455455 }
456456 }
457457}
0 commit comments