class BlockRepositoryOkHttpImpl extends AbstractRepositoryOkHttpImpl implements BlockRepository {

  @Override
  public Observable<Page<BlockInfo>> search(BlockSearchCriteria criteria) {
    Callable<BlockPage> callback =
        () ->
            getClient()
                .searchBlocks(
                    toDto(criteria.getSignerPublicKey()),
                    toDto(criteria.getBeneficiaryAddress()),
                    criteria.getPageSize(),
                    criteria.getPageNumber(),
                    criteria.getOffset(),
                    toDto(criteria.getOrder()),
                    toDto(criteria.getOrderBy()));

    return exceptionHandling(
        call(callback)
            .map(
                mosaicPage ->
                    this.toPage(
                        mosaicPage.getPagination(),
                        mosaicPage.getData().stream()
                            .map(BlockRepositoryOkHttpImpl::toBlockInfo)
                            .collect(Collectors.toList()))));
  }

  public  BlockRepositoryOkHttpImpl(ApiClient apiClient);

}