2626import com .microsoft .graph .http .CoreHttpProvider ;
2727import com .microsoft .graph .http .IHttpProvider ;
2828import com .microsoft .graph .httpcore .HttpClients ;
29- import com .microsoft .graph .authentication .ICoreAuthenticationProvider ;
29+ import com .microsoft .graph .authentication .IAuthenticationProvider ;
3030import com .microsoft .graph .logger .DefaultLogger ;
3131import com .microsoft .graph .logger .ILogger ;
3232import com .microsoft .graph .serializer .DefaultSerializer ;
3636import javax .annotation .Nonnull ;
3737
3838import okhttp3 .OkHttpClient ;
39+ import okhttp3 .Request ;
3940
4041/**
4142 * A client that communications with an OData service
@@ -104,23 +105,25 @@ public CustomRequestBuilder<JsonObject> customRequest(@Nonnull final String url)
104105 * @return builder to start configuring the client
105106 */
106107 @ Nonnull
107- public static Builder <OkHttpClient > builder () {
108- return new Builder <OkHttpClient >();
108+ public static Builder <OkHttpClient , Request > builder () {
109+ return new Builder <>();
109110 }
110111
111112 /**
112113 * Builder to help configure the Graph service client
114+ * @param <httpClientType> type of the native http library client
115+ * @param <httpRequestType> type of the native http library request
113116 */
114- public static class Builder <httpClientType > {
117+ public static class Builder <httpClientType , httpRequestType > {
115118 private ISerializer serializer ;
116119 private IHttpProvider httpProvider ;
117120 private ILogger logger ;
118121 private httpClientType httpClient ;
119- private ICoreAuthenticationProvider auth ;
122+ private IAuthenticationProvider < httpRequestType > auth ;
120123
121- private ICoreAuthenticationProvider getAuthenticationProvider () {
124+ private IAuthenticationProvider < httpRequestType > getAuthenticationProvider () {
122125 if (auth == null ) {
123- throw new NullPointerException ("auth" ); // TODO initialize to default once moved to core
126+ throw new NullPointerException ("auth" );
124127 } else {
125128 return auth ;
126129 }
@@ -142,7 +145,7 @@ private ISerializer getSerializer() {
142145 @ SuppressWarnings ("unchecked" )
143146 private httpClientType getHttpClient () {
144147 if (httpClient == null ) {
145- return (httpClientType )HttpClients .createDefault (getAuthenticationProvider ());
148+ return (httpClientType )HttpClients .createDefault (( IAuthenticationProvider < Request >) getAuthenticationProvider ());
146149 } else {
147150 return httpClient ;
148151 }
@@ -163,7 +166,7 @@ private IHttpProvider getHttpProvider() {
163166 * @return the instance of this builder
164167 */
165168 @ Nonnull
166- public Builder <httpClientType > serializer (@ Nonnull final ISerializer serializer ) {
169+ public Builder <httpClientType , httpRequestType > serializer (@ Nonnull final ISerializer serializer ) {
167170 checkNotNull (serializer , "serializer" );
168171 this .serializer = serializer ;
169172 return this ;
@@ -177,7 +180,7 @@ public Builder<httpClientType> serializer(@Nonnull final ISerializer serializer)
177180 * @return the instance of this builder
178181 */
179182 @ Nonnull
180- public Builder <httpClientType > httpProvider (@ Nonnull final IHttpProvider httpProvider ) {
183+ public Builder <httpClientType , httpRequestType > httpProvider (@ Nonnull final IHttpProvider httpProvider ) {
181184 checkNotNull (httpProvider , "httpProvider" );
182185 this .httpProvider = httpProvider ;
183186 return this ;
@@ -191,7 +194,7 @@ public Builder<httpClientType> httpProvider(@Nonnull final IHttpProvider httpPro
191194 * @return the instance of this builder
192195 */
193196 @ Nonnull
194- public Builder <httpClientType > logger (@ Nonnull final ILogger logger ) {
197+ public Builder <httpClientType , httpRequestType > logger (@ Nonnull final ILogger logger ) {
195198 checkNotNull (logger , "logger" );
196199 this .logger = logger ;
197200 return this ;
@@ -205,7 +208,7 @@ public Builder<httpClientType> logger(@Nonnull final ILogger logger) {
205208 * @return the instance of this builder
206209 */
207210 @ Nonnull
208- public Builder <httpClientType > httpClient (@ Nonnull final httpClientType client ) {
211+ public Builder <httpClientType , httpRequestType > httpClient (@ Nonnull final httpClientType client ) {
209212 checkNotNull (client , "client" );
210213 this .httpClient = client ;
211214 return this ;
@@ -218,7 +221,7 @@ public Builder<httpClientType> httpClient(@Nonnull final httpClientType client)
218221 * @return the instance of this builder
219222 */
220223 @ Nonnull
221- public Builder <httpClientType > authenticationProvider (@ Nonnull final ICoreAuthenticationProvider auth ) {
224+ public Builder <httpClientType , httpRequestType > authenticationProvider (@ Nonnull final IAuthenticationProvider < httpRequestType > auth ) {
222225 checkNotNull (auth , "auth" );
223226 this .auth = auth ;
224227 return this ;
0 commit comments