TF-1625 Get capability supported for Identity/set method

(cherry picked from commit 16a77edba891a628b728d05ddd3a61c9ba45b8dc)
This commit is contained in:
dab246
2023-03-21 16:34:09 +07:00
committed by Dat Vu
parent 2e96b87fc4
commit bb9dbb697a
18 changed files with 223 additions and 143 deletions
@@ -1,5 +1,6 @@
import 'package:jmap_dart_client/jmap/account_id.dart';
import 'package:jmap_dart_client/jmap/core/properties/properties.dart';
import 'package:jmap_dart_client/jmap/core/session/session.dart';
import 'package:jmap_dart_client/jmap/identities/identity.dart';
import 'package:tmail_ui_user/features/manage_account/data/datasource/identity_data_source.dart';
import 'package:tmail_ui_user/features/manage_account/data/network/identity_api.dart';
@@ -16,31 +17,30 @@ class IdentityDataSourceImpl extends IdentityDataSource {
IdentityDataSourceImpl(this._identityAPI, this._exceptionThrower);
@override
Future<IdentitiesResponse> getAllIdentities(AccountId accountId,
{Properties? properties}) {
Future<IdentitiesResponse> getAllIdentities(Session session, AccountId accountId, {Properties? properties}) {
return Future.sync(() async {
return await _identityAPI.getAllIdentities(accountId, properties: properties);
return await _identityAPI.getAllIdentities(session, accountId, properties: properties);
}).catchError(_exceptionThrower.throwException);
}
@override
Future<Identity> createNewIdentity(AccountId accountId, CreateNewIdentityRequest identityRequest) {
Future<Identity> createNewIdentity(Session session, AccountId accountId, CreateNewIdentityRequest identityRequest) {
return Future.sync(() async {
return await _identityAPI.createNewIdentity(accountId, identityRequest);
return await _identityAPI.createNewIdentity(session, accountId, identityRequest);
}).catchError(_exceptionThrower.throwException);
}
@override
Future<bool> deleteIdentity(AccountId accountId, IdentityId identityId) {
Future<bool> deleteIdentity(Session session, AccountId accountId, IdentityId identityId) {
return Future.sync(() async {
return await _identityAPI.deleteIdentity(accountId, identityId);
return await _identityAPI.deleteIdentity(session, accountId, identityId);
}).catchError(_exceptionThrower.throwException);
}
@override
Future<bool> editIdentity(AccountId accountId, EditIdentityRequest editIdentityRequest) {
Future<bool> editIdentity(Session session, AccountId accountId, EditIdentityRequest editIdentityRequest) {
return Future.sync(() async {
return await _identityAPI.editIdentity(accountId, editIdentityRequest);
return await _identityAPI.editIdentity(session, accountId, editIdentityRequest);
}).catchError(_exceptionThrower.throwException);
}
}