Skip to content

Commit 284d80f

Browse files
authored
update url for FollowPlaylist/UnfollowPlaylist/IsFollowingPlaylist (#424)
1 parent c869f0d commit 284d80f

File tree

2 files changed

+21
-35
lines changed

2 files changed

+21
-35
lines changed

SpotifyAPI.Web/SpotifyWebAPI.cs

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,6 @@ public Task<ListResponse<bool>> IsFollowingAsync(FollowType followType, string i
822822
/// <summary>
823823
/// Add the current user as a follower of a playlist.
824824
/// </summary>
825-
/// <param name="ownerId">The Spotify user ID of the person who owns the playlist.</param>
826825
/// <param name="playlistId">
827826
/// The Spotify ID of the playlist. Any playlist can be followed, regardless of its public/private
828827
/// status, as long as you know its playlist ID.
@@ -839,13 +838,12 @@ public ErrorResponse FollowPlaylist(string ownerId, string playlistId, bool show
839838
{
840839
{"public", showPublic}
841840
};
842-
return UploadData<ErrorResponse>(_builder.FollowPlaylist(ownerId, playlistId, showPublic), body.ToString(Formatting.None), "PUT");
841+
return UploadData<ErrorResponse>(_builder.FollowPlaylist(playlistId), body.ToString(Formatting.None), "PUT");
843842
}
844843

845844
/// <summary>
846845
/// Add the current user as a follower of a playlist asynchronously.
847846
/// </summary>
848-
/// <param name="ownerId">The Spotify user ID of the person who owns the playlist.</param>
849847
/// <param name="playlistId">
850848
/// The Spotify ID of the playlist. Any playlist can be followed, regardless of its public/private
851849
/// status, as long as you know its playlist ID.
@@ -856,25 +854,24 @@ public ErrorResponse FollowPlaylist(string ownerId, string playlistId, bool show
856854
/// </param>
857855
/// <returns></returns>
858856
/// <remarks>AUTH NEEDED</remarks>
859-
public Task<ErrorResponse> FollowPlaylistAsync(string ownerId, string playlistId, bool showPublic = true)
857+
public Task<ErrorResponse> FollowPlaylistAsync(string playlistId, bool showPublic = true)
860858
{
861859
JObject body = new JObject
862860
{
863861
{"public", showPublic}
864862
};
865-
return UploadDataAsync<ErrorResponse>(_builder.FollowPlaylist(ownerId, playlistId, showPublic), body.ToString(Formatting.None), "PUT");
863+
return UploadDataAsync<ErrorResponse>(_builder.FollowPlaylist(playlistId), body.ToString(Formatting.None), "PUT");
866864
}
867865

868866
/// <summary>
869867
/// Remove the current user as a follower of a playlist.
870868
/// </summary>
871-
/// <param name="ownerId">The Spotify user ID of the person who owns the playlist.</param>
872869
/// <param name="playlistId">The Spotify ID of the playlist that is to be no longer followed.</param>
873870
/// <returns></returns>
874871
/// <remarks>AUTH NEEDED</remarks>
875-
public ErrorResponse UnfollowPlaylist(string ownerId, string playlistId)
872+
public ErrorResponse UnfollowPlaylist(string playlistId)
876873
{
877-
return UploadData<ErrorResponse>(_builder.UnfollowPlaylist(ownerId, playlistId), "", "DELETE");
874+
return UploadData<ErrorResponse>(_builder.UnfollowPlaylist(playlistId), "", "DELETE");
878875
}
879876

880877
/// <summary>
@@ -884,69 +881,65 @@ public ErrorResponse UnfollowPlaylist(string ownerId, string playlistId)
884881
/// <param name="playlistId">The Spotify ID of the playlist that is to be no longer followed.</param>
885882
/// <returns></returns>
886883
/// <remarks>AUTH NEEDED</remarks>
887-
public Task<ErrorResponse> UnfollowPlaylistAsync(string ownerId, string playlistId)
884+
public Task<ErrorResponse> UnfollowPlaylistAsync(string playlistId)
888885
{
889-
return UploadDataAsync<ErrorResponse>(_builder.UnfollowPlaylist(ownerId, playlistId), "", "DELETE");
886+
return UploadDataAsync<ErrorResponse>(_builder.UnfollowPlaylist(playlistId), "", "DELETE");
890887
}
891888

892889
/// <summary>
893890
/// Check to see if one or more Spotify users are following a specified playlist.
894891
/// </summary>
895-
/// <param name="ownerId">The Spotify user ID of the person who owns the playlist.</param>
896892
/// <param name="playlistId">The Spotify ID of the playlist.</param>
897893
/// <param name="ids">A list of Spotify User IDs</param>
898894
/// <returns></returns>
899895
/// <remarks>AUTH NEEDED</remarks>
900-
public ListResponse<bool> IsFollowingPlaylist(string ownerId, string playlistId, List<string> ids)
896+
public ListResponse<bool> IsFollowingPlaylist(string playlistId, List<string> ids)
901897
{
902898
if (!UseAuth)
903899
throw new InvalidOperationException("Auth is required for IsFollowingPlaylist");
904900

905-
string url = _builder.IsFollowingPlaylist(ownerId, playlistId, ids);
901+
string url = _builder.IsFollowingPlaylist(playlistId, ids);
906902
return DownloadList<bool>(url);
907903
}
908904

909905
/// <summary>
910906
/// Check to see if one or more Spotify users are following a specified playlist asynchronously.
911907
/// </summary>
912-
/// <param name="ownerId">The Spotify user ID of the person who owns the playlist.</param>
913908
/// <param name="playlistId">The Spotify ID of the playlist.</param>
914909
/// <param name="ids">A list of Spotify User IDs</param>
915910
/// <returns></returns>
916911
/// <remarks>AUTH NEEDED</remarks>
917-
public Task<ListResponse<bool>> IsFollowingPlaylistAsync(string ownerId, string playlistId, List<string> ids)
912+
public Task<ListResponse<bool>> IsFollowingPlaylistAsync(string playlistId, List<string> ids)
918913
{
919914
if (!UseAuth)
920915
throw new InvalidOperationException("Auth is required for IsFollowingPlaylist");
921916

922-
string url = _builder.IsFollowingPlaylist(ownerId, playlistId, ids);
917+
string url = _builder.IsFollowingPlaylist(playlistId, ids);
923918
return DownloadListAsync<bool>(url);
924919
}
925920

926921
/// <summary>
927922
/// Check to see if one or more Spotify users are following a specified playlist.
928923
/// </summary>
929-
/// <param name="ownerId">The Spotify user ID of the person who owns the playlist.</param>
930924
/// <param name="playlistId">The Spotify ID of the playlist.</param>
931925
/// <param name="id">A Spotify User ID</param>
932926
/// <returns></returns>
933927
/// <remarks>AUTH NEEDED</remarks>
934-
public ListResponse<bool> IsFollowingPlaylist(string ownerId, string playlistId, string id)
928+
public ListResponse<bool> IsFollowingPlaylist( string playlistId, string id)
935929
{
936-
return IsFollowingPlaylist(ownerId, playlistId, new List<string> { id });
930+
return IsFollowingPlaylist(playlistId, new List<string> { id });
937931
}
938932

939933
/// <summary>
940934
/// Check to see if one or more Spotify users are following a specified playlist asynchronously.
941935
/// </summary>
942-
/// <param name="ownerId">The Spotify user ID of the person who owns the playlist.</param>
943936
/// <param name="playlistId">The Spotify ID of the playlist.</param>
944937
/// <param name="id">A Spotify User ID</param>
945938
/// <returns></returns>
946939
/// <remarks>AUTH NEEDED</remarks>
947-
public Task<ListResponse<bool>> IsFollowingPlaylistAsync(string ownerId, string playlistId, string id)
940+
public Task<ListResponse<bool>> IsFollowingPlaylistAsync(string playlistId, string id)
948941
{
949-
return IsFollowingPlaylistAsync(ownerId, playlistId, new List<string> { id });
942+
return IsFollowingPlaylistAsync( playlistId, new List<string> { id });
950943
}
951944

952945
#endregion Follow

SpotifyAPI.Web/SpotifyWebBuilder.cs

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -396,45 +396,38 @@ public string IsFollowing(FollowType followType, List<string> ids)
396396
/// <summary>
397397
/// Add the current user as a follower of a playlist.
398398
/// </summary>
399-
/// <param name="ownerId">The Spotify user ID of the person who owns the playlist.</param>
400399
/// <param name="playlistId">
401400
/// The Spotify ID of the playlist. Any playlist can be followed, regardless of its public/private
402401
/// status, as long as you know its playlist ID.
403402
/// </param>
404-
/// <param name="showPublic">
405-
/// If true the playlist will be included in user's public playlists, if false it will remain
406-
/// private.
407-
/// </param>
408403
/// <returns></returns>
409404
/// <remarks>AUTH NEEDED</remarks>
410-
public string FollowPlaylist(string ownerId, string playlistId, bool showPublic = true)
405+
public string FollowPlaylist(string playlistId)
411406
{
412-
return $"{APIBase}/users/{ownerId}/playlists/{playlistId}/followers";
407+
return $"{APIBase}/playlists/{playlistId}/followers";
413408
}
414409

415410
/// <summary>
416411
/// Remove the current user as a follower of a playlist.
417412
/// </summary>
418-
/// <param name="ownerId">The Spotify user ID of the person who owns the playlist.</param>
419413
/// <param name="playlistId">The Spotify ID of the playlist that is to be no longer followed.</param>
420414
/// <returns></returns>
421415
/// <remarks>AUTH NEEDED</remarks>
422-
public string UnfollowPlaylist(string ownerId, string playlistId)
416+
public string UnfollowPlaylist(string playlistId)
423417
{
424-
return $"{APIBase}/users/{ownerId}/playlists/{playlistId}/followers";
418+
return $"{APIBase}/playlists/{playlistId}/followers";
425419
}
426420

427421
/// <summary>
428422
/// Check to see if one or more Spotify users are following a specified playlist.
429423
/// </summary>
430-
/// <param name="ownerId">The Spotify user ID of the person who owns the playlist.</param>
431424
/// <param name="playlistId">The Spotify ID of the playlist.</param>
432425
/// <param name="ids">A list of Spotify User IDs</param>
433426
/// <returns></returns>
434427
/// <remarks>AUTH NEEDED</remarks>
435-
public string IsFollowingPlaylist(string ownerId, string playlistId, List<string> ids)
428+
public string IsFollowingPlaylist(string playlistId, List<string> ids)
436429
{
437-
return $"{APIBase}/users/{ownerId}/playlists/{playlistId}/followers/contains?ids={string.Join(",", ids)}";
430+
return $"{APIBase}/playlists/{playlistId}/followers/contains?ids={string.Join(",", ids)}";
438431
}
439432

440433
#endregion Follow

0 commit comments

Comments
 (0)