| Crates.io | reddit-insights |
| lib.rs | reddit-insights |
| version | 1.0.0 |
| created_at | 2025-12-24 07:01:56.645529+00 |
| updated_at | 2025-12-24 07:01:56.645529+00 |
| description | Official Rust SDK for the Reddit Insights API |
| homepage | https://reddit-insights.com/developers |
| repository | https://github.com/lignertys/reddit-insights-rust |
| max_upload_size | |
| id | 2002815 |
| size | 55,207 |
Official Rust SDK for the Reddit Insights API. Analyze Reddit conversations with AI-powered semantic search.
Add this to your Cargo.toml:
[dependencies]
reddit-insights = "1.0"
tokio = { version = "1.0", features = ["rt-multi-thread", "macros"] }
use reddit_insights::RedditInsightsClient;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Initialize the client
let client = RedditInsightsClient::new("YOUR_API_KEY")?;
// Semantic search
let results = client.semantic_search(
"What do young people complain about banking apps?",
Some(20),
).await?;
if let Some(data) = results.data {
println!("Found {} results", data.total);
for result in data.results {
println!("- {}", result.title);
}
}
// Vector search with date filters
let vector_results = client.vector_search(
"electric vehicle charging",
Some(30),
Some("2025-01-01"),
Some("2025-01-31"),
).await?;
// Get trending topics
let trends = client.get_trends(
Some("2025-01-01"),
Some("2025-01-31"),
Some(20),
).await?;
Ok(())
}
Sonars allow you to monitor Reddit conversations and receive alerts.
use reddit_insights::{RedditInsightsClient, CreateSonarOptions};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = RedditInsightsClient::new("YOUR_API_KEY")?;
// List all sonars
let sonars = client.list_sonars().await?;
// Create a new sonar
let options = CreateSonarOptions {
name: "Product Feedback Monitor".to_string(),
query: "What do users think about our product?".to_string(),
description: Some("Track product feedback".to_string()),
schedule: Some("daily".to_string()),
triggers: Some(serde_json::json!({
"keywords": ["bug", "issue", "problem"],
"sentiment": "negative",
"minNewPosts": 5
})),
notify_email: Some(true),
notify_slack: None,
slack_webhook: None,
};
let sonar = client.create_sonar(&options).await?;
Ok(())
}
let client = RedditInsightsClient::with_base_url(
"YOUR_API_KEY",
"https://custom-api.example.com",
)?;
use reddit_insights::{RedditInsightsClient, Error};
#[tokio::main]
async fn main() {
let client = RedditInsightsClient::new("YOUR_API_KEY").unwrap();
match client.semantic_search("test query", Some(20)).await {
Ok(results) => println!("Success!"),
Err(Error::Authentication(msg)) => println!("Invalid API key: {}", msg),
Err(Error::RateLimit(msg)) => println!("Rate limit exceeded: {}", msg),
Err(Error::Validation(msg)) => println!("Invalid request: {}", msg),
Err(Error::Api { status_code, message }) => {
println!("API error (status {}): {}", status_code, message)
}
Err(e) => println!("Error: {}", e),
}
}
| Tier | Limit |
|---|---|
| Free | 100 requests/hour |
| Pro | 10,000 requests/month |
| Enterprise | Unlimited |
MIT License
For support, please visit https://reddit-insights.com or contact support@reddit-insights.com.