Class AppleMusicService

java.lang.Object
org.localify.data.AppleMusicService

@Service @Transactional public class AppleMusicService extends Object
Service for interacting with the Apple Music API.
  • Field Details

    • pendingAuthState

      public static byte[] pendingAuthState
      A byte array representing a pending authentication state.
    • pendingLoginState

      public static byte[] pendingLoginState
      A byte array representing a pending login state.
    • loginPage

      public String loginPage
      The HTML page for the Apple Music login flow.
  • Constructor Details

    • AppleMusicService

      public AppleMusicService()
  • Method Details

    • createMusicEnrollmentToken

      @Transactional public String createMusicEnrollmentToken(UUID userId)
      Creates a music enrollment token for a user.
      Parameters:
      userId - The ID of the user.
      Returns:
      The enrollment token.
    • musicEnrollmentRedirect

      public URI musicEnrollmentRedirect(UUID uuid, String redirect)
      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

      public AppleMusicRequestAttempt getAttemptData(String correlationToken)
      Gets the data for an Apple Music request attempt.
      Parameters:
      correlationToken - The correlation token.
      Returns:
      The request attempt data.
    • saveUserMusicToken

      public void saveUserMusicToken(String correlationKey, String token)
      Saves a user's Apple Music token.
      Parameters:
      correlationKey - The correlation key.
      token - The user's music token.
    • getAppleDevToken

      public String getAppleDevToken()
      Gets the Apple developer token.
      Returns:
      The developer token.
    • getArtistsForName

      public List<org.localify.applemusic.dto.artist.Artist> getArtistsForName(String name)
      Gets a list of artists for a given name.
      Parameters:
      name - The name of the artist.
      Returns:
      A list of artists.
    • doProcessArtist

      @Transactional(propagation=REQUIRES_NEW) public void doProcessArtist(Artist x)
      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.