Skip to content

juliarose/marketplacetf-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

marketplacetf-api

Interface for marketplace.tf API endpoints.

use marketplacetf_api::{MarketplaceAPI, error::Error};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let key = "key";
    let marketplacetf = MarketplaceAPI::new(key);
    let sales = marketplacetf.get_sales(10, None).await?;
    
    if let Some(sale) = sales.first() {
        let names = sale.items
            .iter()
            .map(|item| item.name.as_str())
            .collect::<Vec<_>>();
        
        println!("Sold {} for ${:.2}!", names.join(", "), f32::from(sale.earned_credit) / 100.0);
    } else {
        println!("You have not sold anything :(");
    }
    
    Ok(())
}

License

MIT

About

Interface for marketplace.tf API endpoints.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages