51 lines
1.2 KiB
Dart
51 lines
1.2 KiB
Dart
|
|
class LedgerItem {
|
||
|
|
const LedgerItem({
|
||
|
|
required this.id,
|
||
|
|
required this.direction,
|
||
|
|
required this.amount,
|
||
|
|
required this.balanceAfter,
|
||
|
|
required this.changeType,
|
||
|
|
required this.createdAt,
|
||
|
|
});
|
||
|
|
|
||
|
|
final String id;
|
||
|
|
final int direction;
|
||
|
|
final int amount;
|
||
|
|
final int balanceAfter;
|
||
|
|
final String changeType;
|
||
|
|
final String createdAt;
|
||
|
|
|
||
|
|
factory LedgerItem.fromJson(Map<String, dynamic> json) {
|
||
|
|
return LedgerItem(
|
||
|
|
id: json['id'] as String,
|
||
|
|
direction: json['direction'] as int,
|
||
|
|
amount: json['amount'] as int,
|
||
|
|
balanceAfter: json['balanceAfter'] as int,
|
||
|
|
changeType: json['changeType'] as String,
|
||
|
|
createdAt: json['createdAt'] as String,
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
class LedgerListResult {
|
||
|
|
const LedgerListResult({
|
||
|
|
required this.items,
|
||
|
|
this.nextCursor,
|
||
|
|
required this.hasMore,
|
||
|
|
});
|
||
|
|
|
||
|
|
final List<LedgerItem> items;
|
||
|
|
final String? nextCursor;
|
||
|
|
final bool hasMore;
|
||
|
|
|
||
|
|
factory LedgerListResult.fromJson(Map<String, dynamic> json) {
|
||
|
|
return LedgerListResult(
|
||
|
|
items: (json['items'] as List<dynamic>)
|
||
|
|
.map((e) => LedgerItem.fromJson(e as Map<String, dynamic>))
|
||
|
|
.toList(),
|
||
|
|
nextCursor: json['nextCursor'] as String?,
|
||
|
|
hasMore: json['hasMore'] as bool,
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|