Skip to main content
Version: 5.1.1

Personalization

GetUsersTopTracks

Get the current user’s top tracks based on calculated affinity.

Parameters

NameDescriptionExample
[timeRange]Over what time frame the affinities are compute.TimeRangeType.MediumTerm
[limit]The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50.20
[offset]The index of the first entity to return. Default: 0 (i.e., the first track). Use with limit to get the next set of entities.0

Returns a FullTrack wrapped inside a Paging-object

Usage

Paging<FullTrack> tracks = _spotify.GetUsersTopTracks();
tracks.Items.ForEach(item => Console.WriteLine(item.Name)); //Display all fetched Track-Names (max 20)
Console.WriteLine(tracks.Total.ToString()) //Display total album track count

GetUsersTopArtists

Get the current user’s top artists based on calculated affinity.

Parameters

NameDescriptionExample
[timeRange]Over what time frame the affinities are compute.TimeRangeType.MediumTerm
[limit]The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50.20
[offset]The index of the first entity to return. Default: 0 (i.e., the first track). Use with limit to get the next set of entities.0

Returns a FullArtist wrapped inside a Paging-object

Usage

Paging<FullArtist> artists = _spotify.GetUsersTopArtists();
artists.Items.ForEach(item => Console.WriteLine(item.Name)); //Display all fetched Artist-Names (max 20)

GetUsersRecentlyPlayedTracks

Get tracks from the current user’s recent play history.

Parameters

NameDescriptionExample
[limit]The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50.20
[after]Returns all items after (but not including) this cursor position.DateTime.Now.AddDays(-1)
[before]Returns all items before (but not including) this cursor position.DateTime.Now.AddDays(-1)

Returns a PlayHistory wrapped inside a CursorPaging-object

Usage

CursorPaging<PlayHistory> histories = _spotify.GetUsersRecentlyPlayedTracks();
histories.Items.ForEach(item => Console.WriteLine(item.Track.Name));