From dca8d5e3deb3adf7fb8cc74b911099fe483d8519 Mon Sep 17 00:00:00 2001 From: Jimmy Appelt Date: Fri, 6 Nov 2015 18:08:24 +0100 Subject: [PATCH] Corrected all _builder method names until Playlists --- SpotifyAPI/Web/SpotifyWebAPI.cs | 96 ++++++++++++++++----------------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/SpotifyAPI/Web/SpotifyWebAPI.cs b/SpotifyAPI/Web/SpotifyWebAPI.cs index e1ad5dd1..a327ce2a 100644 --- a/SpotifyAPI/Web/SpotifyWebAPI.cs +++ b/SpotifyAPI/Web/SpotifyWebAPI.cs @@ -88,7 +88,7 @@ namespace SpotifyAPI.Web /// public Paging GetAlbumTracks(String id, int limit = 20, int offset = 0, String market = "") { - return DownloadData>(_builder.SearchItems(id, limit, offset, market)); + return DownloadData>(_builder.GetAlbumTracks(id, limit, offset, market)); } /// @@ -102,7 +102,7 @@ namespace SpotifyAPI.Web /// public Task> GetAlbumTracksAsync(String id, int limit = 20, int offset = 0, String market = "") { - return DownloadDataAsync>(_builder.SearchItems(id, limit, offset, market)); + return DownloadDataAsync>(_builder.GetAlbumTracks(id, limit, offset, market)); } /// @@ -113,7 +113,7 @@ namespace SpotifyAPI.Web /// public FullAlbum GetAlbum(String id, String market = "") { - return DownloadData(_builder.SearchItems(id, market)); + return DownloadData(_builder.GetAlbum(id, market)); } /// @@ -124,7 +124,7 @@ namespace SpotifyAPI.Web /// public Task GetAlbumAsync(String id, String market = "") { - return DownloadDataAsync(_builder.SearchItems(id, market)); + return DownloadDataAsync(_builder.GetAlbum(id, market)); } /// @@ -135,7 +135,7 @@ namespace SpotifyAPI.Web /// public SeveralAlbums GetSeveralAlbums(List ids, String market = "") { - return DownloadData(_builder.SearchItems(ids, market)); + return DownloadData(_builder.GetSeveralAlbums(ids, market)); } /// @@ -146,7 +146,7 @@ namespace SpotifyAPI.Web /// public Task GetSeveralAlbumsAsync(List ids, String market = "") { - return DownloadDataAsync(_builder.SearchItems(ids, market)); + return DownloadDataAsync(_builder.GetSeveralAlbums(ids, market)); } #endregion Albums @@ -160,7 +160,7 @@ namespace SpotifyAPI.Web /// public FullArtist GetArtist(String id) { - return DownloadData(_builder.SearchItems(id)); + return DownloadData(_builder.GetArtist(id)); } /// @@ -170,7 +170,7 @@ namespace SpotifyAPI.Web /// public Task GetArtistAsync(String id) { - return DownloadDataAsync(_builder.SearchItems(id)); + return DownloadDataAsync(_builder.GetArtist(id)); } /// @@ -181,7 +181,7 @@ namespace SpotifyAPI.Web /// public SeveralArtists GetRelatedArtists(String id) { - return DownloadData(_builder.SearchItems(id)); + return DownloadData(_builder.GetRelatedArtists(id)); } /// @@ -192,7 +192,7 @@ namespace SpotifyAPI.Web /// public Task GetRelatedArtistsAsync(String id) { - return DownloadDataAsync(_builder.SearchItems(id)); + return DownloadDataAsync(_builder.GetRelatedArtists(id)); } /// @@ -203,7 +203,7 @@ namespace SpotifyAPI.Web /// public SeveralTracks GetArtistsTopTracks(String id, String country) { - return DownloadData(_builder.SearchItems(id, country)); + return DownloadData(_builder.GetArtistsTopTracks(id, country)); } /// @@ -214,7 +214,7 @@ namespace SpotifyAPI.Web /// public Task GetArtistsTopTracksAsync(String id, String country) { - return DownloadDataAsync(_builder.SearchItems(id, country)); + return DownloadDataAsync(_builder.GetArtistsTopTracks(id, country)); } /// @@ -235,7 +235,7 @@ namespace SpotifyAPI.Web /// public Paging GetArtistsAlbums(String id, AlbumType type = AlbumType.All, int limit = 20, int offset = 0, String market = "") { - return DownloadData>(_builder.SearchItems(id, type, limit, offset, market)); + return DownloadData>(_builder.GetArtistsAlbums(id, type, limit, offset, market)); } /// @@ -256,7 +256,7 @@ namespace SpotifyAPI.Web /// public Task> GetArtistsAlbumsAsync(String id, AlbumType type = AlbumType.All, int limit = 20, int offset = 0, String market = "") { - return DownloadDataAsync>(_builder.SearchItems(id, type, limit, offset, market)); + return DownloadDataAsync>(_builder.GetArtistsAlbums(id, type, limit, offset, market)); } /// @@ -266,7 +266,7 @@ namespace SpotifyAPI.Web /// public SeveralArtists GetSeveralArtists(List ids) { - return DownloadData(_builder.SearchItems(ids)); + return DownloadData(_builder.GetSeveralArtists(ids)); } /// @@ -276,7 +276,7 @@ namespace SpotifyAPI.Web /// public Task GetSeveralArtistsAsync(List ids) { - return DownloadDataAsync(_builder.SearchItems(ids)); + return DownloadDataAsync(_builder.GetSeveralArtists(ids)); } #endregion Artists @@ -299,7 +299,7 @@ namespace SpotifyAPI.Web { if (!UseAuth) throw new InvalidOperationException("Auth is required for GetFeaturedPlaylists"); - return DownloadData(_builder.SearchItems(locale, country, timestamp, limit, offset)); + return DownloadData(_builder.GetFeaturedPlaylists(locale, country, timestamp, limit, offset)); } /// @@ -318,7 +318,7 @@ namespace SpotifyAPI.Web { if (!UseAuth) throw new InvalidOperationException("Auth is required for GetFeaturedPlaylists"); - return DownloadDataAsync(_builder.SearchItems(locale, country, timestamp, limit, offset)); + return DownloadDataAsync(_builder.GetFeaturedPlaylists(locale, country, timestamp, limit, offset)); } /// @@ -333,7 +333,7 @@ namespace SpotifyAPI.Web { if (!UseAuth) throw new InvalidOperationException("Auth is required for GetNewAlbumReleases"); - return DownloadData(_builder.SearchItems(country, limit, offset)); + return DownloadData(_builder.GetNewAlbumReleases(country, limit, offset)); } /// @@ -348,7 +348,7 @@ namespace SpotifyAPI.Web { if (!UseAuth) throw new InvalidOperationException("Auth is required for GetNewAlbumReleases"); - return DownloadDataAsync(_builder.SearchItems(country, limit, offset)); + return DownloadDataAsync(_builder.GetNewAlbumReleases(country, limit, offset)); } /// @@ -370,7 +370,7 @@ namespace SpotifyAPI.Web { if (!UseAuth) throw new InvalidOperationException("Auth is required for GetCategories"); - return DownloadData(_builder.SearchItems(country, locale, limit, offset)); + return DownloadData(_builder.GetCategories(country, locale, limit, offset)); } /// @@ -392,7 +392,7 @@ namespace SpotifyAPI.Web { if (!UseAuth) throw new InvalidOperationException("Auth is required for GetCategories"); - return DownloadDataAsync(_builder.SearchItems(country, locale, limit, offset)); + return DownloadDataAsync(_builder.GetCategories(country, locale, limit, offset)); } /// @@ -411,7 +411,7 @@ namespace SpotifyAPI.Web /// AUTH NEEDED public Category GetCategory(String categoryId, String country = "", String locale = "") { - return DownloadData(_builder.SearchItems(categoryId, country, locale)); + return DownloadData(_builder.GetCategory(categoryId, country, locale)); } /// @@ -430,7 +430,7 @@ namespace SpotifyAPI.Web /// AUTH NEEDED public Task GetCategoryAsync(String categoryId, String country = "", String locale = "") { - return DownloadDataAsync(_builder.SearchItems(categoryId, country, locale)); + return DownloadDataAsync(_builder.GetCategory(categoryId, country, locale)); } /// @@ -444,7 +444,7 @@ namespace SpotifyAPI.Web /// AUTH NEEDED public CategoryPlaylist GetCategoryPlaylists(String categoryId, String country = "", int limit = 20, int offset = 0) { - return DownloadData(_builder.SearchItems(categoryId, country, limit, offset)); + return DownloadData(_builder.GetCategoryPlaylists(categoryId, country, limit, offset)); } /// @@ -458,7 +458,7 @@ namespace SpotifyAPI.Web /// AUTH NEEDED public Task GetCategoryPlaylistsAsync(String categoryId, String country = "", int limit = 20, int offset = 0) { - return DownloadDataAsync(_builder.SearchItems(categoryId, country, limit, offset)); + return DownloadDataAsync(_builder.GetCategoryPlaylists(categoryId, country, limit, offset)); } #endregion Browse @@ -477,7 +477,7 @@ namespace SpotifyAPI.Web { if (!UseAuth) throw new InvalidOperationException("Auth is required for GetFollowedArtists"); - return DownloadData(_builder.SearchItems(followType, limit, after)); + return DownloadData(_builder.GetFollowedArtists(followType, limit, after)); } /// @@ -492,7 +492,7 @@ namespace SpotifyAPI.Web { if (!UseAuth) throw new InvalidOperationException("Auth is required for GetFollowedArtists"); - return DownloadDataAsync(_builder.SearchItems(followType, limit, after)); + return DownloadDataAsync(_builder.GetFollowedArtists(followType, limit, after)); } /// @@ -508,7 +508,7 @@ namespace SpotifyAPI.Web { {"ids", new JArray(ids)} }; - return UploadData(_builder.SearchItems(followType, ids), ob.ToString(Formatting.None), "PUT") ?? new ErrorResponse(); + return UploadData(_builder.Follow(followType, ids), ob.ToString(Formatting.None), "PUT") ?? new ErrorResponse(); } /// @@ -525,7 +525,7 @@ namespace SpotifyAPI.Web {"ids", new JArray(ids)} }; return - UploadDataAsync(_builder.SearchItems(followType, ids), + UploadDataAsync(_builder.Follow(followType, ids), ob.ToString(Formatting.None), "PUT") ?? Task.FromResult(new ErrorResponse()); } @@ -566,7 +566,7 @@ namespace SpotifyAPI.Web { {"ids", new JArray(ids)} }; - return UploadData(_builder.SearchItems(followType, ids), ob.ToString(Formatting.None), "DELETE") ?? new ErrorResponse(); + return UploadData(_builder.Unfollow(followType, ids), ob.ToString(Formatting.None), "DELETE") ?? new ErrorResponse(); } /// @@ -582,7 +582,7 @@ namespace SpotifyAPI.Web { {"ids", new JArray(ids)} }; - return UploadDataAsync(_builder.SearchItems(followType, ids), ob.ToString(Formatting.None), "DELETE") ?? Task.FromResult(new ErrorResponse()); + return UploadDataAsync(_builder.Unfollow(followType, ids), ob.ToString(Formatting.None), "DELETE") ?? Task.FromResult(new ErrorResponse()); } /// @@ -620,7 +620,7 @@ namespace SpotifyAPI.Web { if (!UseAuth) throw new InvalidOperationException("Auth is required for IsFollowing"); - JToken res = DownloadData(_builder.SearchItems(followType, ids)); + JToken res = DownloadData(_builder.IsFollowing(followType, ids)); if (res is JArray) return new ListResponse { List = res.ToObject>(), Error = null }; return new ListResponse { List = null, Error = res["error"].ToObject() }; @@ -637,7 +637,7 @@ namespace SpotifyAPI.Web { if (!UseAuth) throw new InvalidOperationException("Auth is required for IsFollowing"); - JToken res = DownloadDataAsync(_builder.SearchItems(followType, ids)); + JToken res = DownloadDataAsync(_builder.IsFollowing(followType, ids)); if (res is JArray) //todo expression is always false return Task.FromResult(new ListResponse { List = res.ToObject>(), Error = null }); return Task.FromResult(new ListResponse { List = null, Error = res["error"].ToObject() }); @@ -687,7 +687,7 @@ namespace SpotifyAPI.Web { {"public", showPublic} }; - return UploadData(_builder.SearchItems(ownerId, playlistId, showPublic), body.ToString(Formatting.None), "PUT"); + return UploadData(_builder.FollowPlaylist(ownerId, playlistId, showPublic), body.ToString(Formatting.None), "PUT"); } /// @@ -710,7 +710,7 @@ namespace SpotifyAPI.Web { {"public", showPublic} }; - return UploadDataAsync(_builder.SearchItems(ownerId, playlistId, showPublic), body.ToString(Formatting.None), "PUT"); + return UploadDataAsync(_builder.FollowPlaylist(ownerId, playlistId, showPublic), body.ToString(Formatting.None), "PUT"); } /// @@ -722,7 +722,7 @@ namespace SpotifyAPI.Web /// AUTH NEEDED public ErrorResponse UnfollowPlaylist(String ownerId, String playlistId) { - return UploadData(_builder.SearchItems(ownerId, playlistId), "", "DELETE"); + return UploadData(_builder.UnfollowPlaylist(ownerId, playlistId), "", "DELETE"); } /// @@ -734,7 +734,7 @@ namespace SpotifyAPI.Web /// AUTH NEEDED public Task UnfollowPlaylistAsync(String ownerId, String playlistId) { - return UploadDataAsync(_builder.SearchItems(ownerId, playlistId), "", "DELETE"); + return UploadDataAsync(_builder.UnfollowPlaylist(ownerId, playlistId), "", "DELETE"); } /// @@ -749,7 +749,7 @@ namespace SpotifyAPI.Web { if (!UseAuth) throw new InvalidOperationException("Auth is required for IsFollowingPlaylist"); - JToken res = DownloadData(_builder.SearchItems(ownerId, playlistId, ids)); + JToken res = DownloadData(_builder.IsFollowingPlaylist(ownerId, playlistId, ids)); if (res is JArray) return new ListResponse { List = res.ToObject>(), Error = null }; return new ListResponse { List = null, Error = res["error"].ToObject() }; @@ -767,7 +767,7 @@ namespace SpotifyAPI.Web { if (!UseAuth) throw new InvalidOperationException("Auth is required for IsFollowingPlaylist"); - JToken res = DownloadDataAsync(_builder.SearchItems(ownerId, playlistId, ids)); + JToken res = DownloadDataAsync(_builder.IsFollowingPlaylist(ownerId, playlistId, ids)); if (res is JArray) //todo expression is always false return Task.FromResult(new ListResponse { List = res.ToObject>(), Error = null }); return Task.FromResult(new ListResponse { List = null, Error = res["error"].ToObject() }); @@ -812,7 +812,7 @@ namespace SpotifyAPI.Web public ErrorResponse SaveTracks(List ids) { JArray array = new JArray(ids); - return UploadData(_builder.SearchItems(array.ToString(Formatting.None), "PUT") ?? new ErrorResponse()); + return UploadData(_builder.SaveTracks(array.ToString(Formatting.None), "PUT") ?? new ErrorResponse()); } /// @@ -824,7 +824,7 @@ namespace SpotifyAPI.Web public Task SaveTracksAsync(List ids) { JArray array = new JArray(ids); - return UploadDataAsync(_builder.SearchItems(array.ToString(Formatting.None), "PUT") ?? Task.FromResult(new ErrorResponse())); + return UploadDataAsync(_builder.SaveTracks(array.ToString(Formatting.None), "PUT") ?? Task.FromResult(new ErrorResponse())); } /// @@ -861,7 +861,7 @@ namespace SpotifyAPI.Web { if (!UseAuth) throw new InvalidOperationException("Auth is required for GetSavedTracks"); - return DownloadData>(_builder.SearchItems(limit, offset, market)); + return DownloadData>(_builder.GetSavedTracks(limit, offset, market)); } /// @@ -876,7 +876,7 @@ namespace SpotifyAPI.Web { if (!UseAuth) throw new InvalidOperationException("Auth is required for GetSavedTracks"); - return DownloadDataAsync>(_builder.SearchItems(limit, offset, market)); + return DownloadDataAsync>(_builder.GetSavedTracks(limit, offset, market)); } /// @@ -888,7 +888,7 @@ namespace SpotifyAPI.Web public ErrorResponse RemoveSavedTracks(List ids) { JArray array = new JArray(ids); - return UploadData(_builder.SearchItems(array.ToString(Formatting.None), "DELETE") ?? new ErrorResponse(); + return UploadData(_builder.RemoveSavedTracks(array.ToString(Formatting.None), "DELETE") ?? new ErrorResponse(); } /// @@ -900,7 +900,7 @@ namespace SpotifyAPI.Web public Task RemoveSavedTracksAsync(List ids) { JArray array = new JArray(ids); - return UploadDataAsync(_builder.SearchItems(array.ToString(Formatting.None), "DELETE") ?? Task.FromResult(new ErrorResponse()); + return UploadDataAsync(_builder.RemoveSavedTracks(array.ToString(Formatting.None), "DELETE") ?? Task.FromResult(new ErrorResponse()); } /// @@ -913,7 +913,7 @@ namespace SpotifyAPI.Web { if (!UseAuth) throw new InvalidOperationException("Auth is required for CheckSavedTracks"); - JToken res = DownloadData(APIBase + "/me/tracks/contains?ids=" + string.Join(",", ids)); + JToken res = DownloadData(_builder.CheckSavedTracks(ids)); if (res is JArray) return new ListResponse { List = res.ToObject>(), Error = null }; return new ListResponse { List = null, Error = res["error"].ToObject() }; @@ -929,7 +929,7 @@ namespace SpotifyAPI.Web { if (!UseAuth) throw new InvalidOperationException("Auth is required for CheckSavedTracks"); - JToken res = DownloadDataAsync(SpotifyWebBuilder.APIBase + "/me/tracks/contains?ids=" + string.Join(",", ids)); + JToken res = DownloadDataAsync(_builder.CheckSavedTracks(ids)); if (res is JArray) //todo expression is always false return Task.FromResult(new ListResponse { List = res.ToObject>(), Error = null }); return Task.FromResult(new ListResponse { List = null, Error = res["error"].ToObject() });