Skip to content

Commit

Permalink
Add Favorites to data model
Browse files Browse the repository at this point in the history
  • Loading branch information
dvdgeisler committed Nov 28, 2022
1 parent 863d9bd commit 4f39cf9
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

public class Music {
public List<MusicPlayList> playlists;
public List<String> favorites;
public List<MusicFavorite> favorites;

public Music() {
}

public Music(final List<MusicPlayList> playlists, final List<String> favorites) {
public Music(final List<MusicPlayList> playlists, final List<MusicFavorite> favorites) {
this.playlists = playlists;
this.favorites = favorites;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package de.dvdgeisler.iot.dirigera.client.api.model.music;

public class MusicFavorite {
public String id;
public String imageUrl;
public String title;
public String type;

public MusicFavorite(final String id, final String imageUrl, final String title, final String type) {
this.id = id;
this.imageUrl = imageUrl;
this.title = title;
this.type = type;
}

public MusicFavorite() {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,14 @@ public CommandLineRunner run(final ClientApi api) {
api.oauth.pairIfRequired().block();

api.music.music().doOnSuccess(music -> {
log.info("Playlists: [{}]", music.playlists.stream().map(p->p.title).collect(Collectors.joining(", ")));
log.info("Favorites: [{}]", String.join(", ", music.favorites));
log.info("Playlists: [{}]", music.playlists
.stream()
.map(p->p.title)
.collect(Collectors.joining(", ")));
log.info("Favorites: [{}]", music.favorites
.stream()
.map(p->p.title)
.collect(Collectors.joining(", ")));
}).block();
};
}
Expand Down

0 comments on commit 4f39cf9

Please sign in to comment.