Search in sources :

Example 1 with MosaicIds

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

the class MosaicRepositoryVertxImpl method getMosaics.

@Override
public Observable<List<MosaicInfo>> getMosaics(List<MosaicId> ids) {
    MosaicIds mosaicIds = new MosaicIds();
    mosaicIds.mosaicIds(ids.stream().map(MosaicId::getIdAsHex).collect(Collectors.toList()));
    Consumer<Handler<AsyncResult<List<MosaicInfoDTO>>>> callback = handler -> getClient().getMosaics(mosaicIds, handler);
    return exceptionHandling(call(callback).flatMapIterable(item -> item).map(this::createMosaicInfo).toList().toObservable());
}
Also used : MosaicRoutesApi(io.nem.symbol.sdk.openapi.vertx.api.MosaicRoutesApi) MapperUtils(io.nem.symbol.core.utils.MapperUtils) MosaicRoutesApiImpl(io.nem.symbol.sdk.openapi.vertx.api.MosaicRoutesApiImpl) ApiClient(io.nem.symbol.sdk.openapi.vertx.invoker.ApiClient) MapperUtils.toMosaicId(io.nem.symbol.core.utils.MapperUtils.toMosaicId) MosaicInfo(io.nem.symbol.sdk.model.mosaic.MosaicInfo) MosaicId(io.nem.symbol.sdk.model.mosaic.MosaicId) Collectors(java.util.stream.Collectors) MosaicIds(io.nem.symbol.sdk.openapi.vertx.model.MosaicIds) MosaicSearchCriteria(io.nem.symbol.sdk.api.MosaicSearchCriteria) MosaicPage(io.nem.symbol.sdk.openapi.vertx.model.MosaicPage) Consumer(java.util.function.Consumer) List(java.util.List) MosaicDTO(io.nem.symbol.sdk.openapi.vertx.model.MosaicDTO) ObjectUtils(org.apache.commons.lang3.ObjectUtils) MerkleStateInfo(io.nem.symbol.sdk.model.blockchain.MerkleStateInfo) MosaicInfoDTO(io.nem.symbol.sdk.openapi.vertx.model.MosaicInfoDTO) Observable(io.reactivex.Observable) AsyncResult(io.vertx.core.AsyncResult) Handler(io.vertx.core.Handler) MosaicFlags(io.nem.symbol.sdk.model.mosaic.MosaicFlags) Page(io.nem.symbol.sdk.api.Page) MosaicRepository(io.nem.symbol.sdk.api.MosaicRepository) MapperUtils.toMosaicId(io.nem.symbol.core.utils.MapperUtils.toMosaicId) MosaicId(io.nem.symbol.sdk.model.mosaic.MosaicId) Handler(io.vertx.core.Handler) List(java.util.List) MosaicIds(io.nem.symbol.sdk.openapi.vertx.model.MosaicIds)

Example 2 with MosaicIds

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

the class NamespaceRepositoryVertxImpl method getMosaicsNames.

