This commit is contained in:
efrilm
2025-09-18 07:16:56 +07:00
parent b20854f329
commit 3b26b19b25
17 changed files with 1672 additions and 0 deletions
+14
View File
@@ -9,6 +9,7 @@ part 'entities/check_phone_entity.dart';
part 'entities/register_entity.dart';
part 'entities/verify_entity.dart';
part 'entities/login_entity.dart';
part 'entities/resend_entity.dart';
part 'failures/auth_failure.dart';
part 'repositories/i_auth_repository.dart';
@@ -24,3 +25,16 @@ extension CheckPhoneStatusX on CheckPhoneStatus {
bool get isNotRegistered => this == CheckPhoneStatus.notRegistered;
bool get isPasswordRequired => this == CheckPhoneStatus.passwordRequired;
}
enum ResendStatus { resendNotAllowed, success, unknown }
extension ResendStatusX on ResendStatus {
String toStringType() => switch (this) {
ResendStatus.resendNotAllowed => 'RESEND_NOT_ALLOWED',
ResendStatus.success => 'SUCCESS',
ResendStatus.unknown => '',
};
bool get isResendNotAllowed => this == ResendStatus.resendNotAllowed;
bool get isSuccess => this == ResendStatus.success;
}
+230
View File
@@ -1033,6 +1033,236 @@ abstract class _User implements User {
throw _privateConstructorUsedError;
}
/// @nodoc
mixin _$Resend {
String get status => throw _privateConstructorUsedError;
String get message => throw _privateConstructorUsedError;
String get otpToken => throw _privateConstructorUsedError;
int get expiresIn => throw _privateConstructorUsedError;
int get nextResendIn => throw _privateConstructorUsedError;
/// Create a copy of Resend
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$ResendCopyWith<Resend> get copyWith => throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $ResendCopyWith<$Res> {
factory $ResendCopyWith(Resend value, $Res Function(Resend) then) =
_$ResendCopyWithImpl<$Res, Resend>;
@useResult
$Res call({
String status,
String message,
String otpToken,
int expiresIn,
int nextResendIn,
});
}
/// @nodoc
class _$ResendCopyWithImpl<$Res, $Val extends Resend>
implements $ResendCopyWith<$Res> {
_$ResendCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of Resend
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? status = null,
Object? message = null,
Object? otpToken = null,
Object? expiresIn = null,
Object? nextResendIn = null,
}) {
return _then(
_value.copyWith(
status: null == status
? _value.status
: status // ignore: cast_nullable_to_non_nullable
as String,
message: null == message
? _value.message
: message // ignore: cast_nullable_to_non_nullable
as String,
otpToken: null == otpToken
? _value.otpToken
: otpToken // ignore: cast_nullable_to_non_nullable
as String,
expiresIn: null == expiresIn
? _value.expiresIn
: expiresIn // ignore: cast_nullable_to_non_nullable
as int,
nextResendIn: null == nextResendIn
? _value.nextResendIn
: nextResendIn // ignore: cast_nullable_to_non_nullable
as int,
)
as $Val,
);
}
}
/// @nodoc
abstract class _$$ResendImplCopyWith<$Res> implements $ResendCopyWith<$Res> {
factory _$$ResendImplCopyWith(
_$ResendImpl value,
$Res Function(_$ResendImpl) then,
) = __$$ResendImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({
String status,
String message,
String otpToken,
int expiresIn,
int nextResendIn,
});
}
/// @nodoc
class __$$ResendImplCopyWithImpl<$Res>
extends _$ResendCopyWithImpl<$Res, _$ResendImpl>
implements _$$ResendImplCopyWith<$Res> {
__$$ResendImplCopyWithImpl(
_$ResendImpl _value,
$Res Function(_$ResendImpl) _then,
) : super(_value, _then);
/// Create a copy of Resend
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? status = null,
Object? message = null,
Object? otpToken = null,
Object? expiresIn = null,
Object? nextResendIn = null,
}) {
return _then(
_$ResendImpl(
status: null == status
? _value.status
: status // ignore: cast_nullable_to_non_nullable
as String,
message: null == message
? _value.message
: message // ignore: cast_nullable_to_non_nullable
as String,
otpToken: null == otpToken
? _value.otpToken
: otpToken // ignore: cast_nullable_to_non_nullable
as String,
expiresIn: null == expiresIn
? _value.expiresIn
: expiresIn // ignore: cast_nullable_to_non_nullable
as int,
nextResendIn: null == nextResendIn
? _value.nextResendIn
: nextResendIn // ignore: cast_nullable_to_non_nullable
as int,
),
);
}
}
/// @nodoc
class _$ResendImpl implements _Resend {
const _$ResendImpl({
required this.status,
required this.message,
required this.otpToken,
required this.expiresIn,
required this.nextResendIn,
});
@override
final String status;
@override
final String message;
@override
final String otpToken;
@override
final int expiresIn;
@override
final int nextResendIn;
@override
String toString() {
return 'Resend(status: $status, message: $message, otpToken: $otpToken, expiresIn: $expiresIn, nextResendIn: $nextResendIn)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$ResendImpl &&
(identical(other.status, status) || other.status == status) &&
(identical(other.message, message) || other.message == message) &&
(identical(other.otpToken, otpToken) ||
other.otpToken == otpToken) &&
(identical(other.expiresIn, expiresIn) ||
other.expiresIn == expiresIn) &&
(identical(other.nextResendIn, nextResendIn) ||
other.nextResendIn == nextResendIn));
}
@override
int get hashCode => Object.hash(
runtimeType,
status,
message,
otpToken,
expiresIn,
nextResendIn,
);
/// Create a copy of Resend
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$ResendImplCopyWith<_$ResendImpl> get copyWith =>
__$$ResendImplCopyWithImpl<_$ResendImpl>(this, _$identity);
}
abstract class _Resend implements Resend {
const factory _Resend({
required final String status,
required final String message,
required final String otpToken,
required final int expiresIn,
required final int nextResendIn,
}) = _$ResendImpl;
@override
String get status;
@override
String get message;
@override
String get otpToken;
@override
int get expiresIn;
@override
int get nextResendIn;
/// Create a copy of Resend
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$ResendImplCopyWith<_$ResendImpl> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
mixin _$AuthFailure {
@optionalTypeArgs
@@ -0,0 +1,20 @@
part of '../auth.dart';
@freezed
class Resend with _$Resend {
const factory Resend({
required String status,
required String message,
required String otpToken,
required int expiresIn,
required int nextResendIn,
}) = _Resend;
factory Resend.empty() => const Resend(
status: '',
message: '',
otpToken: '',
expiresIn: 0,
nextResendIn: 0,
);
}
@@ -26,4 +26,9 @@ abstract class IAuthRepository {
required String phoneNumber,
required String password,
});
Future<Either<AuthFailure, Resend>> resend({
required String phoneNumber,
required String purpose,
});
}