stack_wallet/lib/dto/ordinals/feed_response.dart

29 lines
811 B
Dart
Raw Normal View History

class FeedResponse {
final List<InscriptionLink> inscriptions;
2023-07-19 15:37:42 +00:00
FeedResponse({required this.inscriptions});
factory FeedResponse.fromJson(Map<String, dynamic> json) {
2023-07-19 15:37:42 +00:00
final List<dynamic> inscriptionsJson = json['_links']['inscriptions'] as List<dynamic>;
final List<InscriptionLink> inscriptions = inscriptionsJson
.map((json) => InscriptionLink.fromJson(json as Map<String, dynamic>))
.toList();
2023-07-19 15:37:42 +00:00
return FeedResponse(inscriptions: inscriptions);
}
}
class InscriptionLink {
final String href;
final String title;
InscriptionLink({required this.href, required this.title});
factory InscriptionLink.fromJson(Map<String, dynamic> json) {
return InscriptionLink(
href: json['href'] as String ?? '',
title: json['title'] as String ?? '',
);
}
}