use crate::{
api::service::QobuzApiService,
errors::QobuzApiError::{self},
models::SearchResult,
};
impl QobuzApiService {
pub async fn search_catalog(
&self,
query: &str,
limit: Option<i32>,
offset: Option<i32>,
type_param: Option<&str>,
with_auth: Option<bool>,
) -> Result<SearchResult, QobuzApiError> {
let mut params = vec![
("query".to_string(), query.to_string()),
("limit".to_string(), limit.unwrap_or(50).to_string()),
("offset".to_string(), offset.unwrap_or(0).to_string()),
];
if let Some(type_val) = type_param {
params.push(("type".to_string(), type_val.to_string()));
}
let _use_auth = with_auth.unwrap_or(false);
self.get("/catalog/search", ¶ms).await
}
}