From 77daa27a076b2213b814079ba84625d3085025a7 Mon Sep 17 00:00:00 2001 From: raghucha Date: Thu, 5 Jun 2025 15:22:40 -0400 Subject: [PATCH 1/3] Added new constructor for GraphServiceClient fixes #2354 Fixes [#]2354(#2354) -Allows Us to Overide the default Base URL in use cases such as GCC customers --- .../graph/beta/serviceclient/GraphServiceClient.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/com/microsoft/graph/beta/serviceclient/GraphServiceClient.java b/src/main/java/com/microsoft/graph/beta/serviceclient/GraphServiceClient.java index 276c3fa1c8e..a443b4b0cb1 100644 --- a/src/main/java/com/microsoft/graph/beta/serviceclient/GraphServiceClient.java +++ b/src/main/java/com/microsoft/graph/beta/serviceclient/GraphServiceClient.java @@ -64,6 +64,16 @@ public GraphServiceClient(@Nonnull AuthenticationProvider authenticationProvider */ public GraphServiceClient(@Nonnull OkHttpClient client) { this(new AnonymousAuthenticationProvider(), client); + } + /** + * Instantiate the GraphServiceClient using an AuthenticationProvider, baseUrl and OkHttpClient. + * @param authenticationProvider The AuthenticationProvider for this GraphServiceClient. + * @param client The OkHttpClient for the GraphServiceClient. + * @param clouds The Clouds for the GraphServiceClient. + * + */ + public GraphServiceClient(@Nonnull AuthenticationProvider authenticationProvider, @Nonnull OkHttpClient client, @Nonnull Clouds clouds) { + this(new BaseGraphRequestAdapter(authenticationProvider, clouds, "v1.0", getGraphClientOptions())); } /** * Instantiate the GraphServiceClient using a TokenCredential and Scopes. From 8f0d155d3165330f41426eaa5508c27b908ed521 Mon Sep 17 00:00:00 2001 From: raghucha Date: Thu, 5 Jun 2025 15:44:19 -0400 Subject: [PATCH 2/3] Update GraphServiceClient.java missing import --- .../microsoft/graph/beta/serviceclient/GraphServiceClient.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/microsoft/graph/beta/serviceclient/GraphServiceClient.java b/src/main/java/com/microsoft/graph/beta/serviceclient/GraphServiceClient.java index a443b4b0cb1..25cbdd62a7e 100644 --- a/src/main/java/com/microsoft/graph/beta/serviceclient/GraphServiceClient.java +++ b/src/main/java/com/microsoft/graph/beta/serviceclient/GraphServiceClient.java @@ -3,6 +3,7 @@ import com.microsoft.graph.core.CoreConstants; import com.microsoft.graph.core.authentication.AzureIdentityAuthenticationProvider; import com.microsoft.graph.core.requests.BaseGraphRequestAdapter; +import com.microsoft.graph.core.requests.BaseGraphRequestAdapter.Clouds; import com.microsoft.graph.core.requests.BatchRequestBuilder; import com.microsoft.graph.core.requests.options.GraphClientOption; import com.microsoft.graph.core.requests.IBaseClient; From 9462b3ee80679ac0e4866eb05a3ccce2071d347b Mon Sep 17 00:00:00 2001 From: raghucha Date: Mon, 9 Jun 2025 11:41:22 -0400 Subject: [PATCH 3/3] Update GraphServiceClient.java --- .../graph/beta/serviceclient/GraphServiceClient.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/microsoft/graph/beta/serviceclient/GraphServiceClient.java b/src/main/java/com/microsoft/graph/beta/serviceclient/GraphServiceClient.java index 25cbdd62a7e..105489beef9 100644 --- a/src/main/java/com/microsoft/graph/beta/serviceclient/GraphServiceClient.java +++ b/src/main/java/com/microsoft/graph/beta/serviceclient/GraphServiceClient.java @@ -66,15 +66,16 @@ public GraphServiceClient(@Nonnull AuthenticationProvider authenticationProvider public GraphServiceClient(@Nonnull OkHttpClient client) { this(new AnonymousAuthenticationProvider(), client); } - /** - * Instantiate the GraphServiceClient using an AuthenticationProvider, baseUrl and OkHttpClient. + /** + * Instantiate the GraphServiceClient using an AuthenticationProvider, Cloud and OkHttpClient. * @param authenticationProvider The AuthenticationProvider for this GraphServiceClient. * @param client The OkHttpClient for the GraphServiceClient. * @param clouds The Clouds for the GraphServiceClient. * */ + @SuppressWarnings("LambdaLast") public GraphServiceClient(@Nonnull AuthenticationProvider authenticationProvider, @Nonnull OkHttpClient client, @Nonnull Clouds clouds) { - this(new BaseGraphRequestAdapter(authenticationProvider, clouds, "v1.0", getGraphClientOptions())); + this(new BaseGraphRequestAdapter(authenticationProvider, clouds, "v1.0", client)); } /** * Instantiate the GraphServiceClient using a TokenCredential and Scopes.