mirror of
https://codeberg.org/icewind/ugc-scaper.git
synced 2026-06-03 18:24:10 +02:00
work
This commit is contained in:
parent
0f5ea2ebda
commit
53cc7822c4
26 changed files with 31748 additions and 73 deletions
45
examples/team.rs
Normal file
45
examples/team.rs
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
use main_error::MainResult;
|
||||
use std::env::args;
|
||||
use ugc_scraper::UgcClient;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> MainResult {
|
||||
let client = UgcClient::new();
|
||||
let id = args().nth(1).expect("no team id provided");
|
||||
let id = id.parse().expect("invalid team id provided");
|
||||
let team = client.team(id).await?;
|
||||
println!("{} - {}", team.tag, team.name);
|
||||
println!("playing {} in {}", team.format, team.division);
|
||||
println!();
|
||||
println!("with: ");
|
||||
for member in team.members {
|
||||
println!(" {} since {}", member.name, member.since);
|
||||
}
|
||||
|
||||
println!();
|
||||
println!("previous players ");
|
||||
let roster_history = client.team_roster_history(id).await?;
|
||||
for roster_item in roster_history {
|
||||
if let Some(left) = roster_item.left {
|
||||
println!(
|
||||
" {} joined at {} and left at {}",
|
||||
roster_item.name, roster_item.joined, left
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
println!();
|
||||
println!("name changes:");
|
||||
for name_change in team.name_changes {
|
||||
println!(
|
||||
" {} - {} to {} - {} at {}",
|
||||
name_change.from_tag,
|
||||
name_change.from,
|
||||
name_change.to_tag,
|
||||
name_change.to,
|
||||
name_change.date
|
||||
);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue