use flickr_api::{ApiKey, FlickrAPI};
use std::error::Error;
use std::io::{self, Write};
fn prompt(message: &str) -> String {
let mut input = String::new();
print!("{message}");
io::stdout().flush().ok();
io::stdin()
.read_line(&mut input)
.expect("Failed to read line");
input.trim().to_string()
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
let client = FlickrAPI::new(ApiKey {
key: prompt("API key: "),
secret: prompt("API secret: "),
})
.login()
.await?;
let user = client.test().login().await?;
println!("Successfully logged in as {} ({})", user.username, user.id);
Ok(())
}