net.dontdrinkandroot.lastfm.api.model

## Class User

- java.lang.Object
- - net.dontdrinkandroot.lastfm.api.model.LfmEntity
  - - net.dontdrinkandroot.lastfm.api.model.User

All Implemented Interfaces:
  Serializable, AgeEntity, BootstrapEntity, CountryEntity, Entity, GenderEntity, IdEntity, ImageEntity, MatchEntity, NameEntity, PlayCountEntity, RealnameEntity, RecentTrackEntity, ScrobbleSourceEntity, SubscriberEntity, UrlEntity, UserEntity

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

See Also:
  Serialized Form

### Field Summary

Fields
`static Map<ImageSize,URL>` `DEFAULT_IMAGES`

### Constructor Summary

Constructors
Constructor and Description
`User(Element element)` Create a user from a dom element.
`User(String name)`

### Method Summary

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

### Constructor Detail

#### User

    public User(String name)

#### User

    public User(Element element)

Create a user from a dom element.

Parameters:
  `element` - The dom element to convert.

### Method Detail

#### getId

    public final Long getId()

Specified by:
  `getId` in interface `IdEntity`

#### setId

    public final void setId(Long id)

Specified by:
  `setId` in interface `IdEntity`

#### getMatch

    public final Float getMatch()

Specified by:
  `getMatch` in interface `MatchEntity`

#### setMatch

    public final void setMatch(Float match)

Specified by:
  `setMatch` in interface `MatchEntity`

#### getName

    public final String getName()

Specified by:
  `getName` in interface `NameEntity`

#### setName

    public final void setName(String name)

Specified by:
  `setName` in interface `NameEntity`

#### setImages

    public final void setImages(Map<ImageSize,URL> images)

Specified by:
  `setImages` in interface `ImageEntity`

#### getImages

    public final Map<ImageSize,URL> getImages()

Specified by:
  `getImages` in interface `ImageEntity`

#### getRealname

    public final String getRealname()

Specified by:
  `getRealname` in interface `RealnameEntity`

#### setRealname

    public final void setRealname(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 URL getUrl()

Specified by:
  `getUrl` in interface `UrlEntity`

#### setUrl

    public final void setUrl(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 Integer getAge()

Specified by:
  `getAge` in interface `AgeEntity`

#### setAge

    public final void setAge(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(Boolean subscriber)

Specified by:
  `setSubscriber` in interface `SubscriberEntity`

#### isSubscriber

    public final Boolean isSubscriber()

Specified by:
  `isSubscriber` in interface `SubscriberEntity`

#### setNumPlaylists

    public final void setNumPlaylists(Integer numPlaylists)

#### getNumPlaylists

    public final Integer getNumPlaylists()

#### getPlayCount

    public final Integer getPlayCount()

Specified by:
  `getPlayCount` in interface `PlayCountEntity`

#### setPlayCount

    public final void setPlayCount(Integer playcount)

Specified by:
  `setPlayCount` in interface `PlayCountEntity`

#### isBootstrap

    public final Boolean isBootstrap()

Specified by:
  `isBootstrap` in interface `BootstrapEntity`

#### setBootstrap

    public final void setBootstrap(Boolean bootstrap)

Specified by:
  `setBootstrap` in interface `BootstrapEntity`

#### getRegistered

    public final Date getRegistered()

#### setRegistered

    public final void setRegistered(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 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 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 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 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 String toString()

Overrides:
  `toString` in class `Object`

#### hashCode

    public final int hashCode()

Based on the assumption that username is unique.

Overrides:
  `hashCode` in class `Object`

#### equals

    public final boolean equals(Object obj)

Based on the assumption that username is unique.

Overrides:
  `equals` in class `Object`

#### getArtistTracks

    public static UnauthenticatedGetQuery<GenericPaginatedResult<List<Track>>> getArtistTracks(String user,
                                                                               String artist,
                                                                               Long startTimestamp,
                                                                               Long endTimestamp,
                                                                               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<List<Track>>> getBannedTracks(String user,
                                                                               Integer limit,
                                                                               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<ArrayList<Event>> getEvents(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<List<User>>> getFriends(String user,
                                                                         Boolean recenttracks,
                                                                         Integer limit,
                                                                         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(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<ArrayList<User>> getNeighbours(String user,
                                                         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<List<Track>>> getRecentTracks(String user,
                                                                        Integer limit,
                                                                        Integer page,
                                                                        Integer from,
                                                                        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<List<Track>>> getAuthenticatedRecentTracks(String user,
                                                                                   Integer limit,
                                                                                   Integer page,
                                                                                   Integer from,
                                                                                   Integer to,
                                                                                   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<List<Album>>> getTopAlbums(String user,
                                                                     Period period,
                                                                     Integer limit,
                                                                     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<List<Artist>>> getTopArtists(String user,
                                                                       Period period,
                                                                       Integer limit,
                                                                       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<List<Track>>> getTopTracks(String user,
                                                                     Period period,
                                                                     Integer limit,
                                                                     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.