Expand description
Client library for the https://api.radio-browser.info API
§Example blocking
It needs to have the feature “blocking” enabled.
radiobrowser = { version = "*", features = ["blocking"] }
use radiobrowser::blocking::RadioBrowserAPI;
use std::error::Error;
fn main() -> Result<(), Box<dyn Error>> {
let api = RadioBrowserAPI::new()?;
let servers = RadioBrowserAPI::get_default_servers()?;
println!("Servers: {:?}", servers);
let countries = api.get_countries().send()?;
println!("Countries: {:?}", countries);
let stations = api.get_stations().name("jazz").send()?;
println!("Stations: {:?}", stations);
Ok(())
}
§Example async
use std::error::Error;
use futures::join;
use radiobrowser::RadioBrowserAPI;
use radiobrowser::StationOrder;
#[async_std::main]
async fn main() -> Result<(), Box<dyn Error>> {
let mut api = RadioBrowserAPI::new().await?;
let countries = api.get_countries().send();
let languages = api.get_languages().send();
let stations = api
.get_stations()
.name("jazz")
.reverse(true)
.order(StationOrder::Clickcount)
.send();
let config = api.get_server_config();
let (stations, config, countries, languages) = join!(stations, config, countries, languages);
println!("Config: {:#?}", config?);
println!("Countries found: {}", countries?.len());
println!("Languages found: {}", languages?.len());
println!("Stations found: {}", stations?.len());
Ok(())
}
Modules§
Structs§
- ApiConfig
- ApiCountry
- A single country
- ApiLanguage
- A single language
- ApiStation
- A single station entry
- ApiStation
AddResult - ApiStation
Click - A click event for a station
- ApiStation
Click Result - ApiStation
History - A single historical entry for a station
- ApiStation
Vote Result - ApiStatus
- Radiobrowser status and statistical information of single server.
- ApiStreaming
Server - ApiTag
- A single tag
- Country
Search Builder - Language
Search Builder - Radio
BrowserAPI - RadioBrowser client for async communication
- Station
Search Builder - TagSearch
Builder