mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-03-22 23:28:48 +00:00
add preview endpoint
This commit is contained in:
parent
d623480a75
commit
697f40fce1
2 changed files with 8 additions and 2 deletions
|
@ -4,7 +4,7 @@ class PreviewResponse {
|
||||||
PreviewResponse({required this.imageLink});
|
PreviewResponse({required this.imageLink});
|
||||||
|
|
||||||
factory PreviewResponse.fromJson(Map<String, dynamic> json) {
|
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});
|
ImageLink({required this.href});
|
||||||
|
|
||||||
factory ImageLink.fromJson(Map<String, dynamic> json) {
|
factory ImageLink.fromJson(Map<String, dynamic> json) {
|
||||||
return ImageLink(href: json['href']);
|
return ImageLink(href: json['href'] as String);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -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/address_response.dart';
|
||||||
import 'package:stackwallet/dto/ordinals/block_response.dart';
|
import 'package:stackwallet/dto/ordinals/block_response.dart';
|
||||||
import 'package:stackwallet/dto/ordinals/content_response.dart';
|
import 'package:stackwallet/dto/ordinals/content_response.dart';
|
||||||
|
import 'package:stackwallet/dto/ordinals/preview_response.dart';
|
||||||
|
|
||||||
class OrdinalsAPI {
|
class OrdinalsAPI {
|
||||||
final String baseUrl;
|
final String baseUrl;
|
||||||
|
@ -72,4 +73,9 @@ class OrdinalsAPI {
|
||||||
final response = await _getResponse('/content/$inscriptionId');
|
final response = await _getResponse('/content/$inscriptionId');
|
||||||
return ContentResponse.fromJson(response);
|
return ContentResponse.fromJson(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<PreviewResponse> getInscriptionPreview(String inscriptionId) async {
|
||||||
|
final response = await _getResponse('/preview/$inscriptionId');
|
||||||
|
return PreviewResponse.fromJson(response);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue