@@ -27,6 +27,8 @@ public final class ClientOptions {
2727
2828 private final int maxRetries ;
2929
30+ private final Telemetry telemetry ;
31+
3032 private ClientOptions (
3133 Environment environment ,
3234 Map <String , String > headers ,
@@ -49,6 +51,7 @@ private ClientOptions(
4951 this .httpClient = httpClient ;
5052 this .timeout = timeout ;
5153 this .maxRetries = maxRetries ;
54+ this .telemetry = telemetry ;
5255 }
5356
5457 public Environment environment () {
@@ -94,6 +97,32 @@ public int maxRetries() {
9497 return this .maxRetries ;
9598 }
9699
100+ /**
101+ * The telemetry explicitly configured on this instance, or {@code null} if it was left to
102+ * default to {@code auth0-java}. Package-private so {@link Builder#from(ClientOptions)} can
103+ * carry it over; not part of the public API.
104+ */
105+ Telemetry telemetry () {
106+ return this .telemetry ;
107+ }
108+
109+ /**
110+ * The static headers configured on this instance, including the resolved {@code Auth0-Client}
111+ * header. Package-private so {@link Builder#from(ClientOptions)} can carry them over; not part
112+ * of the public API.
113+ */
114+ Map <String , String > headers () {
115+ return this .headers ;
116+ }
117+
118+ /**
119+ * The dynamic header suppliers configured on this instance. Package-private so
120+ * {@link Builder#from(ClientOptions)} can carry them over; not part of the public API.
121+ */
122+ Map <String , Supplier <String >> headerSuppliers () {
123+ return this .headerSuppliers ;
124+ }
125+
97126 public static Builder builder () {
98127 return new Builder ();
99128 }
@@ -230,13 +259,22 @@ public ClientOptions build() {
230259 }
231260
232261 /**
233- * Create a new Builder initialized with values from an existing ClientOptions
262+ * Create a new Builder initialized with values from an existing ClientOptions.
263+ *
264+ * <p>Interceptors and logging are not copied explicitly: they are already baked into the
265+ * {@link OkHttpClient} carried over here, and {@link #build()} preserves them via
266+ * {@code newBuilder()}. Copying them would attach them a second time. The same applies to
267+ * the retry interceptor, hence {@code maxRetries} is carried over for reporting only.
234268 */
235269 public static Builder from (ClientOptions clientOptions ) {
236270 Builder builder = new Builder ();
237271 builder .environment = clientOptions .environment ();
238272 builder .timeout = Optional .of (clientOptions .timeout (null ));
239273 builder .httpClient = clientOptions .httpClient ();
274+ builder .maxRetries = clientOptions .maxRetries ();
275+ builder .telemetry = clientOptions .telemetry ();
276+ builder .headers .putAll (clientOptions .headers ());
277+ builder .headerSuppliers .putAll (clientOptions .headerSuppliers ());
240278 return builder ;
241279 }
242280 }
0 commit comments