kaaes.spotify.webapi.android.models.Album Java Examples
The following examples show how to use
kaaes.spotify.webapi.android.models.Album.
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: SpotifyServiceTest.java From spotify-web-api-android with MIT License | 6 votes |
@Test public void shouldGetArtistsAlbumsData() throws IOException { Type modelType = new TypeToken<Pager<Album>>() { }.getType(); String artistId = "1vCWHaC5f2uS3yhpwWbIA6"; String body = TestUtils.readTestData("artist-album.json"); Pager<Album> fixture = mGson.fromJson(body, modelType); Response response = TestUtils.getResponseFromModel(fixture, modelType); when(mMockClient.execute(argThat(new MatchesId(artistId)))).thenReturn(response); Pager<Album> albums = mSpotifyService.getArtistAlbums(artistId); this.compareJSONWithoutNulls(body, albums); }
Example #2
Source File: AlbumListData.java From Pasta-for-Spotify with Apache License 2.0 | 5 votes |
public AlbumListData(Album album) { albumName = album.name; albumId = album.id; albumDate = album.release_date; albumImage = album.images.get(1).url; albumImageLarge = album.images.get(0).url; artists = new ArrayList<>(); for (ArtistSimple artist : album.artists) { artists.add(new ArtistListData(artist)); } tracks = album.tracks.items.size(); }
Example #3
Source File: Pasta.java From Pasta-for-Spotify with Apache License 2.0 | 5 votes |
@Nullable public AlbumListData getAlbum(String id) throws InterruptedException { Album album = null; for (int i = 0; album == null && i < PreferenceUtils.getRetryCount(this); i++) { try { album = spotifyService.getAlbum(id); } catch (Exception e) { e.printStackTrace(); if (StaticUtils.shouldResendRequest(e)) Thread.sleep(200); else break; } } if (album == null) return null; else return new AlbumListData(album); }
Example #4
Source File: SpotifyServiceAndroidTest.java From spotify-web-api-android with MIT License | 5 votes |
@Test public void getAlbum() throws Exception { Album payload = mService.getAlbum("4Mewe6A62ZpJKmVzcaOixy"); Request request = new Request.Builder() .get() .url("https://api.spotify.com/v1/albums/4Mewe6A62ZpJKmVzcaOixy") .build(); Response response = mClient.newCall(request).execute(); assertEquals(200, response.code()); assertThat(payload, JsonEquals.jsonEquals(response.body().string())); }
Example #5
Source File: SpotifyServiceTest.java From spotify-web-api-android with MIT License | 5 votes |
@Test public void shouldGetAlbumData() throws IOException { String body = TestUtils.readTestData("album.json"); Album fixture = mGson.fromJson(body, Album.class); Response response = TestUtils.getResponseFromModel(fixture, Album.class); when(mMockClient.execute(argThat(new MatchesId(fixture.id)))).thenReturn(response); Album album = mSpotifyService.getAlbum(fixture.id); this.compareJSONWithoutNulls(body, album); }
Example #6
Source File: ParcelableModelsTest.java From spotify-web-api-android with MIT License | 4 votes |
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 #7
Source File: SpotifyService.java From spotify-web-api-android with MIT License | 2 votes |
/** * Get Spotify catalog information for a single album. * * @param albumId The Spotify ID for the album. * @param callback Callback method * @see <a href="https://developer.spotify.com/web-api/get-album/">Get an Album</a> */ @GET("/albums/{id}") void getAlbum(@Path("id") String albumId, Callback<Album> callback);
Example #8
Source File: SpotifyService.java From spotify-web-api-android with MIT License | 2 votes |
/** * Get Spotify catalog information for a single album. * * @param albumId The Spotify ID for the album. * @return Requested album information * @see <a href="https://developer.spotify.com/web-api/get-album/">Get an Album</a> */ @GET("/albums/{id}") Album getAlbum(@Path("id") String albumId);
Example #9
Source File: SpotifyService.java From spotify-web-api-android with MIT License | 2 votes |
/** * Get Spotify catalog information for a single album. * * @param albumId The Spotify ID for the album. * @param options Optional parameters. For list of supported parameters see * <a href="https://developer.spotify.com/web-api/get-album/">endpoint documentation</a> * @param callback Callback method * @see <a href="https://developer.spotify.com/web-api/get-album/">Get an Album</a> */ @GET("/albums/{id}") void getAlbum(@Path("id") String albumId, @QueryMap Map<String, Object> options, Callback<Album> callback);
Example #10
Source File: SpotifyService.java From spotify-web-api-android with MIT License | 2 votes |
/** * Get Spotify catalog information for a single album. * * @param albumId The Spotify ID for the album. * @param options Optional parameters. For list of supported parameters see * <a href="https://developer.spotify.com/web-api/get-album/">endpoint documentation</a> * @return Requested album information * @see <a href="https://developer.spotify.com/web-api/get-album/">Get an Album</a> */ @GET("/albums/{id}") Album getAlbum(@Path("id") String albumId, @QueryMap Map<String, Object> options);
Example #11
Source File: SpotifyService.java From spotify-web-api-android with MIT License | 2 votes |
/** * Get Spotify catalog information about an artist’s albums. * * @param artistId The Spotify ID for the artist. * @param callback Callback method * @see <a href="https://developer.spotify.com/web-api/get-artists-albums/">Get an Artist's Albums</a> */ @GET("/artists/{id}/albums") void getArtistAlbums(@Path("id") String artistId, Callback<Pager<Album>> callback);
Example #12
Source File: SpotifyService.java From spotify-web-api-android with MIT License | 2 votes |
/** * Get Spotify catalog information about an artist’s albums. * * @param artistId The Spotify ID for the artist. * @return An array of simplified album objects wrapped in a paging object. * @see <a href="https://developer.spotify.com/web-api/get-artists-albums/">Get an Artist's Albums</a> */ @GET("/artists/{id}/albums") Pager<Album> getArtistAlbums(@Path("id") String artistId);
Example #13
Source File: SpotifyService.java From spotify-web-api-android with MIT License | 2 votes |
/** * Get Spotify catalog information about an artist’s albums. * * @param artistId The Spotify ID for the artist. * @param options Optional parameters. For list of supported parameters see * <a href="https://developer.spotify.com/web-api/get-artists-albums/">endpoint documentation</a> * @param callback Callback method * @see <a href="https://developer.spotify.com/web-api/get-artists-albums/">Get an Artist's Albums</a> */ @GET("/artists/{id}/albums") void getArtistAlbums(@Path("id") String artistId, @QueryMap Map<String, Object> options, Callback<Pager<Album>> callback);
Example #14
Source File: SpotifyService.java From spotify-web-api-android with MIT License | 2 votes |
/** * Get Spotify catalog information about an artist’s albums. * * @param artistId The Spotify ID for the artist. * @param options Optional parameters. For list of supported parameters see * <a href="https://developer.spotify.com/web-api/get-artists-albums/">endpoint documentation</a> * @return An array of simplified album objects wrapped in a paging object. * @see <a href="https://developer.spotify.com/web-api/get-artists-albums/">Get an Artist's Albums</a> */ @GET("/artists/{id}/albums") Pager<Album> getArtistAlbums(@Path("id") String artistId, @QueryMap Map<String, Object> options);