Search in sources :

Example 6 with Order

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

the class SecretLockRepositoryOkHttpImpl method search.

@Override
public Observable<Page<SecretLockInfo>> search(SecretLockSearchCriteria criteria) {
    String address = toDto(criteria.getAddress());
    String secret = criteria.getSecret();
    Integer pageSize = criteria.getPageSize();
    Integer pageNumber = criteria.getPageNumber();
    String offset = criteria.getOffset();
    Order order = toDto(criteria.getOrder());
    Callable<SecretLockPage> callback = () -> getClient().searchSecretLock(address, secret, pageSize, pageNumber, offset, order);
    return this.call(callback, this::toPage);
}
Also used : Order(io.nem.symbol.sdk.openapi.okhttp_gson.model.Order) SecretLockPage(io.nem.symbol.sdk.openapi.okhttp_gson.model.SecretLockPage)

Example 7 with Order

use of io.nem.symbol.sdk.openapi.okhttp_gson.model.Order 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)

Example 8 with Order

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

the class ReceiptRepositoryOkHttpImpl method searchAddressResolutionStatements.

@Override
public Observable<Page<AddressResolutionStatement>> searchAddressResolutionStatements(ResolutionStatementSearchCriteria criteria) {
    BigInteger height = criteria.getHeight();
    Integer pageSize = criteria.getPageSize();
    Integer pageNumber = criteria.getPageNumber();
    String offset = criteria.getOffset();
    Order order = toDto(criteria.getOrder());
    Callable<ResolutionStatementPage> callback = () -> getClient().searchAddressResolutionStatements(height, pageSize, pageNumber, offset, order);
    return exceptionHandling(call(callback).map(page -> this.toPage(page.getPagination(), page.getData().stream().map(mapper::createAddressResolutionStatementFromDto).collect(Collectors.toList()))));
}
Also used : BigInteger(java.math.BigInteger) Order(io.nem.symbol.sdk.openapi.okhttp_gson.model.Order) TransactionStatementPage(io.nem.symbol.sdk.openapi.okhttp_gson.model.TransactionStatementPage) ReceiptTypeEnum(io.nem.symbol.sdk.openapi.okhttp_gson.model.ReceiptTypeEnum) ReceiptRoutesApi(io.nem.symbol.sdk.openapi.okhttp_gson.api.ReceiptRoutesApi) ApiClient(io.nem.symbol.sdk.openapi.okhttp_gson.invoker.ApiClient) Callable(java.util.concurrent.Callable) Collectors(java.util.stream.Collectors) Order(io.nem.symbol.sdk.openapi.okhttp_gson.model.Order) TransactionStatementSearchCriteria(io.nem.symbol.sdk.api.TransactionStatementSearchCriteria) ReceiptType(io.nem.symbol.sdk.model.receipt.ReceiptType) ReceiptRepository(io.nem.symbol.sdk.api.ReceiptRepository) ResolutionStatementPage(io.nem.symbol.sdk.openapi.okhttp_gson.model.ResolutionStatementPage) List(java.util.List) TransactionStatement(io.nem.symbol.sdk.model.receipt.TransactionStatement) ResolutionStatementSearchCriteria(io.nem.symbol.sdk.api.ResolutionStatementSearchCriteria) AddressResolutionStatement(io.nem.symbol.sdk.model.receipt.AddressResolutionStatement) MosaicResolutionStatement(io.nem.symbol.sdk.model.receipt.MosaicResolutionStatement) Observable(io.reactivex.Observable) BigInteger(java.math.BigInteger) Page(io.nem.symbol.sdk.api.Page) BigInteger(java.math.BigInteger) ResolutionStatementPage(io.nem.symbol.sdk.openapi.okhttp_gson.model.ResolutionStatementPage)

Example 9 with Order

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

the class MetadataRepositoryOkHttpImpl method search.

