spotify_cli/cli/commands/
markets.rs1use crate::endpoints::markets::get_available_markets;
4use crate::io::output::Response;
5
6use super::with_client;
7
8pub async fn markets_list() -> Response {
10 with_client(|client| async move {
11 match get_available_markets::get_available_markets(&client).await {
12 Ok(Some(payload)) => Response::success_with_payload(200, "Available markets", payload),
13 Ok(None) => Response::success_with_payload(
14 200,
15 "No markets found",
16 serde_json::json!({ "markets": [] }),
17 ),
18 Err(e) => Response::from_http_error(&e, "Failed to get available markets"),
19 }
20 })
21 .await
22}