import 'package:syncrow_app/features/auth/model/login_with_email_model.dart'; import 'package:syncrow_app/features/auth/model/signup_model.dart'; import 'package:syncrow_app/features/auth/model/token.dart'; import 'package:syncrow_app/services/api/api_links_endpoints.dart'; import 'package:syncrow_app/services/api/http_service.dart'; class AuthenticationAPI { static Future> verifyPassCode( {required Map body}) async { final response = await HTTPService().post( path: ApiEndpoints.verifyOtp, body: body, showServerMessage: false, expectedResponseModel: (json) => json); return response; } static Future loginWithEmail( {required LoginWithEmailModel model}) async { final response = await HTTPService().post( path: ApiEndpoints.login, body: model.toJson(), showServerMessage: false, expectedResponseModel: (json) => Token.fromJson(json['data'])); return response; } static Future signUp({ required SignUpModel model, required String accessToken, }) async { final response = await HTTPService().post( path: ApiEndpoints.signUp, body: model.toJson(), showServerMessage: false, accessToken: accessToken, expectedResponseModel: (json) => json['statusCode'] == 201); return response; } static Future> sendOtp( {required Map body}) async { final response = await HTTPService().post( path: ApiEndpoints.sendOtp, body: body, showServerMessage: false, expectedResponseModel: (json) { return json['data']; }); return response; } static Future> forgetPassword({ required String otpCode, required String email, required String password, }) async { Map params = { "email": email, "password": password, "otpCode": otpCode }; final response = await HTTPService().post( path: ApiEndpoints.forgetPassword, body: params, showServerMessage: false, expectedResponseModel: (json) => json['data']); return response; } static Future> fetchClientToken({ required String clientId, required String clientSecret, }) async { final response = await HTTPService().post( path: ApiEndpoints.clientLogin, body: { 'clientId': clientId, 'clientSecret': clientSecret, }, showServerMessage: false, expectedResponseModel: (json) => json['data'], ); return response; } static Future deleteAccount() async { await HTTPService().delete( path: ApiEndpoints.deleteProfile, expectedResponseModel: (p0) {}, ); } }