kaaes.spotify.webapi.android.models.FeaturedPlaylists Java Examples

The following examples show how to use kaaes.spotify.webapi.android.models.FeaturedPlaylists. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SearchPager.java    From android-spotify-demo with MIT License 6 votes vote down vote up
public void getFeatured(){

        spotifyService.getFeaturedPlaylists(new SpotifyCallback<FeaturedPlaylists>() {
            @Override
            public void failure(SpotifyError spotifyError) {
                Log.d("SearchPager", spotifyError.toString());
            }

            @Override
            public void success(FeaturedPlaylists featuredPlaylists, Response response) {
                List<PlaylistSimple> mlist = featuredPlaylists.playlists.items;

                for(PlaylistSimple simple : mlist)
                {
                    Log.d("SearchPager Simple", simple.name);
                    Log.d("SearchPager Simple", simple.images.get(0).url);

                    ListManager.getInstance().addSimpleList(new SimplePlaylist(simple.name, simple.images.get(0).url));
                }
            }
        });
    }
 
Example #2
Source File: SpotifyServiceTest.java    From spotify-web-api-android with MIT License 5 votes vote down vote up
@Test
public void shouldGetFeaturedPlaylists() throws IOException {
    final String countryId = "SE";
    final String locale = "sv_SE";
    final int limit = 5;

    String body = TestUtils.readTestData("featured-playlists.json");
    FeaturedPlaylists fixture = mGson.fromJson(body, FeaturedPlaylists.class);

    Response response = TestUtils.getResponseFromModel(fixture, FeaturedPlaylists.class);

    when(mMockClient.execute(argThat(new ArgumentMatcher<Request>() {
        @Override
        public boolean matches(Object argument) {

            try {
                return ((Request) argument).getUrl().contains("limit=" + limit) &&
                        ((Request) argument).getUrl().contains("country=" + URLEncoder.encode(countryId, "UTF-8")) &&
                        ((Request) argument).getUrl().contains("locale=" + URLEncoder.encode(locale, "UTF-8"));
            } catch (UnsupportedEncodingException e) {
                return false;
            }
        }
    }))).thenReturn(response);

    HashMap<String, Object> map = new HashMap<String, Object>();
    map.put(SpotifyService.COUNTRY, countryId);
    map.put(SpotifyService.LOCALE, locale);
    map.put(SpotifyService.OFFSET, 0);
    map.put(SpotifyService.LIMIT, limit);

    FeaturedPlaylists featuredPlaylists = mSpotifyService.getFeaturedPlaylists(map);

    this.compareJSONWithoutNulls(body, featuredPlaylists);
}
 
Example #3
Source File: ParcelableModelsTest.java    From spotify-web-api-android with MIT License 4 votes vote down vote up
ArrayList<Class<? extends Parcelable>> getModelClasses() {
    return Lists.newArrayList(
            Album.class,
            Albums.class,
            AlbumSimple.class,
            AlbumsPager.class,
            Artist.class,
            Artists.class,
            ArtistSimple.class,
            ArtistsPager.class,
            AudioFeaturesTrack.class,
            AudioFeaturesTracks.class,
            CategoriesPager.class,
            Category.class,
            Copyright.class,
            ErrorDetails.class,
            ErrorResponse.class,
            FeaturedPlaylists.class,
            Followers.class,
            Image.class,
            LinkedTrack.class,
            NewReleases.class,
            Playlist.class,
            PlaylistFollowPrivacy.class,
            PlaylistSimple.class,
            PlaylistsPager.class,
            PlaylistTrack.class,
            PlaylistTracksInformation.class,
            Recommendations.class,
            Result.class,
            Seed.class,
            SeedsGenres.class,
            SavedTrack.class,
            SnapshotId.class,
            Track.class,
            Tracks.class,
            TrackSimple.class,
            TracksPager.class,
            TrackToRemove.class,
            TrackToRemoveWithPosition.class,
            TracksToRemove.class,
            TracksToRemoveWithPosition.class,
            UserPrivate.class,
            UserPublic.class
    );
}
 
Example #4
Source File: SpotifyService.java    From spotify-web-api-android with MIT License 2 votes vote down vote up
/**
 * Get a list of Spotify featured playlists (shown, for example, on a Spotify player’s “Browse” tab).
 *
 * @param callback Callback method
 * @see <a href="https://developer.spotify.com/web-api/get-list-featured-playlists/">Get a List of Featured Playlists</a>
 */
@GET("/browse/featured-playlists")
void getFeaturedPlaylists(Callback<FeaturedPlaylists> callback);
 
Example #5
Source File: SpotifyService.java    From spotify-web-api-android with MIT License 2 votes vote down vote up
/**
 * Get a list of Spotify featured playlists (shown, for example, on a Spotify player’s “Browse” tab).
 *
 * @return A FeaturedPlaylists object with the featured playlists
 * @see <a href="https://developer.spotify.com/web-api/get-list-featured-playlists/">Get a List of Featured Playlists</a>
 */
@GET("/browse/featured-playlists")
FeaturedPlaylists getFeaturedPlaylists();
 
Example #6
Source File: SpotifyService.java    From spotify-web-api-android with MIT License 2 votes vote down vote up
/**
 * Get a list of Spotify featured playlists (shown, for example, on a Spotify player’s “Browse” tab).
 *
 * @param options  Optional parameters. For list of supported parameters see
 *                 <a href="https://developer.spotify.com/web-api/get-list-featured-playlists/">endpoint documentation</a>
 * @param callback Callback method
 * @see <a href="https://developer.spotify.com/web-api/get-list-featured-playlists/">Get a List of Featured Playlists</a>
 */
@GET("/browse/featured-playlists")
void getFeaturedPlaylists(@QueryMap Map<String, Object> options, Callback<FeaturedPlaylists> callback);
 
Example #7
Source File: SpotifyService.java    From spotify-web-api-android with MIT License 2 votes vote down vote up
/**
 * Get a list of Spotify featured playlists (shown, for example, on a Spotify player’s “Browse” tab).
 *
 * @param options Optional parameters. For list of supported parameters see
 *                <a href="https://developer.spotify.com/web-api/get-list-featured-playlists/">endpoint documentation</a>
 * @return n FeaturedPlaylists object with the featured playlists
 * @see <a href="https://developer.spotify.com/web-api/get-list-featured-playlists/">Get a List of Featured Playlists</a>
 */
@GET("/browse/featured-playlists")
FeaturedPlaylists getFeaturedPlaylists(@QueryMap Map<String, Object> options);