radiobrowser-lib-rust/src/bin/test.rs

26 lines
1.2 KiB
Rust
Raw Normal View History

2022-04-26 20:26:46 +00:00
use radiobrowser::blocking::RadioBrowserAPI;
use std::error::Error;
fn main() -> Result<(), Box<dyn Error>> {
2022-05-06 21:18:52 +00:00
let mut api = RadioBrowserAPI::new()?;
2023-01-27 23:09:01 +00:00
let servers = RadioBrowserAPI::get_default_servers()?;
2022-04-26 20:26:46 +00:00
println!("Servers: {:?}", servers);
2022-05-06 21:18:52 +00:00
let status = api.get_server_status()?;
println!("Status: {:#?}", status);
let config = api.get_server_config()?;
println!("Config: {:#?}", config);
2022-04-26 20:26:46 +00:00
let countries = api.get_countries().send()?;
2022-05-06 21:18:52 +00:00
println!("Countries: {:?}", countries.len());
2022-05-12 20:42:44 +00:00
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);
2022-05-06 21:18:52 +00:00
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);
2023-01-27 22:43:42 +00:00
let station_changes = api.get_station_changes(1,None)?;
println!("Station changes result: {:#?}", station_changes);
2022-04-26 20:26:46 +00:00
Ok(())
2022-05-06 21:18:52 +00:00
}