use super::SunoClient;
use super::types::{FeedFilters, FeedResponse, FeedV3Request};
use crate::core::CliError;
impl SunoClient {
pub async fn feed(&self, cursor: Option<String>) -> Result<FeedResponse, CliError> {
let req = FeedV3Request {
cursor,
limit: Some(20),
filters: Some(FeedFilters::default_workspace()),
};
self.with_auth_retry(|| async {
let resp = self.post("/api/feed/v3").json(&req).send().await?;
let resp = self.check_response(resp).await?;
Ok(resp.json().await?)
})
.await
}
pub async fn search(&self, query: &str) -> Result<FeedResponse, CliError> {
let req = FeedV3Request {
cursor: None,
limit: Some(50),
filters: Some(FeedFilters::search(query)),
};
self.with_auth_retry(|| async {
let resp = self.post("/api/feed/v3").json(&req).send().await?;
let resp = self.check_response(resp).await?;
Ok(resp.json().await?)
})
.await
}
}