csfloat_rs/lib.rs
1//! # CSFloat Async API Client (Unofficial)
2//!
3//! An **unofficial**, **asynchronous** Rust library for interacting with the [CSFloat](https://csfloat.com) API.
4//! This library provides full support for programmatic access to listings, buy orders, user data, exchange rates, and more.
5//! All prices returned by the server are in **cents**.
6//!
7//! ## Key Features
8//!
9//! * **Asynchronous design**: Built on `tokio` and `reqwest` for non-blocking I/O.
10//! * **Fetch listings**: Retrieve detailed listings with filters (price in cents, float, rarity, etc.).
11//! * **Buy orders**: Get and manage buy orders for specific items.
12//! * **User information**: Access your own profile, trades, and stall data.
13//! * **Weapon pricing schema**: Get average prices for all weapon skins across different wear conditions.
14//! * **Listing management**: Create, delete, and modify listings and buy orders.
15//! * **Proxy support**: Optional SOCKS4/5 and HTTP(S) proxy support.
16//! * **Error handling**: Clear exceptions with descriptive messages.
17//!
18//! ## Quick Start
19//!
20//! ```no_run
21//! use csfloat_rs::Client;
22//!
23//! #[tokio::main]
24//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
25//! let client = Client::new("YOUR_API_KEY")?;
26//!
27//! // Fetch up to 50 listings priced between $1.00 and $10.00 (i.e., 100–1000 cents)
28//! let listings = client.get_all_listings()
29//! .min_price(100)
30//! .max_price(1000)
31//! .send()
32//! .await?;
33//!
34//! for listing in listings.listings() {
35//! println!("ID: {}, Price: {} cents", listing.id, listing.price);
36//! }
37//!
38//! Ok(())
39//! }
40//! ```
41//!
42//! ## Schema and Pricing Data
43//!
44//! Access weapon pricing data with the undocumented schema endpoint:
45//!
46//! ```no_run
47//! use csfloat_rs::{Client, models::WearCondition};
48//!
49//! #[tokio::main]
50//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
51//! let client = Client::new("YOUR_API_KEY")?;
52//!
53//! // Get schema with weapon pricing data
54//! let schema = client.get_schema().await?;
55//!
56//! // Find AK-47 Redline pricing
57//! if let Some((_, ak47)) = schema.get_weapon_by_name("AK-47") {
58//! if let Some(redline) = ak47.get_paint_by_name("Redline") {
59//! if let Some(price) = redline.price_for_wear(WearCondition::MinimalWear) {
60//! println!("AK-47 Redline MW: ${:.2}", price as f64 / 100.0);
61//! }
62//! }
63//! }
64//!
65//! Ok(())
66//! }
67//! ```
68
69pub mod client;
70pub mod error;
71pub mod models;
72
73pub use client::Client;
74pub use error::{Error, Result};