@@ -29,8 +29,9 @@ public Task<SnapshotResponse> AddItems(string playlistId, PlaylistAddItemsReques
2929 public Task < Paging < PlaylistTrack < IPlaylistItem > > > GetItems ( string playlistId )
3030 {
3131 Ensure . ArgumentNotNullOrEmptyString ( playlistId , nameof ( playlistId ) ) ;
32+ var request = new PlaylistGetItemsRequest ( ) ;
3233
33- return API . Get < Paging < PlaylistTrack < IPlaylistItem > > > ( URLs . PlaylistTracks ( playlistId ) ) ;
34+ return API . Get < Paging < PlaylistTrack < IPlaylistItem > > > ( URLs . PlaylistTracks ( playlistId ) , request . BuildQueryParams ( ) ) ;
3435 }
3536
3637 public Task < Paging < PlaylistTrack < IPlaylistItem > > > GetItems ( string playlistId , PlaylistGetItemsRequest request )
@@ -54,8 +55,8 @@ public async Task<bool> UploadCover(string playlistId, string base64Jpg)
5455 Ensure . ArgumentNotNullOrEmptyString ( playlistId , nameof ( playlistId ) ) ;
5556 Ensure . ArgumentNotNullOrEmptyString ( base64Jpg , nameof ( base64Jpg ) ) ;
5657
57- var response = await API . PutRaw ( URLs . PlaylistImages ( playlistId ) , null , base64Jpg ) ;
58- return response == HttpStatusCode . Accepted ;
58+ var statusCode = await API . PutRaw ( URLs . PlaylistImages ( playlistId ) , null , base64Jpg ) ;
59+ return statusCode == HttpStatusCode . Accepted ;
5960 }
6061
6162 public Task < List < Image > > GetCovers ( string playlistId )
@@ -64,5 +65,57 @@ public Task<List<Image>> GetCovers(string playlistId)
6465
6566 return API . Get < List < Image > > ( URLs . PlaylistImages ( playlistId ) ) ;
6667 }
68+
69+ public Task < Paging < SimplePlaylist > > GetUsers ( string userId )
70+ {
71+ Ensure . ArgumentNotNullOrEmptyString ( userId , nameof ( userId ) ) ;
72+
73+ return API . Get < Paging < SimplePlaylist > > ( URLs . UserPlaylists ( userId ) ) ;
74+ }
75+
76+ public Task < Paging < SimplePlaylist > > GetUsers ( string userId , PlaylistGetUsersRequest request )
77+ {
78+ Ensure . ArgumentNotNullOrEmptyString ( userId , nameof ( userId ) ) ;
79+ Ensure . ArgumentNotNull ( request , nameof ( request ) ) ;
80+
81+ return API . Get < Paging < SimplePlaylist > > ( URLs . UserPlaylists ( userId ) , request . BuildQueryParams ( ) ) ;
82+ }
83+
84+ public Task < FullPlaylist > Get ( string playlistId )
85+ {
86+ Ensure . ArgumentNotNullOrEmptyString ( playlistId , nameof ( playlistId ) ) ;
87+ var request = new PlaylistGetRequest ( ) ; // We need some defaults
88+
89+ return API . Get < FullPlaylist > ( URLs . Playlist ( playlistId ) , request . BuildQueryParams ( ) ) ;
90+ }
91+
92+ public Task < FullPlaylist > Get ( string playlistId , PlaylistGetRequest request )
93+ {
94+ Ensure . ArgumentNotNullOrEmptyString ( playlistId , nameof ( playlistId ) ) ;
95+ Ensure . ArgumentNotNull ( request , nameof ( request ) ) ;
96+
97+ return API . Get < FullPlaylist > ( URLs . Playlist ( playlistId ) , request . BuildQueryParams ( ) ) ;
98+ }
99+
100+ public async Task < bool > ReplaceItems ( string playlistId , PlaylistReplaceItemsRequest request )
101+ {
102+ Ensure . ArgumentNotNullOrEmptyString ( playlistId , nameof ( playlistId ) ) ;
103+ Ensure . ArgumentNotNull ( request , nameof ( request ) ) ;
104+
105+ var statusCode = await API . Put ( URLs . PlaylistTracks ( playlistId ) , null , request . BuildBodyParams ( ) ) ;
106+ return statusCode == HttpStatusCode . Created ;
107+ }
108+
109+ public Task < Paging < SimplePlaylist > > CurrentUsers ( )
110+ {
111+ return API . Get < Paging < SimplePlaylist > > ( URLs . CurrentUserPlaylists ( ) ) ;
112+ }
113+
114+ public Task < Paging < SimplePlaylist > > CurrentUsers ( PlaylistCurrentUsersRequest request )
115+ {
116+ Ensure . ArgumentNotNull ( request , nameof ( request ) ) ;
117+
118+ return API . Get < Paging < SimplePlaylist > > ( URLs . CurrentUserPlaylists ( ) , request . BuildQueryParams ( ) ) ;
119+ }
67120 }
68121}
0 commit comments