Package org.localify.data
Class AppleMusicService
java.lang.Object
org.localify.data.AppleMusicService
Service for interacting with the Apple Music API.
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe HTML page for the Apple Music login flow.static byte[]A byte array representing a pending authentication state.static byte[]A byte array representing a pending login state. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateMusicEnrollmentToken(UUID userId) Creates a music enrollment token for a user.voidProcesses an artist, matching them with an Apple Music artist if possible.Gets the Apple developer token.List<org.localify.applemusic.dto.artist.Artist>getArtistsForName(String name) Gets a list of artists for a given name.getAttemptData(String correlationToken) Gets the data for an Apple Music request attempt.musicEnrollmentRedirect(UUID uuid, String redirect) Creates a redirect URI for the music enrollment flow.voidsaveUserMusicToken(String correlationKey, String token) Saves a user's Apple Music token.
-
Field Details
-
pendingAuthState
public static byte[] pendingAuthStateA byte array representing a pending authentication state. -
pendingLoginState
public static byte[] pendingLoginStateA byte array representing a pending login state. -
loginPage
The HTML page for the Apple Music login flow.
-
-
Constructor Details
-
AppleMusicService
public AppleMusicService()
-
-
Method Details
-
createMusicEnrollmentToken
Creates a music enrollment token for a user.- Parameters:
userId- The ID of the user.- Returns:
- The enrollment token.
-
musicEnrollmentRedirect
Creates a redirect URI for the music enrollment flow.- Parameters:
uuid- The ID of the user.redirect- The redirect URL.- Returns:
- The redirect URI.
-
getAttemptData
Gets the data for an Apple Music request attempt.- Parameters:
correlationToken- The correlation token.- Returns:
- The request attempt data.
-
saveUserMusicToken
Saves a user's Apple Music token.- Parameters:
correlationKey- The correlation key.token- The user's music token.
-
getAppleDevToken
Gets the Apple developer token.- Returns:
- The developer token.
-
getArtistsForName
Gets a list of artists for a given name.- Parameters:
name- The name of the artist.- Returns:
- A list of artists.
-
doProcessArtist
Processes an artist, matching them with an Apple Music artist if possible. This method is transactional and requires a new transaction.- Parameters:
x- The artist to process.
-