use crate::client::{AriClient, url_encode};
use crate::error::Result;
#[derive(Debug, Clone, serde::Deserialize)]
#[non_exhaustive]
pub struct SoundFormat {
pub language: String,
pub format: String,
}
#[derive(Debug, Clone, serde::Deserialize)]
#[non_exhaustive]
pub struct Sound {
pub id: String,
#[serde(default)]
pub text: Option<String>,
#[serde(default)]
pub formats: Vec<SoundFormat>,
}
pub async fn list(client: &AriClient) -> Result<Vec<Sound>> {
client.get("/sounds").await
}
pub async fn get(client: &AriClient, sound_id: &str) -> Result<Sound> {
client
.get(&format!("/sounds/{}", url_encode(sound_id)))
.await
}