Search in sources :

Example 1 with Order

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

the class RestrictionMosaicRepositoryOkHttpImpl method search.

@Override
public Observable<Page<MosaicRestriction<?>>> search(MosaicRestrictionSearchCriteria criteria) {
    String mosaicId = criteria.getMosaicId() == null ? null : criteria.getMosaicId().getIdAsHex();
    MosaicRestrictionEntryTypeEnum entryType = criteria.getEntryType() == null ? null : MosaicRestrictionEntryTypeEnum.fromValue(criteria.getEntryType().getValue());
    String targetAddress = toDto(criteria.getTargetAddress());
    Integer pageSize = criteria.getPageSize();
    Integer pageNumber = criteria.getPageNumber();
    String offset = criteria.getOffset();
    Order order = toDto(criteria.getOrder());
    Callable<MosaicRestrictionsPage> callback = () -> getClient().searchMosaicRestrictions(mosaicId, entryType, targetAddress, pageSize, pageNumber, offset, order);
    return call(callback, page -> toPage(page.getPagination(), page.getData().stream().map(this::toMosaicRestriction).collect(Collectors.toList())));
}
Also used : BigInteger(java.math.BigInteger) Order(io.nem.symbol.sdk.openapi.okhttp_gson.model.Order) MosaicRestrictionEntryTypeEnum(io.nem.symbol.sdk.openapi.okhttp_gson.model.MosaicRestrictionEntryTypeEnum) MosaicRestrictionsPage(io.nem.symbol.sdk.openapi.okhttp_gson.model.MosaicRestrictionsPage)

Example 2 with Order

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

the class NamespaceRepositoryOkHttpImpl method search.

@Override
public Observable<Page<NamespaceInfo>> search(NamespaceSearchCriteria criteria) {
    String ownerAddress = toDto(criteria.getOwnerAddress());
    NamespaceRegistrationTypeEnum registrationType = criteria.getRegistrationType() == null ? null : NamespaceRegistrationTypeEnum.fromValue(criteria.getRegistrationType().getValue());
    String level0 = criteria.getLevel0();
    AliasTypeEnum aliasType = criteria.getAliasType() == null ? null : AliasTypeEnum.fromValue(criteria.getAliasType().getValue());
    Integer pageSize = criteria.getPageSize();
    Integer pageNumber = criteria.getPageNumber();
    String offset = criteria.getOffset();
    Order order = toDto(criteria.getOrder());
    Callable<NamespacePage> callback = () -> getClient().searchNamespaces(ownerAddress, registrationType, level0, aliasType, pageSize, pageNumber, offset, order);
    return exceptionHandling(call(callback).map(page -> this.toPage(page.getPagination(), page.getData().stream().map(this::toNamespaceInfo).collect(Collectors.toList()))));
}
Also used : Order(io.nem.symbol.sdk.openapi.okhttp_gson.model.Order) NamespacePage(io.nem.symbol.sdk.openapi.okhttp_gson.model.NamespacePage) NamespaceInfo(io.nem.symbol.sdk.model.namespace.NamespaceInfo) MosaicsNamesDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.MosaicsNamesDTO) NamespaceRepository(io.nem.symbol.sdk.api.NamespaceRepository) Callable(java.util.concurrent.Callable) MosaicIds(io.nem.symbol.sdk.openapi.okhttp_gson.model.MosaicIds) NamespaceNameDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.NamespaceNameDTO) ArrayList(java.util.ArrayList) AccountsNamesDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.AccountsNamesDTO) MapperUtils.toNamespaceId(io.nem.symbol.core.utils.MapperUtils.toNamespaceId) NamespaceSearchCriteria(io.nem.symbol.sdk.api.NamespaceSearchCriteria) MosaicNamesDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.MosaicNamesDTO) NamespaceDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.NamespaceDTO) NamespaceRegistrationTypeEnum(io.nem.symbol.sdk.openapi.okhttp_gson.model.NamespaceRegistrationTypeEnum) ObjectUtils(org.apache.commons.lang3.ObjectUtils) MerkleStateInfo(io.nem.symbol.sdk.model.blockchain.MerkleStateInfo) NamespaceInfoDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.NamespaceInfoDTO) MosaicAlias(io.nem.symbol.sdk.model.namespace.MosaicAlias) Observable(io.reactivex.Observable) NamespaceId(io.nem.symbol.sdk.model.namespace.NamespaceId) AliasTypeEnum(io.nem.symbol.sdk.openapi.okhttp_gson.model.AliasTypeEnum) MapperUtils(io.nem.symbol.core.utils.MapperUtils) Alias(io.nem.symbol.sdk.model.namespace.Alias) Addresses(io.nem.symbol.sdk.openapi.okhttp_gson.model.Addresses) NamespaceName(io.nem.symbol.sdk.model.namespace.NamespaceName) ApiClient(io.nem.symbol.sdk.openapi.okhttp_gson.invoker.ApiClient) MosaicNames(io.nem.symbol.sdk.model.mosaic.MosaicNames) MosaicId(io.nem.symbol.sdk.model.mosaic.MosaicId) EmptyAlias(io.nem.symbol.sdk.model.namespace.EmptyAlias) Collectors(java.util.stream.Collectors) Order(io.nem.symbol.sdk.openapi.okhttp_gson.model.Order) AccountNames(io.nem.symbol.sdk.model.account.AccountNames) NamespaceRegistrationType(io.nem.symbol.sdk.model.namespace.NamespaceRegistrationType) AccountNamesDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.AccountNamesDTO) List(java.util.List) NamespaceRoutesApi(io.nem.symbol.sdk.openapi.okhttp_gson.api.NamespaceRoutesApi) AliasType(io.nem.symbol.sdk.model.namespace.AliasType) Optional(java.util.Optional) Address(io.nem.symbol.sdk.model.account.Address) NamespaceIds(io.nem.symbol.sdk.openapi.okhttp_gson.model.NamespaceIds) Page(io.nem.symbol.sdk.api.Page) AddressAlias(io.nem.symbol.sdk.model.namespace.AddressAlias) AliasTypeEnum(io.nem.symbol.sdk.openapi.okhttp_gson.model.AliasTypeEnum) NamespacePage(io.nem.symbol.sdk.openapi.okhttp_gson.model.NamespacePage) NamespaceRegistrationTypeEnum(io.nem.symbol.sdk.openapi.okhttp_gson.model.NamespaceRegistrationTypeEnum)