@Override
public Observable<Page<Metadata>> search(MetadataSearchCriteria criteria) {
    String sourceAddress = toDto(criteria.getSourceAddress());
    String targetAddress = toDto(criteria.getTargetAddress());
    String scopedMetadataKey = toDto(criteria.getScopedMetadataKey());
    String targetId = criteria.getTargetId();
    MetadataTypeEnum metadataType = criteria.getMetadataType() == null ? null : MetadataTypeEnum.fromValue(criteria.getMetadataType().getValue());
    String offset = criteria.getOffset();
    Integer pageSize = criteria.getPageSize();
    Integer pageNumber = criteria.getPageNumber();
    Order order = toDto(criteria.getOrder());
    Callable<MetadataPage> callback = () -> getClient().searchMetadataEntries(sourceAddress, targetAddress, scopedMetadataKey, targetId, metadataType, pageSize, pageNumber, offset, order);
    return call(callback, page -> this.toPage(page.getPagination(), page.getData().stream().map(this::toMetadata).collect(Collectors.toList())));
}
Also used : MetadataTypeEnum(io.nem.symbol.sdk.openapi.okhttp_gson.model.MetadataTypeEnum) BigInteger(java.math.BigInteger) Order(io.nem.symbol.sdk.openapi.okhttp_gson.model.Order) MetadataPage(io.nem.symbol.sdk.openapi.okhttp_gson.model.MetadataPage)

Example 10 with Order

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

the class HashLockRepositoryOkHttpImpl method search.

@Override
public Observable<Page<HashLockInfo>> search(HashLockSearchCriteria criteria) {
    String address = toDto(criteria.getAddress());
    Integer pageSize = criteria.getPageSize();
    Integer pageNumber = criteria.getPageNumber();
    String offset = criteria.getOffset();
    Order order = toDto(criteria.getOrder());
    Callable<HashLockPage> callback = () -> getClient().searchHashLock(address, pageSize, pageNumber, offset, order);
    return this.call(callback, this::toPage);
}
Also used : Order(io.nem.symbol.sdk.openapi.okhttp_gson.model.Order) HashLockPage(io.nem.symbol.sdk.openapi.okhttp_gson.model.HashLockPage)

Aggregations

Order (io.nem.symbol.sdk.openapi.okhttp_gson.model.Order)10 Page (io.nem.symbol.sdk.api.Page)5 ApiClient (io.nem.symbol.sdk.openapi.okhttp_gson.invoker.ApiClient)5 Observable (io.reactivex.Observable)5 BigInteger (java.math.BigInteger)5 List (java.util.List)5 Callable (java.util.concurrent.Callable)5 Collectors (java.util.stream.Collectors)5 ReceiptRepository (io.nem.symbol.sdk.api.ReceiptRepository)3 ResolutionStatementSearchCriteria (io.nem.symbol.sdk.api.ResolutionStatementSearchCriteria)3 TransactionStatementSearchCriteria (io.nem.symbol.sdk.api.TransactionStatementSearchCriteria)3 AddressResolutionStatement (io.nem.symbol.sdk.model.receipt.AddressResolutionStatement)3 MosaicResolutionStatement (io.nem.symbol.sdk.model.receipt.MosaicResolutionStatement)3 ReceiptType (io.nem.symbol.sdk.model.receipt.ReceiptType)3 TransactionStatement (io.nem.symbol.sdk.model.receipt.TransactionStatement)3 ReceiptRoutesApi (io.nem.symbol.sdk.openapi.okhttp_gson.api.ReceiptRoutesApi)3 ReceiptTypeEnum (io.nem.symbol.sdk.openapi.okhttp_gson.model.ReceiptTypeEnum)3 Address (io.nem.symbol.sdk.model.account.Address)2 MerkleStateInfo (io.nem.symbol.sdk.model.blockchain.MerkleStateInfo)2 ResolutionStatementPage (io.nem.symbol.sdk.openapi.okhttp_gson.model.ResolutionStatementPage)2