Skip to main content

lbc/
lib.rs

1//! # LBC-RS - Unofficial Leboncoin API Client
2//!
3//! This crate provides an unofficial client for the Leboncoin API, allowing you to search
4//! for classified ads, retrieve user information, and access detailed ad data.
5//!
6//! This project is heavily inspired by the excellent Python implementation:
7//! [etienne-hd/lbc](https://github.com/etienne-hd/lbc)
8//!
9//! ## Features
10//!
11//! - Search classified ads with various filters
12//! - Retrieve detailed ad information
13//! - Get user profiles and information
14//! - Support for proxy configuration
15//! - Comprehensive location filtering (regions, departments, cities)
16//! - Built with async/await support
17//!
18//! ## Quick Start
19//!
20//! ```rust,no_run
21//! use lbc::{Client, City, Category, Sort, AdType};
22//!
23//! #[tokio::main]
24//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
25//!     let client = Client::new();
26//!     
27//!     let location = City::new(48.85994982004764, 2.33801967847424, Some(10_000), Some("Paris".to_string()));
28//!     
29//!     let result = client.search()
30//!         .text("maison")
31//!         .locations(vec![location.into()])
32//!         .page(1)
33//!         .limit(35)
34//!         .sort(Sort::Newest)
35//!         .ad_type(AdType::Offer)
36//!         .category(Category::Immobilier)
37//!         .square(200, 400)
38//!         .price(300_000, 700_000)
39//!         .execute()
40//!         .await?;
41//!     
42//!     for ad in result.ads {
43//!         println!("{:?} - {:?} - {:?}", ad.url, ad.subject, ad.price());
44//!     }
45//!     
46//!     Ok(())
47//! }
48//! ```
49
50pub mod client;
51pub mod error;
52pub mod models;
53pub mod utils;
54
55pub use client::Client;
56pub use error::*;
57pub use models::*;