Search in sources :

Example 1 with User

use of com.wrapper.spotify.model_objects.specification.User in project data-transfer-project by google.

the class SpotifyPlaylistImporter method importItem.

@Override
public ImportResult importItem(UUID jobId, IdempotentImportExecutor idempotentExecutor, TokensAndUrlAuthData authData, PlaylistContainerResource data) throws Exception {
    spotifyApi.setAccessToken(authData.getAccessToken());
    spotifyApi.setRefreshToken(authData.getRefreshToken());
    User user = spotifyApi.getCurrentUsersProfile().build().execute();
    for (MusicPlaylist playlist : data.getLists()) {
        createPlaylist(idempotentExecutor, playlist, user.getId());
    }
    return ImportResult.OK;
}
Also used : User(com.wrapper.spotify.model_objects.specification.User) MusicPlaylist(org.datatransferproject.types.common.models.playlists.MusicPlaylist)

Example 2 with User

use of com.wrapper.spotify.model_objects.specification.User in project data-transfer-project by google.

the class SpotifyPlaylistExporter method export.

@Override
public ExportResult<PlaylistContainerResource> export(UUID jobId, TokensAndUrlAuthData authData, Optional<ExportInformation> exportInformation) throws Exception {
    spotifyApi.setAccessToken(authData.getAccessToken());
    spotifyApi.setRefreshToken(authData.getRefreshToken());
    User user = spotifyApi.getCurrentUsersProfile().build().execute();
    return new ExportResult<>(ResultType.END, enumeratePlaylists(user.getId()));
}
Also used : User(com.wrapper.spotify.model_objects.specification.User) ExportResult(org.datatransferproject.spi.transfer.provider.ExportResult)

Aggregations

User (com.wrapper.spotify.model_objects.specification.User)2 ExportResult (org.datatransferproject.spi.transfer.provider.ExportResult)1 MusicPlaylist (org.datatransferproject.types.common.models.playlists.MusicPlaylist)1