net.dontdrinkandroot.lastfm.api.model
Class User

java.lang.Object
  extended by net.dontdrinkandroot.lastfm.api.model.LfmEntity
      extended by net.dontdrinkandroot.lastfm.api.model.User
All Implemented Interfaces:
java.io.Serializable, AgeEntity, BootstrapEntity, CountryEntity, Entity, GenderEntity, IdEntity, ImageEntity, MatchEntity, NameEntity, PlayCountEntity, RealnameEntity, RecentTrackEntity, ScrobbleSourceEntity, SubscriberEntity, UrlEntity, UserEntity

public class User
extends LfmEntity
implements java.io.Serializable, ImageEntity, NameEntity, UrlEntity, IdEntity, PlayCountEntity, MatchEntity, CountryEntity, UserEntity, RecentTrackEntity, ScrobbleSourceEntity

See Also:
Serialized Form

Field Summary
static java.util.Map<ImageSize,java.net.URL> DEFAULT_IMAGES
           
 
Constructor Summary
User(org.w3c.dom.Element element)
          Create a user from a dom element.
User(java.lang.String name)
           
 
Method Summary
 boolean equals(java.lang.Object obj)
          Based on the assumption that username is unique.
 java.lang.Integer getAge()
           
static UnauthenticatedGetQuery<GenericPaginatedResult<java.util.List<Track>>> getArtistTracks(java.lang.String user, java.lang.String artist, java.lang.Long startTimestamp, java.lang.Long endTimestamp, java.lang.Integer page)
          Get a list of tracks by a given artist scrobbled by this user, including scrobble time.
static AuthenticatedGetQuery<PaginatedResult<java.util.List<Track>>> getAuthenticatedRecentTracks(java.lang.String user, java.lang.Integer limit, java.lang.Integer page, java.lang.Integer from, java.lang.Integer to, java.lang.String sk)
          Get a list of the recent tracks listened to by this user.
static UnauthenticatedGetQuery<GenericPaginatedResult<java.util.List<Track>>> getBannedTracks(java.lang.String user, java.lang.Integer limit, java.lang.Integer page)
          Returns the tracks banned by the user.
 net.dontdrinkandroot.utils.ISO_3166_1_alpha2 getCountry()
           
static UnauthenticatedGetQuery<java.util.ArrayList<Event>> getEvents(java.lang.String user)
          Get a list of upcoming events that this user is attending.
 java.net.URL getExtraLargeImage()
          Convenience method that returns the extralarge image or the default if not available.
static UnauthenticatedGetQuery<GenericPaginatedResult<java.util.List<User>>> getFriends(java.lang.String user, java.lang.Boolean recenttracks, java.lang.Integer limit, java.lang.Integer page)
          Get a list of the user's friends on Last.fm.
 Gender getGender()
           
 java.lang.Long getId()
           
 java.util.Map<ImageSize,java.net.URL> getImages()
           
static AuthenticatedGetQuery<User> getInfo(Session session)
           
static UnauthenticatedGetQuery<User> getInfo(java.lang.String user)
          Get information about a user profile.
 java.net.URL getLargeImage()
          Convenience method that returns the large image or the default if not available.
 java.lang.Float getMatch()
           
 java.net.URL getMediumImage()
          Convenience method that returns the medium image or the default if not available.
 java.lang.String getName()
           
static UnauthenticatedGetQuery<java.util.ArrayList<User>> getNeighbours(java.lang.String user, java.lang.Integer limit)
          Get a list of a user's neighbours on Last.fm.
 java.lang.Integer getNumPlaylists()
           
 java.lang.Integer getPlayCount()
           
 java.lang.String getRealname()
           
 Track getRecentTrack()
           
static UnauthenticatedGetQuery<PaginatedResult<java.util.List<Track>>> getRecentTracks(java.lang.String user, java.lang.Integer limit, java.lang.Integer page, java.lang.Integer from, java.lang.Integer to)
          Get a list of the recent tracks listened to by this user.
 java.util.Date getRegistered()
           
 ScrobbleSource getScrobbleSource()
           
 java.net.URL getSmallImage()
          Convenience method that returns the small image or the default if not available.
static UnauthenticatedGetQuery<PaginatedResult<java.util.List<Album>>> getTopAlbums(java.lang.String user, Period period, java.lang.Integer limit, java.lang.Integer page)
          Get the top albums listened to by a user.
