SemanticPen Rust SDK
Official Rust SDK for the SemanticPen API - AI-powered content generation made simple.
Installation
Add this to your Cargo.toml:
[]
= "0.1.0"
Quick Start
use ;
async
Features
- Async/Await Support: Built on tokio for modern async Rust
- Type Safety: Full type definitions with serde serialization
- Error Handling: Comprehensive error types with thiserror
- Configurable: Timeout, debug mode, and base URL configuration
- Polling Support: Built-in waiting for article completion
- Bulk Generation: Generate multiple articles efficiently
Configuration
use ;
let config = ClientConfig ;
let client = with_config?;
API Reference
Client Methods
generate_article(target_keyword, project_name)
Generate a single article.
let response = client.generate_article.await?;
get_article(article_id)
Get article status and content.
let article = client.get_article.await?;
wait_for_article(article_id, polling_config)
Wait for article completion with polling.
use PollingConfig;
let config = PollingConfig ;
let article = client.wait_for_article.await?;
generate_article_and_wait(target_keyword, project_name, polling_config)
Generate and wait for completion in one call.
let article = client.generate_article_and_wait.await?;
generate_bulk_articles(keywords, project_name)
Generate multiple articles.
let keywords = vec!;
let article_ids = client.generate_bulk_articles.await?;
Types
Article
GenerateArticleResponse
Error Handling
The SDK uses SemanticPenError for all error cases:
use SemanticPenError;
match client.generate_article.await
Examples
Check the examples/ directory for complete examples:
simple.rs- Basic article generationbulk.rs- Bulk article generation
Run examples:
Requirements
- Rust 1.60+
- Valid SemanticPen API key
- Internet connection
Links
License
MIT License - see LICENSE file for details.