spotify_cli/endpoints/library/
get_saved_tracks.rs

1use crate::http::api::SpotifyApi;
2use crate::http::client::HttpError;
3use crate::http::endpoints::Endpoint;
4use serde_json::Value;
5
6/// Get user's saved tracks (liked songs)
7pub async fn get_saved_tracks(
8    client: &SpotifyApi,
9    limit: Option<u8>,
10    offset: Option<u32>,
11) -> Result<Option<Value>, HttpError> {
12    let limit = limit.unwrap_or(20).min(50);
13    let offset = offset.unwrap_or(0);
14
15    client
16        .get(&Endpoint::SavedTracks { limit, offset }.path())
17        .await
18}