add preview endpoint

This commit is contained in:
sneurlax 2023-07-19 10:55:46 -05:00
parent d623480a75
commit 697f40fce1
2 changed files with 8 additions and 2 deletions

View file

@ -4,7 +4,7 @@ class PreviewResponse {
PreviewResponse({required this.imageLink});
factory PreviewResponse.fromJson(Map<String, dynamic> json) {
return PreviewResponse(imageLink: ImageLink.fromJson(json['_links']['image']));
return PreviewResponse(imageLink: ImageLink.fromJson(json['_links']['image'] as Map<String, dynamic>));
}
}
@ -14,6 +14,6 @@ class ImageLink {
ImageLink({required this.href});
factory ImageLink.fromJson(Map<String, dynamic> json) {
return ImageLink(href: json['href']);
return ImageLink(href: json['href'] as String);
}
}

View file

@ -9,6 +9,7 @@ import 'package:stackwallet/dto/ordinals/output_response.dart';
import 'package:stackwallet/dto/ordinals/address_response.dart';
import 'package:stackwallet/dto/ordinals/block_response.dart';
import 'package:stackwallet/dto/ordinals/content_response.dart';
import 'package:stackwallet/dto/ordinals/preview_response.dart';
class OrdinalsAPI {
final String baseUrl;
@ -72,4 +73,9 @@ class OrdinalsAPI {
final response = await _getResponse('/content/$inscriptionId');
return ContentResponse.fromJson(response);
}
Future<PreviewResponse> getInscriptionPreview(String inscriptionId) async {
final response = await _getResponse('/preview/$inscriptionId');
return PreviewResponse.fromJson(response);
}
}