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 AgricultureClientagriculture()Retrieve the client for interacting with agriculture data.BusinessActivitiesClientbusinessActivities()Retrieve the client for interacting with business activities data.EducationAndResearchClienteducationAndResearch()Retrieve the client for interacting with education and research data.EnergyClientenergy()Retrieve the client for interacting with energy data.EnvironmentClientenvironment()Retrieve the client for interacting with environment data.FinancialMarketsClientfinancialMarkets()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.StringgetRawData(String table)Fetch the JSON response from the specified table.StringgetRawData(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.URLEndpointgetUrl()Returns the URL endpoint which this client represents.GoodsAndServicesClientgoodsAndServices()Retrieve the client for interacting with goods and services data.static booleanisSupportedLanguage(String language)Checks if the specified language is supported by the API.static booleanisSupportedLocale(Locale locale)Checks if the specifiedLocaleis supported by the API.LabourMarketClientlabourMarket()Retrieve the client for interacting with labour market data.LivingConditionsClientlivingConditions()Retrieve the client for interacting with living conditions data.PopulationClientpopulation()Retrieve the client for interacting with population data.PricesAndConsumptionClientpricesAndConsumption()Retrieve the client for interacting with prices and consumption data.PublicFinancesClientpublicFinances()Retrieve the client for interacting with public finances data.TransportClienttransport()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
Mapwill 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
Listwill 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
Listwill 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
Localeis 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- theLocaleto check- Returns:
- true if the
Localeis supported, otherwise false
-
getUrl
public URLEndpoint getUrl()
Description copied from class:AbstractClientReturns the URL endpoint which this client represents.
- Specified by:
getUrlin classAbstractClient- Returns:
- the URL endpoint for this client
-
-