Search in sources :

Example 1 with AccountOrderByEnum

use of io.nem.symbol.sdk.openapi.okhttp_gson.model.AccountOrderByEnum in project nem2-sdk-java by nemtech.

the class AccountRepositoryOkHttpImpl method search.

@Override
public Observable<Page<AccountInfo>> search(AccountSearchCriteria criteria) {
    Integer pageSize = criteria.getPageSize();
    Integer pageNumber = criteria.getPageNumber();
    String offset = criteria.getOffset();
    Order order = toDto(criteria.getOrder());
    AccountOrderByEnum orderBy = criteria.getOrderBy() == null ? null : AccountOrderByEnum.fromValue(criteria.getOrderBy().getValue());
    String mosaicId = criteria.getMosaicId() == null ? null : criteria.getMosaicId().getIdAsHex();
    Callable<AccountPage> callback = () -> getClient().searchAccounts(pageSize, pageNumber, offset, order, orderBy, mosaicId);
    return exceptionHandling(call(callback).map(page -> this.toPage(page.getPagination(), page.getData().stream().map(this::toAccountInfo).collect(Collectors.toList()))));
}
Also used : Order(io.nem.symbol.sdk.openapi.okhttp_gson.model.Order) AccountOrderByEnum(io.nem.symbol.sdk.openapi.okhttp_gson.model.AccountOrderByEnum) AccountInfoDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.AccountInfoDTO) MapperUtils.toMosaicId(io.nem.symbol.core.utils.MapperUtils.toMosaicId) AccountLinkPublicKeyDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.AccountLinkPublicKeyDTO) AccountRepository(io.nem.symbol.sdk.api.AccountRepository) Callable(java.util.concurrent.Callable) AccountDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.AccountDTO) AccountType(io.nem.symbol.sdk.model.account.AccountType) AccountPage(io.nem.symbol.sdk.openapi.okhttp_gson.model.AccountPage) MapperUtils.toAddress(io.nem.symbol.core.utils.MapperUtils.toAddress) ObjectUtils(org.apache.commons.lang3.ObjectUtils) AccountInfo(io.nem.symbol.sdk.model.account.AccountInfo) MerkleStateInfo(io.nem.symbol.sdk.model.blockchain.MerkleStateInfo) ActivityBucket(io.nem.symbol.sdk.model.account.ActivityBucket) AccountRoutesApi(io.nem.symbol.sdk.openapi.okhttp_gson.api.AccountRoutesApi) Observable(io.reactivex.Observable) ResolvedMosaic(io.nem.symbol.sdk.model.mosaic.ResolvedMosaic) SupplementalPublicKeysDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.SupplementalPublicKeysDTO) ApiClient(io.nem.symbol.sdk.openapi.okhttp_gson.invoker.ApiClient) AccountIds(io.nem.symbol.sdk.openapi.okhttp_gson.model.AccountIds) AccountOrderByEnum(io.nem.symbol.sdk.openapi.okhttp_gson.model.AccountOrderByEnum) AccountSearchCriteria(io.nem.symbol.sdk.api.AccountSearchCriteria) Collectors(java.util.stream.Collectors) Order(io.nem.symbol.sdk.openapi.okhttp_gson.model.Order) List(java.util.List) SupplementalAccountKeys(io.nem.symbol.sdk.model.account.SupplementalAccountKeys) PublicKey(io.nem.symbol.core.crypto.PublicKey) AccountLinkVotingKey(io.nem.symbol.sdk.model.account.AccountLinkVotingKey) Address(io.nem.symbol.sdk.model.account.Address) Collections(java.util.Collections) Page(io.nem.symbol.sdk.api.Page) AccountPage(io.nem.symbol.sdk.openapi.okhttp_gson.model.AccountPage)

Aggregations

PublicKey (io.nem.symbol.core.crypto.PublicKey)1 MapperUtils.toAddress (io.nem.symbol.core.utils.MapperUtils.toAddress)1 MapperUtils.toMosaicId (io.nem.symbol.core.utils.MapperUtils.toMosaicId)1 AccountRepository (io.nem.symbol.sdk.api.AccountRepository)1 AccountSearchCriteria (io.nem.symbol.sdk.api.AccountSearchCriteria)1 Page (io.nem.symbol.sdk.api.Page)1 AccountInfo (io.nem.symbol.sdk.model.account.AccountInfo)1 AccountLinkVotingKey (io.nem.symbol.sdk.model.account.AccountLinkVotingKey)1 AccountType (io.nem.symbol.sdk.model.account.AccountType)1 ActivityBucket (io.nem.symbol.sdk.model.account.ActivityBucket)1 Address (io.nem.symbol.sdk.model.account.Address)1 SupplementalAccountKeys (io.nem.symbol.sdk.model.account.SupplementalAccountKeys)1 MerkleStateInfo (io.nem.symbol.sdk.model.blockchain.MerkleStateInfo)1 ResolvedMosaic (io.nem.symbol.sdk.model.mosaic.ResolvedMosaic)1 AccountRoutesApi (io.nem.symbol.sdk.openapi.okhttp_gson.api.AccountRoutesApi)1 ApiClient (io.nem.symbol.sdk.openapi.okhttp_gson.invoker.ApiClient)1 AccountDTO (io.nem.symbol.sdk.openapi.okhttp_gson.model.AccountDTO)1 AccountIds (io.nem.symbol.sdk.openapi.okhttp_gson.model.AccountIds)1 AccountInfoDTO (io.nem.symbol.sdk.openapi.okhttp_gson.model.AccountInfoDTO)1 AccountLinkPublicKeyDTO (io.nem.symbol.sdk.openapi.okhttp_gson.model.AccountLinkPublicKeyDTO)1