2023-07-19 18:03:17 +00:00
|
|
|
import 'package:stackwallet/dto/ordinals/ordinals_response.dart';
|
|
|
|
|
|
|
|
class ContentResponse extends OrdinalsResponse<ContentResponse> {
|
2023-07-18 21:36:26 +00:00
|
|
|
final FileLink fileLink;
|
|
|
|
|
|
|
|
ContentResponse({required this.fileLink});
|
|
|
|
|
2023-07-19 18:03:17 +00:00
|
|
|
factory ContentResponse.fromJson(OrdinalsResponse json) {
|
|
|
|
final data = json.data as Map<String, dynamic>;
|
|
|
|
return ContentResponse(fileLink: FileLink.fromJson(data['_links']['file'] as Map<String, dynamic>)); // TODO don't cast as Map<String, dynamic>
|
2023-07-18 21:36:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class FileLink {
|
|
|
|
final String href;
|
|
|
|
|
|
|
|
FileLink({required this.href});
|
|
|
|
|
|
|
|
factory FileLink.fromJson(Map<String, dynamic> json) {
|
2023-07-19 15:51:46 +00:00
|
|
|
return FileLink(href: json['href'] as String);
|
2023-07-18 21:36:26 +00:00
|
|
|
}
|
|
|
|
}
|