mirror of
https://github.com/foss42/apidash.git
synced 2025-12-02 10:49:49 +08:00
feat: add preRequestScript and postRequestScript to HistoryRequestModel
This commit is contained in:
@@ -16,6 +16,8 @@ class HistoryRequestModel with _$HistoryRequestModel {
|
|||||||
required HistoryMetaModel metaData,
|
required HistoryMetaModel metaData,
|
||||||
required HttpRequestModel httpRequestModel,
|
required HttpRequestModel httpRequestModel,
|
||||||
required HttpResponseModel httpResponseModel,
|
required HttpResponseModel httpResponseModel,
|
||||||
|
required String preRequestScript,
|
||||||
|
required String postRequestScript,
|
||||||
}) = _HistoryRequestModel;
|
}) = _HistoryRequestModel;
|
||||||
|
|
||||||
factory HistoryRequestModel.fromJson(Map<String, Object?> json) =>
|
factory HistoryRequestModel.fromJson(Map<String, Object?> json) =>
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ mixin _$HistoryRequestModel {
|
|||||||
HistoryMetaModel get metaData => throw _privateConstructorUsedError;
|
HistoryMetaModel get metaData => throw _privateConstructorUsedError;
|
||||||
HttpRequestModel get httpRequestModel => throw _privateConstructorUsedError;
|
HttpRequestModel get httpRequestModel => throw _privateConstructorUsedError;
|
||||||
HttpResponseModel get httpResponseModel => throw _privateConstructorUsedError;
|
HttpResponseModel get httpResponseModel => throw _privateConstructorUsedError;
|
||||||
|
String get preRequestScript => throw _privateConstructorUsedError;
|
||||||
|
String get postRequestScript => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
/// Serializes this HistoryRequestModel to a JSON map.
|
/// Serializes this HistoryRequestModel to a JSON map.
|
||||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||||
@@ -45,7 +47,9 @@ abstract class $HistoryRequestModelCopyWith<$Res> {
|
|||||||
{String historyId,
|
{String historyId,
|
||||||
HistoryMetaModel metaData,
|
HistoryMetaModel metaData,
|
||||||
HttpRequestModel httpRequestModel,
|
HttpRequestModel httpRequestModel,
|
||||||
HttpResponseModel httpResponseModel});
|
HttpResponseModel httpResponseModel,
|
||||||
|
String preRequestScript,
|
||||||
|
String postRequestScript});
|
||||||
|
|
||||||
$HistoryMetaModelCopyWith<$Res> get metaData;
|
$HistoryMetaModelCopyWith<$Res> get metaData;
|
||||||
$HttpRequestModelCopyWith<$Res> get httpRequestModel;
|
$HttpRequestModelCopyWith<$Res> get httpRequestModel;
|
||||||
@@ -71,6 +75,8 @@ class _$HistoryRequestModelCopyWithImpl<$Res, $Val extends HistoryRequestModel>
|
|||||||
Object? metaData = null,
|
Object? metaData = null,
|
||||||
Object? httpRequestModel = null,
|
Object? httpRequestModel = null,
|
||||||
Object? httpResponseModel = null,
|
Object? httpResponseModel = null,
|
||||||
|
Object? preRequestScript = null,
|
||||||
|
Object? postRequestScript = null,
|
||||||
}) {
|
}) {
|
||||||
return _then(_value.copyWith(
|
return _then(_value.copyWith(
|
||||||
historyId: null == historyId
|
historyId: null == historyId
|
||||||
@@ -89,6 +95,14 @@ class _$HistoryRequestModelCopyWithImpl<$Res, $Val extends HistoryRequestModel>
|
|||||||
? _value.httpResponseModel
|
? _value.httpResponseModel
|
||||||
: httpResponseModel // ignore: cast_nullable_to_non_nullable
|
: httpResponseModel // ignore: cast_nullable_to_non_nullable
|
||||||
as HttpResponseModel,
|
as HttpResponseModel,
|
||||||
|
preRequestScript: null == preRequestScript
|
||||||
|
? _value.preRequestScript
|
||||||
|
: preRequestScript // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
postRequestScript: null == postRequestScript
|
||||||
|
? _value.postRequestScript
|
||||||
|
: postRequestScript // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
) as $Val);
|
) as $Val);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,7 +149,9 @@ abstract class _$$HistoryRequestModelImplCopyWith<$Res>
|
|||||||
{String historyId,
|
{String historyId,
|
||||||
HistoryMetaModel metaData,
|
HistoryMetaModel metaData,
|
||||||
HttpRequestModel httpRequestModel,
|
HttpRequestModel httpRequestModel,
|
||||||
HttpResponseModel httpResponseModel});
|
HttpResponseModel httpResponseModel,
|
||||||
|
String preRequestScript,
|
||||||
|
String postRequestScript});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
$HistoryMetaModelCopyWith<$Res> get metaData;
|
$HistoryMetaModelCopyWith<$Res> get metaData;
|
||||||
@@ -162,6 +178,8 @@ class __$$HistoryRequestModelImplCopyWithImpl<$Res>
|
|||||||
Object? metaData = null,
|
Object? metaData = null,
|
||||||
Object? httpRequestModel = null,
|
Object? httpRequestModel = null,
|
||||||
Object? httpResponseModel = null,
|
Object? httpResponseModel = null,
|
||||||
|
Object? preRequestScript = null,
|
||||||
|
Object? postRequestScript = null,
|
||||||
}) {
|
}) {
|
||||||
return _then(_$HistoryRequestModelImpl(
|
return _then(_$HistoryRequestModelImpl(
|
||||||
historyId: null == historyId
|
historyId: null == historyId
|
||||||
@@ -180,6 +198,14 @@ class __$$HistoryRequestModelImplCopyWithImpl<$Res>
|
|||||||
? _value.httpResponseModel
|
? _value.httpResponseModel
|
||||||
: httpResponseModel // ignore: cast_nullable_to_non_nullable
|
: httpResponseModel // ignore: cast_nullable_to_non_nullable
|
||||||
as HttpResponseModel,
|
as HttpResponseModel,
|
||||||
|
preRequestScript: null == preRequestScript
|
||||||
|
? _value.preRequestScript
|
||||||
|
: preRequestScript // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
postRequestScript: null == postRequestScript
|
||||||
|
? _value.postRequestScript
|
||||||
|
: postRequestScript // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -192,7 +218,9 @@ class _$HistoryRequestModelImpl implements _HistoryRequestModel {
|
|||||||
{required this.historyId,
|
{required this.historyId,
|
||||||
required this.metaData,
|
required this.metaData,
|
||||||
required this.httpRequestModel,
|
required this.httpRequestModel,
|
||||||
required this.httpResponseModel});
|
required this.httpResponseModel,
|
||||||
|
required this.preRequestScript,
|
||||||
|
required this.postRequestScript});
|
||||||
|
|
||||||
factory _$HistoryRequestModelImpl.fromJson(Map<String, dynamic> json) =>
|
factory _$HistoryRequestModelImpl.fromJson(Map<String, dynamic> json) =>
|
||||||
_$$HistoryRequestModelImplFromJson(json);
|
_$$HistoryRequestModelImplFromJson(json);
|
||||||
@@ -205,10 +233,14 @@ class _$HistoryRequestModelImpl implements _HistoryRequestModel {
|
|||||||
final HttpRequestModel httpRequestModel;
|
final HttpRequestModel httpRequestModel;
|
||||||
@override
|
@override
|
||||||
final HttpResponseModel httpResponseModel;
|
final HttpResponseModel httpResponseModel;
|
||||||
|
@override
|
||||||
|
final String preRequestScript;
|
||||||
|
@override
|
||||||
|
final String postRequestScript;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'HistoryRequestModel(historyId: $historyId, metaData: $metaData, httpRequestModel: $httpRequestModel, httpResponseModel: $httpResponseModel)';
|
return 'HistoryRequestModel(historyId: $historyId, metaData: $metaData, httpRequestModel: $httpRequestModel, httpResponseModel: $httpResponseModel, preRequestScript: $preRequestScript, postRequestScript: $postRequestScript)';
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -223,13 +255,17 @@ class _$HistoryRequestModelImpl implements _HistoryRequestModel {
|
|||||||
(identical(other.httpRequestModel, httpRequestModel) ||
|
(identical(other.httpRequestModel, httpRequestModel) ||
|
||||||
other.httpRequestModel == httpRequestModel) &&
|
other.httpRequestModel == httpRequestModel) &&
|
||||||
(identical(other.httpResponseModel, httpResponseModel) ||
|
(identical(other.httpResponseModel, httpResponseModel) ||
|
||||||
other.httpResponseModel == httpResponseModel));
|
other.httpResponseModel == httpResponseModel) &&
|
||||||
|
(identical(other.preRequestScript, preRequestScript) ||
|
||||||
|
other.preRequestScript == preRequestScript) &&
|
||||||
|
(identical(other.postRequestScript, postRequestScript) ||
|
||||||
|
other.postRequestScript == postRequestScript));
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
@override
|
@override
|
||||||
int get hashCode => Object.hash(
|
int get hashCode => Object.hash(runtimeType, historyId, metaData,
|
||||||
runtimeType, historyId, metaData, httpRequestModel, httpResponseModel);
|
httpRequestModel, httpResponseModel, preRequestScript, postRequestScript);
|
||||||
|
|
||||||
/// Create a copy of HistoryRequestModel
|
/// Create a copy of HistoryRequestModel
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@@ -250,11 +286,12 @@ class _$HistoryRequestModelImpl implements _HistoryRequestModel {
|
|||||||
|
|
||||||
abstract class _HistoryRequestModel implements HistoryRequestModel {
|
abstract class _HistoryRequestModel implements HistoryRequestModel {
|
||||||
const factory _HistoryRequestModel(
|
const factory _HistoryRequestModel(
|
||||||
{required final String historyId,
|
{required final String historyId,
|
||||||
required final HistoryMetaModel metaData,
|
required final HistoryMetaModel metaData,
|
||||||
required final HttpRequestModel httpRequestModel,
|
required final HttpRequestModel httpRequestModel,
|
||||||
required final HttpResponseModel httpResponseModel}) =
|
required final HttpResponseModel httpResponseModel,
|
||||||
_$HistoryRequestModelImpl;
|
required final String preRequestScript,
|
||||||
|
required final String postRequestScript}) = _$HistoryRequestModelImpl;
|
||||||
|
|
||||||
factory _HistoryRequestModel.fromJson(Map<String, dynamic> json) =
|
factory _HistoryRequestModel.fromJson(Map<String, dynamic> json) =
|
||||||
_$HistoryRequestModelImpl.fromJson;
|
_$HistoryRequestModelImpl.fromJson;
|
||||||
@@ -267,6 +304,10 @@ abstract class _HistoryRequestModel implements HistoryRequestModel {
|
|||||||
HttpRequestModel get httpRequestModel;
|
HttpRequestModel get httpRequestModel;
|
||||||
@override
|
@override
|
||||||
HttpResponseModel get httpResponseModel;
|
HttpResponseModel get httpResponseModel;
|
||||||
|
@override
|
||||||
|
String get preRequestScript;
|
||||||
|
@override
|
||||||
|
String get postRequestScript;
|
||||||
|
|
||||||
/// Create a copy of HistoryRequestModel
|
/// Create a copy of HistoryRequestModel
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ _$HistoryRequestModelImpl _$$HistoryRequestModelImplFromJson(Map json) =>
|
|||||||
Map<String, Object?>.from(json['httpRequestModel'] as Map)),
|
Map<String, Object?>.from(json['httpRequestModel'] as Map)),
|
||||||
httpResponseModel: HttpResponseModel.fromJson(
|
httpResponseModel: HttpResponseModel.fromJson(
|
||||||
Map<String, Object?>.from(json['httpResponseModel'] as Map)),
|
Map<String, Object?>.from(json['httpResponseModel'] as Map)),
|
||||||
|
preRequestScript: json['preRequestScript'] as String,
|
||||||
|
postRequestScript: json['postRequestScript'] as String,
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$$HistoryRequestModelImplToJson(
|
Map<String, dynamic> _$$HistoryRequestModelImplToJson(
|
||||||
@@ -24,4 +26,6 @@ Map<String, dynamic> _$$HistoryRequestModelImplToJson(
|
|||||||
'metaData': instance.metaData.toJson(),
|
'metaData': instance.metaData.toJson(),
|
||||||
'httpRequestModel': instance.httpRequestModel.toJson(),
|
'httpRequestModel': instance.httpRequestModel.toJson(),
|
||||||
'httpResponseModel': instance.httpResponseModel.toJson(),
|
'httpResponseModel': instance.httpResponseModel.toJson(),
|
||||||
|
'preRequestScript': instance.preRequestScript,
|
||||||
|
'postRequestScript': instance.postRequestScript,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -352,6 +352,8 @@ class CollectionStateNotifier
|
|||||||
),
|
),
|
||||||
httpRequestModel: substitutedHttpRequestModel,
|
httpRequestModel: substitutedHttpRequestModel,
|
||||||
httpResponseModel: httpResponseModel,
|
httpResponseModel: httpResponseModel,
|
||||||
|
preRequestScript: requestModel.preRequestScript,
|
||||||
|
postRequestScript: requestModel.postRequestScript,
|
||||||
);
|
);
|
||||||
if (requestModel.postRequestScript.isNotEmpty) {
|
if (requestModel.postRequestScript.isNotEmpty) {
|
||||||
newRequestModel = await handlePostResponseScript(
|
newRequestModel = await handlePostResponseScript(
|
||||||
|
|||||||
Reference in New Issue
Block a user