Update HistoryMetaModel

This commit is contained in:
Ashita Prasad
2025-01-12 16:37:57 +05:30
parent 2ebeded784
commit 18f4687d30
6 changed files with 34 additions and 3 deletions

View File

@ -9,6 +9,7 @@ class HistoryMetaModel with _$HistoryMetaModel {
const factory HistoryMetaModel({
required String historyId,
required String requestId,
required APIType apiType,
@Default("") String name,
required String url,
required HTTPVerb method,

View File

@ -22,6 +22,7 @@ HistoryMetaModel _$HistoryMetaModelFromJson(Map<String, dynamic> json) {
mixin _$HistoryMetaModel {
String get historyId => throw _privateConstructorUsedError;
String get requestId => throw _privateConstructorUsedError;
APIType get apiType => throw _privateConstructorUsedError;
String get name => throw _privateConstructorUsedError;
String get url => throw _privateConstructorUsedError;
HTTPVerb get method => throw _privateConstructorUsedError;
@ -47,6 +48,7 @@ abstract class $HistoryMetaModelCopyWith<$Res> {
$Res call(
{String historyId,
String requestId,
APIType apiType,
String name,
String url,
HTTPVerb method,
@ -71,6 +73,7 @@ class _$HistoryMetaModelCopyWithImpl<$Res, $Val extends HistoryMetaModel>
$Res call({
Object? historyId = null,
Object? requestId = null,
Object? apiType = null,
Object? name = null,
Object? url = null,
Object? method = null,
@ -86,6 +89,10 @@ class _$HistoryMetaModelCopyWithImpl<$Res, $Val extends HistoryMetaModel>
? _value.requestId
: requestId // ignore: cast_nullable_to_non_nullable
as String,
apiType: null == apiType
? _value.apiType
: apiType // ignore: cast_nullable_to_non_nullable
as APIType,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
@ -121,6 +128,7 @@ abstract class _$$HistoryMetaModelImplCopyWith<$Res>
$Res call(
{String historyId,
String requestId,
APIType apiType,
String name,
String url,
HTTPVerb method,
@ -143,6 +151,7 @@ class __$$HistoryMetaModelImplCopyWithImpl<$Res>
$Res call({
Object? historyId = null,
Object? requestId = null,
Object? apiType = null,
Object? name = null,
Object? url = null,
Object? method = null,
@ -158,6 +167,10 @@ class __$$HistoryMetaModelImplCopyWithImpl<$Res>
? _value.requestId
: requestId // ignore: cast_nullable_to_non_nullable
as String,
apiType: null == apiType
? _value.apiType
: apiType // ignore: cast_nullable_to_non_nullable
as APIType,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
@ -188,6 +201,7 @@ class _$HistoryMetaModelImpl implements _HistoryMetaModel {
const _$HistoryMetaModelImpl(
{required this.historyId,
required this.requestId,
required this.apiType,
this.name = "",
required this.url,
required this.method,
@ -202,6 +216,8 @@ class _$HistoryMetaModelImpl implements _HistoryMetaModel {
@override
final String requestId;
@override
final APIType apiType;
@override
@JsonKey()
final String name;
@override
@ -215,7 +231,7 @@ class _$HistoryMetaModelImpl implements _HistoryMetaModel {
@override
String toString() {
return 'HistoryMetaModel(historyId: $historyId, requestId: $requestId, name: $name, url: $url, method: $method, responseStatus: $responseStatus, timeStamp: $timeStamp)';
return 'HistoryMetaModel(historyId: $historyId, requestId: $requestId, apiType: $apiType, name: $name, url: $url, method: $method, responseStatus: $responseStatus, timeStamp: $timeStamp)';
}
@override
@ -227,6 +243,7 @@ class _$HistoryMetaModelImpl implements _HistoryMetaModel {
other.historyId == historyId) &&
(identical(other.requestId, requestId) ||
other.requestId == requestId) &&
(identical(other.apiType, apiType) || other.apiType == apiType) &&
(identical(other.name, name) || other.name == name) &&
(identical(other.url, url) || other.url == url) &&
(identical(other.method, method) || other.method == method) &&
@ -238,8 +255,8 @@ class _$HistoryMetaModelImpl implements _HistoryMetaModel {
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, historyId, requestId, name, url,
method, responseStatus, timeStamp);
int get hashCode => Object.hash(runtimeType, historyId, requestId, apiType,
name, url, method, responseStatus, timeStamp);
/// Create a copy of HistoryMetaModel
/// with the given fields replaced by the non-null parameter values.
@ -262,6 +279,7 @@ abstract class _HistoryMetaModel implements HistoryMetaModel {
const factory _HistoryMetaModel(
{required final String historyId,
required final String requestId,
required final APIType apiType,
final String name,
required final String url,
required final HTTPVerb method,
@ -276,6 +294,8 @@ abstract class _HistoryMetaModel implements HistoryMetaModel {
@override
String get requestId;
@override
APIType get apiType;
@override
String get name;
@override
String get url;

View File

@ -11,6 +11,7 @@ _$HistoryMetaModelImpl _$$HistoryMetaModelImplFromJson(
_$HistoryMetaModelImpl(
historyId: json['historyId'] as String,
requestId: json['requestId'] as String,
apiType: $enumDecode(_$APITypeEnumMap, json['apiType']),
name: json['name'] as String? ?? "",
url: json['url'] as String,
method: $enumDecode(_$HTTPVerbEnumMap, json['method']),
@ -23,6 +24,7 @@ Map<String, dynamic> _$$HistoryMetaModelImplToJson(
<String, dynamic>{
'historyId': instance.historyId,
'requestId': instance.requestId,
'apiType': _$APITypeEnumMap[instance.apiType]!,
'name': instance.name,
'url': instance.url,
'method': _$HTTPVerbEnumMap[instance.method]!,
@ -30,6 +32,11 @@ Map<String, dynamic> _$$HistoryMetaModelImplToJson(
'timeStamp': instance.timeStamp.toIso8601String(),
};
const _$APITypeEnumMap = {
APIType.rest: 'rest',
APIType.graphql: 'graphql',
};
const _$HTTPVerbEnumMap = {
HTTPVerb.get: 'get',
HTTPVerb.head: 'head',

View File

@ -326,6 +326,7 @@ class CollectionStateNotifier
metaData: HistoryMetaModel(
historyId: newHistoryId,
requestId: requestId,
apiType: requestModel.apiType,
name: requestModel.name,
url: substitutedHttpRequestModel.url,
method: substitutedHttpRequestModel.method,

View File

@ -142,6 +142,7 @@ class _HistoryExpansionTileState extends ConsumerState<HistoryExpansionTile>
padding: kPv2 + kPh4,
child: SidebarHistoryCard(
id: item.first.historyId,
apiType: item.first.apiType,
models: item,
method: item.first.method,
isSelected: selectedGroupId == getHistoryRequestKey(item.first),

View File

@ -186,6 +186,7 @@ class RequestItem extends ConsumerWidget {
return SidebarRequestCard(
id: id,
apiType: requestModel.apiType,
method: requestModel.httpRequestModel!.method,
name: requestModel.name,
url: requestModel.httpRequestModel?.url,