Search in sources :

Example 1 with MosaicIds

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

the class NamespaceRepositoryOkHttpImpl 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()));
    Callable<MosaicsNamesDTO> callback = () -> getClient().getMosaicsNames(mosaicIds);
    return exceptionHandling(call(callback).map(MosaicsNamesDTO::getMosaicNames).flatMapIterable(item -> item).map(this::toMosaicNames).toList().toObservable());
}
Also used : MosaicsNamesDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.MosaicsNamesDTO) MosaicId(io.nem.symbol.sdk.model.mosaic.MosaicId) MosaicIds(io.nem.symbol.sdk.openapi.okhttp_gson.model.MosaicIds)

Example 2 with MosaicIds

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

the class MosaicRepositoryOkHttpImpl 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()));
    Callable<List<MosaicInfoDTO>> callback = () -> getClient().getMosaics(mosaicIds);
    return exceptionHandling(call(callback).flatMapIterable(item -> item).map(this::createMosaicInfo).toList().toObservable());
}
Also used : MapperUtils.toMosaicId(io.nem.symbol.core.utils.MapperUtils.toMosaicId) MosaicId(io.nem.symbol.sdk.model.mosaic.MosaicId) List(java.util.List) MosaicIds(io.nem.symbol.sdk.openapi.okhttp_gson.model.MosaicIds)

Aggregations

MosaicId (io.nem.symbol.sdk.model.mosaic.MosaicId)2 MosaicIds (io.nem.symbol.sdk.openapi.okhttp_gson.model.MosaicIds)2 MapperUtils.toMosaicId (io.nem.symbol.core.utils.MapperUtils.toMosaicId)1 MosaicsNamesDTO (io.nem.symbol.sdk.openapi.okhttp_gson.model.MosaicsNamesDTO)1 List (java.util.List)1