spotify_cli/endpoints/playlists/
get_playlist_items.rs

1use crate::http::api::SpotifyApi;
2use crate::http::client::HttpError;
3use crate::http::endpoints::Endpoint;
4use serde_json::Value;
5
6/// Get playlist items (tracks)
7pub async fn get_playlist_items(
8    client: &SpotifyApi,
9    playlist_id: &str,
10    limit: Option<u8>,
11    offset: Option<u32>,
12) -> Result<Option<Value>, HttpError> {
13    let limit = limit.unwrap_or(20).min(50);
14    let offset = offset.unwrap_or(0);
15    client
16        .get(
17            &Endpoint::PlaylistItems {
18                id: playlist_id,
19                limit,
20                offset,
21            }
22            .path(),
23        )
24        .await
25}