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
The generic class used to get various data from the Unified API endpoints
-
Constructor Summary
ConstructorsConstructorDescriptionDataProvider(String uriFormat, SdkInternalConfiguration config, com.sportradar.unifiedodds.sdk.internal.impl.HttpDataFetcher logHttpDataFetcher, Deserializer deserializer) DataProvider(String uriFormat, String apiHostAndPort, boolean useApiSsl, Locale defaultLocale, LogHttpDataFetcher logHttpDataFetcher, Deserializer deserializer) -
Method Summary
Modifier and TypeMethodDescriptiongetData()If successful returns the requested API endpoint objectIf successful returns the requested API endpoint objectIf successful returns the requested API endpoint objectgetDataWithAdditionalInfo(Locale locale, String... args) If successful returns the requested API endpoint objectgetDataWithHeaders(Map<String, String> headers, String... args) If successful returns the requested API endpoint objectgetFinalUrl(Locale locale, String arg) getFinalUrl(Locale locale, String[] args) If successful returns the requested API endpoint objectstatic <T> TstreamFetchCatchEndpoint(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.toString()
-
Constructor Details
-
DataProvider
public DataProvider(String uriFormat, SdkInternalConfiguration config, com.sportradar.unifiedodds.sdk.internal.impl.HttpDataFetcher logHttpDataFetcher, Deserializer deserializer) -
DataProvider
public DataProvider(String uriFormat, String apiHostAndPort, boolean useApiSsl, Locale defaultLocale, LogHttpDataFetcher logHttpDataFetcher, Deserializer deserializer)
-
-
Method Details
-
getData
If successful returns the requested API endpoint object- Throws:
DataProviderException
-
getData
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
If successful returns the requested API endpoint object- Parameters:
locale- the locale that is used with the supplied URI formatargs- 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 DataProviderExceptionIf successful returns the requested API endpoint object- Parameters:
headers- additional HTTP headers to include in the requestargs- 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 formatargs- that are used with the supplied URI format- Returns:
- the requested API endpoint object and other related information wrapped in a
DataWrapperinstance - Throws:
DataProviderException
-
postData
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
-
getFinalUrl
-
toString
-
streamFetchCatchEndpoint
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 aDataProviderStreamExceptionwhich can be catched out of the stream.- Type Parameters:
T- the type of the provider endpoint- Parameters:
provider- the provider to perform the fetch withl- the Locale used for the fetchargs- a list of arguments which should be passed to the provider- Returns:
- the fetched endpoint object
-