mirror of
https://github.com/Sarsoo/Spotify.NET.git
synced 2025-01-11 14:07:47 +00:00
Added another endpoint and made sure the logger works for bodys <50 chars
This commit is contained in:
parent
7310c9bc8d
commit
c9a374080b
@ -27,5 +27,7 @@ namespace SpotifyAPI.Web
|
|||||||
|
|
||||||
Task<Paging<SimplePlaylist>> CurrentUsers();
|
Task<Paging<SimplePlaylist>> CurrentUsers();
|
||||||
Task<Paging<SimplePlaylist>> CurrentUsers(PlaylistCurrentUsersRequest request);
|
Task<Paging<SimplePlaylist>> CurrentUsers(PlaylistCurrentUsersRequest request);
|
||||||
|
|
||||||
|
Task<bool> ChangeDetails(string playlistId, PlaylistChangeDetailsRequest request);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -117,5 +117,14 @@ namespace SpotifyAPI.Web
|
|||||||
|
|
||||||
return API.Get<Paging<SimplePlaylist>>(URLs.CurrentUserPlaylists(), request.BuildQueryParams());
|
return API.Get<Paging<SimplePlaylist>>(URLs.CurrentUserPlaylists(), request.BuildQueryParams());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<bool> ChangeDetails(string playlistId, PlaylistChangeDetailsRequest request)
|
||||||
|
{
|
||||||
|
Ensure.ArgumentNotNullOrEmptyString(playlistId, nameof(playlistId));
|
||||||
|
Ensure.ArgumentNotNull(request, nameof(request));
|
||||||
|
|
||||||
|
var statusCode = await API.Put(URLs.Playlist(playlistId), null, request.BuildBodyParams());
|
||||||
|
return statusCode == HttpStatusCode.OK;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,8 @@ namespace SpotifyAPI.Web.Http
|
|||||||
|
|
||||||
public void OnResponse(IResponse response)
|
public void OnResponse(IResponse response)
|
||||||
{
|
{
|
||||||
string body = response.Body?.ToString().Substring(0, 50).Replace("\n", "");
|
string body = response.Body?.ToString().Replace("\n", "");
|
||||||
|
body = body?.Substring(0, Math.Min(50, body?.Length ?? 0));
|
||||||
Console.WriteLine("--> {0} {1} {2}\n", response.StatusCode, response.ContentType, body);
|
Console.WriteLine("--> {0} {1} {2}\n", response.StatusCode, response.ContentType, body);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
namespace SpotifyAPI.Web
|
||||||
|
{
|
||||||
|
public class PlaylistChangeDetailsRequest : RequestParams
|
||||||
|
{
|
||||||
|
[BodyParam("name")]
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
[BodyParam("public")]
|
||||||
|
public bool? Public { get; set; }
|
||||||
|
|
||||||
|
[BodyParam("collaborative")]
|
||||||
|
public bool? Collaborative { get; set; }
|
||||||
|
|
||||||
|
[BodyParam("description")]
|
||||||
|
public string Description { get; set; }
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user