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;
}
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()));
}
Aggregations