Search in sources :

Example 1 with MetadataTypeEnum

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

Aggregations

MetadataPage (io.nem.symbol.sdk.openapi.okhttp_gson.model.MetadataPage)1 MetadataTypeEnum (io.nem.symbol.sdk.openapi.okhttp_gson.model.MetadataTypeEnum)1 Order (io.nem.symbol.sdk.openapi.okhttp_gson.model.Order)1 BigInteger (java.math.BigInteger)1