Class SpotifyApiDispatch

java.lang.Object
org.localify.data.dispatch.SpotifyApiDispatch

@Component public class SpotifyApiDispatch extends Object
A service for dispatching Spotify API requests.
  • Constructor Details

    • SpotifyApiDispatch

      public SpotifyApiDispatch(ArtistRepository artistRepository, jakarta.persistence.EntityManager entityManager, SpotifyService spotifyService, SongRepository songRepository)
      Constructs a new SpotifyApiDispatch.
      Parameters:
      artistRepository - The artist repository.
      entityManager - The entity manager.
      spotifyService - The Spotify service.
      songRepository - The song repository.
  • Method Details

    • dispatchArtistsSpotifyApi

      public void dispatchArtistsSpotifyApi(List<Artist> artists)
      Dispatches a list of artists to be updated via the Spotify API.
      Parameters:
      artists - The list of artists to dispatch.
    • bulkDispatchArtistTracksSpotifyApi

      @Transactional public void bulkDispatchArtistTracksSpotifyApi(List<Artist> artists)
      Bulk dispatches artists to have their tracks updated via the Spotify API.
      Parameters:
      artists - The list of artists to dispatch.
    • dispatchTracksAcousticInformation

      @Transactional public void dispatchTracksAcousticInformation(List<Song> songs)
      Dispatches tracks to have their acoustic information updated via the Spotify API.
      Parameters:
      songs - The list of songs to dispatch.
    • queueArtistsUpdatedBefore

      public void queueArtistsUpdatedBefore(Instant time, int limit)
      Queues artists that were updated before a certain time.
      Parameters:
      time - The time to check against.
      limit - The maximum number of artists to queue.
    • queueArtistsBulk

      public void queueArtistsBulk(int limit)
      Queues all artists in the database for a bulk update.
      Parameters:
      limit - The maximum number of artists to queue.