You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tangheem/lib/api/user_api_client.dart

67 lines
2.3 KiB
Dart

import 'package:tangheem/classes/consts.dart';
import 'package:tangheem/models/country_model.dart';
import 'package:tangheem/models/general_response_model.dart';
import 'api_client.dart';
class UserApiClient {
static final UserApiClient _instance = UserApiClient._internal();
UserApiClient._internal();
factory UserApiClient() => _instance;
Future<GeneralResponseModel> registerUser(
String _firstName,
String _lastName,
String _email,
String _password,
String _countryCode,
String _phone,
) async {
String url = "${ApiConsts.user}MobileUserRegistration_Add";
var postParams = {
"password": _password,
"email": _email,
"firstName": _firstName,
"secondName": "",
"thirdName": "",
"lastName": _lastName,
"countryCode": _countryCode,
"mobileNumber": _phone,
"isUserLock": true,
"gender": 0,
"passWrongAttempt": 0,
"statusId": 0,
"isEmailVerified": true,
"isMobileVerified": true
};
return await ApiClient().postJsonForObject((json) => GeneralResponseModel.fromJson(json), url, postParams);
}
Future<GeneralResponseModel> forgotPassword(String _email) async {
String url = "${ApiConsts.user}ForgotPassword";
var postParams = {"email": _email};
return await ApiClient().postJsonForObject((json) => GeneralResponseModel.fromJson(json), url, postParams);
}
Future<GeneralResponseModel> verifyOTP(String _email, int _otp) async {
String url = "${ApiConsts.user}OTPVerification";
var postParams = {"email": _email, "opt": _otp};
return await ApiClient().postJsonForObject((json) => GeneralResponseModel.fromJson(json), url, postParams);
}
Future<GeneralResponseModel> updatePassword(String _email, String _currentPassword, String _password) async {
String url = "${ApiConsts.user}MobileChangePassword";
var postParams = {"email": _email, "oldPassword": _currentPassword, "newPassword": _password, "confirmPassword": _password};
return await ApiClient().postJsonForObject((json) => GeneralResponseModel.fromJson(json), url, postParams);
}
Future<CountryModel> getCountry() async {
String url = "${ApiConsts.user}Country_Get";
var postParams = {};
return await ApiClient().postJsonForObject((json) => CountryModel.fromJson(json), url, postParams);
}
}