class MosaicRepositoryOkHttpImpl extends AbstractRepositoryOkHttpImpl implements MosaicRepository {

  @Override
  public Observable<Page<MosaicInfo>> search(MosaicSearchCriteria criteria) {
    Callable<MosaicPage> callback =
        () ->
            getClient()
                .searchMosaics(
                    toDto(criteria.getOwnerAddress()),
                    criteria.getPageSize(),
                    criteria.getPageNumber(),
                    criteria.getOffset(),
                    toDto(criteria.getOrder()));

    return exceptionHandling(
        networkTypeObservable.flatMap(
            networkType ->
                call(callback)
                    .map(
                        mosaicPage ->
                            this.toPage(
                                mosaicPage.getPagination(),
                                mosaicPage.getData().stream()
                                    .map(dto -> this.createMosaicInfo(dto, networkType))
                                    .collect(Collectors.toList())))));
  }

  public  MosaicRepositoryOkHttpImpl(
      ApiClient apiClient, Observable<NetworkType> networkTypeObservable);

}