Class SCBClient
- java.lang.Object
-
- com.github.dannil.scbjavaclient.client.AbstractClient
-
- com.github.dannil.scbjavaclient.client.AbstractContainerClient
-
- com.github.dannil.scbjavaclient.client.SCBClient
-
public class SCBClient extends AbstractContainerClient
Root client for the client hierarchy.
- Since:
- 0.0.2
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description AgricultureClient
agriculture()
Retrieve the client for interacting with agriculture data.BusinessActivitiesClient
businessActivities()
Retrieve the client for interacting with business activities data.EducationAndResearchClient
educationAndResearch()
Retrieve the client for interacting with education and research data.EnergyClient
energy()
Retrieve the client for interacting with energy data.EnvironmentClient
environment()
Retrieve the client for interacting with environment data.FinancialMarketsClient
financialMarkets()
Retrieve the client for interacting with financial markets data.Map<String,String>
getConfig()
Fetches the config from the API.Map<String,Collection<String>>
getInputs(String table)
Fetches all the inputs for a given table from the API.String
getRawData(String table)
Fetch the JSON response from the specified table.String
getRawData(String table, Map<String,Collection<?>> query)
Fetch the JSON response from the specified table.List<String>
getRegions(String table)
Returns the list of the available regions for a given table.List<String>
getTimes(String table)
Returns the list of the available times for a given table.URLEndpoint
getUrl()
Returns the URL endpoint which this client represents.GoodsAndServicesClient
goodsAndServices()
Retrieve the client for interacting with goods and services data.static boolean
isSupportedLanguage(String language)
Checks if the specified language is supported by the API.static boolean
isSupportedLocale(Locale locale)
Checks if the specifiedLocale
is supported by the API.LabourMarketClient
labourMarket()
Retrieve the client for interacting with labour market data.LivingConditionsClient
livingConditions()
Retrieve the client for interacting with living conditions data.PopulationClient
population()
Retrieve the client for interacting with population data.PricesAndConsumptionClient
pricesAndConsumption()
Retrieve the client for interacting with prices and consumption data.PublicFinancesClient
publicFinances()
Retrieve the client for interacting with public finances data.TransportClient
transport()
Retrieve the client for interacting with transport data.-
Methods inherited from class com.github.dannil.scbjavaclient.client.AbstractContainerClient
addClient, getClient, setLocale
-
Methods inherited from class com.github.dannil.scbjavaclient.client.AbstractClient
doGetRequest, doPostRequest, getCommunicationProtocol, getLocale, getLocalizationLocale, getResponseModels, getResponseModels, getRootUrl, setCommunicationProtocol, setLocalizationLocale
-
-
-
-
Constructor Detail
-
SCBClient
public SCBClient()
Default constructor. Initializes values and creates sub-clients.
-
SCBClient
public SCBClient(Locale locale)
Overloaded constructor.
- Parameters:
locale
- the locale for this client
-
-
Method Detail
-
agriculture
public AgricultureClient agriculture()
Retrieve the client for interacting with agriculture data.
- Returns:
- a client for agriculture data
-
businessActivities
public BusinessActivitiesClient businessActivities()
Retrieve the client for interacting with business activities data.
- Returns:
- a client for business activities data
-
educationAndResearch
public EducationAndResearchClient educationAndResearch()
Retrieve the client for interacting with education and research data.
- Returns:
- a client for education and research data
-
energy
public EnergyClient energy()
Retrieve the client for interacting with energy data.
- Returns:
- a client for energy data
-
environment
public EnvironmentClient environment()
Retrieve the client for interacting with environment data.
- Returns:
- a client for environment data
-
financialMarkets
public FinancialMarketsClient financialMarkets()
Retrieve the client for interacting with financial markets data.
- Returns:
- a client for financial markets data
-
goodsAndServices
public GoodsAndServicesClient goodsAndServices()
Retrieve the client for interacting with goods and services data.
- Returns:
- a client for goods and services data
-
labourMarket
public LabourMarketClient labourMarket()
Retrieve the client for interacting with labour market data.
- Returns:
- a client for labour market data
-
livingConditions
public LivingConditionsClient livingConditions()
Retrieve the client for interacting with living conditions data.
- Returns:
- a client for living conditions data
-
population
public PopulationClient population()
Retrieve the client for interacting with population data.
- Returns:
- a client for population data
-
pricesAndConsumption
public PricesAndConsumptionClient pricesAndConsumption()
Retrieve the client for interacting with prices and consumption data.
- Returns:
- a client for prices and consumption data
-
publicFinances
public PublicFinancesClient publicFinances()
Retrieve the client for interacting with public finances data.
- Returns:
- a client for public finances data
-
transport
public TransportClient transport()
Retrieve the client for interacting with transport data.
- Returns:
- a client for transport data
-
getInputs
public Map<String,Collection<String>> getInputs(String table)
Fetches all the inputs for a given table from the API. If the table doesn't exist an empty
Map
will be returned.- Parameters:
table
- the table to fetch the inputs from- Returns:
- a collection of all codes and their respective values for the given table
- See Also:
JsonAPITableFormat#getPairs()
-
getRegions
public List<String> getRegions(String table)
Returns the list of the available regions for a given table. If the table doesn't exist an empty
List
will be returned.- Parameters:
table
- the table to retrieve the regions from- Returns:
- a list of the available regions for the given table
-
getTimes
public List<String> getTimes(String table)
Returns the list of the available times for a given table. If the table doesn't exist an empty
List
will be returned.- Parameters:
table
- the table to retrieve the times from- Returns:
- a list of the available times for the given table
-
getRawData
public String getRawData(String table)
Fetch the JSON response from the specified table. As opposed to
getRawData(String, Map)
, this method fetches all available data and therefore doesn't support selecting specific values before calling the API.Do note: as this method matches all content codes available on the API, the response is likely to be several times larger than the response when selecting values.
- Parameters:
table
- the table to fetch data from- Returns:
- a JSON string containing all available data in the specified table
- See Also:
JsonAPITableFormat#getValues(String)
-
getRawData
public String getRawData(String table, Map<String,Collection<?>> query)
Fetch the JSON response from the specified table. Useful if you're only interested in the raw JSON data.
- Parameters:
table
- the table to fetch data fromquery
- the selected values- Returns:
- a response from the API formatted as JSON
-
getConfig
public Map<String,String> getConfig()
Fetches the config from the API. Useful if you for example need to know how often you're allowed to make calls to the API, or the max size of the response.
- Returns:
- the config
-
isSupportedLanguage
public static boolean isSupportedLanguage(String language)
Checks if the specified language is supported by the API. See
isSupportedLocale(Locale)
for implementation details.- Parameters:
language
- the language to check- Returns:
- true if the language is supported, otherwise false
-
isSupportedLocale
public static boolean isSupportedLocale(Locale locale)
Checks if the specified
Locale
is supported by the API. The method performs a request to the API using theLocale
's language and checks if a HTTP resource exists matching the language.- Parameters:
locale
- theLocale
to check- Returns:
- true if the
Locale
is supported, otherwise false
-
getUrl
public URLEndpoint getUrl()
Description copied from class:AbstractClient
Returns the URL endpoint which this client represents.
- Specified by:
getUrl
in classAbstractClient
- Returns:
- the URL endpoint for this client
-
-