Package org.localify.auth.dto.web
Class SpotifyUserDetails
java.lang.Object
org.localify.auth.dto.web.SpotifyUserDetails
- All Implemented Interfaces:
Serializable
Represents the user details obtained from Spotify.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic SpotifyUserDetailsfromSpotifyUser(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.Gets the access token.Gets the expiration time of the access token.Gets the URL of the user's avatar.Gets the user's country.Gets the user's display name.getEmail()Gets the user's email.getId()Gets the user's Spotify ID.static StringgetLargestImage(se.michaelthelin.spotify.model_objects.specification.Image[] images) Gets the URL of the largest image from an array of images.Gets the refresh token.setAccessToken(String accessToken) Sets the access token.voidsetAccessTokenExpireTime(Instant accessTokenExpireTime) Sets the expiration time of the access token.setAvatarUrl(String avatarUrl) Sets the URL of the user's avatar.setCountry(String country) Sets the user's country.setDisplayName(String displayName) Sets the user's display name.Sets the user's email.Sets the user's Spotify ID.setRefreshToken(String refreshToken) Sets the refresh token.
-
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
Gets the user's Spotify ID.- Returns:
- The Spotify ID.
-
setId
Sets the user's Spotify ID.- Parameters:
id- The Spotify ID.- Returns:
- This SpotifyUserDetails instance.
-
getAccessTokenExpireTime
Gets the expiration time of the access token.- Returns:
- The expiration time.
-
setAccessTokenExpireTime
Sets the expiration time of the access token.- Parameters:
accessTokenExpireTime- The expiration time.
-
getAccessToken
Gets the access token.- Returns:
- The access token.
-
setAccessToken
Sets the access token.- Parameters:
accessToken- The access token.- Returns:
- This SpotifyUserDetails instance.
-
getRefreshToken
Gets the refresh token.- Returns:
- The refresh token.
-
setRefreshToken
Sets the refresh token.- Parameters:
refreshToken- The refresh token.- Returns:
- This SpotifyUserDetails instance.
-
getAvatarUrl
Gets the URL of the user's avatar.- Returns:
- The avatar URL.
-
setAvatarUrl
Sets the URL of the user's avatar.- Parameters:
avatarUrl- The avatar URL.- Returns:
- This SpotifyUserDetails instance.
-
getCountry
Gets the user's country.- Returns:
- The country.
-
setCountry
Sets the user's country.- Parameters:
country- The country.- Returns:
- This SpotifyUserDetails instance.
-
getEmail
Gets the user's email.- Returns:
- The email.
-
setEmail
Sets the user's email.- Parameters:
email- The email.- Returns:
- This SpotifyUserDetails instance.
-
getDisplayName
Gets the user's display name.- Returns:
- The display name.
-
setDisplayName
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.
-