forked from JohnnyCrazy/SpotifyAPI-NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAlbumsClient.cs
More file actions
50 lines (39 loc) · 1.78 KB
/
AlbumsClient.cs
File metadata and controls
50 lines (39 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using System.Threading;
using System.Threading.Tasks;
using SpotifyAPI.Web.Http;
using URLs = SpotifyAPI.Web.SpotifyUrls;
namespace SpotifyAPI.Web
{
public class AlbumsClient : APIClient, IAlbumsClient
{
public AlbumsClient(IAPIConnector apiConnector) : base(apiConnector) { }
public Task<FullAlbum> Get(string albumId, CancellationToken cancel = default)
{
Ensure.ArgumentNotNullOrEmptyString(albumId, nameof(albumId));
return API.Get<FullAlbum>(URLs.Album(albumId), cancel);
}
public Task<FullAlbum> Get(string albumId, AlbumRequest request, CancellationToken cancel = default)
{
Ensure.ArgumentNotNullOrEmptyString(albumId, nameof(albumId));
Ensure.ArgumentNotNull(request, nameof(request));
return API.Get<FullAlbum>(URLs.Album(albumId), request.BuildQueryParams(), cancel);
}
[System.Obsolete("This endpoint (GET /albums) has been removed.")]
public Task<AlbumsResponse> GetSeveral(AlbumsRequest request, CancellationToken cancel = default)
{
Ensure.ArgumentNotNull(request, nameof(request));
return API.Get<AlbumsResponse>(URLs.Albums(), request.BuildQueryParams(), cancel);
}
public Task<Paging<SimpleTrack>> GetTracks(string albumId, CancellationToken cancel = default)
{
Ensure.ArgumentNotNullOrEmptyString(albumId, nameof(albumId));
return API.Get<Paging<SimpleTrack>>(URLs.AlbumTracks(albumId), cancel);
}
public Task<Paging<SimpleTrack>> GetTracks(string albumId, AlbumTracksRequest request, CancellationToken cancel = default)
{
Ensure.ArgumentNotNullOrEmptyString(albumId, nameof(albumId));
Ensure.ArgumentNotNull(request, nameof(request));
return API.Get<Paging<SimpleTrack>>(URLs.AlbumTracks(albumId), request.BuildQueryParams(), cancel);
}
}
}