From 4393e3bf6a2dd6199207aca2ddec01940a7e3b58 Mon Sep 17 00:00:00 2001 From: raghucha Date: Thu, 5 Jun 2025 14:04:27 -0400 Subject: [PATCH 1/5] Added new constructor for GraphServiceClient To resolve https://github.com/microsoftgraph/msgraph-sdk-java/issues/2354 --- .../graph/serviceclient/GraphServiceClient.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/com/microsoft/graph/serviceclient/GraphServiceClient.java b/src/main/java/com/microsoft/graph/serviceclient/GraphServiceClient.java index 83d633f8781..34ca6f1fae6 100644 --- a/src/main/java/com/microsoft/graph/serviceclient/GraphServiceClient.java +++ b/src/main/java/com/microsoft/graph/serviceclient/GraphServiceClient.java @@ -50,6 +50,16 @@ public GraphServiceClient(@Nonnull RequestAdapter requestAdapter) { public GraphServiceClient(@Nonnull AuthenticationProvider authenticationProvider) { this(new BaseGraphRequestAdapter(authenticationProvider, null, "v1.0" , getGraphClientOptions())); } + /** + * 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 an AuthenticationProvider and OkHttpClient. * @param authenticationProvider The AuthenticationProvider for this GraphServiceClient. From 2fdeaae13ba373b741af428cd921c4d9ff7d367e Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 5 Jun 2025 14:30:08 -0400 Subject: [PATCH 2/5] chore: formatting --- .../com/microsoft/graph/serviceclient/GraphServiceClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/microsoft/graph/serviceclient/GraphServiceClient.java b/src/main/java/com/microsoft/graph/serviceclient/GraphServiceClient.java index 34ca6f1fae6..7ed9da48277 100644 --- a/src/main/java/com/microsoft/graph/serviceclient/GraphServiceClient.java +++ b/src/main/java/com/microsoft/graph/serviceclient/GraphServiceClient.java @@ -57,7 +57,7 @@ public GraphServiceClient(@Nonnull AuthenticationProvider authenticationProvider * @param clouds The Clouds for the GraphServiceClient. * */ - public GraphServiceClient(@Nonnull AuthenticationProvider authenticationProvider,@Nonnull OkHttpClient client, @Nonnull Clouds clouds) { + public GraphServiceClient(@Nonnull AuthenticationProvider authenticationProvider, @Nonnull OkHttpClient client, @Nonnull Clouds clouds) { this(new BaseGraphRequestAdapter(authenticationProvider, clouds, "v1.0", getGraphClientOptions())); } /** From a95cc916b0038ba3edb1b37be943aee6d1f5a215 Mon Sep 17 00:00:00 2001 From: raghucha Date: Thu, 5 Jun 2025 15:43:20 -0400 Subject: [PATCH 3/5] Update GraphServiceClient.java missing import --- .../com/microsoft/graph/serviceclient/GraphServiceClient.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/microsoft/graph/serviceclient/GraphServiceClient.java b/src/main/java/com/microsoft/graph/serviceclient/GraphServiceClient.java index 7ed9da48277..6bdea553478 100644 --- a/src/main/java/com/microsoft/graph/serviceclient/GraphServiceClient.java +++ b/src/main/java/com/microsoft/graph/serviceclient/GraphServiceClient.java @@ -2,6 +2,7 @@ import com.microsoft.graph.core.CoreConstants; 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 712533052c34cbbdaba0ca8558d16057ee86e531 Mon Sep 17 00:00:00 2001 From: raghucha Date: Mon, 9 Jun 2025 09:10:10 -0400 Subject: [PATCH 4/5] Update GraphServiceClient.java --- .../microsoft/graph/serviceclient/GraphServiceClient.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/microsoft/graph/serviceclient/GraphServiceClient.java b/src/main/java/com/microsoft/graph/serviceclient/GraphServiceClient.java index 6bdea553478..515c7fc6927 100644 --- a/src/main/java/com/microsoft/graph/serviceclient/GraphServiceClient.java +++ b/src/main/java/com/microsoft/graph/serviceclient/GraphServiceClient.java @@ -52,13 +52,14 @@ public GraphServiceClient(@Nonnull AuthenticationProvider authenticationProvider this(new BaseGraphRequestAdapter(authenticationProvider, null, "v1.0" , getGraphClientOptions())); } /** - * Instantiate the GraphServiceClient using an AuthenticationProvider, baseUrl and OkHttpClient. - * @param authenticationProvider The AuthenticationProvider for this GraphServiceClient. + * Instantiate the GraphServiceClient using an AuthenticationProvider, Cloud and OkHttpClient. * @param client The OkHttpClient for the GraphServiceClient. * @param clouds The Clouds for the GraphServiceClient. + * @param authenticationProvider The AuthenticationProvider for this GraphServiceClient. * */ - public GraphServiceClient(@Nonnull AuthenticationProvider authenticationProvider, @Nonnull OkHttpClient client, @Nonnull Clouds clouds) { + @SuppressWarnings("LambdaLast") + public GraphServiceClient(@Nonnull OkHttpClient client, @Nonnull Clouds clouds, @Nonnull AuthenticationProvider authenticationProvider) { this(new BaseGraphRequestAdapter(authenticationProvider, clouds, "v1.0", getGraphClientOptions())); } /** From 8c1c45eb07cc5ff3f6588967400ea58742392e7a Mon Sep 17 00:00:00 2001 From: raghucha Date: Mon, 9 Jun 2025 14:39:44 +0000 Subject: [PATCH 5/5] Fix Constructor --- .../microsoft/graph/serviceclient/GraphServiceClient.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/microsoft/graph/serviceclient/GraphServiceClient.java b/src/main/java/com/microsoft/graph/serviceclient/GraphServiceClient.java index 515c7fc6927..e9308ced1f3 100644 --- a/src/main/java/com/microsoft/graph/serviceclient/GraphServiceClient.java +++ b/src/main/java/com/microsoft/graph/serviceclient/GraphServiceClient.java @@ -53,14 +53,14 @@ public GraphServiceClient(@Nonnull AuthenticationProvider authenticationProvider } /** * 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. - * @param authenticationProvider The AuthenticationProvider for this GraphServiceClient. * */ @SuppressWarnings("LambdaLast") - public GraphServiceClient(@Nonnull OkHttpClient client, @Nonnull Clouds clouds, @Nonnull AuthenticationProvider authenticationProvider) { - this(new BaseGraphRequestAdapter(authenticationProvider, clouds, "v1.0", getGraphClientOptions())); + public GraphServiceClient(@Nonnull AuthenticationProvider authenticationProvider, @Nonnull OkHttpClient client, @Nonnull Clouds clouds) { + this(new BaseGraphRequestAdapter(authenticationProvider, clouds, "v1.0", client)); } /** * Instantiate the GraphServiceClient using an AuthenticationProvider and OkHttpClient.