@Override
public Observable<List<MosaicNames>> getMosaicsNames(List<MosaicId> ids) {
    MosaicIds mosaicIds = new MosaicIds();
    mosaicIds.mosaicIds(ids.stream().map(MosaicId::getIdAsHex).collect(Collectors.toList()));
    Consumer<Handler<AsyncResult<MosaicsNamesDTO>>> callback = handler -> getClient().getMosaicsNames(mosaicIds, handler);
    return exceptionHandling(call(callback).map(MosaicsNamesDTO::getMosaicNames).flatMapIterable(item -> item).map(this::toMosaicNames).toList().toObservable());
}
Also used : AliasTypeEnum(io.nem.symbol.sdk.openapi.vertx.model.AliasTypeEnum) NamespaceInfo(io.nem.symbol.sdk.model.namespace.NamespaceInfo) NamespaceDTO(io.nem.symbol.sdk.openapi.vertx.model.NamespaceDTO) Addresses(io.nem.symbol.sdk.openapi.vertx.model.Addresses) NamespaceRepository(io.nem.symbol.sdk.api.NamespaceRepository) NamespaceRoutesApi(io.nem.symbol.sdk.openapi.vertx.api.NamespaceRoutesApi) ArrayList(java.util.ArrayList) Order(io.nem.symbol.sdk.openapi.vertx.model.Order) MapperUtils.toNamespaceId(io.nem.symbol.core.utils.MapperUtils.toNamespaceId) NamespaceSearchCriteria(io.nem.symbol.sdk.api.NamespaceSearchCriteria) ObjectUtils(org.apache.commons.lang3.ObjectUtils) MerkleStateInfo(io.nem.symbol.sdk.model.blockchain.MerkleStateInfo) MosaicAlias(io.nem.symbol.sdk.model.namespace.MosaicAlias) Observable(io.reactivex.Observable) AsyncResult(io.vertx.core.AsyncResult) NamespaceId(io.nem.symbol.sdk.model.namespace.NamespaceId) MosaicNamesDTO(io.nem.symbol.sdk.openapi.vertx.model.MosaicNamesDTO) MapperUtils(io.nem.symbol.core.utils.MapperUtils) Alias(io.nem.symbol.sdk.model.namespace.Alias) ApiClient(io.nem.symbol.sdk.openapi.vertx.invoker.ApiClient) MosaicsNamesDTO(io.nem.symbol.sdk.openapi.vertx.model.MosaicsNamesDTO) NamespaceName(io.nem.symbol.sdk.model.namespace.NamespaceName) NamespacePage(io.nem.symbol.sdk.openapi.vertx.model.NamespacePage) MosaicNames(io.nem.symbol.sdk.model.mosaic.MosaicNames) NamespaceNameDTO(io.nem.symbol.sdk.openapi.vertx.model.NamespaceNameDTO) MosaicId(io.nem.symbol.sdk.model.mosaic.MosaicId) NamespaceRegistrationTypeEnum(io.nem.symbol.sdk.openapi.vertx.model.NamespaceRegistrationTypeEnum) EmptyAlias(io.nem.symbol.sdk.model.namespace.EmptyAlias) Collectors(java.util.stream.Collectors) NamespaceRoutesApiImpl(io.nem.symbol.sdk.openapi.vertx.api.NamespaceRoutesApiImpl) MosaicIds(io.nem.symbol.sdk.openapi.vertx.model.MosaicIds) NamespaceIds(io.nem.symbol.sdk.openapi.vertx.model.NamespaceIds) AccountNames(io.nem.symbol.sdk.model.account.AccountNames) NamespaceRegistrationType(io.nem.symbol.sdk.model.namespace.NamespaceRegistrationType) Consumer(java.util.function.Consumer) NamespaceInfoDTO(io.nem.symbol.sdk.openapi.vertx.model.NamespaceInfoDTO) List(java.util.List) AccountNamesDTO(io.nem.symbol.sdk.openapi.vertx.model.AccountNamesDTO) AliasType(io.nem.symbol.sdk.model.namespace.AliasType) AccountsNamesDTO(io.nem.symbol.sdk.openapi.vertx.model.AccountsNamesDTO) Optional(java.util.Optional) Address(io.nem.symbol.sdk.model.account.Address) Handler(io.vertx.core.Handler) Page(io.nem.symbol.sdk.api.Page) AddressAlias(io.nem.symbol.sdk.model.namespace.AddressAlias) MosaicsNamesDTO(io.nem.symbol.sdk.openapi.vertx.model.MosaicsNamesDTO) MosaicId(io.nem.symbol.sdk.model.mosaic.MosaicId) Handler(io.vertx.core.Handler) MosaicIds(io.nem.symbol.sdk.openapi.vertx.model.MosaicIds)

Aggregations

MapperUtils (io.nem.symbol.core.utils.MapperUtils)2 Page (io.nem.symbol.sdk.api.Page)2 MerkleStateInfo (io.nem.symbol.sdk.model.blockchain.MerkleStateInfo)2 MosaicId (io.nem.symbol.sdk.model.mosaic.MosaicId)2 ApiClient (io.nem.symbol.sdk.openapi.vertx.invoker.ApiClient)2 MosaicIds (io.nem.symbol.sdk.openapi.vertx.model.MosaicIds)2 Observable (io.reactivex.Observable)2 AsyncResult (io.vertx.core.AsyncResult)2 Handler (io.vertx.core.Handler)2 List (java.util.List)2 Consumer (java.util.function.Consumer)2 Collectors (java.util.stream.Collectors)2 ObjectUtils (org.apache.commons.lang3.ObjectUtils)2 MapperUtils.toMosaicId (io.nem.symbol.core.utils.MapperUtils.toMosaicId)1 MapperUtils.toNamespaceId (io.nem.symbol.core.utils.MapperUtils.toNamespaceId)1 MosaicRepository (io.nem.symbol.sdk.api.MosaicRepository)1 MosaicSearchCriteria (io.nem.symbol.sdk.api.MosaicSearchCriteria)1 NamespaceRepository (io.nem.symbol.sdk.api.NamespaceRepository)1 NamespaceSearchCriteria (io.nem.symbol.sdk.api.NamespaceSearchCriteria)1 AccountNames (io.nem.symbol.sdk.model.account.AccountNames)1