mirror of
https://github.com/foss42/apidash.git
synced 2025-12-02 18:57:05 +08:00
refactor: rename ApiAuthModel to AuthModel and authData to authModel
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import 'package:apidash_core/apidash_core.dart';
|
||||
import 'package:apidash_core/models/auth/api_auth_model.dart';
|
||||
|
||||
part 'request_model.freezed.dart';
|
||||
|
||||
@@ -16,7 +15,7 @@ class RequestModel with _$RequestModel {
|
||||
@Default(APIType.rest) APIType apiType,
|
||||
@Default("") String name,
|
||||
@Default("") String description,
|
||||
@Default(ApiAuthModel(type: APIAuthType.none)) ApiAuthModel? authData,
|
||||
@Default(AuthModel(type: APIAuthType.none)) AuthModel? authModel,
|
||||
@JsonKey(includeToJson: false) @Default(0) requestTabIndex,
|
||||
HttpRequestModel? httpRequestModel,
|
||||
int? responseStatus,
|
||||
|
||||
@@ -24,7 +24,7 @@ mixin _$RequestModel {
|
||||
APIType get apiType => throw _privateConstructorUsedError;
|
||||
String get name => throw _privateConstructorUsedError;
|
||||
String get description => throw _privateConstructorUsedError;
|
||||
ApiAuthModel? get authData => throw _privateConstructorUsedError;
|
||||
AuthModel? get authModel => throw _privateConstructorUsedError;
|
||||
@JsonKey(includeToJson: false)
|
||||
dynamic get requestTabIndex => throw _privateConstructorUsedError;
|
||||
HttpRequestModel? get httpRequestModel => throw _privateConstructorUsedError;
|
||||
@@ -60,7 +60,7 @@ abstract class $RequestModelCopyWith<$Res> {
|
||||
APIType apiType,
|
||||
String name,
|
||||
String description,
|
||||
ApiAuthModel? authData,
|
||||
AuthModel? authModel,
|
||||
@JsonKey(includeToJson: false) dynamic requestTabIndex,
|
||||
HttpRequestModel? httpRequestModel,
|
||||
int? responseStatus,
|
||||
@@ -71,7 +71,7 @@ abstract class $RequestModelCopyWith<$Res> {
|
||||
String? preRequestScript,
|
||||
String? postRequestScript});
|
||||
|
||||
$ApiAuthModelCopyWith<$Res>? get authData;
|
||||
$AuthModelCopyWith<$Res>? get authModel;
|
||||
$HttpRequestModelCopyWith<$Res>? get httpRequestModel;
|
||||
$HttpResponseModelCopyWith<$Res>? get httpResponseModel;
|
||||
}
|
||||
@@ -95,7 +95,7 @@ class _$RequestModelCopyWithImpl<$Res, $Val extends RequestModel>
|
||||
Object? apiType = null,
|
||||
Object? name = null,
|
||||
Object? description = null,
|
||||
Object? authData = freezed,
|
||||
Object? authModel = freezed,
|
||||
Object? requestTabIndex = freezed,
|
||||
Object? httpRequestModel = freezed,
|
||||
Object? responseStatus = freezed,
|
||||
@@ -123,10 +123,10 @@ class _$RequestModelCopyWithImpl<$Res, $Val extends RequestModel>
|
||||
? _value.description
|
||||
: description // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
authData: freezed == authData
|
||||
? _value.authData
|
||||
: authData // ignore: cast_nullable_to_non_nullable
|
||||
as ApiAuthModel?,
|
||||
authModel: freezed == authModel
|
||||
? _value.authModel
|
||||
: authModel // ignore: cast_nullable_to_non_nullable
|
||||
as AuthModel?,
|
||||
requestTabIndex: freezed == requestTabIndex
|
||||
? _value.requestTabIndex
|
||||
: requestTabIndex // ignore: cast_nullable_to_non_nullable
|
||||
@@ -170,13 +170,13 @@ class _$RequestModelCopyWithImpl<$Res, $Val extends RequestModel>
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$ApiAuthModelCopyWith<$Res>? get authData {
|
||||
if (_value.authData == null) {
|
||||
$AuthModelCopyWith<$Res>? get authModel {
|
||||
if (_value.authModel == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $ApiAuthModelCopyWith<$Res>(_value.authData!, (value) {
|
||||
return _then(_value.copyWith(authData: value) as $Val);
|
||||
return $AuthModelCopyWith<$Res>(_value.authModel!, (value) {
|
||||
return _then(_value.copyWith(authModel: value) as $Val);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -222,7 +222,7 @@ abstract class _$$RequestModelImplCopyWith<$Res>
|
||||
APIType apiType,
|
||||
String name,
|
||||
String description,
|
||||
ApiAuthModel? authData,
|
||||
AuthModel? authModel,
|
||||
@JsonKey(includeToJson: false) dynamic requestTabIndex,
|
||||
HttpRequestModel? httpRequestModel,
|
||||
int? responseStatus,
|
||||
@@ -234,7 +234,7 @@ abstract class _$$RequestModelImplCopyWith<$Res>
|
||||
String? postRequestScript});
|
||||
|
||||
@override
|
||||
$ApiAuthModelCopyWith<$Res>? get authData;
|
||||
$AuthModelCopyWith<$Res>? get authModel;
|
||||
@override
|
||||
$HttpRequestModelCopyWith<$Res>? get httpRequestModel;
|
||||
@override
|
||||
@@ -258,7 +258,7 @@ class __$$RequestModelImplCopyWithImpl<$Res>
|
||||
Object? apiType = null,
|
||||
Object? name = null,
|
||||
Object? description = null,
|
||||
Object? authData = freezed,
|
||||
Object? authModel = freezed,
|
||||
Object? requestTabIndex = freezed,
|
||||
Object? httpRequestModel = freezed,
|
||||
Object? responseStatus = freezed,
|
||||
@@ -286,10 +286,10 @@ class __$$RequestModelImplCopyWithImpl<$Res>
|
||||
? _value.description
|
||||
: description // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
authData: freezed == authData
|
||||
? _value.authData
|
||||
: authData // ignore: cast_nullable_to_non_nullable
|
||||
as ApiAuthModel?,
|
||||
authModel: freezed == authModel
|
||||
? _value.authModel
|
||||
: authModel // ignore: cast_nullable_to_non_nullable
|
||||
as AuthModel?,
|
||||
requestTabIndex: freezed == requestTabIndex
|
||||
? _value.requestTabIndex!
|
||||
: requestTabIndex,
|
||||
@@ -338,7 +338,7 @@ class _$RequestModelImpl implements _RequestModel {
|
||||
this.apiType = APIType.rest,
|
||||
this.name = "",
|
||||
this.description = "",
|
||||
this.authData = const ApiAuthModel(type: APIAuthType.none),
|
||||
this.authModel = const AuthModel(type: APIAuthType.none),
|
||||
@JsonKey(includeToJson: false) this.requestTabIndex = 0,
|
||||
this.httpRequestModel,
|
||||
this.responseStatus,
|
||||
@@ -365,7 +365,7 @@ class _$RequestModelImpl implements _RequestModel {
|
||||
final String description;
|
||||
@override
|
||||
@JsonKey()
|
||||
final ApiAuthModel? authData;
|
||||
final AuthModel? authModel;
|
||||
@override
|
||||
@JsonKey(includeToJson: false)
|
||||
final dynamic requestTabIndex;
|
||||
@@ -390,7 +390,7 @@ class _$RequestModelImpl implements _RequestModel {
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'RequestModel(id: $id, apiType: $apiType, name: $name, description: $description, authData: $authData, requestTabIndex: $requestTabIndex, httpRequestModel: $httpRequestModel, responseStatus: $responseStatus, message: $message, httpResponseModel: $httpResponseModel, isWorking: $isWorking, sendingTime: $sendingTime)';
|
||||
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)';
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -403,8 +403,8 @@ class _$RequestModelImpl implements _RequestModel {
|
||||
(identical(other.name, name) || other.name == name) &&
|
||||
(identical(other.description, description) ||
|
||||
other.description == description) &&
|
||||
(identical(other.authData, authData) ||
|
||||
other.authData == authData) &&
|
||||
(identical(other.authModel, authModel) ||
|
||||
other.authModel == authModel) &&
|
||||
const DeepCollectionEquality()
|
||||
.equals(other.requestTabIndex, requestTabIndex) &&
|
||||
(identical(other.httpRequestModel, httpRequestModel) ||
|
||||
@@ -432,7 +432,7 @@ class _$RequestModelImpl implements _RequestModel {
|
||||
apiType,
|
||||
name,
|
||||
description,
|
||||
authData,
|
||||
authModel,
|
||||
const DeepCollectionEquality().hash(requestTabIndex),
|
||||
httpRequestModel,
|
||||
responseStatus,
|
||||
@@ -465,7 +465,7 @@ abstract class _RequestModel implements RequestModel {
|
||||
final APIType apiType,
|
||||
final String name,
|
||||
final String description,
|
||||
final ApiAuthModel? authData,
|
||||
final AuthModel? authModel,
|
||||
@JsonKey(includeToJson: false) final dynamic requestTabIndex,
|
||||
final HttpRequestModel? httpRequestModel,
|
||||
final int? responseStatus,
|
||||
@@ -487,7 +487,7 @@ abstract class _RequestModel implements RequestModel {
|
||||
@override
|
||||
String get description;
|
||||
@override
|
||||
ApiAuthModel? get authData;
|
||||
AuthModel? get authModel;
|
||||
@override
|
||||
@JsonKey(includeToJson: false)
|
||||
dynamic get requestTabIndex;
|
||||
|
||||
@@ -12,10 +12,10 @@ _$RequestModelImpl _$$RequestModelImplFromJson(Map json) => _$RequestModelImpl(
|
||||
APIType.rest,
|
||||
name: json['name'] as String? ?? "",
|
||||
description: json['description'] as String? ?? "",
|
||||
authData: json['authData'] == null
|
||||
? const ApiAuthModel(type: APIAuthType.none)
|
||||
: ApiAuthModel.fromJson(
|
||||
Map<String, dynamic>.from(json['authData'] as Map)),
|
||||
authModel: json['authModel'] == null
|
||||
? const AuthModel(type: APIAuthType.none)
|
||||
: AuthModel.fromJson(
|
||||
Map<String, dynamic>.from(json['authModel'] as Map)),
|
||||
requestTabIndex: json['requestTabIndex'] ?? 0,
|
||||
httpRequestModel: json['httpRequestModel'] == null
|
||||
? null
|
||||
@@ -41,7 +41,7 @@ Map<String, dynamic> _$$RequestModelImplToJson(_$RequestModelImpl instance) =>
|
||||
'apiType': _$APITypeEnumMap[instance.apiType]!,
|
||||
'name': instance.name,
|
||||
'description': instance.description,
|
||||
'authData': instance.authData?.toJson(),
|
||||
'authModel': instance.authModel?.toJson(),
|
||||
'httpRequestModel': instance.httpRequestModel?.toJson(),
|
||||
'responseStatus': instance.responseStatus,
|
||||
'message': instance.message,
|
||||
|
||||
@@ -16,9 +16,9 @@ class EditAuthType extends ConsumerWidget {
|
||||
|
||||
final currentAuthType = ref.watch(
|
||||
selectedRequestModelProvider
|
||||
.select((request) => request?.authData?.type ?? APIAuthType.none),
|
||||
.select((request) => request?.authModel?.type ?? APIAuthType.none),
|
||||
);
|
||||
final currentAuthData = selectedRequest.authData;
|
||||
final currentAuthData = selectedRequest.authModel;
|
||||
|
||||
return SingleChildScrollView(
|
||||
child: Padding(
|
||||
@@ -53,9 +53,9 @@ class EditAuthType extends ConsumerWidget {
|
||||
final selectedRequest = ref.read(selectedRequestModelProvider);
|
||||
if (newType != null) {
|
||||
ref.read(collectionStateNotifierProvider.notifier).update(
|
||||
authData: selectedRequest?.authData
|
||||
authData: selectedRequest?.authModel
|
||||
?.copyWith(type: newType) ??
|
||||
ApiAuthModel(type: newType),
|
||||
AuthModel(type: newType),
|
||||
);
|
||||
}
|
||||
},
|
||||
@@ -71,9 +71,9 @@ class EditAuthType extends ConsumerWidget {
|
||||
Widget _buildAuthFields(
|
||||
BuildContext context,
|
||||
WidgetRef ref,
|
||||
ApiAuthModel? authData,
|
||||
AuthModel? authData,
|
||||
) {
|
||||
void updateAuth(ApiAuthModel? model) {
|
||||
void updateAuth(AuthModel? model) {
|
||||
ref.read(collectionStateNotifierProvider.notifier).update(
|
||||
authData: model,
|
||||
);
|
||||
|
||||
@@ -30,7 +30,7 @@ class EditRestRequestPane extends ConsumerWidget {
|
||||
false;
|
||||
|
||||
final hasAuth = ref.watch(selectedRequestModelProvider
|
||||
.select((value) => value?.authData?.type != APIAuthType.none));
|
||||
.select((value) => value?.authModel?.type != APIAuthType.none));
|
||||
false;
|
||||
|
||||
return RequestPane(
|
||||
|
||||
@@ -9,15 +9,15 @@ part 'api_auth_model.g.dart';
|
||||
part 'api_auth_model.freezed.dart';
|
||||
|
||||
@freezed
|
||||
class ApiAuthModel with _$ApiAuthModel {
|
||||
const factory ApiAuthModel({
|
||||
class AuthModel with _$AuthModel {
|
||||
const factory AuthModel({
|
||||
required APIAuthType type,
|
||||
AuthApiKeyModel? apikey,
|
||||
AuthBearerModel? bearer,
|
||||
AuthBasicAuthModel? basic,
|
||||
AuthJwtModel? jwt,
|
||||
}) = _ApiAuthModel;
|
||||
}) = _AuthModel;
|
||||
|
||||
factory ApiAuthModel.fromJson(Map<String, dynamic> json) =>
|
||||
_$ApiAuthModelFromJson(json);
|
||||
factory AuthModel.fromJson(Map<String, dynamic> json) =>
|
||||
_$AuthModelFromJson(json);
|
||||
}
|
||||
|
||||
@@ -14,33 +14,32 @@ T _$identity<T>(T value) => value;
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
|
||||
ApiAuthModel _$ApiAuthModelFromJson(Map<String, dynamic> json) {
|
||||
return _ApiAuthModel.fromJson(json);
|
||||
AuthModel _$AuthModelFromJson(Map<String, dynamic> json) {
|
||||
return _AuthModel.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$ApiAuthModel {
|
||||
mixin _$AuthModel {
|
||||
APIAuthType get type => throw _privateConstructorUsedError;
|
||||
AuthApiKeyModel? get apikey => throw _privateConstructorUsedError;
|
||||
AuthBearerModel? get bearer => throw _privateConstructorUsedError;
|
||||
AuthBasicAuthModel? get basic => throw _privateConstructorUsedError;
|
||||
AuthJwtModel? get jwt => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this ApiAuthModel to a JSON map.
|
||||
/// Serializes this AuthModel to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of ApiAuthModel
|
||||
/// Create a copy of AuthModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$ApiAuthModelCopyWith<ApiAuthModel> get copyWith =>
|
||||
$AuthModelCopyWith<AuthModel> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $ApiAuthModelCopyWith<$Res> {
|
||||
factory $ApiAuthModelCopyWith(
|
||||
ApiAuthModel value, $Res Function(ApiAuthModel) then) =
|
||||
_$ApiAuthModelCopyWithImpl<$Res, ApiAuthModel>;
|
||||
abstract class $AuthModelCopyWith<$Res> {
|
||||
factory $AuthModelCopyWith(AuthModel value, $Res Function(AuthModel) then) =
|
||||
_$AuthModelCopyWithImpl<$Res, AuthModel>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{APIAuthType type,
|
||||
@@ -56,16 +55,16 @@ abstract class $ApiAuthModelCopyWith<$Res> {
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$ApiAuthModelCopyWithImpl<$Res, $Val extends ApiAuthModel>
|
||||
implements $ApiAuthModelCopyWith<$Res> {
|
||||
_$ApiAuthModelCopyWithImpl(this._value, this._then);
|
||||
class _$AuthModelCopyWithImpl<$Res, $Val extends AuthModel>
|
||||
implements $AuthModelCopyWith<$Res> {
|
||||
_$AuthModelCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of ApiAuthModel
|
||||
/// Create a copy of AuthModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
@@ -100,7 +99,7 @@ class _$ApiAuthModelCopyWithImpl<$Res, $Val extends ApiAuthModel>
|
||||
) as $Val);
|
||||
}
|
||||
|
||||
/// Create a copy of ApiAuthModel
|
||||
/// Create a copy of AuthModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
@@ -114,7 +113,7 @@ class _$ApiAuthModelCopyWithImpl<$Res, $Val extends ApiAuthModel>
|
||||
});
|
||||
}
|
||||
|
||||
/// Create a copy of ApiAuthModel
|
||||
/// Create a copy of AuthModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
@@ -128,7 +127,7 @@ class _$ApiAuthModelCopyWithImpl<$Res, $Val extends ApiAuthModel>
|
||||
});
|
||||
}
|
||||
|
||||
/// Create a copy of ApiAuthModel
|
||||
/// Create a copy of AuthModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
@@ -142,7 +141,7 @@ class _$ApiAuthModelCopyWithImpl<$Res, $Val extends ApiAuthModel>
|
||||
});
|
||||
}
|
||||
|
||||
/// Create a copy of ApiAuthModel
|
||||
/// Create a copy of AuthModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
@@ -158,11 +157,11 @@ class _$ApiAuthModelCopyWithImpl<$Res, $Val extends ApiAuthModel>
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$ApiAuthModelImplCopyWith<$Res>
|
||||
implements $ApiAuthModelCopyWith<$Res> {
|
||||
factory _$$ApiAuthModelImplCopyWith(
|
||||
_$ApiAuthModelImpl value, $Res Function(_$ApiAuthModelImpl) then) =
|
||||
__$$ApiAuthModelImplCopyWithImpl<$Res>;
|
||||
abstract class _$$AuthModelImplCopyWith<$Res>
|
||||
implements $AuthModelCopyWith<$Res> {
|
||||
factory _$$AuthModelImplCopyWith(
|
||||
_$AuthModelImpl value, $Res Function(_$AuthModelImpl) then) =
|
||||
__$$AuthModelImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
@@ -183,14 +182,14 @@ abstract class _$$ApiAuthModelImplCopyWith<$Res>
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$ApiAuthModelImplCopyWithImpl<$Res>
|
||||
extends _$ApiAuthModelCopyWithImpl<$Res, _$ApiAuthModelImpl>
|
||||
implements _$$ApiAuthModelImplCopyWith<$Res> {
|
||||
__$$ApiAuthModelImplCopyWithImpl(
|
||||
_$ApiAuthModelImpl _value, $Res Function(_$ApiAuthModelImpl) _then)
|
||||
class __$$AuthModelImplCopyWithImpl<$Res>
|
||||
extends _$AuthModelCopyWithImpl<$Res, _$AuthModelImpl>
|
||||
implements _$$AuthModelImplCopyWith<$Res> {
|
||||
__$$AuthModelImplCopyWithImpl(
|
||||
_$AuthModelImpl _value, $Res Function(_$AuthModelImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of ApiAuthModel
|
||||
/// Create a copy of AuthModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
@@ -201,7 +200,7 @@ class __$$ApiAuthModelImplCopyWithImpl<$Res>
|
||||
Object? basic = freezed,
|
||||
Object? jwt = freezed,
|
||||
}) {
|
||||
return _then(_$ApiAuthModelImpl(
|
||||
return _then(_$AuthModelImpl(
|
||||
type: null == type
|
||||
? _value.type
|
||||
: type // ignore: cast_nullable_to_non_nullable
|
||||
@@ -228,12 +227,12 @@ class __$$ApiAuthModelImplCopyWithImpl<$Res>
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$ApiAuthModelImpl implements _ApiAuthModel {
|
||||
const _$ApiAuthModelImpl(
|
||||
class _$AuthModelImpl implements _AuthModel {
|
||||
const _$AuthModelImpl(
|
||||
{required this.type, this.apikey, this.bearer, this.basic, this.jwt});
|
||||
|
||||
factory _$ApiAuthModelImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$ApiAuthModelImplFromJson(json);
|
||||
factory _$AuthModelImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$AuthModelImplFromJson(json);
|
||||
|
||||
@override
|
||||
final APIAuthType type;
|
||||
@@ -248,14 +247,14 @@ class _$ApiAuthModelImpl implements _ApiAuthModel {
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ApiAuthModel(type: $type, apikey: $apikey, bearer: $bearer, basic: $basic, jwt: $jwt)';
|
||||
return 'AuthModel(type: $type, apikey: $apikey, bearer: $bearer, basic: $basic, jwt: $jwt)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$ApiAuthModelImpl &&
|
||||
other is _$AuthModelImpl &&
|
||||
(identical(other.type, type) || other.type == type) &&
|
||||
(identical(other.apikey, apikey) || other.apikey == apikey) &&
|
||||
(identical(other.bearer, bearer) || other.bearer == bearer) &&
|
||||
@@ -268,32 +267,32 @@ class _$ApiAuthModelImpl implements _ApiAuthModel {
|
||||
int get hashCode =>
|
||||
Object.hash(runtimeType, type, apikey, bearer, basic, jwt);
|
||||
|
||||
/// Create a copy of ApiAuthModel
|
||||
/// Create a copy of AuthModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$ApiAuthModelImplCopyWith<_$ApiAuthModelImpl> get copyWith =>
|
||||
__$$ApiAuthModelImplCopyWithImpl<_$ApiAuthModelImpl>(this, _$identity);
|
||||
_$$AuthModelImplCopyWith<_$AuthModelImpl> get copyWith =>
|
||||
__$$AuthModelImplCopyWithImpl<_$AuthModelImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$ApiAuthModelImplToJson(
|
||||
return _$$AuthModelImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _ApiAuthModel implements ApiAuthModel {
|
||||
const factory _ApiAuthModel(
|
||||
abstract class _AuthModel implements AuthModel {
|
||||
const factory _AuthModel(
|
||||
{required final APIAuthType type,
|
||||
final AuthApiKeyModel? apikey,
|
||||
final AuthBearerModel? bearer,
|
||||
final AuthBasicAuthModel? basic,
|
||||
final AuthJwtModel? jwt}) = _$ApiAuthModelImpl;
|
||||
final AuthJwtModel? jwt}) = _$AuthModelImpl;
|
||||
|
||||
factory _ApiAuthModel.fromJson(Map<String, dynamic> json) =
|
||||
_$ApiAuthModelImpl.fromJson;
|
||||
factory _AuthModel.fromJson(Map<String, dynamic> json) =
|
||||
_$AuthModelImpl.fromJson;
|
||||
|
||||
@override
|
||||
APIAuthType get type;
|
||||
@@ -306,10 +305,10 @@ abstract class _ApiAuthModel implements ApiAuthModel {
|
||||
@override
|
||||
AuthJwtModel? get jwt;
|
||||
|
||||
/// Create a copy of ApiAuthModel
|
||||
/// Create a copy of AuthModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$ApiAuthModelImplCopyWith<_$ApiAuthModelImpl> get copyWith =>
|
||||
_$$AuthModelImplCopyWith<_$AuthModelImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@ part of 'api_auth_model.dart';
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$ApiAuthModelImpl _$$ApiAuthModelImplFromJson(Map<String, dynamic> json) =>
|
||||
_$ApiAuthModelImpl(
|
||||
_$AuthModelImpl _$$AuthModelImplFromJson(Map<String, dynamic> json) =>
|
||||
_$AuthModelImpl(
|
||||
type: $enumDecode(_$APIAuthTypeEnumMap, json['type']),
|
||||
apikey: json['apikey'] == null
|
||||
? null
|
||||
@@ -23,7 +23,7 @@ _$ApiAuthModelImpl _$$ApiAuthModelImplFromJson(Map<String, dynamic> json) =>
|
||||
: AuthJwtModel.fromJson(json['jwt'] as Map<String, dynamic>),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$ApiAuthModelImplToJson(_$ApiAuthModelImpl instance) =>
|
||||
Map<String, dynamic> _$$AuthModelImplToJson(_$AuthModelImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'type': _$APIAuthTypeEnumMap[instance.type]!,
|
||||
'apikey': instance.apikey,
|
||||
|
||||
@@ -6,7 +6,7 @@ import 'package:apidash_core/utils/auth_utils.dart';
|
||||
import 'package:seed/seed.dart';
|
||||
|
||||
HttpRequestModel handleAuth(
|
||||
HttpRequestModel httpRequestModel, ApiAuthModel? auth) {
|
||||
HttpRequestModel httpRequestModel, AuthModel? auth) {
|
||||
if (auth == null || auth.type == APIAuthType.none) {
|
||||
return httpRequestModel;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ final httpClientManager = HttpClientManager();
|
||||
Future<(HttpResponse?, Duration?, String?)> sendHttpRequest(
|
||||
String requestId,
|
||||
APIType apiType,
|
||||
ApiAuthModel? authData,
|
||||
AuthModel? authData,
|
||||
HttpRequestModel requestModel, {
|
||||
SupportedUriSchemes defaultUriScheme = kDefaultUriScheme,
|
||||
bool noSSL = false,
|
||||
|
||||
Reference in New Issue
Block a user