mirror of
https://github.com/Sarsoo/Spotify.NET.git
synced 2025-01-11 14:07:47 +00:00
update url for FollowPlaylist/UnfollowPlaylist/IsFollowingPlaylist (#424)
This commit is contained in:
parent
c869f0ddcd
commit
284d80ff6f
@ -822,7 +822,6 @@ namespace SpotifyAPI.Web
|
||||
/// <summary>
|
||||
/// Add the current user as a follower of a playlist.
|
||||
/// </summary>
|
||||
/// <param name="ownerId">The Spotify user ID of the person who owns the playlist.</param>
|
||||
/// <param name="playlistId">
|
||||
/// The Spotify ID of the playlist. Any playlist can be followed, regardless of its public/private
|
||||
/// status, as long as you know its playlist ID.
|
||||
@ -839,13 +838,12 @@ namespace SpotifyAPI.Web
|
||||
{
|
||||
{"public", showPublic}
|
||||
};
|
||||
return UploadData<ErrorResponse>(_builder.FollowPlaylist(ownerId, playlistId, showPublic), body.ToString(Formatting.None), "PUT");
|
||||
return UploadData<ErrorResponse>(_builder.FollowPlaylist(playlistId), body.ToString(Formatting.None), "PUT");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add the current user as a follower of a playlist asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="ownerId">The Spotify user ID of the person who owns the playlist.</param>
|
||||
/// <param name="playlistId">
|
||||
/// The Spotify ID of the playlist. Any playlist can be followed, regardless of its public/private
|
||||
/// status, as long as you know its playlist ID.
|
||||
@ -856,25 +854,24 @@ namespace SpotifyAPI.Web
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>AUTH NEEDED</remarks>
|
||||
public Task<ErrorResponse> FollowPlaylistAsync(string ownerId, string playlistId, bool showPublic = true)
|
||||
public Task<ErrorResponse> FollowPlaylistAsync(string playlistId, bool showPublic = true)
|
||||
{
|
||||
JObject body = new JObject
|
||||
{
|
||||
{"public", showPublic}
|
||||
};
|
||||
return UploadDataAsync<ErrorResponse>(_builder.FollowPlaylist(ownerId, playlistId, showPublic), body.ToString(Formatting.None), "PUT");
|
||||
return UploadDataAsync<ErrorResponse>(_builder.FollowPlaylist(playlistId), body.ToString(Formatting.None), "PUT");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove the current user as a follower of a playlist.
|
||||
/// </summary>
|
||||
/// <param name="ownerId">The Spotify user ID of the person who owns the playlist.</param>
|
||||
/// <param name="playlistId">The Spotify ID of the playlist that is to be no longer followed.</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>AUTH NEEDED</remarks>
|
||||
public ErrorResponse UnfollowPlaylist(string ownerId, string playlistId)
|
||||
public ErrorResponse UnfollowPlaylist(string playlistId)
|
||||
{
|
||||
return UploadData<ErrorResponse>(_builder.UnfollowPlaylist(ownerId, playlistId), "", "DELETE");
|
||||
return UploadData<ErrorResponse>(_builder.UnfollowPlaylist(playlistId), "", "DELETE");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -884,69 +881,65 @@ namespace SpotifyAPI.Web
|
||||
/// <param name="playlistId">The Spotify ID of the playlist that is to be no longer followed.</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>AUTH NEEDED</remarks>
|
||||
public Task<ErrorResponse> UnfollowPlaylistAsync(string ownerId, string playlistId)
|
||||
public Task<ErrorResponse> UnfollowPlaylistAsync(string playlistId)
|
||||
{
|
||||
return UploadDataAsync<ErrorResponse>(_builder.UnfollowPlaylist(ownerId, playlistId), "", "DELETE");
|
||||
return UploadDataAsync<ErrorResponse>(_builder.UnfollowPlaylist(playlistId), "", "DELETE");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check to see if one or more Spotify users are following a specified playlist.
|
||||
/// </summary>
|
||||
/// <param name="ownerId">The Spotify user ID of the person who owns the playlist.</param>
|
||||
/// <param name="playlistId">The Spotify ID of the playlist.</param>
|
||||
/// <param name="ids">A list of Spotify User IDs</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>AUTH NEEDED</remarks>
|
||||
public ListResponse<bool> IsFollowingPlaylist(string ownerId, string playlistId, List<string> ids)
|
||||
public ListResponse<bool> IsFollowingPlaylist(string playlistId, List<string> ids)
|
||||
{
|
||||
if (!UseAuth)
|
||||
throw new InvalidOperationException("Auth is required for IsFollowingPlaylist");
|
||||
|
||||
string url = _builder.IsFollowingPlaylist(ownerId, playlistId, ids);
|
||||
string url = _builder.IsFollowingPlaylist(playlistId, ids);
|
||||
return DownloadList<bool>(url);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check to see if one or more Spotify users are following a specified playlist asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="ownerId">The Spotify user ID of the person who owns the playlist.</param>
|
||||
/// <param name="playlistId">The Spotify ID of the playlist.</param>
|
||||
/// <param name="ids">A list of Spotify User IDs</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>AUTH NEEDED</remarks>
|
||||
public Task<ListResponse<bool>> IsFollowingPlaylistAsync(string ownerId, string playlistId, List<string> ids)
|
||||
public Task<ListResponse<bool>> IsFollowingPlaylistAsync(string playlistId, List<string> ids)
|
||||
{
|
||||
if (!UseAuth)
|
||||
throw new InvalidOperationException("Auth is required for IsFollowingPlaylist");
|
||||
|
||||
string url = _builder.IsFollowingPlaylist(ownerId, playlistId, ids);
|
||||
string url = _builder.IsFollowingPlaylist(playlistId, ids);
|
||||
return DownloadListAsync<bool>(url);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check to see if one or more Spotify users are following a specified playlist.
|
||||
/// </summary>
|
||||
/// <param name="ownerId">The Spotify user ID of the person who owns the playlist.</param>
|
||||
/// <param name="playlistId">The Spotify ID of the playlist.</param>
|
||||
/// <param name="id">A Spotify User ID</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>AUTH NEEDED</remarks>
|
||||
public ListResponse<bool> IsFollowingPlaylist(string ownerId, string playlistId, string id)
|
||||
public ListResponse<bool> IsFollowingPlaylist( string playlistId, string id)
|
||||
{
|
||||
return IsFollowingPlaylist(ownerId, playlistId, new List<string> { id });
|
||||
return IsFollowingPlaylist(playlistId, new List<string> { id });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check to see if one or more Spotify users are following a specified playlist asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="ownerId">The Spotify user ID of the person who owns the playlist.</param>
|
||||
/// <param name="playlistId">The Spotify ID of the playlist.</param>
|
||||
/// <param name="id">A Spotify User ID</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>AUTH NEEDED</remarks>
|
||||
public Task<ListResponse<bool>> IsFollowingPlaylistAsync(string ownerId, string playlistId, string id)
|
||||
public Task<ListResponse<bool>> IsFollowingPlaylistAsync(string playlistId, string id)
|
||||
{
|
||||
return IsFollowingPlaylistAsync(ownerId, playlistId, new List<string> { id });
|
||||
return IsFollowingPlaylistAsync( playlistId, new List<string> { id });
|
||||
}
|
||||
|
||||
#endregion Follow
|
||||
|
@ -396,45 +396,38 @@ namespace SpotifyAPI.Web
|
||||
/// <summary>
|
||||
/// Add the current user as a follower of a playlist.
|
||||
/// </summary>
|
||||
/// <param name="ownerId">The Spotify user ID of the person who owns the playlist.</param>
|
||||
/// <param name="playlistId">
|
||||
/// The Spotify ID of the playlist. Any playlist can be followed, regardless of its public/private
|
||||
/// status, as long as you know its playlist ID.
|
||||
/// </param>
|
||||
/// <param name="showPublic">
|
||||
/// If true the playlist will be included in user's public playlists, if false it will remain
|
||||
/// private.
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>AUTH NEEDED</remarks>
|
||||
public string FollowPlaylist(string ownerId, string playlistId, bool showPublic = true)
|
||||
public string FollowPlaylist(string playlistId)
|
||||
{
|
||||
return $"{APIBase}/users/{ownerId}/playlists/{playlistId}/followers";
|
||||
return $"{APIBase}/playlists/{playlistId}/followers";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove the current user as a follower of a playlist.
|
||||
/// </summary>
|
||||
/// <param name="ownerId">The Spotify user ID of the person who owns the playlist.</param>
|
||||
/// <param name="playlistId">The Spotify ID of the playlist that is to be no longer followed.</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>AUTH NEEDED</remarks>
|
||||
public string UnfollowPlaylist(string ownerId, string playlistId)
|
||||
public string UnfollowPlaylist(string playlistId)
|
||||
{
|
||||
return $"{APIBase}/users/{ownerId}/playlists/{playlistId}/followers";
|
||||
return $"{APIBase}/playlists/{playlistId}/followers";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check to see if one or more Spotify users are following a specified playlist.
|
||||
/// </summary>
|
||||
/// <param name="ownerId">The Spotify user ID of the person who owns the playlist.</param>
|
||||
/// <param name="playlistId">The Spotify ID of the playlist.</param>
|
||||
/// <param name="ids">A list of Spotify User IDs</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>AUTH NEEDED</remarks>
|
||||
public string IsFollowingPlaylist(string ownerId, string playlistId, List<string> ids)
|
||||
public string IsFollowingPlaylist(string playlistId, List<string> ids)
|
||||
{
|
||||
return $"{APIBase}/users/{ownerId}/playlists/{playlistId}/followers/contains?ids={string.Join(",", ids)}";
|
||||
return $"{APIBase}/playlists/{playlistId}/followers/contains?ids={string.Join(",", ids)}";
|
||||
}
|
||||
|
||||
#endregion Follow
|
||||
|
Loading…
Reference in New Issue
Block a user