static UnauthenticatedGetQuery<PaginatedResult<java.util.List<Artist>>> getTopArtists(java.lang.String user, Period period, java.lang.Integer limit, java.lang.Integer page)
          Get the top artists listened to by a user.
static UnauthenticatedGetQuery<PaginatedResult<java.util.List<Track>>> getTopTracks(java.lang.String user, Period period, java.lang.Integer limit, java.lang.Integer page)
          Get the top tracks listened to by a user.
 java.net.URL getUrl()
           
 int hashCode()
          Based on the assumption that username is unique.
 java.lang.Boolean isBootstrap()
           
 java.lang.Boolean isSubscriber()
           
 void setAge(java.lang.Integer age)
           
 void setBootstrap(java.lang.Boolean bootstrap)
           
 void setCountry(net.dontdrinkandroot.utils.ISO_3166_1_alpha2 country)
           
 void setGender(Gender gender)
           
 void setId(java.lang.Long id)
           
 void setImages(java.util.Map<ImageSize,java.net.URL> images)
           
 void setMatch(java.lang.Float match)
           
 void setName(java.lang.String name)
           
 void setNumPlaylists(java.lang.Integer numPlaylists)
           
 void setPlayCount(java.lang.Integer playcount)
           
 void setRealname(java.lang.String realname)
           
 void setRecentTrack(Track recentTrack)
           
 void setRegistered(java.util.Date registered)
           
 void setScrobbleSource(ScrobbleSource scrobbleSource)
           
 void setSubscriber(java.lang.Boolean subscriber)
           
 void setUrl(java.net.URL url)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_IMAGES

public static final transient java.util.Map<ImageSize,java.net.URL> DEFAULT_IMAGES
Constructor Detail

User

public User(java.lang.String name)

User

public User(org.w3c.dom.Element element)
Create a user from a dom element.

Parameters:
element - The dom element to convert.
Method Detail

getId

public final java.lang.Long getId()
Specified by:
getId in interface IdEntity

setId

public final void setId(java.lang.Long id)
Specified by:
setId in interface IdEntity

getMatch

public final java.lang.Float getMatch()
Specified by:
getMatch in interface MatchEntity

setMatch

public final void setMatch(java.lang.Float match)
Specified by:
setMatch in interface MatchEntity

getName

public final java.lang.String getName()
Specified by:
getName in interface NameEntity

setName

public final void setName(java.lang.String name)
Specified by:
setName in interface NameEntity

setImages

public final void setImages(java.util.Map<ImageSize,java.net.URL> images)
Specified by:
setImages in interface ImageEntity

getImages

public final java.util.Map<ImageSize,java.net.URL> getImages()
Specified by:
getImages in interface ImageEntity

getRealname

public final java.lang.String getRealname()
Specified by:
getRealname in interface RealnameEntity

setRealname

public final void setRealname(java.lang.String realname)
Specified by:
setRealname in interface RealnameEntity

setRecentTrack

public final void setRecentTrack(Track recentTrack)
Specified by:
setRecentTrack in interface RecentTrackEntity

getRecentTrack

public final Track getRecentTrack()
Specified by:
getRecentTrack in interface RecentTrackEntity

getUrl

public final java.net.URL getUrl()
Specified by:
getUrl in interface UrlEntity

setUrl

public final void setUrl(java.net.URL url)
Specified by:
setUrl in interface UrlEntity

getCountry

public final net.dontdrinkandroot.utils.ISO_3166_1_alpha2 getCountry()
Specified by:
getCountry in interface CountryEntity

setCountry

public final void setCountry(net.dontdrinkandroot.utils.ISO_3166_1_alpha2 country)
Specified by:
setCountry in interface CountryEntity

getAge

public final java.lang.Integer getAge()
Specified by:
getAge in interface AgeEntity

setAge

public final void setAge(java.lang.Integer age)
Specified by:
setAge in interface AgeEntity

getGender

public final Gender getGender()
Specified by:
getGender in interface GenderEntity

setGender

public final void setGender(Gender gender)
Specified by:
setGender in interface GenderEntity

setSubscriber

public final void setSubscriber(java.lang.Boolean subscriber)
Specified by:
setSubscriber in interface SubscriberEntity

isSubscriber

public final java.lang.Boolean isSubscriber()
Specified by:
isSubscriber in interface SubscriberEntity

setNumPlaylists

public final void setNumPlaylists(java.lang.Integer numPlaylists)

getNumPlaylists

