mirror of
https://gitlab.com/hladislav/radiobrowser-lib-rust.git
synced 2025-04-29 23:34:12 +00:00
34 lines
1.3 KiB
Rust
34 lines
1.3 KiB
Rust
use radiobrowser::{blocking::RadioBrowserAPI, RbError};
|
|
|
|
fn main() -> Result<(), RbError> {
|
|
let mut api = RadioBrowserAPI::new()?;
|
|
let servers = RadioBrowserAPI::get_default_servers()?;
|
|
println!("Servers: {:?}", servers);
|
|
let status = api.get_server_status()?;
|
|
println!("Status: {:#?}", status);
|
|
let config = api.get_server_config()?;
|
|
println!("Config: {:#?}", config);
|
|
let countries = api.get_countries().send()?;
|
|
println!("Countries: {:?}", countries.len());
|
|
let tags = vec!["jazz", "classical"];
|
|
let stations = api.get_stations().tag_list(tags).send()?;
|
|
println!(
|
|
"Stations with tags containing 'jazz' and 'classical': {:?}",
|
|
stations.len()
|
|
);
|
|
println!(
|
|
"First found station: {:#?}",
|
|
stations[0].clicktimestamp_iso8601
|
|
);
|
|
println!(
|
|
"First station JSON: {}",
|
|
serde_json::to_string(&stations[0]).expect("Failure")
|
|
);
|
|
let vote_result = api.station_vote(&stations[0].stationuuid)?;
|
|
println!("Stations voted result: {:?}", vote_result);
|
|
let click_result = api.station_click(&stations[0].stationuuid)?;
|
|
println!("Stations clicked result: {:?}", click_result);
|
|
let station_changes = api.get_station_changes(1, None)?;
|
|
println!("Station changes result: {:#?}", station_changes);
|
|
Ok(())
|
|
}
|