From e19fabd13d29cffe4101dd8f38c67e30f9a2fbd6 Mon Sep 17 00:00:00 2001 From: SlayerOrnstein <6075693+SlayerOrnstein@users.noreply.github.com> Date: Tue, 30 Jan 2024 11:05:22 -0500 Subject: [PATCH] feat: add `vaulted` and `vaultedDate` to MinimalItem --- lib/src/clients/items_client.dart | 5 ++++- lib/src/models/warframe_items/minimal_item.dart | 9 +++++++++ lib/src/models/warframe_items/minimal_item.g.dart | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/src/clients/items_client.dart b/lib/src/clients/items_client.dart index ff2a5fe..ee666f7 100644 --- a/lib/src/clients/items_client.dart +++ b/lib/src/clients/items_client.dart @@ -20,9 +20,12 @@ class WarframeItemsClient extends WarframestatClient { /// Returns all [Item]s that match the search query. Future> search(String query) async { + const opts = + 'uniqueName,name,description,imageName,category,type,vaulted,vaultDate'; + final response = await _get>( '/search/$query', - query: {'only': 'uniqueName,name,description,imageName,category,type'}, + query: {'only': opts}, ); return compute(toSearchItems, response); diff --git a/lib/src/models/warframe_items/minimal_item.dart b/lib/src/models/warframe_items/minimal_item.dart index e08b506..5df9b0e 100644 --- a/lib/src/models/warframe_items/minimal_item.dart +++ b/lib/src/models/warframe_items/minimal_item.dart @@ -18,6 +18,8 @@ class MinimalItem extends Item { required super.productCategory, required super.patchlogs, required super.imageName, + required this.vaultDate, + required this.vaulted, }); /// Creates an instance of [MinimalItem] from json. @@ -25,6 +27,13 @@ class MinimalItem extends Item { return _$MinimalItemFromJson(json); } + final String? vaultDate; + + final bool? vaulted; + @override Map toJson() => _$MinimalItemToJson(this); + + @override + List get props => super.props..add([vaultDate, vaulted]); } diff --git a/lib/src/models/warframe_items/minimal_item.g.dart b/lib/src/models/warframe_items/minimal_item.g.dart index 89cc926..e616bf3 100644 --- a/lib/src/models/warframe_items/minimal_item.g.dart +++ b/lib/src/models/warframe_items/minimal_item.g.dart @@ -25,6 +25,8 @@ MinimalItem _$MinimalItemFromJson(Map json) => $checkedCreate( Patchlog.fromJson(Map.from(e as Map))) .toList()), imageName: $checkedConvert('imageName', (v) => v as String?), + vaultDate: $checkedConvert('vaultDate', (v) => v as String?), + vaulted: $checkedConvert('vaulted', (v) => v as bool?), ); return val; }, @@ -49,5 +51,7 @@ Map _$MinimalItemToJson(MinimalItem instance) { writeNotNull( 'patchlogs', instance.patchlogs?.map((e) => e.toJson()).toList()); writeNotNull('imageName', instance.imageName); + writeNotNull('vaultDate', instance.vaultDate); + writeNotNull('vaulted', instance.vaulted); return val; }