diff --git a/.gitignore b/.gitignore index 1803c29..13ac30d 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ .DS_Store *.log .claude/ +.worktrees/ diff --git a/src/client/mod.rs b/src/client/mod.rs index 898b9fc..36c7ec1 100644 --- a/src/client/mod.rs +++ b/src/client/mod.rs @@ -583,6 +583,11 @@ impl PersonasClient<'_> { let resp: models::UpdateBackgroundSoundResponse = self.0.patch(url, &req).await?; Ok(resp.background_sound) } + + pub async fn list_voices(&self) -> Result { + let url = self.0.url("/v1/personas/voices"); + self.0.get(url).await + } } impl MetricsClient<'_> { diff --git a/src/client/models/persona.rs b/src/client/models/persona.rs index 6a07bdc..5d77b61 100644 --- a/src/client/models/persona.rs +++ b/src/client/models/persona.rs @@ -253,3 +253,28 @@ pub struct UpdateBackgroundSoundRequest { pub struct UpdateBackgroundSoundResponse { pub background_sound: BackgroundSoundResource, } + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct Voice { + pub voice_name: String, + #[serde(default)] + pub supported_languages: Vec, + #[serde(flatten)] + pub extra: serde_json::Map, +} + +impl Tabular for Voice { + fn headers() -> Vec<&'static str> { + vec!["VOICE NAME", "SUPPORTED LANGUAGES"] + } + + fn row(&self) -> Vec { + let languages = self.supported_languages.join(", "); + vec![self.voice_name.clone(), truncate(&languages, 60)] + } +} + +#[derive(Debug, Deserialize)] +pub struct ListVoicesResponse { + pub voices: Vec, +} diff --git a/src/commands/personas.rs b/src/commands/personas.rs index ed66c3c..3682449 100644 --- a/src/commands/personas.rs +++ b/src/commands/personas.rs @@ -33,6 +33,7 @@ pub enum PersonaCommands { }, #[command(name = "phone-numbers")] PhoneNumbers, + Voices, } impl PersonaCommands { @@ -46,6 +47,7 @@ impl PersonaCommands { Self::Delete(_) => "delete", Self::BackgroundSounds { command } => command.operation(), Self::PhoneNumbers => "phone-numbers", + Self::Voices => "voices", } } } @@ -279,6 +281,16 @@ pub async fn execute( vec![next_actions::context("personas")], ); } + PersonaCommands::Voices => { + let response = client.personas().list_voices().await?; + emit_list_with_actions( + ctx, + "personas", + operation, + &response.voices, + vec![next_actions::context("personas")], + ); + } } Ok(()) }