Search in sources :

Example 16 with ParseException

use of org.apache.hc.core5.http.ParseException 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());
    }
}
Also used : CurrentlyPlayingContext(se.michaelthelin.spotify.model_objects.miscellaneous.CurrentlyPlayingContext) IOException(java.io.IOException) ParseException(org.apache.hc.core5.http.ParseException) SpotifyWebApiException(se.michaelthelin.spotify.exceptions.SpotifyWebApiException)

Example 17 with ParseException

use of org.apache.hc.core5.http.ParseException 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());
    }
}
Also used : SnapshotResult(se.michaelthelin.spotify.model_objects.special.SnapshotResult) IOException(java.io.IOException) ParseException(org.apache.hc.core5.http.ParseException) SpotifyWebApiException(se.michaelthelin.spotify.exceptions.SpotifyWebApiException)

Example 18 with ParseException

use of org.apache.hc.core5.http.ParseException 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());
    }
}
Also used : Playlist(se.michaelthelin.spotify.model_objects.specification.Playlist) IOException(java.io.IOException) ParseException(org.apache.hc.core5.http.ParseException) SpotifyWebApiException(se.michaelthelin.spotify.exceptions.SpotifyWebApiException)

Example 19 with ParseException

use of org.apache.hc.core5.http.ParseException in project spotify-web-api-java by spotify-web-api-java.

the class GetListOfFeaturedPlaylistsExample method getListOfFeaturedPlaylists_Sync.

public static void getListOfFeaturedPlaylists_Sync() {
    try {
        final FeaturedPlaylists featuredPlaylists = getListOfFeaturedPlaylistsRequest.execute();
        System.out.println("Message: " + featuredPlaylists.getMessage());
    } catch (IOException | SpotifyWebApiException | ParseException e) {
        System.out.println("Error: " + e.getMessage());
    }
}
Also used : FeaturedPlaylists(se.michaelthelin.spotify.model_objects.special.FeaturedPlaylists) IOException(java.io.IOException) ParseException(org.apache.hc.core5.http.ParseException) SpotifyWebApiException(se.michaelthelin.spotify.exceptions.SpotifyWebApiException)

Example 20 with ParseException

use of org.apache.hc.core5.http.ParseException in project spotify-web-api-java by spotify-web-api-java.

the class GetRecommendationsExample method getRecommendations_Sync.

public static void getRecommendations_Sync() {
    try {
        final Recommendations recommendations = getRecommendationsRequest.execute();
        System.out.println("Length: " + recommendations.getTracks().length);
    } catch (IOException | SpotifyWebApiException | ParseException e) {
        System.out.println("Error: " + e.getMessage());
    }
}
Also used : Recommendations(se.michaelthelin.spotify.model_objects.specification.Recommendations) IOException(java.io.IOException) ParseException(org.apache.hc.core5.http.ParseException) SpotifyWebApiException(se.michaelthelin.spotify.exceptions.SpotifyWebApiException)

Aggregations

ParseException (org.apache.hc.core5.http.ParseException)62 IOException (java.io.IOException)54 SpotifyWebApiException (se.michaelthelin.spotify.exceptions.SpotifyWebApiException)33 CloseableHttpResponse (org.apache.hc.client5.http.impl.classic.CloseableHttpResponse)24 HttpPost (org.apache.hc.client5.http.classic.methods.HttpPost)13 HttpGet (org.apache.hc.client5.http.classic.methods.HttpGet)12 CloseableHttpClient (org.apache.hc.client5.http.impl.classic.CloseableHttpClient)11 HttpEntity (org.apache.hc.core5.http.HttpEntity)10 HashMap (java.util.HashMap)8 Map (java.util.Map)6 StringEntity (org.apache.hc.core5.http.io.entity.StringEntity)6 BasicNameValuePair (org.apache.hc.core5.http.message.BasicNameValuePair)6 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)5 ArrayList (java.util.ArrayList)5 ClassicHttpResponse (org.apache.hc.core5.http.ClassicHttpResponse)5 Matcher (java.util.regex.Matcher)4 UrlEncodedFormEntity (org.apache.hc.client5.http.entity.UrlEncodedFormEntity)4 AuthorizationCodeCredentials (se.michaelthelin.spotify.model_objects.credentials.AuthorizationCodeCredentials)4 AudioTrack (com.sedmelluq.discord.lavaplayer.track.AudioTrack)3 List (java.util.List)3