Mercury-IM/domain/src/main/java/org/mercury_im/messenger/core/data/repository/AccountRepository.java

55 lines
1.5 KiB
Java
Raw Normal View History

2020-06-06 18:45:20 +02:00
package org.mercury_im.messenger.core.data.repository;
2019-11-18 23:51:27 +01:00
import org.mercury_im.messenger.entity.Account;
2020-06-06 18:45:20 +02:00
import org.mercury_im.messenger.core.util.Optional;
import java.util.List;
2019-12-21 16:30:14 +01:00
import java.util.UUID;
import io.reactivex.Completable;
import io.reactivex.Maybe;
import io.reactivex.Observable;
import io.reactivex.Single;
public interface AccountRepository {
Single<Account> insertAccount(Account account);
2020-01-05 15:50:35 +01:00
default Observable<Optional<Account>> observeAccount(Account account) {
return observeAccount(account.getId());
}
2019-12-21 16:30:14 +01:00
Observable<Optional<Account>> observeAccount(UUID accountId);
2020-01-05 15:50:35 +01:00
default Maybe<Account> getAccount(Account account) {
return getAccount(account.getId());
}
2019-12-21 16:30:14 +01:00
Maybe<Account> getAccount(UUID accountId);
Observable<Optional<Account>> observeAccountByAddress(String address);
Maybe<Account> getAccountByAddress(String address);
Observable<List<Account>> observeAllAccounts();
2019-12-20 10:41:55 +01:00
Observable<Account> observeAccounts();
Single<Account> updateAccount(Account account);
Single<Account> upsertAccount(Account account);
2019-12-22 02:21:19 +01:00
default Completable deleteAccount(Account account) {
return deleteAccount(account.getId());
}
Completable deleteAccount(UUID accountId);
2020-05-31 22:32:33 +02:00
default Completable updateRosterVersion(Account account, String rosterVersion) {
return updateRosterVersion(account.getId(), rosterVersion);
}
Completable updateRosterVersion(UUID accountId, String rosterVersion);
}