# ShindanMaker
A Rust library for interacting with [ShindanMaker](https://en.shindanmaker.com/), the popular personality quiz service.
## Features
- Multi-domain support (JP, EN, CN, KR, TH)
- Asynchronous API
- Easy shindan submission and result parsing
## Usage
```toml
[dependencies]
shindan-maker = "0.1.4"
```
## Example
```rust
use shindan_maker::{ShindanClient, ShindanDomain, ShindanResult, Segment};
use std::error::Error;
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
// Create a client for the English domain
let client = ShindanClient::new(ShindanDomain::En)?;
// Shindan ID for "What kind of person will you turn out to be?"
let shindan_id = "1221154";
// Get the shindan title
let title = client.get_title(shindan_id).await?;
println!("Shindan title: {}", title);
// Submit the shindan
let result = client.submit_shindan(shindan_id, "Rust").await?;
// Process the result
if let ShindanResult::Text { title, content } = result {
println!("Result title: {}", title);
println!("Result content: {:#?}", content);
// Print text segments
for segment in content.iter().filter_map(|s| s.get_text()) {
println!("Text: {}", segment);
}
// Print image URLs
for segment in content.iter().filter_map(|s| s.get_image_url()) {
println!("Image URL: {}", segment);
}
// Example of using filter_segments_by_type
let text_segments: Vec<&Segment> = shindan_maker::filter_segments_by_type(&content, "text");
println!("Number of text segments: {}", text_segments.len());
}
Ok(())
}
```
## License
MIT OR Apache-2.0.