refactor(apps): 重构数据层目录结构并新增启动预热编排器
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import 'package:social_app/data/network/i_api_client.dart';
|
||||
import '../models/signup_request.dart';
|
||||
import '../models/login_request.dart';
|
||||
import '../models/auth_response.dart';
|
||||
|
||||
class AuthApi {
|
||||
final IApiClient _client;
|
||||
static const _prefix = '/api/v1/auth';
|
||||
|
||||
AuthApi(this._client);
|
||||
|
||||
Future<void> sendOtp(OtpSendRequest request) async {
|
||||
await _client.post('$_prefix/otp/send', data: request.toJson());
|
||||
}
|
||||
|
||||
Future<AuthResponse> createPhoneSession(LoginRequest request) async {
|
||||
final response = await _client.post(
|
||||
'$_prefix/phone-session',
|
||||
data: request.toJson(),
|
||||
);
|
||||
return AuthResponse.fromJson(response.data);
|
||||
}
|
||||
|
||||
Future<AuthResponse> refreshSession(RefreshRequest request) async {
|
||||
final response = await _client.post(
|
||||
'$_prefix/sessions/refresh',
|
||||
data: request.toJson(),
|
||||
);
|
||||
return AuthResponse.fromJson(response.data);
|
||||
}
|
||||
|
||||
Future<void> deleteSession(LogoutRequest request) async {
|
||||
await _client.delete('$_prefix/sessions', data: request.toJson());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user