feat: add playlist browse/search discovery and follow controls
Some checks failed
Build for Windows / build-windows (push) Has been cancelled
Some checks failed
Build for Windows / build-windows (push) Has been cancelled
This commit is contained in:
@@ -416,7 +416,7 @@ impl QobuzClient {
|
||||
|
||||
pub async fn get_featured_albums(
|
||||
&self,
|
||||
genre_id: i64,
|
||||
genre_ids: &str,
|
||||
kind: &str,
|
||||
limit: u32,
|
||||
offset: u32,
|
||||
@@ -425,7 +425,64 @@ impl QobuzClient {
|
||||
.get_request("album/getFeatured")
|
||||
.query(&[
|
||||
("type", kind.to_string()),
|
||||
("genre_id", genre_id.to_string()),
|
||||
("genre_id", genre_ids.to_string()),
|
||||
("limit", limit.to_string()),
|
||||
("offset", offset.to_string()),
|
||||
])
|
||||
.send()
|
||||
.await?;
|
||||
Self::check_response(resp).await
|
||||
}
|
||||
|
||||
pub async fn get_featured_playlists(
|
||||
&self,
|
||||
genre_ids: &str,
|
||||
kind: &str,
|
||||
limit: u32,
|
||||
offset: u32,
|
||||
) -> Result<Value> {
|
||||
let resp = self
|
||||
.get_request("playlist/getFeatured")
|
||||
.query(&[
|
||||
("type", kind.to_string()),
|
||||
("genre_ids", genre_ids.to_string()),
|
||||
("limit", limit.to_string()),
|
||||
("offset", offset.to_string()),
|
||||
])
|
||||
.send()
|
||||
.await?;
|
||||
Self::check_response(resp).await
|
||||
}
|
||||
|
||||
pub async fn discover_playlists(
|
||||
&self,
|
||||
genre_ids: &str,
|
||||
tags: &str,
|
||||
limit: u32,
|
||||
offset: u32,
|
||||
) -> Result<Value> {
|
||||
let mut query = vec![
|
||||
("genre_ids", genre_ids.to_string()),
|
||||
("limit", limit.to_string()),
|
||||
("offset", offset.to_string()),
|
||||
];
|
||||
if !tags.is_empty() {
|
||||
query.push(("tags", tags.to_string()));
|
||||
}
|
||||
|
||||
let resp = self
|
||||
.get_request("discover/playlists")
|
||||
.query(&query)
|
||||
.send()
|
||||
.await?;
|
||||
Self::check_response(resp).await
|
||||
}
|
||||
|
||||
pub async fn search_playlists(&self, query: &str, limit: u32, offset: u32) -> Result<Value> {
|
||||
let resp = self
|
||||
.get_request("playlist/search")
|
||||
.query(&[
|
||||
("query", query.to_string()),
|
||||
("limit", limit.to_string()),
|
||||
("offset", offset.to_string()),
|
||||
])
|
||||
@@ -779,6 +836,26 @@ impl QobuzClient {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn subscribe_playlist(&self, playlist_id: i64) -> Result<()> {
|
||||
let resp = self
|
||||
.get_request("playlist/subscribe")
|
||||
.query(&[("playlist_id", playlist_id.to_string())])
|
||||
.send()
|
||||
.await?;
|
||||
Self::check_response(resp).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn unsubscribe_playlist(&self, playlist_id: i64) -> Result<()> {
|
||||
let resp = self
|
||||
.get_request("playlist/unsubscribe")
|
||||
.query(&[("playlist_id", playlist_id.to_string())])
|
||||
.send()
|
||||
.await?;
|
||||
Self::check_response(resp).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn add_fav_track(&self, track_id: i64) -> Result<()> {
|
||||
let resp = self
|
||||
.get_request("favorite/create")
|
||||
|
||||
Reference in New Issue
Block a user