mirror of
https://github.com/foss42/apidash.git
synced 2025-12-03 03:17:00 +08:00
refactor: rename ApiAuthModel to AuthModel and authData to authModel
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user