mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-15 17:47:28 +00:00
54 lines
2.0 KiB
Dart
54 lines
2.0 KiB
Dart
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<Map<String, dynamic>> verifyPassCode({required Map<String, dynamic> body}) async {
|
|
final response = await HTTPService().post(
|
|
path: ApiEndpoints.verifyOtp,
|
|
body: body,
|
|
showServerMessage: false,
|
|
expectedResponseModel: (json) => json);
|
|
return response;
|
|
}
|
|
|
|
static Future<Token> 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<bool> signUp({required SignUpModel model}) async {
|
|
final response = await HTTPService().post(
|
|
path: ApiEndpoints.signUp,
|
|
body: model.toJson(),
|
|
showServerMessage: false,
|
|
expectedResponseModel: (json) => json['statusCode'] == 201);
|
|
return response;
|
|
}
|
|
|
|
static Future<Map<String, dynamic>> sendOtp({required Map<String, dynamic> body}) async {
|
|
final response = await HTTPService().post(
|
|
path: ApiEndpoints.sendOtp,
|
|
body: body,
|
|
showServerMessage: false,
|
|
expectedResponseModel: (json) => json['data']);
|
|
return response;
|
|
}
|
|
|
|
static Future<Map<String, dynamic>> forgetPassword({required String email,required String password ,}) async {
|
|
Map<String, dynamic> params = {"email": email, "password": password,};
|
|
final response = await HTTPService().post(
|
|
path: ApiEndpoints.forgetPassword,
|
|
body: params,
|
|
showServerMessage: false,
|
|
expectedResponseModel: (json) => json['data']);
|
|
return response;
|
|
}
|
|
}
|