baseproject

This commit is contained in:
Gaurav Kumar
2025-09-06 19:21:52 +05:30
commit 01be9df2ed
254 changed files with 28342 additions and 0 deletions

View File

@@ -0,0 +1,71 @@
import 'package:base_project/data/network/no_token_base_network_service.dart';
import 'package:base_project/resources/api_constants.dart';
import '../data/network/no-token_network_api_service.dart';
class AuthRepo {
final NoTokenBaseNetworkService _service = NoTokenNetworkApiService();
Future<dynamic> loginApi(dynamic body) async {
try {
final res =
await _service.getPostApiResponse(ApiConstants.loginEndpoint, body);
return res;
} catch (e) {
rethrow;
}
}
Future<dynamic> getOtpApi(dynamic body) async {
try {
final res =
await _service.getPostApiResponse(ApiConstants.getOtpEndpoint, body);
return res;
} catch (e) {
rethrow;
}
}
Future<dynamic> verifyOtpApi(dynamic body) async {
print(' boody is $body');
try {
final email = Uri.encodeComponent((body['email'] ?? '').toString());
final otp = Uri.encodeComponent((body['otp'] ?? '').toString());
final url = "${ApiConstants.verifyEndpoint}?email=$email&otp=$otp";
final res = await _service.getPostApiResponse(url, null);
return res;
} catch (e) {
rethrow;
}
}
Future<dynamic> resendOtpApi(dynamic body) async {
try {
final res = await _service.getPostApiResponse(
ApiConstants.createAcEndpoint, body);
return res;
} catch (e) {
rethrow;
}
}
Future<dynamic> createUserApi(dynamic body) async {
try {
final res = await _service.getPostApiResponse(
ApiConstants.createUserEndpoint, body);
return res;
} catch (e) {
rethrow;
}
}
Future<dynamic> createAcApi(dynamic body) async {
try {
final res = await _service.getPostApiResponse(
ApiConstants.createAcEndpoint, body);
return res;
} catch (e) {
rethrow;
}
}
}

View File

@@ -0,0 +1,82 @@
import 'package:base_project/data/network/base_network_service.dart';
import 'package:base_project/data/network/network_api_service.dart';
import 'package:base_project/resources/api_constants.dart';
class ProfileRepo {
final BaseNetworkService _networkService = NetworkApiService();
Future<dynamic> getProfileImgApi() async {
try {
final response = _networkService
.getGetApiResponse(ApiConstants.getUserProfileImgEndpoint);
return response;
} catch (e) {
rethrow;
}
}
Future<dynamic> getProfileApi() async {
try {
final response = _networkService
.getGetApiResponse(ApiConstants.getUserProfileEndpoint);
return response;
} catch (e) {
rethrow;
}
}
Future<dynamic> updateProfileApi(dynamic data, dynamic uId) async {
final uri = Uri.parse("${ApiConstants.updateUserProfileEndpoint}/$uId");
try {
final response =
await _networkService.getPutApiResponse(uri.toString(), data);
return response;
} catch (e) {
rethrow;
}
}
Future<dynamic> updateProfileImg(dynamic data) async {
try {
final response = await _networkService.getPostApiResponse(
ApiConstants.updateUserProfileImgEndpoint, data);
return response;
} catch (e) {
rethrow;
}
}
Future<dynamic> changPassApi(dynamic data) async {
try {
final response = await _networkService.getPostApiResponse(
ApiConstants.changePasswordEndpoint, data);
print('chan res $response');
return response;
} catch (e) {
rethrow;
}
}
Future<dynamic> forgotPassApi(dynamic data) async {
try {
final response = await _networkService.getPostApiResponse(
ApiConstants.forgotPasswordEndpoint, data);
return response;
} catch (e) {
rethrow;
}
}
// Update System Account
Future<dynamic> updateAccountApi(dynamic accId, dynamic data) async {
final uri = Uri.parse("${ApiConstants.updateAcEndpoint}/$accId");
try {
final response =
await _networkService.getPutApiResponse(uri.toString(), data);
return response;
} catch (e) {
rethrow;
}
}
}

View File

@@ -0,0 +1,80 @@
import 'package:base_project/data/network/base_network_service.dart';
import 'package:base_project/data/network/network_api_service.dart';
import 'package:base_project/resources/api_constants.dart';
class SystemParamsRepo {
final BaseNetworkService _networkService = NetworkApiService();
Future<dynamic> getProfileImgApi() async {
try {
final response = _networkService
.getGetApiResponse(ApiConstants.getUserProfileImgEndpoint);
return response;
} catch (e) {
rethrow;
}
}
Future<dynamic> getProfileApi() async {
try {
final response = _networkService
.getGetApiResponse(ApiConstants.getUserProfileEndpoint);
return response;
} catch (e) {
rethrow;
}
}
Future<dynamic> updateProfileApi(dynamic data, dynamic uId) async {
final uri = Uri.parse("${ApiConstants.updateUserProfileEndpoint}/$uId");
try {
final response =
await _networkService.getPutApiResponse(uri.toString(), data);
return response;
} catch (e) {
rethrow;
}
}
Future<dynamic> updateProfileImg(dynamic data) async {
try {
final response = await _networkService.getPostApiResponse(
ApiConstants.updateUserProfileImgEndpoint, data);
return response;
} catch (e) {
rethrow;
}
}
Future<dynamic> getSystemParameters() async {
final uri = Uri.parse("${ApiConstants.getSystemParameters}");
try {
final response = _networkService.getGetApiResponse(uri.toString());
return response;
} catch (e) {
rethrow;
}
}
Future<dynamic> updateSystemParameters(dynamic body) async {
try {
final uri = Uri.parse("${ApiConstants.updateSystemParams}");
final response = _networkService.getPutApiResponse(uri.toString(), body);
return response;
} catch (e) {
rethrow;
}
}
Future<dynamic> uploadSystemParamLogo(dynamic data) async {
try {
final uri = Uri.parse("${ApiConstants.uploadSystemParamImg}");
final response =
await _networkService.getPostApiResponse(uri.toString(), data);
return response;
} catch (e) {
rethrow;
}
}
}