Class DataProvider<TOut>

java.lang.Object
com.sportradar.unifiedodds.sdk.internal.impl.DataProvider<TOut>
Type Parameters:
TOut - valid Unified API endpoint object generated from API xsd schemas
Direct Known Subclasses:
ObservableDataProvider

public class DataProvider<TOut> extends Object
The generic class used to get various data from the Unified API endpoints
  • Constructor Details

  • Method Details

    • getData

      public TOut getData() throws DataProviderException
      If successful returns the requested API endpoint object
      Throws:
      DataProviderException
    • getData

      public TOut getData(String... args) throws DataProviderException
      If successful returns the requested API endpoint object
      Parameters:
      args - that are used with the supplied URI format
      Returns:
      the requested API endpoint object
      Throws:
      DataProviderException
    • getData

      public TOut getData(Locale locale, String... args) throws DataProviderException
      If successful returns the requested API endpoint object
      Parameters:
      locale - the locale that is used with the supplied URI format
      args - that are used with the supplied URI format
      Returns:
      the requested API endpoint object
      Throws:
      DataProviderException
    • getDataWithHeaders

      public TOut getDataWithHeaders(Map<String,String> headers, String... args) throws DataProviderException
      If successful returns the requested API endpoint object
      Parameters:
      headers - additional HTTP headers to include in the request
      args - that are used with the supplied URI format
      Returns:
      the requested API endpoint object
      Throws:
      DataProviderException
    • getDataWithAdditionalInfo

      public DataWrapper<TOut> getDataWithAdditionalInfo(Locale locale, String... args) throws DataProviderException
      If successful returns the requested API endpoint object
      Parameters:
      locale - the locale that is used with the supplied URI format
      args - that are used with the supplied URI format
      Returns:
      the requested API endpoint object and other related information wrapped in a DataWrapper instance
      Throws:
      DataProviderException
    • postData

      public TOut postData(Object content) throws DataProviderException
      If successful returns the requested API endpoint object
      Parameters:
      content - the content used to make POST request
      Returns:
      the requested API endpoint object
      Throws:
      DataProviderException
    • getFinalUrl

      public String getFinalUrl(Locale locale, String arg)
    • getFinalUrl

      public String getFinalUrl(Locale locale, String[] args)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • streamFetchCatchEndpoint

      public static <T> T streamFetchCatchEndpoint(DataProvider<T> provider, Locale l, String... args)
      Method used to wrap up the checked exception in an uncatched exception - streams can not handle checked exception and delegate them forward. For this reason this wrapper method throws a DataProviderStreamException which can be catched out of the stream.
      Type Parameters:
      T - the type of the provider endpoint
      Parameters:
      provider - the provider to perform the fetch with
      l - the Locale used for the fetch
      args - a list of arguments which should be passed to the provider
      Returns:
      the fetched endpoint object