mirror of
https://github.com/foss42/apidash.git
synced 2025-12-02 10:49:49 +08:00
refactor: move authModel to HttpRequestModel
This commit is contained in:
@@ -15,7 +15,6 @@ class RequestModel with _$RequestModel {
|
|||||||
@Default(APIType.rest) APIType apiType,
|
@Default(APIType.rest) APIType apiType,
|
||||||
@Default("") String name,
|
@Default("") String name,
|
||||||
@Default("") String description,
|
@Default("") String description,
|
||||||
@Default(AuthModel(type: APIAuthType.none)) AuthModel? authModel,
|
|
||||||
@JsonKey(includeToJson: false) @Default(0) requestTabIndex,
|
@JsonKey(includeToJson: false) @Default(0) requestTabIndex,
|
||||||
HttpRequestModel? httpRequestModel,
|
HttpRequestModel? httpRequestModel,
|
||||||
int? responseStatus,
|
int? responseStatus,
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ mixin _$RequestModel {
|
|||||||
APIType get apiType => throw _privateConstructorUsedError;
|
APIType get apiType => throw _privateConstructorUsedError;
|
||||||
String get name => throw _privateConstructorUsedError;
|
String get name => throw _privateConstructorUsedError;
|
||||||
String get description => throw _privateConstructorUsedError;
|
String get description => throw _privateConstructorUsedError;
|
||||||
AuthModel? get authModel => throw _privateConstructorUsedError;
|
|
||||||
@JsonKey(includeToJson: false)
|
@JsonKey(includeToJson: false)
|
||||||
dynamic get requestTabIndex => throw _privateConstructorUsedError;
|
dynamic get requestTabIndex => throw _privateConstructorUsedError;
|
||||||
HttpRequestModel? get httpRequestModel => throw _privateConstructorUsedError;
|
HttpRequestModel? get httpRequestModel => throw _privateConstructorUsedError;
|
||||||
@@ -60,7 +59,6 @@ abstract class $RequestModelCopyWith<$Res> {
|
|||||||
APIType apiType,
|
APIType apiType,
|
||||||
String name,
|
String name,
|
||||||
String description,
|
String description,
|
||||||
AuthModel? authModel,
|
|
||||||
@JsonKey(includeToJson: false) dynamic requestTabIndex,
|
@JsonKey(includeToJson: false) dynamic requestTabIndex,
|
||||||
HttpRequestModel? httpRequestModel,
|
HttpRequestModel? httpRequestModel,
|
||||||
int? responseStatus,
|
int? responseStatus,
|
||||||
@@ -71,7 +69,6 @@ abstract class $RequestModelCopyWith<$Res> {
|
|||||||
String? preRequestScript,
|
String? preRequestScript,
|
||||||
String? postRequestScript});
|
String? postRequestScript});
|
||||||
|
|
||||||
$AuthModelCopyWith<$Res>? get authModel;
|
|
||||||
$HttpRequestModelCopyWith<$Res>? get httpRequestModel;
|
$HttpRequestModelCopyWith<$Res>? get httpRequestModel;
|
||||||
$HttpResponseModelCopyWith<$Res>? get httpResponseModel;
|
$HttpResponseModelCopyWith<$Res>? get httpResponseModel;
|
||||||
}
|
}
|
||||||
@@ -95,7 +92,6 @@ class _$RequestModelCopyWithImpl<$Res, $Val extends RequestModel>
|
|||||||
Object? apiType = null,
|
Object? apiType = null,
|
||||||
Object? name = null,
|
Object? name = null,
|
||||||
Object? description = null,
|
Object? description = null,
|
||||||
Object? authModel = freezed,
|
|
||||||
Object? requestTabIndex = freezed,
|
Object? requestTabIndex = freezed,
|
||||||
Object? httpRequestModel = freezed,
|
Object? httpRequestModel = freezed,
|
||||||
Object? responseStatus = freezed,
|
Object? responseStatus = freezed,
|
||||||
@@ -123,10 +119,6 @@ class _$RequestModelCopyWithImpl<$Res, $Val extends RequestModel>
|
|||||||
? _value.description
|
? _value.description
|
||||||
: description // ignore: cast_nullable_to_non_nullable
|
: description // ignore: cast_nullable_to_non_nullable
|
||||||
as String,
|
as String,
|
||||||
authModel: freezed == authModel
|
|
||||||
? _value.authModel
|
|
||||||
: authModel // ignore: cast_nullable_to_non_nullable
|
|
||||||
as AuthModel?,
|
|
||||||
requestTabIndex: freezed == requestTabIndex
|
requestTabIndex: freezed == requestTabIndex
|
||||||
? _value.requestTabIndex
|
? _value.requestTabIndex
|
||||||
: requestTabIndex // ignore: cast_nullable_to_non_nullable
|
: requestTabIndex // ignore: cast_nullable_to_non_nullable
|
||||||
@@ -166,20 +158,6 @@ class _$RequestModelCopyWithImpl<$Res, $Val extends RequestModel>
|
|||||||
) as $Val);
|
) 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);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Create a copy of RequestModel
|
/// Create a copy of RequestModel
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@override
|
@override
|
||||||
@@ -222,7 +200,6 @@ abstract class _$$RequestModelImplCopyWith<$Res>
|
|||||||
APIType apiType,
|
APIType apiType,
|
||||||
String name,
|
String name,
|
||||||
String description,
|
String description,
|
||||||
AuthModel? authModel,
|
|
||||||
@JsonKey(includeToJson: false) dynamic requestTabIndex,
|
@JsonKey(includeToJson: false) dynamic requestTabIndex,
|
||||||
HttpRequestModel? httpRequestModel,
|
HttpRequestModel? httpRequestModel,
|
||||||
int? responseStatus,
|
int? responseStatus,
|
||||||
@@ -233,8 +210,6 @@ abstract class _$$RequestModelImplCopyWith<$Res>
|
|||||||
String? preRequestScript,
|
String? preRequestScript,
|
||||||
String? postRequestScript});
|
String? postRequestScript});
|
||||||
|
|
||||||
@override
|
|
||||||
$AuthModelCopyWith<$Res>? get authModel;
|
|
||||||
@override
|
@override
|
||||||
$HttpRequestModelCopyWith<$Res>? get httpRequestModel;
|
$HttpRequestModelCopyWith<$Res>? get httpRequestModel;
|
||||||
@override
|
@override
|
||||||
@@ -258,7 +233,6 @@ class __$$RequestModelImplCopyWithImpl<$Res>
|
|||||||
Object? apiType = null,
|
Object? apiType = null,
|
||||||
Object? name = null,
|
Object? name = null,
|
||||||
Object? description = null,
|
Object? description = null,
|
||||||
Object? authModel = freezed,
|
|
||||||
Object? requestTabIndex = freezed,
|
Object? requestTabIndex = freezed,
|
||||||
Object? httpRequestModel = freezed,
|
Object? httpRequestModel = freezed,
|
||||||
Object? responseStatus = freezed,
|
Object? responseStatus = freezed,
|
||||||
@@ -286,10 +260,6 @@ class __$$RequestModelImplCopyWithImpl<$Res>
|
|||||||
? _value.description
|
? _value.description
|
||||||
: description // ignore: cast_nullable_to_non_nullable
|
: description // ignore: cast_nullable_to_non_nullable
|
||||||
as String,
|
as String,
|
||||||
authModel: freezed == authModel
|
|
||||||
? _value.authModel
|
|
||||||
: authModel // ignore: cast_nullable_to_non_nullable
|
|
||||||
as AuthModel?,
|
|
||||||
requestTabIndex: freezed == requestTabIndex
|
requestTabIndex: freezed == requestTabIndex
|
||||||
? _value.requestTabIndex!
|
? _value.requestTabIndex!
|
||||||
: requestTabIndex,
|
: requestTabIndex,
|
||||||
@@ -338,7 +308,6 @@ class _$RequestModelImpl implements _RequestModel {
|
|||||||
this.apiType = APIType.rest,
|
this.apiType = APIType.rest,
|
||||||
this.name = "",
|
this.name = "",
|
||||||
this.description = "",
|
this.description = "",
|
||||||
this.authModel = const AuthModel(type: APIAuthType.none),
|
|
||||||
@JsonKey(includeToJson: false) this.requestTabIndex = 0,
|
@JsonKey(includeToJson: false) this.requestTabIndex = 0,
|
||||||
this.httpRequestModel,
|
this.httpRequestModel,
|
||||||
this.responseStatus,
|
this.responseStatus,
|
||||||
@@ -364,9 +333,6 @@ class _$RequestModelImpl implements _RequestModel {
|
|||||||
@JsonKey()
|
@JsonKey()
|
||||||
final String description;
|
final String description;
|
||||||
@override
|
@override
|
||||||
@JsonKey()
|
|
||||||
final AuthModel? authModel;
|
|
||||||
@override
|
|
||||||
@JsonKey(includeToJson: false)
|
@JsonKey(includeToJson: false)
|
||||||
final dynamic requestTabIndex;
|
final dynamic requestTabIndex;
|
||||||
@override
|
@override
|
||||||
@@ -390,7 +356,7 @@ class _$RequestModelImpl implements _RequestModel {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
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)';
|
return 'RequestModel(id: $id, apiType: $apiType, name: $name, description: $description, requestTabIndex: $requestTabIndex, httpRequestModel: $httpRequestModel, responseStatus: $responseStatus, message: $message, httpResponseModel: $httpResponseModel, isWorking: $isWorking, sendingTime: $sendingTime, preRequestScript: $preRequestScript, postRequestScript: $postRequestScript)';
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -403,8 +369,6 @@ class _$RequestModelImpl implements _RequestModel {
|
|||||||
(identical(other.name, name) || other.name == name) &&
|
(identical(other.name, name) || other.name == name) &&
|
||||||
(identical(other.description, description) ||
|
(identical(other.description, description) ||
|
||||||
other.description == description) &&
|
other.description == description) &&
|
||||||
(identical(other.authModel, authModel) ||
|
|
||||||
other.authModel == authModel) &&
|
|
||||||
const DeepCollectionEquality()
|
const DeepCollectionEquality()
|
||||||
.equals(other.requestTabIndex, requestTabIndex) &&
|
.equals(other.requestTabIndex, requestTabIndex) &&
|
||||||
(identical(other.httpRequestModel, httpRequestModel) ||
|
(identical(other.httpRequestModel, httpRequestModel) ||
|
||||||
@@ -432,7 +396,6 @@ class _$RequestModelImpl implements _RequestModel {
|
|||||||
apiType,
|
apiType,
|
||||||
name,
|
name,
|
||||||
description,
|
description,
|
||||||
authModel,
|
|
||||||
const DeepCollectionEquality().hash(requestTabIndex),
|
const DeepCollectionEquality().hash(requestTabIndex),
|
||||||
httpRequestModel,
|
httpRequestModel,
|
||||||
responseStatus,
|
responseStatus,
|
||||||
@@ -465,7 +428,6 @@ abstract class _RequestModel implements RequestModel {
|
|||||||
final APIType apiType,
|
final APIType apiType,
|
||||||
final String name,
|
final String name,
|
||||||
final String description,
|
final String description,
|
||||||
final AuthModel? authModel,
|
|
||||||
@JsonKey(includeToJson: false) final dynamic requestTabIndex,
|
@JsonKey(includeToJson: false) final dynamic requestTabIndex,
|
||||||
final HttpRequestModel? httpRequestModel,
|
final HttpRequestModel? httpRequestModel,
|
||||||
final int? responseStatus,
|
final int? responseStatus,
|
||||||
@@ -488,8 +450,6 @@ abstract class _RequestModel implements RequestModel {
|
|||||||
@override
|
@override
|
||||||
String get description;
|
String get description;
|
||||||
@override
|
@override
|
||||||
AuthModel? get authModel;
|
|
||||||
@override
|
|
||||||
@JsonKey(includeToJson: false)
|
@JsonKey(includeToJson: false)
|
||||||
dynamic get requestTabIndex;
|
dynamic get requestTabIndex;
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -12,10 +12,6 @@ _$RequestModelImpl _$$RequestModelImplFromJson(Map json) => _$RequestModelImpl(
|
|||||||
APIType.rest,
|
APIType.rest,
|
||||||
name: json['name'] as String? ?? "",
|
name: json['name'] as String? ?? "",
|
||||||
description: json['description'] as String? ?? "",
|
description: json['description'] as String? ?? "",
|
||||||
authModel: json['authModel'] == null
|
|
||||||
? const AuthModel(type: APIAuthType.none)
|
|
||||||
: AuthModel.fromJson(
|
|
||||||
Map<String, dynamic>.from(json['authModel'] as Map)),
|
|
||||||
requestTabIndex: json['requestTabIndex'] ?? 0,
|
requestTabIndex: json['requestTabIndex'] ?? 0,
|
||||||
httpRequestModel: json['httpRequestModel'] == null
|
httpRequestModel: json['httpRequestModel'] == null
|
||||||
? null
|
? null
|
||||||
@@ -41,7 +37,6 @@ Map<String, dynamic> _$$RequestModelImplToJson(_$RequestModelImpl instance) =>
|
|||||||
'apiType': _$APITypeEnumMap[instance.apiType]!,
|
'apiType': _$APITypeEnumMap[instance.apiType]!,
|
||||||
'name': instance.name,
|
'name': instance.name,
|
||||||
'description': instance.description,
|
'description': instance.description,
|
||||||
'authModel': instance.authModel?.toJson(),
|
|
||||||
'httpRequestModel': instance.httpRequestModel?.toJson(),
|
'httpRequestModel': instance.httpRequestModel?.toJson(),
|
||||||
'responseStatus': instance.responseStatus,
|
'responseStatus': instance.responseStatus,
|
||||||
'message': instance.message,
|
'message': instance.message,
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ class CollectionStateNotifier
|
|||||||
String? id,
|
String? id,
|
||||||
HTTPVerb? method,
|
HTTPVerb? method,
|
||||||
APIType? apiType,
|
APIType? apiType,
|
||||||
AuthModel? authData,
|
AuthModel? authModel,
|
||||||
String? url,
|
String? url,
|
||||||
String? name,
|
String? name,
|
||||||
String? description,
|
String? description,
|
||||||
@@ -235,7 +235,6 @@ class CollectionStateNotifier
|
|||||||
var currentHttpRequestModel = currentModel.httpRequestModel;
|
var currentHttpRequestModel = currentModel.httpRequestModel;
|
||||||
final newModel = currentModel.copyWith(
|
final newModel = currentModel.copyWith(
|
||||||
apiType: apiType ?? currentModel.apiType,
|
apiType: apiType ?? currentModel.apiType,
|
||||||
authModel: authData ?? currentModel.authModel,
|
|
||||||
name: name ?? currentModel.name,
|
name: name ?? currentModel.name,
|
||||||
description: description ?? currentModel.description,
|
description: description ?? currentModel.description,
|
||||||
requestTabIndex: requestTabIndex ?? currentModel.requestTabIndex,
|
requestTabIndex: requestTabIndex ?? currentModel.requestTabIndex,
|
||||||
@@ -244,6 +243,7 @@ class CollectionStateNotifier
|
|||||||
url: url ?? currentHttpRequestModel.url,
|
url: url ?? currentHttpRequestModel.url,
|
||||||
headers: headers ?? currentHttpRequestModel.headers,
|
headers: headers ?? currentHttpRequestModel.headers,
|
||||||
params: params ?? currentHttpRequestModel.params,
|
params: params ?? currentHttpRequestModel.params,
|
||||||
|
authModel: authModel ?? currentHttpRequestModel.authModel,
|
||||||
isHeaderEnabledList:
|
isHeaderEnabledList:
|
||||||
isHeaderEnabledList ?? currentHttpRequestModel.isHeaderEnabledList,
|
isHeaderEnabledList ?? currentHttpRequestModel.isHeaderEnabledList,
|
||||||
isParamEnabledList:
|
isParamEnabledList:
|
||||||
@@ -316,7 +316,7 @@ class CollectionStateNotifier
|
|||||||
var responseRec = await sendHttpRequest(
|
var responseRec = await sendHttpRequest(
|
||||||
requestId,
|
requestId,
|
||||||
apiType,
|
apiType,
|
||||||
requestModel.authModel,
|
requestModel.httpRequestModel?.authModel,
|
||||||
substitutedHttpRequestModel,
|
substitutedHttpRequestModel,
|
||||||
defaultUriScheme: defaultUriScheme,
|
defaultUriScheme: defaultUriScheme,
|
||||||
noSSL: noSSL,
|
noSSL: noSSL,
|
||||||
@@ -358,7 +358,7 @@ class CollectionStateNotifier
|
|||||||
httpResponseModel: httpResponseModel,
|
httpResponseModel: httpResponseModel,
|
||||||
preRequestScript: requestModel.preRequestScript,
|
preRequestScript: requestModel.preRequestScript,
|
||||||
postRequestScript: requestModel.postRequestScript,
|
postRequestScript: requestModel.postRequestScript,
|
||||||
authModel: requestModel.authModel,
|
authModel: requestModel.httpRequestModel?.authModel,
|
||||||
);
|
);
|
||||||
|
|
||||||
ref.read(historyMetaStateNotifier.notifier).addHistoryRequest(model);
|
ref.read(historyMetaStateNotifier.notifier).addHistoryRequest(model);
|
||||||
|
|||||||
@@ -33,10 +33,10 @@ class EditAuthType extends ConsumerWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
currentAuthType = ref.watch(
|
currentAuthType = ref.watch(
|
||||||
selectedRequestModelProvider
|
selectedRequestModelProvider.select((request) =>
|
||||||
.select((request) => request?.authModel?.type ?? APIAuthType.none),
|
request?.httpRequestModel?.authModel?.type ?? APIAuthType.none),
|
||||||
);
|
);
|
||||||
currentAuthData = selectedRequest.authModel;
|
currentAuthData = selectedRequest.httpRequestModel?.authModel;
|
||||||
}
|
}
|
||||||
return SingleChildScrollView(
|
return SingleChildScrollView(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
@@ -93,7 +93,8 @@ class EditAuthType extends ConsumerWidget {
|
|||||||
ref.read(selectedRequestModelProvider);
|
ref.read(selectedRequestModelProvider);
|
||||||
if (newType != null) {
|
if (newType != null) {
|
||||||
ref.read(collectionStateNotifierProvider.notifier).update(
|
ref.read(collectionStateNotifierProvider.notifier).update(
|
||||||
authData: selectedRequest?.authModel
|
authModel: selectedRequest
|
||||||
|
?.httpRequestModel?.authModel
|
||||||
?.copyWith(type: newType) ??
|
?.copyWith(type: newType) ??
|
||||||
AuthModel(type: newType),
|
AuthModel(type: newType),
|
||||||
);
|
);
|
||||||
@@ -117,11 +118,11 @@ class EditAuthType extends ConsumerWidget {
|
|||||||
void updateAuth(AuthModel? model) {
|
void updateAuth(AuthModel? model) {
|
||||||
if (model == null) {
|
if (model == null) {
|
||||||
ref.read(collectionStateNotifierProvider.notifier).update(
|
ref.read(collectionStateNotifierProvider.notifier).update(
|
||||||
authData: AuthModel(type: APIAuthType.none),
|
authModel: AuthModel(type: APIAuthType.none),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
ref.read(collectionStateNotifierProvider.notifier).update(
|
ref.read(collectionStateNotifierProvider.notifier).update(
|
||||||
authData: model,
|
authModel: model,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class EditGraphQLRequestPane extends ConsumerWidget {
|
|||||||
false;
|
false;
|
||||||
|
|
||||||
final hasAuth = ref.watch(selectedRequestModelProvider
|
final hasAuth = ref.watch(selectedRequestModelProvider
|
||||||
.select((value) => value?.authModel?.type != APIAuthType.none));
|
.select((value) => value?.httpRequestModel?.authModel?.type != APIAuthType.none));
|
||||||
|
|
||||||
final scriptsLength = ref.watch(selectedHistoryRequestModelProvider
|
final scriptsLength = ref.watch(selectedHistoryRequestModelProvider
|
||||||
.select((value) => value?.preRequestScript?.length)) ??
|
.select((value) => value?.preRequestScript?.length)) ??
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class EditRestRequestPane extends ConsumerWidget {
|
|||||||
0;
|
0;
|
||||||
|
|
||||||
final hasAuth = ref.watch(selectedRequestModelProvider.select((value) =>
|
final hasAuth = ref.watch(selectedRequestModelProvider.select((value) =>
|
||||||
value?.authModel?.type != APIAuthType.none));
|
value?.httpRequestModel?.authModel?.type != APIAuthType.none));
|
||||||
|
|
||||||
return RequestPane(
|
return RequestPane(
|
||||||
selectedId: selectedId,
|
selectedId: selectedId,
|
||||||
|
|||||||
@@ -48,6 +48,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.19.1"
|
version: "1.19.1"
|
||||||
|
crypto:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: crypto
|
||||||
|
sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "3.0.6"
|
||||||
cupertino_icons:
|
cupertino_icons:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import '../extensions/extensions.dart';
|
|||||||
import '../utils/utils.dart'
|
import '../utils/utils.dart'
|
||||||
show rowsToFormDataMapList, rowsToMap, getEnabledRows;
|
show rowsToFormDataMapList, rowsToMap, getEnabledRows;
|
||||||
import '../consts.dart';
|
import '../consts.dart';
|
||||||
|
import 'auth/api_auth_model.dart';
|
||||||
|
|
||||||
part 'http_request_model.freezed.dart';
|
part 'http_request_model.freezed.dart';
|
||||||
part 'http_request_model.g.dart';
|
part 'http_request_model.g.dart';
|
||||||
@@ -19,6 +20,7 @@ class HttpRequestModel with _$HttpRequestModel {
|
|||||||
@Default("") String url,
|
@Default("") String url,
|
||||||
List<NameValueModel>? headers,
|
List<NameValueModel>? headers,
|
||||||
List<NameValueModel>? params,
|
List<NameValueModel>? params,
|
||||||
|
@Default(AuthModel(type: APIAuthType.none)) AuthModel? authModel,
|
||||||
List<bool>? isHeaderEnabledList,
|
List<bool>? isHeaderEnabledList,
|
||||||
List<bool>? isParamEnabledList,
|
List<bool>? isParamEnabledList,
|
||||||
@Default(ContentType.json) ContentType bodyContentType,
|
@Default(ContentType.json) ContentType bodyContentType,
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ mixin _$HttpRequestModel {
|
|||||||
String get url => throw _privateConstructorUsedError;
|
String get url => throw _privateConstructorUsedError;
|
||||||
List<NameValueModel>? get headers => throw _privateConstructorUsedError;
|
List<NameValueModel>? get headers => throw _privateConstructorUsedError;
|
||||||
List<NameValueModel>? get params => throw _privateConstructorUsedError;
|
List<NameValueModel>? get params => throw _privateConstructorUsedError;
|
||||||
|
AuthModel? get authModel => throw _privateConstructorUsedError;
|
||||||
List<bool>? get isHeaderEnabledList => throw _privateConstructorUsedError;
|
List<bool>? get isHeaderEnabledList => throw _privateConstructorUsedError;
|
||||||
List<bool>? get isParamEnabledList => throw _privateConstructorUsedError;
|
List<bool>? get isParamEnabledList => throw _privateConstructorUsedError;
|
||||||
ContentType get bodyContentType => throw _privateConstructorUsedError;
|
ContentType get bodyContentType => throw _privateConstructorUsedError;
|
||||||
@@ -54,6 +55,7 @@ abstract class $HttpRequestModelCopyWith<$Res> {
|
|||||||
String url,
|
String url,
|
||||||
List<NameValueModel>? headers,
|
List<NameValueModel>? headers,
|
||||||
List<NameValueModel>? params,
|
List<NameValueModel>? params,
|
||||||
|
AuthModel? authModel,
|
||||||
List<bool>? isHeaderEnabledList,
|
List<bool>? isHeaderEnabledList,
|
||||||
List<bool>? isParamEnabledList,
|
List<bool>? isParamEnabledList,
|
||||||
ContentType bodyContentType,
|
ContentType bodyContentType,
|
||||||
@@ -61,6 +63,8 @@ abstract class $HttpRequestModelCopyWith<$Res> {
|
|||||||
String? query,
|
String? query,
|
||||||
List<FormDataModel>? formData,
|
List<FormDataModel>? formData,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$AuthModelCopyWith<$Res>? get authModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@@ -82,6 +86,7 @@ class _$HttpRequestModelCopyWithImpl<$Res, $Val extends HttpRequestModel>
|
|||||||
Object? url = null,
|
Object? url = null,
|
||||||
Object? headers = freezed,
|
Object? headers = freezed,
|
||||||
Object? params = freezed,
|
Object? params = freezed,
|
||||||
|
Object? authModel = freezed,
|
||||||
Object? isHeaderEnabledList = freezed,
|
Object? isHeaderEnabledList = freezed,
|
||||||
Object? isParamEnabledList = freezed,
|
Object? isParamEnabledList = freezed,
|
||||||
Object? bodyContentType = null,
|
Object? bodyContentType = null,
|
||||||
@@ -107,6 +112,10 @@ class _$HttpRequestModelCopyWithImpl<$Res, $Val extends HttpRequestModel>
|
|||||||
? _value.params
|
? _value.params
|
||||||
: params // ignore: cast_nullable_to_non_nullable
|
: params // ignore: cast_nullable_to_non_nullable
|
||||||
as List<NameValueModel>?,
|
as List<NameValueModel>?,
|
||||||
|
authModel: freezed == authModel
|
||||||
|
? _value.authModel
|
||||||
|
: authModel // ignore: cast_nullable_to_non_nullable
|
||||||
|
as AuthModel?,
|
||||||
isHeaderEnabledList: freezed == isHeaderEnabledList
|
isHeaderEnabledList: freezed == isHeaderEnabledList
|
||||||
? _value.isHeaderEnabledList
|
? _value.isHeaderEnabledList
|
||||||
: isHeaderEnabledList // ignore: cast_nullable_to_non_nullable
|
: isHeaderEnabledList // ignore: cast_nullable_to_non_nullable
|
||||||
@@ -135,6 +144,20 @@ class _$HttpRequestModelCopyWithImpl<$Res, $Val extends HttpRequestModel>
|
|||||||
as $Val,
|
as $Val,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Create a copy of HttpRequestModel
|
||||||
|
/// 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
|
/// @nodoc
|
||||||
@@ -151,6 +174,7 @@ abstract class _$$HttpRequestModelImplCopyWith<$Res>
|
|||||||
String url,
|
String url,
|
||||||
List<NameValueModel>? headers,
|
List<NameValueModel>? headers,
|
||||||
List<NameValueModel>? params,
|
List<NameValueModel>? params,
|
||||||
|
AuthModel? authModel,
|
||||||
List<bool>? isHeaderEnabledList,
|
List<bool>? isHeaderEnabledList,
|
||||||
List<bool>? isParamEnabledList,
|
List<bool>? isParamEnabledList,
|
||||||
ContentType bodyContentType,
|
ContentType bodyContentType,
|
||||||
@@ -158,6 +182,9 @@ abstract class _$$HttpRequestModelImplCopyWith<$Res>
|
|||||||
String? query,
|
String? query,
|
||||||
List<FormDataModel>? formData,
|
List<FormDataModel>? formData,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
$AuthModelCopyWith<$Res>? get authModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@@ -178,6 +205,7 @@ class __$$HttpRequestModelImplCopyWithImpl<$Res>
|
|||||||
Object? url = null,
|
Object? url = null,
|
||||||
Object? headers = freezed,
|
Object? headers = freezed,
|
||||||
Object? params = freezed,
|
Object? params = freezed,
|
||||||
|
Object? authModel = freezed,
|
||||||
Object? isHeaderEnabledList = freezed,
|
Object? isHeaderEnabledList = freezed,
|
||||||
Object? isParamEnabledList = freezed,
|
Object? isParamEnabledList = freezed,
|
||||||
Object? bodyContentType = null,
|
Object? bodyContentType = null,
|
||||||
@@ -203,6 +231,10 @@ class __$$HttpRequestModelImplCopyWithImpl<$Res>
|
|||||||
? _value._params
|
? _value._params
|
||||||
: params // ignore: cast_nullable_to_non_nullable
|
: params // ignore: cast_nullable_to_non_nullable
|
||||||
as List<NameValueModel>?,
|
as List<NameValueModel>?,
|
||||||
|
authModel: freezed == authModel
|
||||||
|
? _value.authModel
|
||||||
|
: authModel // ignore: cast_nullable_to_non_nullable
|
||||||
|
as AuthModel?,
|
||||||
isHeaderEnabledList: freezed == isHeaderEnabledList
|
isHeaderEnabledList: freezed == isHeaderEnabledList
|
||||||
? _value._isHeaderEnabledList
|
? _value._isHeaderEnabledList
|
||||||
: isHeaderEnabledList // ignore: cast_nullable_to_non_nullable
|
: isHeaderEnabledList // ignore: cast_nullable_to_non_nullable
|
||||||
@@ -241,6 +273,7 @@ class _$HttpRequestModelImpl extends _HttpRequestModel {
|
|||||||
this.url = "",
|
this.url = "",
|
||||||
final List<NameValueModel>? headers,
|
final List<NameValueModel>? headers,
|
||||||
final List<NameValueModel>? params,
|
final List<NameValueModel>? params,
|
||||||
|
this.authModel = const AuthModel(type: APIAuthType.none),
|
||||||
final List<bool>? isHeaderEnabledList,
|
final List<bool>? isHeaderEnabledList,
|
||||||
final List<bool>? isParamEnabledList,
|
final List<bool>? isParamEnabledList,
|
||||||
this.bodyContentType = ContentType.json,
|
this.bodyContentType = ContentType.json,
|
||||||
@@ -283,6 +316,9 @@ class _$HttpRequestModelImpl extends _HttpRequestModel {
|
|||||||
return EqualUnmodifiableListView(value);
|
return EqualUnmodifiableListView(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@JsonKey()
|
||||||
|
final AuthModel? authModel;
|
||||||
final List<bool>? _isHeaderEnabledList;
|
final List<bool>? _isHeaderEnabledList;
|
||||||
@override
|
@override
|
||||||
List<bool>? get isHeaderEnabledList {
|
List<bool>? get isHeaderEnabledList {
|
||||||
@@ -324,7 +360,7 @@ class _$HttpRequestModelImpl extends _HttpRequestModel {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'HttpRequestModel(method: $method, url: $url, headers: $headers, params: $params, isHeaderEnabledList: $isHeaderEnabledList, isParamEnabledList: $isParamEnabledList, bodyContentType: $bodyContentType, body: $body, query: $query, formData: $formData)';
|
return 'HttpRequestModel(method: $method, url: $url, headers: $headers, params: $params, authModel: $authModel, isHeaderEnabledList: $isHeaderEnabledList, isParamEnabledList: $isParamEnabledList, bodyContentType: $bodyContentType, body: $body, query: $query, formData: $formData)';
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -336,6 +372,8 @@ class _$HttpRequestModelImpl extends _HttpRequestModel {
|
|||||||
(identical(other.url, url) || other.url == url) &&
|
(identical(other.url, url) || other.url == url) &&
|
||||||
const DeepCollectionEquality().equals(other._headers, _headers) &&
|
const DeepCollectionEquality().equals(other._headers, _headers) &&
|
||||||
const DeepCollectionEquality().equals(other._params, _params) &&
|
const DeepCollectionEquality().equals(other._params, _params) &&
|
||||||
|
(identical(other.authModel, authModel) ||
|
||||||
|
other.authModel == authModel) &&
|
||||||
const DeepCollectionEquality().equals(
|
const DeepCollectionEquality().equals(
|
||||||
other._isHeaderEnabledList,
|
other._isHeaderEnabledList,
|
||||||
_isHeaderEnabledList,
|
_isHeaderEnabledList,
|
||||||
@@ -359,6 +397,7 @@ class _$HttpRequestModelImpl extends _HttpRequestModel {
|
|||||||
url,
|
url,
|
||||||
const DeepCollectionEquality().hash(_headers),
|
const DeepCollectionEquality().hash(_headers),
|
||||||
const DeepCollectionEquality().hash(_params),
|
const DeepCollectionEquality().hash(_params),
|
||||||
|
authModel,
|
||||||
const DeepCollectionEquality().hash(_isHeaderEnabledList),
|
const DeepCollectionEquality().hash(_isHeaderEnabledList),
|
||||||
const DeepCollectionEquality().hash(_isParamEnabledList),
|
const DeepCollectionEquality().hash(_isParamEnabledList),
|
||||||
bodyContentType,
|
bodyContentType,
|
||||||
@@ -390,6 +429,7 @@ abstract class _HttpRequestModel extends HttpRequestModel {
|
|||||||
final String url,
|
final String url,
|
||||||
final List<NameValueModel>? headers,
|
final List<NameValueModel>? headers,
|
||||||
final List<NameValueModel>? params,
|
final List<NameValueModel>? params,
|
||||||
|
final AuthModel? authModel,
|
||||||
final List<bool>? isHeaderEnabledList,
|
final List<bool>? isHeaderEnabledList,
|
||||||
final List<bool>? isParamEnabledList,
|
final List<bool>? isParamEnabledList,
|
||||||
final ContentType bodyContentType,
|
final ContentType bodyContentType,
|
||||||
@@ -411,6 +451,8 @@ abstract class _HttpRequestModel extends HttpRequestModel {
|
|||||||
@override
|
@override
|
||||||
List<NameValueModel>? get params;
|
List<NameValueModel>? get params;
|
||||||
@override
|
@override
|
||||||
|
AuthModel? get authModel;
|
||||||
|
@override
|
||||||
List<bool>? get isHeaderEnabledList;
|
List<bool>? get isHeaderEnabledList;
|
||||||
@override
|
@override
|
||||||
List<bool>? get isParamEnabledList;
|
List<bool>? get isParamEnabledList;
|
||||||
|
|||||||
@@ -18,6 +18,9 @@ _$HttpRequestModelImpl _$$HttpRequestModelImplFromJson(
|
|||||||
params: (json['params'] as List<dynamic>?)
|
params: (json['params'] as List<dynamic>?)
|
||||||
?.map((e) => NameValueModel.fromJson(Map<String, Object?>.from(e as Map)))
|
?.map((e) => NameValueModel.fromJson(Map<String, Object?>.from(e as Map)))
|
||||||
.toList(),
|
.toList(),
|
||||||
|
authModel: json['authModel'] == null
|
||||||
|
? const AuthModel(type: APIAuthType.none)
|
||||||
|
: AuthModel.fromJson(Map<String, dynamic>.from(json['authModel'] as Map)),
|
||||||
isHeaderEnabledList: (json['isHeaderEnabledList'] as List<dynamic>?)
|
isHeaderEnabledList: (json['isHeaderEnabledList'] as List<dynamic>?)
|
||||||
?.map((e) => e as bool)
|
?.map((e) => e as bool)
|
||||||
.toList(),
|
.toList(),
|
||||||
@@ -41,6 +44,7 @@ Map<String, dynamic> _$$HttpRequestModelImplToJson(
|
|||||||
'url': instance.url,
|
'url': instance.url,
|
||||||
'headers': instance.headers?.map((e) => e.toJson()).toList(),
|
'headers': instance.headers?.map((e) => e.toJson()).toList(),
|
||||||
'params': instance.params?.map((e) => e.toJson()).toList(),
|
'params': instance.params?.map((e) => e.toJson()).toList(),
|
||||||
|
'authModel': instance.authModel?.toJson(),
|
||||||
'isHeaderEnabledList': instance.isHeaderEnabledList,
|
'isHeaderEnabledList': instance.isHeaderEnabledList,
|
||||||
'isParamEnabledList': instance.isParamEnabledList,
|
'isParamEnabledList': instance.isParamEnabledList,
|
||||||
'bodyContentType': _$ContentTypeEnumMap[instance.bodyContentType]!,
|
'bodyContentType': _$ContentTypeEnumMap[instance.bodyContentType]!,
|
||||||
|
|||||||
Reference in New Issue
Block a user