2023-07-19 16:04:19 +00:00
|
|
|
import 'package:stackwallet/dto/ordinals/inscription_link.dart';
|
2023-07-19 18:03:17 +00:00
|
|
|
import 'package:stackwallet/dto/ordinals/ordinals_response.dart';
|
2023-07-19 16:04:19 +00:00
|
|
|
|
2023-07-19 18:03:17 +00:00
|
|
|
class FeedResponse extends OrdinalsResponse<FeedResponse> {
|
2023-07-18 21:36:26 +00:00
|
|
|
final List<InscriptionLink> inscriptions;
|
|
|
|
|
2023-07-19 15:37:42 +00:00
|
|
|
FeedResponse({required this.inscriptions});
|
2023-07-19 18:03:17 +00:00
|
|
|
|
|
|
|
factory FeedResponse.fromJson(OrdinalsResponse json) {
|
|
|
|
final List<dynamic> inscriptionsJson = json.data['_links']['inscriptions'] as List<dynamic>;
|
2023-07-19 15:37:42 +00:00
|
|
|
final List<InscriptionLink> inscriptions = inscriptionsJson
|
|
|
|
.map((json) => InscriptionLink.fromJson(json as Map<String, dynamic>))
|
2023-07-18 21:36:26 +00:00
|
|
|
.toList();
|
|
|
|
|
2023-07-19 15:37:42 +00:00
|
|
|
return FeedResponse(inscriptions: inscriptions);
|
|
|
|
}
|
2023-07-19 18:03:17 +00:00
|
|
|
}
|