| Crates.io | boosty_api |
| lib.rs | boosty_api |
| version | 0.15.0 |
| created_at | 2025-06-29 16:15:24.711988+00 |
| updated_at | 2025-09-20 10:18:11.821337+00 |
| description | API client for interacting with Boosty platform |
| homepage | |
| repository | https://github.com/ath31st/boosty_api_rs |
| max_upload_size | |
| id | 1730886 |
| size | 146,131 |
A minimal, async-ready client for getting post data from a remote blogging API that requires either a bearer token or a refresh token + device ID combo for authentication. This crate is designed with resiliency in mind: it transparently handles token expiration and retries requests when needed.
This crate is intended for research and personal use only. By using it, you agree to:
The author is not responsible for any misuse of this software.
🚧 This library is under active development.
Breaking changes, refactoring, and architectural updates may occur frequently.
Use with caution in production environments and pin specific versions if needed.
AuthProvider logic.The client automatically retries HTTP requests that fail due to transient network errors or expired access tokens.
get_request() method.get_post(blog, id).get_posts(blog, limit).Post struct with serde support."not available" status gracefully.get_targets(blog).get_subscription_levels(blog, show_free_level).get_subscriptions(limit, with_follow), returning a paginated
SubscriptionsResponse.ApiClient using reqwest.User-Agent, DNT, Cache-Control, etc.ApiError, AuthError with detailed variants.Add this to your Cargo.toml:
[dependencies]
boosty_api = "0.15.0"
or
cargo add boosty_api
use boosty_api::api_client::ApiClient;
use reqwest::Client;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
let base_url = "https://api.example.com";
let api_client = ApiClient::new(client, base_url);
// Use static bearer token (optional)
api_client.set_bearer_token("your-access-token").await?;
// Or use refresh token + device ID
// api.set_refresh_token_and_device_id("your-refresh-token", "your-device-id").await?;
let post = api_client.get_post("some-blog-name", "post-id").await?;
println!("{:#?}", post);
Ok(())
}
use boosty_api::api_client::ApiClient;
use reqwest::Client;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
let base_url = "https://api.example.com";
let api_client = ApiClient::new(client, base_url);
// Use static bearer token (optional)
api_client.set_bearer_token("your-access-token").await?;
// Or use refresh token + device ID
// api.set_refresh_token_and_device_id("your-refresh-token", "your-device-id").await?;
let limit = 5;
let posts = api_client.get_posts("blog_name", limit).await?;
println!("{:#?}", posts);
Ok(())
}
use boosty_api::post_data_extractor::ContentItem;
fn print_content(post: &boosty_api::Post) {
let content_items = post.extract_content();
for item in content_items {
match item {
ContentItem::Image { url, id } => {
println!("Image URL: {url}, ID: {id}");
}
ContentItem::Video { url } => {
println!("Video URL: {url}");
}
ContentItem::OkVideo { url, video_title } => {
println!("OK Video URL: {url}, Title: {video_title}");
}
ContentItem::Audio { url, audio_title, file_type } => {
println!("Audio URL: {url}, Title: {audio_title}, Type: {file_type}");
}
ContentItem::Text { modificator, content } => {
println!("Text: {content}, Modificator: {modificator}");
}
ContentItem::Link { explicit, content, url } => {
println!("Link: {url}, Content: {content}, Explicit: {explicit}");
}
ContentItem::File { url, title, size } => {
println!("File: {title}, URL: {url}, Size: {size}");
}
ContentItem::List { style, items } => {
println!("List: {style}, Items: {items}");
}
ContentItem::Unknown => {
println!("Unknown content type");
}
}
}
}
To get access token or refresh token and device_id, you need to log in to the service, then press F12 in the browser and go to the application tab, where you can select local storage. The required keys are _clentId and auth.
There are two options:
api_client.set_bearer_token("access-token").await?;
api_client.set_refresh_token_and_device_id("refresh-token", "device-id").await?;
If a post is unavailable and refresh credentials are present, the client will automatically attempt a refresh.
api_client: Main entry point; gets post(s), manages headers, and authentication logicauth_provider: Refresh-token and access-token managementapi_response: Deserialization models for all API content types (e.g. post, target); organized by domainerror: Uniform error types for API and auth operationspost_data_extractor: Utility module for extracting structured data from post modelsAll API and auth operations return Result<T, ApiError> or Result<T, AuthError>, depending on context. Errors are
strongly typed and cover:
For detailed documentation, please refer to docs.rs.
Contributions are welcome! Please open an issue or submit a pull request on GitHub.
This project is licensed under the MIT License.