use crate::http::api::SpotifyApi;
use crate::http::client::HttpError;
use crate::http::endpoints::Endpoint;
use serde_json::Value;
pub async fn get_users_top_items(
client: &SpotifyApi,
item_type: &str,
time_range: Option<&str>,
limit: Option<u8>,
offset: Option<u32>,
) -> Result<Option<Value>, HttpError> {
let time_range = time_range.unwrap_or("medium_term");
let limit = limit.unwrap_or(20);
let offset = offset.unwrap_or(0);
client
.get(
&Endpoint::UserTopItems {
item_type,
time_range,
limit,
offset,
}
.path(),
)
.await
}