1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
//! Typecast Rust SDK
//!
//! Official Rust SDK for the Typecast Text-to-Speech API.
//!
//! # Quick Start
//!
//! ```no_run
//! use typecast_rust::{TypecastClient, TTSRequest, TTSModel, ClientConfig};
//!
//! #[tokio::main]
//! async fn main() -> typecast_rust::Result<()> {
//! // Create a client from environment variables
//! let client = TypecastClient::from_env()?;
//!
//! // Or create with explicit API key
//! // let client = TypecastClient::with_api_key("your-api-key")?;
//!
//! // Create a TTS request
//! let request = TTSRequest::new(
//! "tc_60e5426de8b95f1d3000d7b5",
//! "Hello, world!",
//! TTSModel::SsfmV30,
//! );
//!
//! // Generate speech
//! let response = client.text_to_speech(&request).await?;
//!
//! // Save audio to file
//! std::fs::write("output.wav", &response.audio_data)?;
//! println!("Audio saved! Duration: {} seconds", response.duration);
//!
//! Ok(())
//! }
//! ```
//!
//! # Features
//!
//! - **Text-to-Speech**: Convert text to natural-sounding speech
//! - **Multiple Models**: Support for ssfm-v21 and ssfm-v30 models
//! - **Emotion Control**: Preset emotions and smart context-aware inference
//! - **Voice Discovery**: List and filter available voices
//! - **Audio Customization**: Control volume, pitch, tempo, and format
//!
//! # Configuration
//!
//! The SDK can be configured using environment variables:
//!
//! - `TYPECAST_API_KEY`: Your Typecast API key (required)
//! - `TYPECAST_API_HOST`: Custom API host (optional, defaults to <https://api.typecast.ai>)
//!
//! # Error Handling
//!
//! All operations return a `Result<T, TypecastError>`. The error type provides
//! detailed information about what went wrong:
//!
//! ```no_run
//! use typecast_rust::{TypecastClient, TTSRequest, TTSModel, TypecastError};
//!
//! # async fn example() -> typecast_rust::Result<()> {
//! let client = TypecastClient::from_env()?;
//! let request = TTSRequest::new("invalid_voice", "Hello", TTSModel::SsfmV30);
//!
//! match client.text_to_speech(&request).await {
//! Ok(response) => println!("Success!"),
//! Err(TypecastError::NotFound { detail }) => {
//! println!("Voice not found: {}", detail);
//! }
//! Err(TypecastError::Unauthorized { .. }) => {
//! println!("Invalid API key");
//! }
//! Err(e) => println!("Other error: {}", e),
//! }
//! # Ok(())
//! # }
//! ```
// Re-export main types for convenience
pub use ;
pub use ;
pub use ;