Skip to main content

threads_rs/
lib.rs

1#![warn(missing_docs)]
2
3//! Rust client library for the [Meta Threads API](https://developers.facebook.com/docs/threads).
4//!
5//! # Features
6//!
7//! - Full Threads API coverage: posts, replies, insights, user profiles, search, and location tagging
8//! - OAuth 2.0 authentication with short-lived and long-lived token exchange
9//! - Automatic rate limiting and retry with exponential backoff
10//! - Cursor-based pagination helpers
11//! - Strongly typed request/response models
12//! - Pluggable token storage
13//!
14//! # Quick start
15//!
16//! ```rust,no_run
17//! use threads_rs::client::{Config, Client};
18//!
19//! # async fn run() -> threads_rs::Result<()> {
20//! let config = Config::new("client-id", "client-secret", "https://example.com/cb");
21//! let client = Client::with_token(config, "ACCESS_TOKEN").await?;
22//!
23//! let me = client.get_me().await?;
24//! println!("Logged in as @{}", me.username);
25//! # Ok(())
26//! # }
27//! ```
28
29/// Application constants (API base URL, version, timeouts).
30pub mod constants;
31/// Error types and helpers.
32pub mod error;
33/// Request and response model types.
34pub mod types;
35
36/// API endpoint implementations.
37pub mod api;
38/// OAuth 2.0 authentication flows.
39pub mod auth;
40/// Client configuration and construction.
41pub mod client;
42/// HTTP transport with retry and rate-limit integration.
43pub mod http;
44/// Cursor-based pagination utilities.
45pub mod pagination;
46/// Rate limiter for API request throttling.
47pub mod rate_limit;
48/// Input validation helpers.
49pub mod validation;
50
51// Re-export primary types for convenience
52pub use error::{Error, Result};
53pub use types::*;