added api for forgot password otp

This commit is contained in:
llsajjad
2025-09-16 17:18:51 +03:30
parent 69980925ad
commit e9a1d0c665
17 changed files with 800 additions and 79 deletions
@@ -0,0 +1,16 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'verify_otp_data.freezed.dart';
part 'verify_otp_data.g.dart';
@freezed
abstract class VerifyOtpData with _$VerifyOtpData {
const factory VerifyOtpData({
required String message,
required bool success,
required String token,
}) = _VerifyOtpData;
factory VerifyOtpData.fromJson(Map<String, dynamic> json) =>
_$VerifyOtpDataFromJson(json);
}
@@ -0,0 +1,283 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'verify_otp_data.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$VerifyOtpData {
String get message; bool get success; String get token;
/// Create a copy of VerifyOtpData
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$VerifyOtpDataCopyWith<VerifyOtpData> get copyWith => _$VerifyOtpDataCopyWithImpl<VerifyOtpData>(this as VerifyOtpData, _$identity);
/// Serializes this VerifyOtpData to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is VerifyOtpData&&(identical(other.message, message) || other.message == message)&&(identical(other.success, success) || other.success == success)&&(identical(other.token, token) || other.token == token));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,message,success,token);
@override
String toString() {
return 'VerifyOtpData(message: $message, success: $success, token: $token)';
}
}
/// @nodoc
abstract mixin class $VerifyOtpDataCopyWith<$Res> {
factory $VerifyOtpDataCopyWith(VerifyOtpData value, $Res Function(VerifyOtpData) _then) = _$VerifyOtpDataCopyWithImpl;
@useResult
$Res call({
String message, bool success, String token
});
}
/// @nodoc
class _$VerifyOtpDataCopyWithImpl<$Res>
implements $VerifyOtpDataCopyWith<$Res> {
_$VerifyOtpDataCopyWithImpl(this._self, this._then);
final VerifyOtpData _self;
final $Res Function(VerifyOtpData) _then;
/// Create a copy of VerifyOtpData
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? message = null,Object? success = null,Object? token = null,}) {
return _then(_self.copyWith(
message: null == message ? _self.message : message // ignore: cast_nullable_to_non_nullable
as String,success: null == success ? _self.success : success // ignore: cast_nullable_to_non_nullable
as bool,token: null == token ? _self.token : token // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// Adds pattern-matching-related methods to [VerifyOtpData].
extension VerifyOtpDataPatterns on VerifyOtpData {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _VerifyOtpData value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _VerifyOtpData() when $default != null:
return $default(_that);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _VerifyOtpData value) $default,){
final _that = this;
switch (_that) {
case _VerifyOtpData():
return $default(_that);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _VerifyOtpData value)? $default,){
final _that = this;
switch (_that) {
case _VerifyOtpData() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String message, bool success, String token)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _VerifyOtpData() when $default != null:
return $default(_that.message,_that.success,_that.token);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String message, bool success, String token) $default,) {final _that = this;
switch (_that) {
case _VerifyOtpData():
return $default(_that.message,_that.success,_that.token);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String message, bool success, String token)? $default,) {final _that = this;
switch (_that) {
case _VerifyOtpData() when $default != null:
return $default(_that.message,_that.success,_that.token);case _:
return null;
}
}
}
/// @nodoc
@JsonSerializable()
class _VerifyOtpData implements VerifyOtpData {
const _VerifyOtpData({required this.message, required this.success, required this.token});
factory _VerifyOtpData.fromJson(Map<String, dynamic> json) => _$VerifyOtpDataFromJson(json);
@override final String message;
@override final bool success;
@override final String token;
/// Create a copy of VerifyOtpData
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$VerifyOtpDataCopyWith<_VerifyOtpData> get copyWith => __$VerifyOtpDataCopyWithImpl<_VerifyOtpData>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$VerifyOtpDataToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _VerifyOtpData&&(identical(other.message, message) || other.message == message)&&(identical(other.success, success) || other.success == success)&&(identical(other.token, token) || other.token == token));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,message,success,token);
@override
String toString() {
return 'VerifyOtpData(message: $message, success: $success, token: $token)';
}
}
/// @nodoc
abstract mixin class _$VerifyOtpDataCopyWith<$Res> implements $VerifyOtpDataCopyWith<$Res> {
factory _$VerifyOtpDataCopyWith(_VerifyOtpData value, $Res Function(_VerifyOtpData) _then) = __$VerifyOtpDataCopyWithImpl;
@override @useResult
$Res call({
String message, bool success, String token
});
}
/// @nodoc
class __$VerifyOtpDataCopyWithImpl<$Res>
implements _$VerifyOtpDataCopyWith<$Res> {
__$VerifyOtpDataCopyWithImpl(this._self, this._then);
final _VerifyOtpData _self;
final $Res Function(_VerifyOtpData) _then;
/// Create a copy of VerifyOtpData
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? message = null,Object? success = null,Object? token = null,}) {
return _then(_VerifyOtpData(
message: null == message ? _self.message : message // ignore: cast_nullable_to_non_nullable
as String,success: null == success ? _self.success : success // ignore: cast_nullable_to_non_nullable
as bool,token: null == token ? _self.token : token // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
// dart format on
@@ -0,0 +1,21 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'verify_otp_data.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_VerifyOtpData _$VerifyOtpDataFromJson(Map<String, dynamic> json) =>
_VerifyOtpData(
message: json['message'] as String,
success: json['success'] as bool,
token: json['token'] as String,
);
Map<String, dynamic> _$VerifyOtpDataToJson(_VerifyOtpData instance) =>
<String, dynamic>{
'message': instance.message,
'success': instance.success,
'token': instance.token,
};