package ru.yandex.qe.dispenser.client.v1.impl;

import javax.ws.rs.core.GenericType;

import org.apache.cxf.jaxrs.client.WebClient;

import ru.yandex.qe.dispenser.api.v1.response.DiPage;

public class DiListPageItemIterator<T> extends AbstractPageItemIterator<T> {

    final WebClient client;
    private final GenericType<? extends DiPage<T>> type;

    public DiListPageItemIterator(final WebClient client, final GenericType<? extends DiPage<T>> type) {
        this.client = client;
        this.type = type;
    }

    @Override
    protected DiPage<T> loadPage(final int page) {
        return client.replaceQueryParam("page", page).get(type);
    }
}
