@@ -62,6 +62,12 @@ public static OkHttpClient.Builder create(@Nonnull BaseBearerTokenAuthentication
6262 return create (authenticationProvider , new RequestOption [0 ]);
6363 }
6464
65+ /**
66+ * OkHttpClient Builder for Graph with specified AuthenticationProvider and RequestOptions to override default graph interceptors
67+ * @param authenticationProvider the AuthenticationProvider to use for requests.
68+ * @param requestOptions custom request options to override default graph interceptors
69+ * @return an OkHttpClient Builder instance.
70+ */
6571 @ Nonnull
6672 public static OkHttpClient .Builder create (@ Nonnull BaseBearerTokenAuthenticationProvider authenticationProvider , @ Nonnull RequestOption [] requestOptions ) {
6773 final GraphClientOption graphClientOption = new GraphClientOption ();
@@ -81,9 +87,9 @@ public static OkHttpClient.Builder create(@Nonnull BaseBearerTokenAuthentication
8187 */
8288 @ Nonnull
8389 public static OkHttpClient .Builder create (@ Nonnull GraphClientOption graphClientOption , @ Nonnull Interceptor ... interceptors ) {
84- var builder = KiotaClientFactory .create (interceptors );
85- var customInterceptors = builder .interceptors ();
86- var telemetryHandlerExists = customInterceptors .stream ().anyMatch (x -> x instanceof GraphTelemetryHandler );
90+ final OkHttpClient . Builder builder = KiotaClientFactory .create (interceptors );
91+ final List < Interceptor > customInterceptors = builder .interceptors ();
92+ final boolean telemetryHandlerExists = customInterceptors .stream ().anyMatch (x -> x instanceof GraphTelemetryHandler );
8793 if (!telemetryHandlerExists ) {
8894 customInterceptors .add (new GraphTelemetryHandler (graphClientOption ));
8995 }
@@ -112,6 +118,12 @@ public static OkHttpClient.Builder create(@Nullable GraphClientOption graphClien
112118 return create (graphClientOption , new RequestOption [0 ]);
113119 }
114120
121+ /**
122+ * The OkHttpClient Builder with optional GraphClientOption and RequestOptions to override default graph interceptors
123+ * @param graphClientOption the GraphClientOption for use in requests.
124+ * @param requestOptions custom request options to override default graph interceptors
125+ * @return an OkHttpClient Builder instance.
126+ */
115127 @ Nonnull
116128 public static OkHttpClient .Builder create (@ Nullable GraphClientOption graphClientOption , @ Nonnull RequestOption [] requestOptions ) {
117129 GraphClientOption options = graphClientOption != null ? graphClientOption : new GraphClientOption ();
@@ -129,6 +141,12 @@ public static Interceptor[] createDefaultGraphInterceptors(@Nonnull GraphClientO
129141 return createDefaultGraphInterceptors (graphClientOption , new RequestOption [0 ]);
130142 }
131143
144+ /**
145+ * Creates the default Interceptors for use with Graph configured with the provided RequestOptions.
146+ * @param graphClientOption the GraphClientOption used to create the GraphTelemetryHandler with.
147+ * @param requestOptions custom request options to override default graph interceptors
148+ * @return an array of interceptors.
149+ */
132150 @ Nonnull
133151 public static Interceptor [] createDefaultGraphInterceptors (@ Nonnull GraphClientOption graphClientOption , @ Nonnull RequestOption [] requestOptions ) {
134152 Objects .requireNonNull (requestOptions , "parameter requestOptions cannot be null" );
@@ -142,9 +160,7 @@ public static Interceptor[] createDefaultGraphInterceptors(@Nonnull GraphClientO
142160 }
143161
144162 List <Interceptor > handlers = new ArrayList <>();
145- handlers .add (urlReplaceHandlerOption == null ?
146- new UrlReplaceHandler (new UrlReplaceHandlerOption (CoreConstants .ReplacementConstants .getDefaultReplacementPairs ())) :
147- new UrlReplaceHandler (urlReplaceHandlerOption ));
163+ handlers .add (new UrlReplaceHandler (urlReplaceHandlerOption ));
148164 handlers .add (new GraphTelemetryHandler (graphClientOption ));
149165 handlers .addAll (Arrays .asList (KiotaClientFactory .createDefaultInterceptors (requestOptions )));
150166 addDefaultFeatureUsages (graphClientOption );
0 commit comments