Class SpotifyUserDetails

java.lang.Object
org.localify.auth.dto.web.SpotifyUserDetails
All Implemented Interfaces:
Serializable

public class SpotifyUserDetails extends Object implements Serializable
Represents the user details obtained from Spotify.
See Also:
  • Constructor Details

    • SpotifyUserDetails

      public SpotifyUserDetails(String id, String accessToken, String refreshToken, String avatarUrl, String country, String email, String displayName, Instant accessTokenExpireTime)
      Constructs a new SpotifyUserDetails.
      Parameters:
      id - The user's Spotify ID.
      accessToken - The access token.
      refreshToken - The refresh token.
      avatarUrl - The URL of the user's avatar.
      country - The user's country.
      email - The user's email.
      displayName - The user's display name.
      accessTokenExpireTime - The expiration time of the access token.
    • SpotifyUserDetails

      public SpotifyUserDetails()
      Default constructor.
  • Method Details

    • getId

      public String getId()
      Gets the user's Spotify ID.
      Returns:
      The Spotify ID.
    • setId

      public SpotifyUserDetails setId(String id)
      Sets the user's Spotify ID.
      Parameters:
      id - The Spotify ID.
      Returns:
      This SpotifyUserDetails instance.
    • getAccessTokenExpireTime

      public Instant getAccessTokenExpireTime()
      Gets the expiration time of the access token.
      Returns:
      The expiration time.
    • setAccessTokenExpireTime

      public void setAccessTokenExpireTime(Instant accessTokenExpireTime)
      Sets the expiration time of the access token.
      Parameters:
      accessTokenExpireTime - The expiration time.
    • getAccessToken

      public String getAccessToken()
      Gets the access token.
      Returns:
      The access token.
    • setAccessToken

      public SpotifyUserDetails setAccessToken(String accessToken)
      Sets the access token.
      Parameters:
      accessToken - The access token.
      Returns:
      This SpotifyUserDetails instance.
    • getRefreshToken

      public String getRefreshToken()
      Gets the refresh token.
      Returns:
      The refresh token.
    • setRefreshToken

      public SpotifyUserDetails setRefreshToken(String refreshToken)
      Sets the refresh token.
      Parameters:
      refreshToken - The refresh token.
      Returns:
      This SpotifyUserDetails instance.
    • getAvatarUrl

      public String getAvatarUrl()
      Gets the URL of the user's avatar.
      Returns:
      The avatar URL.
    • setAvatarUrl

      public SpotifyUserDetails setAvatarUrl(String avatarUrl)
      Sets the URL of the user's avatar.
      Parameters:
      avatarUrl - The avatar URL.
      Returns:
      This SpotifyUserDetails instance.
    • getCountry

      public String getCountry()
      Gets the user's country.
      Returns:
      The country.
    • setCountry

      public SpotifyUserDetails setCountry(String country)
      Sets the user's country.
      Parameters:
      country - The country.
      Returns:
      This SpotifyUserDetails instance.
    • getEmail

      public String getEmail()
      Gets the user's email.
      Returns:
      The email.
    • setEmail

      public SpotifyUserDetails setEmail(String email)
      Sets the user's email.
      Parameters:
      email - The email.
      Returns:
      This SpotifyUserDetails instance.
    • getDisplayName

      public String getDisplayName()
      Gets the user's display name.
      Returns:
      The display name.
    • setDisplayName

      public SpotifyUserDetails setDisplayName(String displayName)
      Sets the user's display name.
      Parameters:
      displayName - The display name.
      Returns:
      This SpotifyUserDetails instance.
    • fromSpotifyUser

      public static SpotifyUserDetails fromSpotifyUser(se.michaelthelin.spotify.model_objects.specification.User usr, se.michaelthelin.spotify.model_objects.credentials.AuthorizationCodeCredentials creds)
      Creates a SpotifyUserDetails object from a Spotify User object and AuthorizationCodeCredentials.
      Parameters:
      usr - The Spotify User object.
      creds - The AuthorizationCodeCredentials.
      Returns:
      A new SpotifyUserDetails object.
    • getLargestImage

      public static String getLargestImage(se.michaelthelin.spotify.model_objects.specification.Image[] images)
      Gets the URL of the largest image from an array of images.
      Parameters:
      images - The array of images.
      Returns:
      The URL of the largest image, or null if the array is empty.