Class BaseClient<nativeRequestType>

java.lang.Object
com.microsoft.graph.core.BaseClient<nativeRequestType>
Type Parameters:
nativeRequestType - type of a request for the native http client
All Implemented Interfaces:
IBaseClient<nativeRequestType>

public class BaseClient<nativeRequestType> extends Object implements IBaseClient<nativeRequestType>
A client that communications with an OData service
  • Field Details

    • DEFAULT_GRAPH_ENDPOINT

      public static final String DEFAULT_GRAPH_ENDPOINT
      The default endpoint for the Microsoft Graph Service
      See Also:
  • Constructor Details

    • BaseClient

      protected BaseClient()
      Restricted constructor
  • Method Details

    • getServiceRoot

      @Nonnull public String getServiceRoot()
      Description copied from interface: IBaseClient
      Gets the service root
      Specified by:
      getServiceRoot in interface IBaseClient<nativeRequestType>
      Returns:
      the service root
    • setServiceRoot

      public void setServiceRoot(@Nonnull String value)
      Description copied from interface: IBaseClient
      Sets the service root
      Specified by:
      setServiceRoot in interface IBaseClient<nativeRequestType>
      Parameters:
      value - the service root
    • customRequest

      @Nonnull public <T> CustomRequestBuilder<T> customRequest(@Nonnull String url, @Nonnull Class<T> responseType)
      Send a custom request to Graph
      Specified by:
      customRequest in interface IBaseClient<nativeRequestType>
      Type Parameters:
      T - the type to deserialize the response to
      Parameters:
      url - the full URL to make a request with
      responseType - the response class to deserialize the response into
      Returns:
      the instance of this builder
    • customRequest

      @Nonnull public CustomRequestBuilder<com.google.gson.JsonElement> customRequest(@Nonnull String url)
      Send a custom request to Graph
      Specified by:
      customRequest in interface IBaseClient<nativeRequestType>
      Parameters:
      url - the full URL to make a request with
      Returns:
      the instance of this builder
    • batch

      @Nonnull public BatchRequestBuilder batch()
      Get the batch request builder.
      Specified by:
      batch in interface IBaseClient<nativeRequestType>
      Returns:
      a request builder to execute a batch.
    • builder

      @Nonnull public static BaseClient.Builder<okhttp3.OkHttpClient,okhttp3.Request> builder()
      Gets the builder to start configuring the client
      Returns:
      builder to start configuring the client
    • builder

      @Nonnull public static <nativeClient, nativeRequest> BaseClient.Builder<nativeClient,nativeRequest> builder(@Nonnull Class<nativeClient> nativeClientClass, @Nonnull Class<nativeRequest> nativeRequestClass)
      Gets the builder to start configuring the client
      Type Parameters:
      nativeClient - the type of the native http client
      nativeRequest - the type of the native http request
      Parameters:
      nativeClientClass - the class of the native http client
      nativeRequestClass - the class of the native http request
      Returns:
      builder to start configuring the client
    • getHttpProvider

      @Nullable public IHttpProvider<nativeRequestType> getHttpProvider()
      Gets the HTTP provider
      Specified by:
      getHttpProvider in interface IBaseClient<nativeRequestType>
      Returns:
      The HTTP provider
    • getLogger

      @Nullable public ILogger getLogger()
      Gets the logger
      Specified by:
      getLogger in interface IBaseClient<nativeRequestType>
      Returns:
      The logger
    • getSerializer

      @Nullable public ISerializer getSerializer()
      Gets the serializer
      Specified by:
      getSerializer in interface IBaseClient<nativeRequestType>
      Returns:
      The serializer
    • setLogger

      protected void setLogger(@Nonnull ILogger logger)
      Sets the logger
      Parameters:
      logger - The logger
    • setHttpProvider

      protected void setHttpProvider(@Nonnull IHttpProvider<nativeRequestType> httpProvider)
      Sets the HTTP provider
      Parameters:
      httpProvider - The HTTP provider
    • setSerializer

      public void setSerializer(@Nonnull ISerializer serializer)
      Sets the serializer
      Parameters:
      serializer - The serializer
    • getServiceSDKVersion

      @Nullable public String getServiceSDKVersion()
      Gets the service SDK version if the service SDK is in use, null otherwise
      Specified by:
      getServiceSDKVersion in interface IBaseClient<nativeRequestType>
      Returns:
      the service SDK version if the service SDK is in use, null otherwise