use of se.michaelthelin.spotify.exceptions.SpotifyWebApiException in project spotify-web-api-java by spotify-web-api-java.
the class AuthorizationCodeRefreshExample method authorizationCodeRefresh_Sync.
public static void authorizationCodeRefresh_Sync() {
try {
final AuthorizationCodeCredentials authorizationCodeCredentials = authorizationCodeRefreshRequest.execute();
// Set access and refresh token for further "spotifyApi" object usage
spotifyApi.setAccessToken(authorizationCodeCredentials.getAccessToken());
System.out.println("Expires in: " + authorizationCodeCredentials.getExpiresIn());
} catch (IOException | SpotifyWebApiException | ParseException e) {
System.out.println("Error: " + e.getMessage());
}
}
use of se.michaelthelin.spotify.exceptions.SpotifyWebApiException in project spotify-web-api-java by spotify-web-api-java.
the class GetArtistExample method getArtist_Sync.
public static void getArtist_Sync() {
try {
final Artist artist = getArtistRequest.execute();
System.out.println("Name: " + artist.getName());
} catch (IOException | SpotifyWebApiException | ParseException e) {
System.out.println("Error: " + e.getMessage());
}
}
use of se.michaelthelin.spotify.exceptions.SpotifyWebApiException in project spotify-web-api-java by spotify-web-api-java.
the class GetInformationAboutUsersCurrentPlaybackExample method getInformationAboutUsersCurrentPlayback_Sync.
public static void getInformationAboutUsersCurrentPlayback_Sync() {
try {
final CurrentlyPlayingContext currentlyPlayingContext = getInformationAboutUsersCurrentPlaybackRequest.execute();
System.out.println("Timestamp: " + currentlyPlayingContext.getTimestamp());
} catch (IOException | SpotifyWebApiException | ParseException e) {
System.out.println("Error: " + e.getMessage());
}
}
use of se.michaelthelin.spotify.exceptions.SpotifyWebApiException in project spotify-web-api-java by spotify-web-api-java.
the class AddItemsToPlaylistExample method addItemsToPlaylist_Sync.
public static void addItemsToPlaylist_Sync() {
try {
final SnapshotResult snapshotResult = addItemsToPlaylistRequest.execute();
System.out.println("Snapshot ID: " + snapshotResult.getSnapshotId());
} catch (IOException | SpotifyWebApiException | ParseException e) {
System.out.println("Error: " + e.getMessage());
}
}
use of se.michaelthelin.spotify.exceptions.SpotifyWebApiException in project spotify-web-api-java by spotify-web-api-java.
the class CreatePlaylistExample method createPlaylist_Sync.
public static void createPlaylist_Sync() {
try {
final Playlist playlist = createPlaylistRequest.execute();
System.out.println("Name: " + playlist.getName());
} catch (IOException | SpotifyWebApiException | ParseException e) {
System.out.println("Error: " + e.getMessage());
}
}
Aggregations