update api
This commit is contained in:
36
lib/features/auth/domain/repositories/auth_repository.dart
Normal file
36
lib/features/auth/domain/repositories/auth_repository.dart
Normal file
@@ -0,0 +1,36 @@
|
||||
import 'package:dartz/dartz.dart';
|
||||
import '../../../../core/errors/failures.dart';
|
||||
import '../entities/auth_response.dart';
|
||||
import '../entities/user.dart';
|
||||
|
||||
/// Abstract repository for authentication operations
|
||||
abstract class AuthRepository {
|
||||
/// Login user with email and password
|
||||
Future<Either<Failure, AuthResponse>> login({
|
||||
required String email,
|
||||
required String password,
|
||||
});
|
||||
|
||||
/// Register new user
|
||||
Future<Either<Failure, AuthResponse>> register({
|
||||
required String name,
|
||||
required String email,
|
||||
required String password,
|
||||
List<String> roles = const ['user'],
|
||||
});
|
||||
|
||||
/// Get current user profile
|
||||
Future<Either<Failure, User>> getProfile();
|
||||
|
||||
/// Refresh access token
|
||||
Future<Either<Failure, AuthResponse>> refreshToken();
|
||||
|
||||
/// Logout user (clear local token)
|
||||
Future<Either<Failure, void>> logout();
|
||||
|
||||
/// Check if user is authenticated
|
||||
Future<bool> isAuthenticated();
|
||||
|
||||
/// Get stored access token
|
||||
Future<String?> getAccessToken();
|
||||
}
|
||||
Reference in New Issue
Block a user