public final java.lang.Integer getNumPlaylists()

getPlayCount

public final java.lang.Integer getPlayCount()
Specified by:
getPlayCount in interface PlayCountEntity

setPlayCount

public final void setPlayCount(java.lang.Integer playcount)
Specified by:
setPlayCount in interface PlayCountEntity

isBootstrap

public final java.lang.Boolean isBootstrap()
Specified by:
isBootstrap in interface BootstrapEntity

setBootstrap

public final void setBootstrap(java.lang.Boolean bootstrap)
Specified by:
setBootstrap in interface BootstrapEntity

getRegistered

public final java.util.Date getRegistered()

setRegistered

public final void setRegistered(java.util.Date registered)

getScrobbleSource

public ScrobbleSource getScrobbleSource()
Specified by:
getScrobbleSource in interface ScrobbleSourceEntity

setScrobbleSource

public void setScrobbleSource(ScrobbleSource scrobbleSource)
Specified by:
setScrobbleSource in interface ScrobbleSourceEntity

getSmallImage

public java.net.URL getSmallImage()
Convenience method that returns the small image or the default if not available.

Returns:
The small image or the small default.

getMediumImage

public java.net.URL getMediumImage()
Convenience method that returns the medium image or the default if not available.

Returns:
The medium image or the medium default.

getLargeImage

public java.net.URL getLargeImage()
Convenience method that returns the large image or the default if not available.

Returns:
The large image or the large default.

getExtraLargeImage

public java.net.URL getExtraLargeImage()
Convenience method that returns the extralarge image or the default if not available.

Returns:
The extralarge image or the extralarge default.

toString

public final java.lang.String toString()
Overrides:
toString in class java.lang.Object

hashCode

public final int hashCode()
Based on the assumption that username is unique.

Overrides:
hashCode in class java.lang.Object

equals

public final boolean equals(java.lang.Object obj)
Based on the assumption that username is unique.

Overrides:
equals in class java.lang.Object

getArtistTracks

public static UnauthenticatedGetQuery<GenericPaginatedResult<java.util.List<Track>>> getArtistTracks(java.lang.String user,
                                                                                                     java.lang.String artist,
                                                                                                     java.lang.Long startTimestamp,
                                                                                                     java.lang.Long endTimestamp,
                                                                                                     java.lang.Integer page)
Get a list of tracks by a given artist scrobbled by this user, including scrobble time. Can be limited to specific timeranges, defaults to all time.

Parameters:
user - The last.fm username to fetch the recent tracks of (Required).
artist - The artist name you are interested in (Required).
startTimestamp - An unix timestamp to start at (Optional).
endTimestamp - An unix timestamp to end at (Optional).
page - An integer used to fetch a specific page of tracks (Optional).
Returns:

getBannedTracks

public static UnauthenticatedGetQuery<GenericPaginatedResult<java.util.List<Track>>> getBannedTracks(java.lang.String user,
                                                                                                     java.lang.Integer limit,
                                                                                                     java.lang.Integer page)
Returns the tracks banned by the user.

Parameters:
user - The user name (Required).
limit - The number of results to fetch per page (Optional). Defaults to 50.
page - The page number to fetch. Defaults to first page (Optional).
Returns:

getEvents

public static UnauthenticatedGetQuery<java.util.ArrayList<Event>> getEvents(java.lang.String user)
Get a list of upcoming events that this user is attending. TODO: COMPLETE

Parameters:
user - The user to fetch the events for (Required).
Returns:

getFriends

public static UnauthenticatedGetQuery<GenericPaginatedResult<java.util.List<User>>> getFriends(java.lang.String user,
                                                                                               java.lang.Boolean recenttracks,
                                                                                               java.lang.Integer limit,
                                                                                               java.lang.Integer page)
Get a list of the user's friends on Last.fm.

Parameters:
user - The last.fm username to fetch the friends of. (Required).
recenttracks - Whether or not to include information about friends' recent listening in the response. (Optional).
limit - An integer used to limit the number of friends returned per page. The default is 50. (Optional).
page - The page number to fetch. (Optional).
Returns:

getInfo

public static UnauthenticatedGetQuery<User> getInfo(java.lang.String user)
Get information about a user profile.

Parameters:
user - The user to fetch info for (Required).

getInfo

public static AuthenticatedGetQuery<User> getInfo(Session session)

getNeighbours

public static UnauthenticatedGetQuery<java.util.ArrayList<User>> getNeighbours(java.lang.String user,
                                                                               java.lang.Integer limit)
