forked from eatvio/eatvio_app
60 lines
1.7 KiB
Dart
60 lines
1.7 KiB
Dart
import 'package:eatvio_app/features/profile/models/profile_model.dart';
|
|
import 'package:eatvio_app/features/settings/models/oauth_account_model.dart';
|
|
import 'package:eatvio_app/features/settings/models/oauth_attach_request.dart';
|
|
import 'package:eatvio_app/features/settings/models/profile_settings_model.dart';
|
|
import 'package:eatvio_app/features/settings/services/settings_service.dart';
|
|
|
|
class SettingsRepository {
|
|
final SettingsService settingsService;
|
|
|
|
const SettingsRepository({required this.settingsService});
|
|
|
|
Future<ProfileSettingsModel> getProfileSettings() async {
|
|
try {
|
|
return await settingsService.getProfileSettings();
|
|
} catch (e) {
|
|
rethrow;
|
|
}
|
|
}
|
|
|
|
Future<ProfileSettingsModel> updateProfileSettings({required ProfileSettingsModel profileSettingsModel}) async {
|
|
try {
|
|
return await settingsService.updateProfileSettings(data: profileSettingsModel.toJson());
|
|
} catch (e) {
|
|
rethrow;
|
|
}
|
|
}
|
|
|
|
Future<ProfileDetailsModel> updateProfileDetails({required ProfileDetailsModel profileDetailsModel}) async {
|
|
try {
|
|
return await settingsService.updateProfileDetails(data: profileDetailsModel.toJson());
|
|
} catch (e) {
|
|
rethrow;
|
|
}
|
|
}
|
|
|
|
Future<OAuthAccountsResponseModel> getOAuthAccounts() async {
|
|
try {
|
|
return await settingsService.getOAuthAccounts();
|
|
} catch (e) {
|
|
rethrow;
|
|
}
|
|
}
|
|
|
|
Future<void> linkOAuthAccount({required OAuthAttachRequest request}) async {
|
|
try {
|
|
return await settingsService.linkOAuthAccount(request);
|
|
} catch (e) {
|
|
rethrow;
|
|
}
|
|
}
|
|
|
|
Future<void> unlinkOAuthAccount({required String provider}) async {
|
|
try {
|
|
return await settingsService.unlinkOAuthAccount(provider);
|
|
} catch (e) {
|
|
rethrow;
|
|
}
|
|
}
|
|
}
|