use serde_json::Value;
use crate::client::Client;
use crate::error::Error;
#[derive(Debug, Clone, Copy)]
pub struct Audio<'a> {
pub(crate) client: &'a Client,
}
impl Audio<'_> {
pub async fn search(
&self,
query: Option<&str>,
audio_type: Option<&str>,
) -> Result<Value, Error> {
let mut params = Vec::new();
if let Some(query) = query {
params.push(("q", query.to_owned()));
}
if let Some(audio_type) = audio_type {
params.push(("type", audio_type.to_owned()));
}
self.client.get("/audio/search", params).await
}
}