Example 3 with Order

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

the class ReceiptRepositoryOkHttpImpl method searchMosaicResolutionStatements.

@Override
public Observable<Page<MosaicResolutionStatement>> searchMosaicResolutionStatements(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().searchMosaicResolutionStatements(height, pageSize, pageNumber, offset, order);
    return exceptionHandling(call(callback).map(page -> this.toPage(page.getPagination(), page.getData().stream().map(mapper::createMosaicResolutionStatementFromDto).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 4 with Order

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

the class ReceiptRepositoryOkHttpImpl method searchReceipts.

@Override
public Observable<Page<TransactionStatement>> searchReceipts(TransactionStatementSearchCriteria criteria) {
    BigInteger height = criteria.getHeight();
    BigInteger fromHeight = criteria.getFromHeight();
    BigInteger toHeight = criteria.getToHeight();
    List<ReceiptTypeEnum> receiptTypes = toDto(criteria.getReceiptTypes());
    String recipientAddress = toDto(criteria.getRecipientAddress());
    String senderAddress = toDto(criteria.getSenderAddress());
    String targetAddress = toDto(criteria.getTargetAddress());
    String artifactId = criteria.getArtifactId();
    Integer pageSize = criteria.getPageSize();
    Integer pageNumber = criteria.getPageNumber();
    String offset = criteria.getOffset();
    Order order = toDto(criteria.getOrder());
    Callable<TransactionStatementPage> callback = () -> getClient().searchReceipts(height, fromHeight, toHeight, receiptTypes, recipientAddress, senderAddress, targetAddress, artifactId, pageSize, pageNumber, offset, order);
    return exceptionHandling(call(callback).map(page -> this.toPage(page.getPagination(), page.getData().stream().map(mapper::createTransactionStatement).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) TransactionStatementPage(io.nem.symbol.sdk.openapi.okhttp_gson.model.TransactionStatementPage) BigInteger(java.math.BigInteger) ReceiptTypeEnum(io.nem.symbol.sdk.openapi.okhttp_gson.model.ReceiptTypeEnum)

Example 5 with Order

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

the class RestrictionAccountRepositoryOkHttpImpl method search.

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

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