Package de.sfuhrm.radiobrowser4j
Class RadioBrowser
java.lang.Object
de.sfuhrm.radiobrowser4j.RadioBrowser
API facade for the RadioBrowser.
You usually create a new instance
and then use the methods to invoke API calls.
- Author:
- Stephan Fuhrmann
-
Constructor Summary
ConstructorsConstructorDescriptionRadioBrowser(@NonNull ConnectionParams connectionParams) Creates a new API client using a proxy. -
Method Summary
Modifier and TypeMethodDescriptionGet the server statistics.getStationByUUID(@NonNull UUID uuid) Get a station referenced by its UUID.Get a list of all broken stations as one continuous stream.listBrokenStations(@NonNull Limit limit) Get a list of all broken stations.List the known codecs.Deprecated.List the known country codes.List the known languages.Get a stream of last changed stations.listLastChangedStations(@NonNull Limit limit) Get a list of the last changed stations.Get a stream of last clicked stations.listLastClickStations(@NonNull Limit limit) Get a list of the last clicked stations.listStations(@NonNull Paging paging, Parameter... listParam) Get a list of all stations.listStations(Parameter... listParam) Get a list of all stations.listStationsBy(@NonNull Paging paging, @NonNull SearchMode searchMode, @NonNull String searchTerm, Parameter... listParam) Get a list of stations matching a certain search criteria.listStationsBy(@NonNull SearchMode searchMode, @NonNull String searchTerm, Parameter... listParam) Get a stream of stations matching a certain search criteria.listStationsWithAdvancedSearch(@NonNull AdvancedSearch advancedSearch, Parameter... listParam) Get a stream of stations matching a certain search criteria.listStationsWithAdvancedSearch(@NonNull Paging paging, @NonNull AdvancedSearch advancedSearch, Parameter... listParam) Get a list of stations matching a certain search criteria.listTags()List the known tags.Get a stream of all top click stations.listTopClickStations(@NonNull Limit limit) Get a list of the top click stations.Get a stream of the top vote stations.listTopVoteStations(@NonNull Limit limit) Get a list of the top vote stations.postNewStation(@NonNull Station station) Posts a new station to the server.resolveStreamUrl(@NonNull UUID stationUUID) Resolves the streaming URL for the given station.voidvoteForStation(@NonNull UUID stationUUID) Votes for a station.
-
Constructor Details
-
RadioBrowser
Creates a new API client using a proxy.- Parameters:
connectionParams- the parameters for creating an API connection.- See Also:
-
-
Method Details
-
listCountries
Deprecated.Since clear-text country names are deprecated in all parts of the HTTP API, please use the calllistCountryCodes()List the known clear-text countries.- Returns:
- a list of countries (keys) and country usages (values). Example for key-value pair is @code{"Germany"} and @code{1}.
- See Also:
-
listCountryCodes
List the known country codes.- Returns:
- a list of ISO-3166-1 country codes (keys) and country usages (values). Example for key-value pair is @code{"DE"} and @code{1}.
- See Also:
-
listCodecs
List the known codecs.- Returns:
- a list of codecs (keys) and codec usages (values).
- See Also:
-
listLanguages
List the known languages.- Returns:
- a list of languages (keys) and language usages (values).
- See Also:
-
listTags
List the known tags.- Returns:
- a list of tags (keys) and tag usages (values).
- See Also:
-
listStations
Get a list of all stations. Will return a single batch.- Parameters:
paging- the offset and limit of the page to retrieve.listParam- the optional listing parameters.- Returns:
- the partial list of the stations. Can be empty for exceeding the possible stations.
-
listStations
Get a list of all stations. Will return all stations in a stream.- Parameters:
listParam- the optional listing parameters.- Returns:
- the full stream of stations.
-
listBrokenStations
Get a list of all broken stations. Will return a single batch.- Parameters:
limit- the limit of the page to retrieve.- Returns:
- the partial list of the broken stations. Can be empty for exceeding the possible stations.
-
listBrokenStations
Get a list of all broken stations as one continuous stream.- Returns:
- the continuous stream of all broken stations.
-
listTopClickStations
Get a list of the top click stations. Will return a single batch.- Parameters:
limit- the limit of the page to retrieve.- Returns:
- the partial list of the top click stations. Can be empty for exceeding the possible stations.
-
listTopClickStations
Get a stream of all top click stations.- Returns:
- the complete stream of all top click stations.
-
listTopVoteStations
Get a list of the top vote stations. Will return a single batch.- Parameters:
limit- the limit of the page to retrieve.- Returns:
- the partial list of the top vote stations. Can be empty for exceeding the possible stations.
-
listTopVoteStations
Get a stream of the top vote stations.- Returns:
- the complete stream of the top vote stations.
-
listLastClickStations
Get a list of the last clicked stations. Will return a single batch.- Parameters:
limit- the limit of the page to retrieve.- Returns:
- the partial list of the last clicked stations. Can be empty for exceeding the possible stations.
-
listLastClickStations
Get a stream of last clicked stations.- Returns:
- the complete stream of the last clicked stations.
-
listLastChangedStations
Get a list of the last changed stations. Will return a single batch.- Parameters:
limit- the limit of the page to retrieve.- Returns:
- the partial list of the last clicked stations. Can be empty for exceeding the possible stations.
-
listLastChangedStations
Get a stream of last changed stations.- Returns:
- the complete stream of the last changed stations.
-
getStationByUUID
Get a station referenced by its UUID.- Parameters:
uuid- the UUID of the station to retrieve.- Returns:
- an optional containing either the station or nothing. Nothing is returned if the API didn't find the station by the given ID.
-
listStationsBy
public List<Station> listStationsBy(@NonNull @NonNull Paging paging, @NonNull @NonNull SearchMode searchMode, @NonNull @NonNull String searchTerm, Parameter... listParam) Get a list of stations matching a certain search criteria. Will return a single batch.- Parameters:
paging- the offset and limit of the page to retrieve.searchMode- the field to match.searchTerm- the term to search for.listParam- the optional listing parameters.- Returns:
- the partial list of the stations. Can be empty for exceeding the number of matching stations.
-
listStationsBy
public Stream<Station> listStationsBy(@NonNull @NonNull SearchMode searchMode, @NonNull @NonNull String searchTerm, Parameter... listParam) Get a stream of stations matching a certain search criteria.- Parameters:
searchMode- the field to match.searchTerm- the term to search for.listParam- the optional listing parameters.- Returns:
- the full stream of matching stations.
-
resolveStreamUrl
Resolves the streaming URL for the given station.- Parameters:
stationUUID- the station UUID to retrieve the stream URL for.- Returns:
- the URL of the stream.
- Throws:
RadioBrowserException- if the URL could not be retrieved
-
postNewStation
Posts a new station to the server. Note: This call only transmits certain fields. The fields are: name, url, homepage, favicon, country, state, language and tags.- Parameters:
station- the station to add to the REST service.- Returns:
- the uuid of the new station.
- Throws:
RadioBrowserException- if there was a problem creating the station.- See Also:
-
voteForStation
Votes for a station.- Parameters:
stationUUID- The uuid of the station to vote for.- Throws:
RadioBrowserException- if there was a problem voting for the station.
-
getServerStats
Get the server statistics.- Returns:
- the statistics for the configured server endpoint.
-
listStationsWithAdvancedSearch
public List<Station> listStationsWithAdvancedSearch(@NonNull @NonNull Paging paging, @NonNull @NonNull AdvancedSearch advancedSearch, Parameter... listParam) Get a list of stations matching a certain search criteria.- Parameters:
paging- the paging offset and limit of the station sublist to fetch.advancedSearch- the advanced search query object. A builder can be created by callingAdvancedSearch.builder(), and then when you are finishedAdvancedSearch.AdvancedSearchBuilder.build().listParam- the optional listing parameters. SeeListParameter.- Returns:
- the list of matching stations.
-
listStationsWithAdvancedSearch
public Stream<Station> listStationsWithAdvancedSearch(@NonNull @NonNull AdvancedSearch advancedSearch, Parameter... listParam) Get a stream of stations matching a certain search criteria.- Parameters:
advancedSearch- the advanced search query object. A builder can be created by callingAdvancedSearch.builder(), and then when you are finishedAdvancedSearch.AdvancedSearchBuilder.build().listParam- the optional listing parameters.- Returns:
- the full stream of matching stations.
-
listCountryCodes()