2024-05-23 19:14:08 +02:00
|
|
|
import 'package:json_annotation/json_annotation.dart';
|
2024-05-27 21:46:54 +02:00
|
|
|
import 'package:ocarina/api/subsonic/subsonic.dart';
|
2024-05-23 19:14:08 +02:00
|
|
|
part 'artist.g.dart';
|
|
|
|
|
|
|
|
@JsonSerializable()
|
|
|
|
|
|
|
|
/// Artist object from the Subsonic API
|
|
|
|
class Artist {
|
|
|
|
/// Artist object from the Subsonic API
|
|
|
|
const Artist(
|
|
|
|
this.id,
|
|
|
|
this.name,
|
|
|
|
this.albumCount,
|
|
|
|
this.coverArtId,
|
|
|
|
this.artistImageUrl,
|
|
|
|
);
|
|
|
|
|
|
|
|
/// Creates instance from the JSON response
|
|
|
|
factory Artist.fromJson(Map<String, dynamic> json) => _$ArtistFromJson(json);
|
|
|
|
|
|
|
|
Map<String, dynamic> toJson() => _$ArtistToJson(this);
|
|
|
|
|
|
|
|
/// ID of the artist
|
|
|
|
final String id;
|
|
|
|
|
|
|
|
/// Artist's name
|
|
|
|
final String name;
|
|
|
|
|
|
|
|
/// Number of albums
|
|
|
|
final int albumCount;
|
|
|
|
|
|
|
|
/// Cover art ID
|
|
|
|
@JsonKey(name: "coverArt")
|
|
|
|
final String coverArtId;
|
|
|
|
|
|
|
|
/// Artist image URL
|
|
|
|
final String artistImageUrl;
|
2024-05-27 21:46:54 +02:00
|
|
|
|
|
|
|
/// Returns the cover art URL formed from the [coverArtId]
|
2024-05-28 18:54:05 +02:00
|
|
|
String get coverArtUrl => SubsonicApiService().getCoverArtUrl(coverArtId);
|
2024-05-23 19:14:08 +02:00
|
|
|
}
|