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

The following examples show how to use kaaes.spotify.webapi.android.models.TracksPager. 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 spotify-web-api-android with MIT License 6 votes vote down vote up
private void getData(String query, int offset, final int limit, final CompleteListener listener) {

        Map<String, Object> options = new HashMap<>();
        options.put(SpotifyService.OFFSET, offset);
        options.put(SpotifyService.LIMIT, limit);

        mSpotifyApi.searchTracks(query, options, new SpotifyCallback<TracksPager>() {
            @Override
            public void success(TracksPager tracksPager, Response response) {
                listener.onComplete(tracksPager.tracks.items);
            }

            @Override
            public void failure(SpotifyError error) {
                listener.onError(error);
            }
        });
    }
 
Example #2
Source File: SearchPager.java    From android-spotify-demo with MIT License 5 votes vote down vote up
private void getData(String query, final CompleteListener listener){

        spotifyService.searchTracks(query, new SpotifyCallback<TracksPager>() {
            @Override
            public void failure(SpotifyError spotifyError) {
                listener.onError(spotifyError);
            }

            @Override
            public void success(TracksPager tracksPager, Response response) {
                listener.onComplete(tracksPager.tracks.items);
            }
        });
    }
 
Example #3
Source File: SpotifyServiceTest.java    From spotify-web-api-android with MIT License 5 votes vote down vote up
@Test
public void shouldGetSearchedTracks() throws IOException {
    String body = TestUtils.readTestData("search-track.json");
    TracksPager fixture = mGson.fromJson(body, TracksPager.class);

    Response response = TestUtils.getResponseFromModel(fixture, TracksPager.class);
    when(mMockClient.execute(isA(Request.class))).thenReturn(response);

    TracksPager tracks = mSpotifyService.searchTracks("Christmas");
    compareJSONWithoutNulls(body, tracks);
}
 
Example #4
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 #5
Source File: SpotifyService.java    From spotify-web-api-android with MIT License 2 votes vote down vote up
/**
 * Get Spotify catalog information about tracks that match a keyword string.
 *
 * @param q        The search query's keywords (and optional field filters and operators), for example "roadhouse+blues"
 * @param callback Callback method.
 * @see <a href="https://developer.spotify.com/web-api/search-item/">Search for an Item</a>
 */
@GET("/search?type=track")
void searchTracks(@Query("q") String q, Callback<TracksPager> callback);
 
Example #6
Source File: SpotifyService.java    From spotify-web-api-android with MIT License 2 votes vote down vote up
/**
 * Get Spotify catalog information about tracks that match a keyword string.
 *
 * @param q The search query's keywords (and optional field filters and operators), for example "roadhouse+blues"
 * @return A paginated list of results
 * @see <a href="https://developer.spotify.com/web-api/search-item/">Search for an Item</a>
 */
@GET("/search?type=track")
TracksPager searchTracks(@Query("q") String q);
 
Example #7
Source File: SpotifyService.java    From spotify-web-api-android with MIT License 2 votes vote down vote up
/**
 * Get Spotify catalog information about tracks that match a keyword string.
 *
 * @param q        The search query's keywords (and optional field filters and operators), for example "roadhouse+blues"
 * @param options  Optional parameters. For list of supported parameters see
 *                 <a href="https://developer.spotify.com/web-api/search-item/">endpoint documentation</a>
 * @param callback Callback method.
 * @see <a href="https://developer.spotify.com/web-api/search-item/">Search for an Item</a>
 */
@GET("/search?type=track")
void searchTracks(@Query("q") String q, @QueryMap Map<String, Object> options, Callback<TracksPager> callback);
 
Example #8
Source File: SpotifyService.java    From spotify-web-api-android with MIT License 2 votes vote down vote up
/**
 * Get Spotify catalog information about tracks that match a keyword string.
 *
 * @param q       The search query's keywords (and optional field filters and operators), for example "roadhouse+blues"
 * @param options Optional parameters. For list of supported parameters see
 *                <a href="https://developer.spotify.com/web-api/search-item/">endpoint documentation</a>
 * @return A paginated list of results
 * @see <a href="https://developer.spotify.com/web-api/search-item/">Search for an Item</a>
 */
@GET("/search?type=track")
TracksPager searchTracks(@Query("q") String q, @QueryMap Map<String, Object> options);