Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 25 additions & 8 deletions src/main/java/com/microsoft/graph/requests/GraphServiceClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,15 @@
import com.microsoft.graph.logger.ILogger;
import com.microsoft.graph.serializer.ISerializer;
import okhttp3.OkHttpClient;
import okhttp3.Request;

// **NOTE** This file was generated by a tool and any changes will be overwritten.

/**
* The class for the Graph Service Client.
* @param <NativeRequestType> type of a request for the native http client
*/
public class GraphServiceClient extends BaseClient implements IBaseClient {
public class GraphServiceClient<NativeRequestType> extends BaseClient<NativeRequestType> implements IBaseClient<NativeRequestType> {
/**
* Restricted constructor
*/
Expand All @@ -129,13 +131,28 @@ public String getServiceSDKVersion() {
* @return builder to start configuring the client
*/
@Nonnull
public static Builder<OkHttpClient> builder() {
public static Builder<OkHttpClient, Request> builder() {
return builder(OkHttpClient.class, Request.class);
}

/**
* Gets the builder to start configuring the client
*
* @param <nativeClient> the type of the native http client
* @param <nativeRequest> the type of the native http request
* @param nativeClientClass the class of the native http client
* @param nativeRequestClass the class of the native http request
* @return builder to start configuring the client
*/
@Nonnull
public static <nativeClient, nativeRequest> Builder<nativeClient, nativeRequest> builder(Class<nativeClient> nativeClientClass, Class<nativeRequest> nativeRequestClass) {
return new Builder<>();
}
/**
* Builder to help configure the Graph service client
* @param <NativeRequestType> type of a request for the native http client
*/
public static class Builder<httpClientType> extends BaseClient.Builder<httpClientType> {
public static class Builder<httpClientType, NativeRequestType> extends BaseClient.Builder<httpClientType, NativeRequestType> {
/**
* Sets the serializer.
*
Expand All @@ -145,7 +162,7 @@ public static class Builder<httpClientType> extends BaseClient.Builder<httpClien
*/
@Nonnull
@Override
public Builder<httpClientType> serializer(@Nonnull final ISerializer serializer) {
public Builder<httpClientType, NativeRequestType> serializer(@Nonnull final ISerializer serializer) {
super.serializer(serializer);
return this;
}
Expand All @@ -159,7 +176,7 @@ public Builder<httpClientType> serializer(@Nonnull final ISerializer serializer)
*/
@Nonnull
@Override
public Builder<httpClientType> httpProvider(@Nonnull final IHttpProvider httpProvider) {
public Builder<httpClientType, NativeRequestType> httpProvider(@Nonnull final IHttpProvider httpProvider) {
super.httpProvider(httpProvider);
return this;
}
Expand All @@ -173,7 +190,7 @@ public Builder<httpClientType> httpProvider(@Nonnull final IHttpProvider httpPro
*/
@Nonnull
@Override
public Builder<httpClientType> logger(@Nonnull final ILogger logger) {
public Builder<httpClientType, NativeRequestType> logger(@Nonnull final ILogger logger) {
super.logger(logger);
return this;
}
Expand All @@ -187,7 +204,7 @@ public Builder<httpClientType> logger(@Nonnull final ILogger logger) {
*/
@Nonnull
@Override
public Builder<httpClientType> httpClient(@Nonnull final httpClientType client) {
public Builder<httpClientType, NativeRequestType> httpClient(@Nonnull final httpClientType client) {
super.httpClient(client);
return this;
}
Expand All @@ -200,7 +217,7 @@ public Builder<httpClientType> httpClient(@Nonnull final httpClientType client)
*/
@Nonnull
@Override
public Builder<httpClientType> authenticationProvider(@Nonnull final IAuthenticationProvider auth) {
public Builder<httpClientType, NativeRequestType> authenticationProvider(@Nonnull final IAuthenticationProvider auth) {
super.authenticationProvider(auth);
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class BatchTests {
@Test
public void GetsABatchFromRequests() throws IOException{
final TestBase testBase = new TestBase();
final GraphServiceClient graphServiceClient = testBase.graphClient;
final GraphServiceClient<?> graphServiceClient = testBase.graphClient;
final BatchRequestContent batchContent = new BatchRequestContent();
final String meGetId = batchContent.addBatchRequestStep(graphServiceClient.me()
.buildRequest());
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/microsoft/graph/functional/TestBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class TestBase {
private String tokenEndpoint = "https://login.microsoftonline.com/"+ Constants.TENANTID +"/oauth2/v2.0/token";
private String resourceId = "https%3A%2F%2Fgraph.microsoft.com%2F.default";

public GraphServiceClient graphClient = null;
public GraphServiceClient<Request> graphClient = null;

public TestBase(){
this(true);
Expand Down