File tree Expand file tree Collapse file tree 5 files changed +50
-0
lines changed
Expand file tree Collapse file tree 5 files changed +50
-0
lines changed Original file line number Diff line number Diff line change 1+ using System . Threading . Tasks ;
2+
3+ namespace SpotifyAPI . Web
4+ {
5+ /// <summary>
6+ /// Markets Endpoints
7+ /// </summary>
8+ public interface IMarketsClient
9+ {
10+ /// <summary>
11+ /// Get the list of markets where Spotify is available.
12+ /// </summary>
13+ /// <remarks>
14+ /// https://developer.spotify.com/documentation/web-api/reference/#/operations/get-available-markets
15+ /// </remarks>
16+ /// <returns></returns>
17+ Task < AvailableMarketsResponse > AvailableMarkets ( ) ;
18+ }
19+ }
Original file line number Diff line number Diff line change 1+ using System . Threading . Tasks ;
2+ using SpotifyAPI . Web . Http ;
3+ using URLs = SpotifyAPI . Web . SpotifyUrls ;
4+
5+ namespace SpotifyAPI . Web
6+ {
7+ public class MarketsClient : APIClient , IMarketsClient
8+ {
9+ public MarketsClient ( IAPIConnector apiConnector ) : base ( apiConnector ) { }
10+
11+ public Task < AvailableMarketsResponse > AvailableMarkets ( )
12+ {
13+ return API . Get < AvailableMarketsResponse > ( URLs . Markets ( ) ) ;
14+ }
15+ }
16+ }
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ public SpotifyClient(SpotifyClientConfig config)
4949 Personalization = new PersonalizationClient ( _apiConnector ) ;
5050 Episodes = new EpisodesClient ( _apiConnector ) ;
5151 Library = new LibraryClient ( _apiConnector ) ;
52+ Markets = new MarketsClient ( _apiConnector ) ;
5253 }
5354
5455 public IPaginator DefaultPaginator { get ; }
@@ -79,6 +80,8 @@ public SpotifyClient(SpotifyClientConfig config)
7980
8081 public ILibraryClient Library { get ; }
8182
83+ public IMarketsClient Markets { get ; }
84+
8285 public IResponse ? LastResponse { get ; private set ; }
8386
8487 /// <summary>
Original file line number Diff line number Diff line change 1+ using System . Collections . Generic ;
2+
3+ namespace SpotifyAPI . Web
4+ {
5+ public class AvailableMarketsResponse
6+ {
7+ public List < string > Markets { get ; set ; } = default ! ;
8+ }
9+ }
10+
Original file line number Diff line number Diff line change @@ -129,6 +129,8 @@ public static class SpotifyUrls
129129
130130 public static Uri LibraryEpisodesContains ( ) => EUri ( $ "me/episodes/contains") ;
131131
132+ public static Uri Markets ( ) => EUri ( $ "markets") ;
133+
132134 private static Uri EUri ( FormattableString path ) => new ( path . ToString ( _provider ) , UriKind . Relative ) ;
133135 }
134136}
You can’t perform that action at this time.
0 commit comments