use of se.michaelthelin.spotify.exceptions.SpotifyWebApiException in project spotify-web-api-java by spotify-web-api-java.
the class AuthorizationCodePKCERefreshExample method authorizationCodeRefresh_Sync.
public static void authorizationCodeRefresh_Sync() {
try {
final AuthorizationCodeCredentials authorizationCodeCredentials = authorizationCodePKCERefreshRequest.execute();
// Set access and refresh token for further "spotifyApi" object usage
spotifyApi.setAccessToken(authorizationCodeCredentials.getAccessToken());
spotifyApi.setRefreshToken(authorizationCodeCredentials.getRefreshToken());
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 ClientCredentialsExample method clientCredentials_Sync.
public static void clientCredentials_Sync() {
try {
final ClientCredentials clientCredentials = clientCredentialsRequest.execute();
// Set access token for further "spotifyApi" object usage
spotifyApi.setAccessToken(clientCredentials.getAccessToken());
System.out.println("Expires in: " + clientCredentials.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 GetUsersCurrentlyPlayingTrackExample method getUsersCurrentlyPlayingTrack_Sync.
public static void getUsersCurrentlyPlayingTrack_Sync() {
try {
final CurrentlyPlaying currentlyPlaying = getUsersCurrentlyPlayingTrackRequest.execute();
System.out.println("Timestamp: " + currentlyPlaying.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 GetShowExample method getShow_Sync.
public static void getShow_Sync() {
try {
final Show show = getShowRequest.execute();
System.out.println("Name: " + show.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 ReorderPlaylistsItemsExample method reorderPlaylistsItems_Sync.
public static void reorderPlaylistsItems_Sync() {
try {
final SnapshotResult snapshotResult = reorderPlaylistsItemsRequest.execute();
System.out.println("Snapshot ID: " + snapshotResult.getSnapshotId());
} catch (IOException | SpotifyWebApiException | ParseException e) {
System.out.println("Error: " + e.getMessage());
}
}
Aggregations