Get a list of a user's neighbours on Last.fm. TODO: Using ArrayList here to avoid complex generics.

Parameters:
user - The last.fm username to fetch the neighbours of. (Required).
limit - An integer used to limit the number of neighbours returned. (Optional).
Returns:

getRecentTracks

public static UnauthenticatedGetQuery<PaginatedResult<java.util.List<Track>>> getRecentTracks(java.lang.String user,
                                                                                              java.lang.Integer limit,
                                                                                              java.lang.Integer page,
                                                                                              java.lang.Integer from,
                                                                                              java.lang.Integer to)
Get a list of the recent tracks listened to by this user. Also includes the currently playing track with the nowplaying="true" attribute if the user is currently listening.

Parameters:
user - The last.fm username to fetch the recent tracks of (Required).
limit - The number of results to fetch per page (Optional). Defaults to 50. Maximum is 200.
page - The page number to fetch (Optional). Defaults to first page.
from - Beginning timestamp of a range - only display scrobbles after this time, in UNIX timestamp format (integer number of seconds since 00:00:00, January 1st 1970 UTC) (Optional). This must be in the UTC time zone.
to - End timestamp of a range - only display scrobbles before this time, in UNIX timestamp format (integer number of seconds since 00:00:00, January 1st 1970 UTC) (Optional). This must be in the UTC time zone.

getAuthenticatedRecentTracks

public static AuthenticatedGetQuery<PaginatedResult<java.util.List<Track>>> getAuthenticatedRecentTracks(java.lang.String user,
                                                                                                         java.lang.Integer limit,
                                                                                                         java.lang.Integer page,
                                                                                                         java.lang.Integer from,
                                                                                                         java.lang.Integer to,
                                                                                                         java.lang.String sk)
Get a list of the recent tracks listened to by this user. Also includes the currently playing track with the nowplaying="true" attribute if the user is currently listening.

Parameters:
user - The last.fm username to fetch the recent tracks of (Required).
limit - The number of results to fetch per page (Optional). Defaults to 50. Maximum is 200.
page - The page number to fetch (Optional). Defaults to first page.
from - Beginning timestamp of a range - only display scrobbles after this time, in UNIX timestamp format (integer number of seconds since 00:00:00, January 1st 1970 UTC) (Optional). This must be in the UTC time zone.
to - End timestamp of a range - only display scrobbles before this time, in UNIX timestamp format (integer number of seconds since 00:00:00, January 1st 1970 UTC) (Optional). This must be in the UTC time zone.

getTopAlbums

public static UnauthenticatedGetQuery<PaginatedResult<java.util.List<Album>>> getTopAlbums(java.lang.String user,
                                                                                           Period period,
                                                                                           java.lang.Integer limit,
                                                                                           java.lang.Integer page)
Get the top albums listened to by a user. You can stipulate a time period. Sends the overall chart by default.

Parameters:
user - The user name to fetch top albums for (Required).
period - The time period over which to retrieve top albums for (Optional).
limit - The number of results to fetch per page (Optional). Defaults to 50.
page - The page number to fetch (Optional). Defaults to first page.
Returns:

getTopArtists

public static UnauthenticatedGetQuery<PaginatedResult<java.util.List<Artist>>> getTopArtists(java.lang.String user,
                                                                                             Period period,
                                                                                             java.lang.Integer limit,
                                                                                             java.lang.Integer page)
Get the top artists listened to by a user. You can stipulate a time period. Sends the overall chart by default.

Parameters:
user - The user name to fetch top artists for (Required).
period - The time period over which to retrieve top artists for (Optional).
limit - The number of results to fetch per page (Optional). Defaults to 50.
page - The page number to fetch (Optional). Defaults to first page.

getTopTracks

public static UnauthenticatedGetQuery<PaginatedResult<java.util.List<Track>>> getTopTracks(java.lang.String user,
                                                                                           Period period,
                                                                                           java.lang.Integer limit,
                                                                                           java.lang.Integer page)
Get the top tracks listened to by a user. You can stipulate a time period. Sends the overall chart by default.

Parameters:
user - The user name to fetch top tracks for (Required).
period - The time period over which to retrieve top tracks for (Optional).
limit - The number of results to fetch per page (Optional). Defaults to 50.
The - page number to fetch (Optional). Defaults to first page.


Copyright © 2013 dontdrinkandroot. All Rights Reserved.