mirror of
https://github.com/foss42/apidash.git
synced 2025-12-02 02:39:19 +08:00
chore: resolve merge conflicts
This commit is contained in:
@@ -16,6 +16,8 @@ class HistoryRequestModel with _$HistoryRequestModel {
|
||||
required HistoryMetaModel metaData,
|
||||
required HttpRequestModel httpRequestModel,
|
||||
required HttpResponseModel httpResponseModel,
|
||||
String? preRequestScript,
|
||||
String? postRequestScript,
|
||||
required AuthModel? authModel,
|
||||
}) = _HistoryRequestModel;
|
||||
|
||||
|
||||
@@ -24,6 +24,8 @@ mixin _$HistoryRequestModel {
|
||||
HistoryMetaModel get metaData => throw _privateConstructorUsedError;
|
||||
HttpRequestModel get httpRequestModel => throw _privateConstructorUsedError;
|
||||
HttpResponseModel get httpResponseModel => throw _privateConstructorUsedError;
|
||||
String? get preRequestScript => throw _privateConstructorUsedError;
|
||||
String? get postRequestScript => throw _privateConstructorUsedError;
|
||||
AuthModel? get authModel => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this HistoryRequestModel to a JSON map.
|
||||
@@ -47,6 +49,8 @@ abstract class $HistoryRequestModelCopyWith<$Res> {
|
||||
HistoryMetaModel metaData,
|
||||
HttpRequestModel httpRequestModel,
|
||||
HttpResponseModel httpResponseModel,
|
||||
String? preRequestScript,
|
||||
String? postRequestScript,
|
||||
AuthModel? authModel});
|
||||
|
||||
$HistoryMetaModelCopyWith<$Res> get metaData;
|
||||
@@ -74,6 +78,8 @@ class _$HistoryRequestModelCopyWithImpl<$Res, $Val extends HistoryRequestModel>
|
||||
Object? metaData = null,
|
||||
Object? httpRequestModel = null,
|
||||
Object? httpResponseModel = null,
|
||||
Object? preRequestScript = freezed,
|
||||
Object? postRequestScript = freezed,
|
||||
Object? authModel = freezed,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
@@ -93,6 +99,14 @@ class _$HistoryRequestModelCopyWithImpl<$Res, $Val extends HistoryRequestModel>
|
||||
? _value.httpResponseModel
|
||||
: httpResponseModel // ignore: cast_nullable_to_non_nullable
|
||||
as HttpResponseModel,
|
||||
preRequestScript: freezed == preRequestScript
|
||||
? _value.preRequestScript
|
||||
: preRequestScript // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
postRequestScript: freezed == postRequestScript
|
||||
? _value.postRequestScript
|
||||
: postRequestScript // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
authModel: freezed == authModel
|
||||
? _value.authModel
|
||||
: authModel // ignore: cast_nullable_to_non_nullable
|
||||
@@ -158,6 +172,8 @@ abstract class _$$HistoryRequestModelImplCopyWith<$Res>
|
||||
HistoryMetaModel metaData,
|
||||
HttpRequestModel httpRequestModel,
|
||||
HttpResponseModel httpResponseModel,
|
||||
String? preRequestScript,
|
||||
String? postRequestScript,
|
||||
AuthModel? authModel});
|
||||
|
||||
@override
|
||||
@@ -187,6 +203,8 @@ class __$$HistoryRequestModelImplCopyWithImpl<$Res>
|
||||
Object? metaData = null,
|
||||
Object? httpRequestModel = null,
|
||||
Object? httpResponseModel = null,
|
||||
Object? preRequestScript = freezed,
|
||||
Object? postRequestScript = freezed,
|
||||
Object? authModel = freezed,
|
||||
}) {
|
||||
return _then(_$HistoryRequestModelImpl(
|
||||
@@ -206,6 +224,14 @@ class __$$HistoryRequestModelImplCopyWithImpl<$Res>
|
||||
? _value.httpResponseModel
|
||||
: httpResponseModel // ignore: cast_nullable_to_non_nullable
|
||||
as HttpResponseModel,
|
||||
preRequestScript: freezed == preRequestScript
|
||||
? _value.preRequestScript
|
||||
: preRequestScript // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
postRequestScript: freezed == postRequestScript
|
||||
? _value.postRequestScript
|
||||
: postRequestScript // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
authModel: freezed == authModel
|
||||
? _value.authModel
|
||||
: authModel // ignore: cast_nullable_to_non_nullable
|
||||
@@ -223,6 +249,8 @@ class _$HistoryRequestModelImpl implements _HistoryRequestModel {
|
||||
required this.metaData,
|
||||
required this.httpRequestModel,
|
||||
required this.httpResponseModel,
|
||||
this.preRequestScript,
|
||||
this.postRequestScript,
|
||||
required this.authModel});
|
||||
|
||||
factory _$HistoryRequestModelImpl.fromJson(Map<String, dynamic> json) =>
|
||||
@@ -237,11 +265,15 @@ class _$HistoryRequestModelImpl implements _HistoryRequestModel {
|
||||
@override
|
||||
final HttpResponseModel httpResponseModel;
|
||||
@override
|
||||
final String? preRequestScript;
|
||||
@override
|
||||
final String? postRequestScript;
|
||||
@override
|
||||
final AuthModel? authModel;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'HistoryRequestModel(historyId: $historyId, metaData: $metaData, httpRequestModel: $httpRequestModel, httpResponseModel: $httpResponseModel, authModel: $authModel)';
|
||||
return 'HistoryRequestModel(historyId: $historyId, metaData: $metaData, httpRequestModel: $httpRequestModel, httpResponseModel: $httpResponseModel, preRequestScript: $preRequestScript, postRequestScript: $postRequestScript, authModel: $authModel)';
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -257,14 +289,25 @@ class _$HistoryRequestModelImpl implements _HistoryRequestModel {
|
||||
other.httpRequestModel == httpRequestModel) &&
|
||||
(identical(other.httpResponseModel, httpResponseModel) ||
|
||||
other.httpResponseModel == httpResponseModel) &&
|
||||
(identical(other.preRequestScript, preRequestScript) ||
|
||||
other.preRequestScript == preRequestScript) &&
|
||||
(identical(other.postRequestScript, postRequestScript) ||
|
||||
other.postRequestScript == postRequestScript) &&
|
||||
(identical(other.authModel, authModel) ||
|
||||
other.authModel == authModel));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, historyId, metaData,
|
||||
httpRequestModel, httpResponseModel, authModel);
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
historyId,
|
||||
metaData,
|
||||
httpRequestModel,
|
||||
httpResponseModel,
|
||||
preRequestScript,
|
||||
postRequestScript,
|
||||
authModel);
|
||||
|
||||
/// Create a copy of HistoryRequestModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -289,6 +332,8 @@ abstract class _HistoryRequestModel implements HistoryRequestModel {
|
||||
required final HistoryMetaModel metaData,
|
||||
required final HttpRequestModel httpRequestModel,
|
||||
required final HttpResponseModel httpResponseModel,
|
||||
final String? preRequestScript,
|
||||
final String? postRequestScript,
|
||||
required final AuthModel? authModel}) = _$HistoryRequestModelImpl;
|
||||
|
||||
factory _HistoryRequestModel.fromJson(Map<String, dynamic> json) =
|
||||
@@ -303,6 +348,10 @@ abstract class _HistoryRequestModel implements HistoryRequestModel {
|
||||
@override
|
||||
HttpResponseModel get httpResponseModel;
|
||||
@override
|
||||
String? get preRequestScript;
|
||||
@override
|
||||
String? get postRequestScript;
|
||||
@override
|
||||
AuthModel? get authModel;
|
||||
|
||||
/// Create a copy of HistoryRequestModel
|
||||
|
||||
@@ -15,6 +15,8 @@ _$HistoryRequestModelImpl _$$HistoryRequestModelImplFromJson(Map json) =>
|
||||
Map<String, Object?>.from(json['httpRequestModel'] as Map)),
|
||||
httpResponseModel: HttpResponseModel.fromJson(
|
||||
Map<String, Object?>.from(json['httpResponseModel'] as Map)),
|
||||
preRequestScript: json['preRequestScript'] as String?,
|
||||
postRequestScript: json['postRequestScript'] as String?,
|
||||
authModel: json['authModel'] == null
|
||||
? null
|
||||
: AuthModel.fromJson(
|
||||
@@ -28,5 +30,7 @@ Map<String, dynamic> _$$HistoryRequestModelImplToJson(
|
||||
'metaData': instance.metaData.toJson(),
|
||||
'httpRequestModel': instance.httpRequestModel.toJson(),
|
||||
'httpResponseModel': instance.httpResponseModel.toJson(),
|
||||
'preRequestScript': instance.preRequestScript,
|
||||
'postRequestScript': instance.postRequestScript,
|
||||
'authModel': instance.authModel?.toJson(),
|
||||
};
|
||||
|
||||
@@ -23,7 +23,8 @@ class RequestModel with _$RequestModel {
|
||||
HttpResponseModel? httpResponseModel,
|
||||
@JsonKey(includeToJson: false) @Default(false) bool isWorking,
|
||||
@JsonKey(includeToJson: false) DateTime? sendingTime,
|
||||
@Default(AuthModel(type: APIAuthType.none)) AuthModel? authModel,
|
||||
String? preRequestScript,
|
||||
String? postRequestScript,
|
||||
}) = _RequestModel;
|
||||
|
||||
factory RequestModel.fromJson(Map<String, Object?> json) =>
|
||||
|
||||
@@ -36,7 +36,8 @@ mixin _$RequestModel {
|
||||
bool get isWorking => throw _privateConstructorUsedError;
|
||||
@JsonKey(includeToJson: false)
|
||||
DateTime? get sendingTime => throw _privateConstructorUsedError;
|
||||
AuthModel? get authModel => throw _privateConstructorUsedError;
|
||||
String? get preRequestScript => throw _privateConstructorUsedError;
|
||||
String? get postRequestScript => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this RequestModel to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
@@ -67,12 +68,12 @@ abstract class $RequestModelCopyWith<$Res> {
|
||||
HttpResponseModel? httpResponseModel,
|
||||
@JsonKey(includeToJson: false) bool isWorking,
|
||||
@JsonKey(includeToJson: false) DateTime? sendingTime,
|
||||
AuthModel? authModel});
|
||||
String? preRequestScript,
|
||||
String? postRequestScript});
|
||||
|
||||
$AuthModelCopyWith<$Res>? get authModel;
|
||||
$HttpRequestModelCopyWith<$Res>? get httpRequestModel;
|
||||
$HttpResponseModelCopyWith<$Res>? get httpResponseModel;
|
||||
$AuthModelCopyWith<$Res>? get authModel;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@@ -102,7 +103,8 @@ class _$RequestModelCopyWithImpl<$Res, $Val extends RequestModel>
|
||||
Object? httpResponseModel = freezed,
|
||||
Object? isWorking = null,
|
||||
Object? sendingTime = freezed,
|
||||
Object? authModel = freezed,
|
||||
Object? preRequestScript = freezed,
|
||||
Object? postRequestScript = freezed,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
id: null == id
|
||||
@@ -153,10 +155,14 @@ class _$RequestModelCopyWithImpl<$Res, $Val extends RequestModel>
|
||||
? _value.sendingTime
|
||||
: sendingTime // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,
|
||||
authModel: freezed == authModel
|
||||
? _value.authModel
|
||||
: authModel // ignore: cast_nullable_to_non_nullable
|
||||
as AuthModel?,
|
||||
preRequestScript: freezed == preRequestScript
|
||||
? _value.preRequestScript
|
||||
: preRequestScript // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
postRequestScript: freezed == postRequestScript
|
||||
? _value.postRequestScript
|
||||
: postRequestScript // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
) as $Val);
|
||||
}
|
||||
|
||||
@@ -201,20 +207,6 @@ class _$RequestModelCopyWithImpl<$Res, $Val extends RequestModel>
|
||||
return _then(_value.copyWith(httpResponseModel: value) as $Val);
|
||||
});
|
||||
}
|
||||
|
||||
/// Create a copy of RequestModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$AuthModelCopyWith<$Res>? get authModel {
|
||||
if (_value.authModel == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $AuthModelCopyWith<$Res>(_value.authModel!, (value) {
|
||||
return _then(_value.copyWith(authModel: value) as $Val);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@@ -238,7 +230,8 @@ abstract class _$$RequestModelImplCopyWith<$Res>
|
||||
HttpResponseModel? httpResponseModel,
|
||||
@JsonKey(includeToJson: false) bool isWorking,
|
||||
@JsonKey(includeToJson: false) DateTime? sendingTime,
|
||||
AuthModel? authModel});
|
||||
String? preRequestScript,
|
||||
String? postRequestScript});
|
||||
|
||||
@override
|
||||
$AuthModelCopyWith<$Res>? get authModel;
|
||||
@@ -246,8 +239,6 @@ abstract class _$$RequestModelImplCopyWith<$Res>
|
||||
$HttpRequestModelCopyWith<$Res>? get httpRequestModel;
|
||||
@override
|
||||
$HttpResponseModelCopyWith<$Res>? get httpResponseModel;
|
||||
@override
|
||||
$AuthModelCopyWith<$Res>? get authModel;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@@ -275,7 +266,8 @@ class __$$RequestModelImplCopyWithImpl<$Res>
|
||||
Object? httpResponseModel = freezed,
|
||||
Object? isWorking = null,
|
||||
Object? sendingTime = freezed,
|
||||
Object? authModel = freezed,
|
||||
Object? preRequestScript = freezed,
|
||||
Object? postRequestScript = freezed,
|
||||
}) {
|
||||
return _then(_$RequestModelImpl(
|
||||
id: null == id
|
||||
@@ -325,10 +317,14 @@ class __$$RequestModelImplCopyWithImpl<$Res>
|
||||
? _value.sendingTime
|
||||
: sendingTime // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,
|
||||
authModel: freezed == authModel
|
||||
? _value.authModel
|
||||
: authModel // ignore: cast_nullable_to_non_nullable
|
||||
as AuthModel?,
|
||||
preRequestScript: freezed == preRequestScript
|
||||
? _value.preRequestScript
|
||||
: preRequestScript // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
postRequestScript: freezed == postRequestScript
|
||||
? _value.postRequestScript
|
||||
: postRequestScript // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -350,7 +346,8 @@ class _$RequestModelImpl implements _RequestModel {
|
||||
this.httpResponseModel,
|
||||
@JsonKey(includeToJson: false) this.isWorking = false,
|
||||
@JsonKey(includeToJson: false) this.sendingTime,
|
||||
this.authModel = const AuthModel(type: APIAuthType.none)});
|
||||
this.preRequestScript,
|
||||
this.postRequestScript});
|
||||
|
||||
factory _$RequestModelImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$RequestModelImplFromJson(json);
|
||||
@@ -387,12 +384,13 @@ class _$RequestModelImpl implements _RequestModel {
|
||||
@JsonKey(includeToJson: false)
|
||||
final DateTime? sendingTime;
|
||||
@override
|
||||
@JsonKey()
|
||||
final AuthModel? authModel;
|
||||
final String? preRequestScript;
|
||||
@override
|
||||
final String? postRequestScript;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'RequestModel(id: $id, apiType: $apiType, name: $name, description: $description, requestTabIndex: $requestTabIndex, httpRequestModel: $httpRequestModel, responseStatus: $responseStatus, message: $message, httpResponseModel: $httpResponseModel, isWorking: $isWorking, sendingTime: $sendingTime, authModel: $authModel)';
|
||||
return 'RequestModel(id: $id, apiType: $apiType, name: $name, description: $description, authModel: $authModel, requestTabIndex: $requestTabIndex, httpRequestModel: $httpRequestModel, responseStatus: $responseStatus, message: $message, httpResponseModel: $httpResponseModel, isWorking: $isWorking, sendingTime: $sendingTime, preRequestScript: $preRequestScript, postRequestScript: $postRequestScript)';
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -420,8 +418,10 @@ class _$RequestModelImpl implements _RequestModel {
|
||||
other.isWorking == isWorking) &&
|
||||
(identical(other.sendingTime, sendingTime) ||
|
||||
other.sendingTime == sendingTime) &&
|
||||
(identical(other.authModel, authModel) ||
|
||||
other.authModel == authModel));
|
||||
(identical(other.preRequestScript, preRequestScript) ||
|
||||
other.preRequestScript == preRequestScript) &&
|
||||
(identical(other.postRequestScript, postRequestScript) ||
|
||||
other.postRequestScript == postRequestScript));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@@ -440,7 +440,8 @@ class _$RequestModelImpl implements _RequestModel {
|
||||
httpResponseModel,
|
||||
isWorking,
|
||||
sendingTime,
|
||||
authModel);
|
||||
preRequestScript,
|
||||
postRequestScript);
|
||||
|
||||
/// Create a copy of RequestModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -464,6 +465,7 @@ abstract class _RequestModel implements RequestModel {
|
||||
final APIType apiType,
|
||||
final String name,
|
||||
final String description,
|
||||
final AuthModel? authModel,
|
||||
@JsonKey(includeToJson: false) final dynamic requestTabIndex,
|
||||
final HttpRequestModel? httpRequestModel,
|
||||
final int? responseStatus,
|
||||
@@ -471,7 +473,8 @@ abstract class _RequestModel implements RequestModel {
|
||||
final HttpResponseModel? httpResponseModel,
|
||||
@JsonKey(includeToJson: false) final bool isWorking,
|
||||
@JsonKey(includeToJson: false) final DateTime? sendingTime,
|
||||
final AuthModel? authModel}) = _$RequestModelImpl;
|
||||
final String? preRequestScript,
|
||||
final String? postRequestScript}) = _$RequestModelImpl;
|
||||
|
||||
factory _RequestModel.fromJson(Map<String, dynamic> json) =
|
||||
_$RequestModelImpl.fromJson;
|
||||
@@ -504,7 +507,9 @@ abstract class _RequestModel implements RequestModel {
|
||||
@JsonKey(includeToJson: false)
|
||||
DateTime? get sendingTime;
|
||||
@override
|
||||
AuthModel? get authModel;
|
||||
String? get preRequestScript;
|
||||
@override
|
||||
String? get postRequestScript;
|
||||
|
||||
/// Create a copy of RequestModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
|
||||
@@ -31,10 +31,8 @@ _$RequestModelImpl _$$RequestModelImplFromJson(Map json) => _$RequestModelImpl(
|
||||
sendingTime: json['sendingTime'] == null
|
||||
? null
|
||||
: DateTime.parse(json['sendingTime'] as String),
|
||||
authModel: json['authModel'] == null
|
||||
? const AuthModel(type: APIAuthType.none)
|
||||
: AuthModel.fromJson(
|
||||
Map<String, dynamic>.from(json['authModel'] as Map)),
|
||||
preRequestScript: json['preRequestScript'] as String?,
|
||||
postRequestScript: json['postRequestScript'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$RequestModelImplToJson(_$RequestModelImpl instance) =>
|
||||
@@ -48,7 +46,8 @@ Map<String, dynamic> _$$RequestModelImplToJson(_$RequestModelImpl instance) =>
|
||||
'responseStatus': instance.responseStatus,
|
||||
'message': instance.message,
|
||||
'httpResponseModel': instance.httpResponseModel?.toJson(),
|
||||
'authModel': instance.authModel?.toJson(),
|
||||
'preRequestScript': instance.preRequestScript,
|
||||
'postRequestScript': instance.postRequestScript,
|
||||
};
|
||||
|
||||
const _$APITypeEnumMap = {
|
||||
|
||||
@@ -239,7 +239,6 @@ class CollectionStateNotifier
|
||||
name: name ?? currentModel.name,
|
||||
description: description ?? currentModel.description,
|
||||
requestTabIndex: requestTabIndex ?? currentModel.requestTabIndex,
|
||||
authModel: authData ?? currentModel.authModel,
|
||||
httpRequestModel: currentHttpRequestModel?.copyWith(
|
||||
method: method ?? currentHttpRequestModel.method,
|
||||
url: url ?? currentHttpRequestModel.url,
|
||||
@@ -318,7 +317,6 @@ class CollectionStateNotifier
|
||||
requestId,
|
||||
apiType,
|
||||
requestModel.authModel,
|
||||
requestModel.authModel,
|
||||
substitutedHttpRequestModel,
|
||||
defaultUriScheme: defaultUriScheme,
|
||||
noSSL: noSSL,
|
||||
@@ -358,8 +356,28 @@ class CollectionStateNotifier
|
||||
),
|
||||
httpRequestModel: substitutedHttpRequestModel,
|
||||
httpResponseModel: httpResponseModel,
|
||||
authModel: requestModel.authModel);
|
||||
preRequestScript: requestModel.preRequestScript,
|
||||
postRequestScript: requestModel.postRequestScript,
|
||||
authModel: requestModel.authModel,
|
||||
);
|
||||
|
||||
ref.read(historyMetaStateNotifier.notifier).addHistoryRequest(model);
|
||||
|
||||
if (!requestModel.postRequestScript.isNullOrEmpty()) {
|
||||
newRequestModel = await handlePostResponseScript(
|
||||
newRequestModel,
|
||||
originalEnvironmentModel,
|
||||
(envModel, updatedValues) {
|
||||
ref
|
||||
.read(environmentsStateNotifierProvider.notifier)
|
||||
.updateEnvironment(
|
||||
envModel.id,
|
||||
name: envModel.name,
|
||||
values: updatedValues,
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// update state with response data
|
||||
|
||||
@@ -40,6 +40,13 @@ class HistoryRequestPane extends ConsumerWidget {
|
||||
.select((value) => value?.httpRequestModel.hasQuery)) ??
|
||||
false;
|
||||
|
||||
final scriptsLength = ref.watch(selectedHistoryRequestModelProvider
|
||||
.select((value) => value?.preRequestScript?.length)) ??
|
||||
ref.watch(selectedHistoryRequestModelProvider
|
||||
.select((value) => value?.postRequestScript?.length)) ??
|
||||
0;
|
||||
|
||||
|
||||
final hasAuth = ref.watch(selectedHistoryRequestModelProvider.select(
|
||||
(value) =>
|
||||
value?.authModel?.type != APIAuthType.none));
|
||||
@@ -61,6 +68,7 @@ class HistoryRequestPane extends ConsumerWidget {
|
||||
paramLength > 0,
|
||||
headerLength > 0,
|
||||
hasBody,
|
||||
scriptsLength > 0,
|
||||
],
|
||||
tabLabels: const [
|
||||
kLabelURLParams,
|
||||
@@ -98,6 +106,7 @@ class HistoryRequestPane extends ConsumerWidget {
|
||||
headerLength > 0,
|
||||
hasAuth,
|
||||
hasQuery,
|
||||
scriptsLength > 0
|
||||
],
|
||||
tabLabels: const [
|
||||
kLabelHeaders,
|
||||
|
||||
@@ -28,6 +28,12 @@ class EditGraphQLRequestPane extends ConsumerWidget {
|
||||
final hasAuth = ref.watch(selectedRequestModelProvider.select((value) =>
|
||||
value?.authModel?.type != APIAuthType.none));
|
||||
|
||||
final scriptsLength = ref.watch(selectedHistoryRequestModelProvider
|
||||
.select((value) => value?.preRequestScript?.length)) ??
|
||||
ref.watch(selectedHistoryRequestModelProvider
|
||||
.select((value) => value?.postRequestScript?.length)) ??
|
||||
0;
|
||||
|
||||
if (tabIndex >= 3) {
|
||||
tabIndex = 0;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import 'request_headers.dart';
|
||||
import 'request_params.dart';
|
||||
import 'request_body.dart';
|
||||
import 'request_auth.dart';
|
||||
import 'request_scripts.dart';
|
||||
|
||||
class EditRestRequestPane extends ConsumerWidget {
|
||||
const EditRestRequestPane({super.key});
|
||||
@@ -29,6 +30,12 @@ class EditRestRequestPane extends ConsumerWidget {
|
||||
.select((value) => value?.httpRequestModel?.hasBody)) ??
|
||||
false;
|
||||
|
||||
final scriptsLength = ref.watch(selectedRequestModelProvider
|
||||
.select((value) => value?.preRequestScript?.length)) ??
|
||||
ref.watch(selectedRequestModelProvider
|
||||
.select((value) => value?.postRequestScript?.length)) ??
|
||||
0;
|
||||
|
||||
final hasAuth = ref.watch(selectedRequestModelProvider.select((value) =>
|
||||
value?.authModel?.type != APIAuthType.none));
|
||||
|
||||
@@ -50,18 +57,21 @@ class EditRestRequestPane extends ConsumerWidget {
|
||||
hasAuth,
|
||||
headerLength > 0,
|
||||
hasBody,
|
||||
scriptsLength > 0,
|
||||
],
|
||||
tabLabels: const [
|
||||
kLabelURLParams,
|
||||
kLabelAuth,
|
||||
kLabelHeaders,
|
||||
kLabelBody,
|
||||
kLabelScripts,
|
||||
],
|
||||
children: const [
|
||||
EditRequestURLParams(),
|
||||
EditAuthType(),
|
||||
EditRequestHeaders(),
|
||||
EditRequestBody(),
|
||||
EditRequestScripts(),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,14 +1,3 @@
|
||||
import 'dart:convert';
|
||||
|
||||
enum APIType {
|
||||
rest("HTTP", "HTTP"),
|
||||
graphql("GraphQL", "GQL");
|
||||
|
||||
const APIType(this.label, this.abbr);
|
||||
final String label;
|
||||
final String abbr;
|
||||
}
|
||||
|
||||
enum APIAuthType {
|
||||
none,
|
||||
basic,
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'http_request_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$HttpRequestModelImpl _$$HttpRequestModelImplFromJson(Map json) =>
|
||||
_$HttpRequestModelImpl(
|
||||
method: $enumDecodeNullable(_$HTTPVerbEnumMap, json['method']) ??
|
||||
HTTPVerb.get,
|
||||
url: json['url'] as String? ?? "",
|
||||
headers: (json['headers'] as List<dynamic>?)
|
||||
?.map((e) =>
|
||||
NameValueModel.fromJson(Map<String, Object?>.from(e as Map)))
|
||||
.toList(),
|
||||
params: (json['params'] as List<dynamic>?)
|
||||
?.map((e) =>
|
||||
NameValueModel.fromJson(Map<String, Object?>.from(e as Map)))
|
||||
.toList(),
|
||||
isHeaderEnabledList: (json['isHeaderEnabledList'] as List<dynamic>?)
|
||||
?.map((e) => e as bool)
|
||||
.toList(),
|
||||
isParamEnabledList: (json['isParamEnabledList'] as List<dynamic>?)
|
||||
?.map((e) => e as bool)
|
||||
.toList(),
|
||||
bodyContentType:
|
||||
$enumDecodeNullable(_$ContentTypeEnumMap, json['bodyContentType']) ??
|
||||
ContentType.json,
|
||||
body: json['body'] as String?,
|
||||
query: json['query'] as String?,
|
||||
formData: (json['formData'] as List<dynamic>?)
|
||||
?.map((e) =>
|
||||
FormDataModel.fromJson(Map<String, Object?>.from(e as Map)))
|
||||
.toList(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$HttpRequestModelImplToJson(
|
||||
_$HttpRequestModelImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'method': _$HTTPVerbEnumMap[instance.method]!,
|
||||
'url': instance.url,
|
||||
'headers': instance.headers?.map((e) => e.toJson()).toList(),
|
||||
'params': instance.params?.map((e) => e.toJson()).toList(),
|
||||
'isHeaderEnabledList': instance.isHeaderEnabledList,
|
||||
'isParamEnabledList': instance.isParamEnabledList,
|
||||
'bodyContentType': _$ContentTypeEnumMap[instance.bodyContentType]!,
|
||||
'body': instance.body,
|
||||
'query': instance.query,
|
||||
'formData': instance.formData?.map((e) => e.toJson()).toList(),
|
||||
};
|
||||
|
||||
const _$HTTPVerbEnumMap = {
|
||||
HTTPVerb.get: 'get',
|
||||
HTTPVerb.head: 'head',
|
||||
HTTPVerb.post: 'post',
|
||||
HTTPVerb.put: 'put',
|
||||
HTTPVerb.patch: 'patch',
|
||||
HTTPVerb.delete: 'delete',
|
||||
HTTPVerb.options: 'options',
|
||||
};
|
||||
|
||||
const _$ContentTypeEnumMap = {
|
||||
ContentType.json: 'json',
|
||||
ContentType.text: 'text',
|
||||
ContentType.formdata: 'formdata',
|
||||
};
|
||||
@@ -1,6 +1,4 @@
|
||||
export 'environment_model.dart';
|
||||
export 'http_request_model.dart';
|
||||
export 'http_response_model.dart';
|
||||
export 'auth/api_auth_model.dart';
|
||||
export 'auth/auth_api_key_model.dart';
|
||||
export 'auth/auth_basic_model.dart';
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import 'dart:convert';
|
||||
import 'package:apidash_core/consts.dart';
|
||||
import 'package:apidash_core/models/auth/api_auth_model.dart';
|
||||
import 'package:apidash_core/models/http_request_model.dart';
|
||||
import 'package:apidash_core/utils/auth_utils.dart';
|
||||
import 'package:seed/seed.dart';
|
||||
|
||||
HttpRequestModel handleAuth(HttpRequestModel httpRequestModel,AuthModel? authData) {
|
||||
if (authData == null || authData.type == APIAuthType.none) {
|
||||
|
||||
Reference in New Issue
Block a user