add content endpoint

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

View file

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

View file

@ -8,6 +8,7 @@ import 'package:stackwallet/dto/ordinals/transaction_response.dart';
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';
class OrdinalsAPI {
final String baseUrl;
@ -66,4 +67,9 @@ class OrdinalsAPI {
final response = await _getResponse('/block/$blockNumber');
return BlockResponse.fromJson(response);
}
Future<ContentResponse> getInscriptionContent(String inscriptionId) async {
final response = await _getResponse('/content/$inscriptionId');
return ContentResponse.fromJson(response);
}
}