41 lines
952 B
Dart
41 lines
952 B
Dart
import 'package:json_annotation/json_annotation.dart';
|
|
import 'package:ocarina/api/subsonic/subsonic.dart';
|
|
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;
|
|
|
|
/// Returns the cover art URL formed from the [coverArtId]
|
|
String get coverArt => SubsonicApiService().getCoverArtUrl(coverArtId);
|
|
}
|