update api

This commit is contained in:
Phuoc Nguyen
2025-10-10 17:15:40 +07:00
parent b94c158004
commit 04f7042b8d
24 changed files with 3322 additions and 8 deletions

View 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();
}