org.gitlab.api.query.PaginationQuery Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-gitlab-api Show documentation
Show all versions of java-gitlab-api Show documentation
A Java wrapper for the Gitlab Git Hosting Server API
The newest version!
package org.gitlab.api.query;
import org.gitlab.api.http.Query;
import java.io.UnsupportedEncodingException;
public class PaginationQuery extends Query {
public static final String PARAM_PAGE = "page";
public static final String PARAM_PER_PAGE = "per_page";
public static final int MAX_ITEMS_PER_PAGE = 100;
public void setPage(int page) {
try {
append(PARAM_PAGE, String.valueOf(page));
} catch (UnsupportedEncodingException ignored) {
}
}
public void setPerPage(int perPage) {
if (perPage > MAX_ITEMS_PER_PAGE) {
throw new IllegalArgumentException("Max value for perPage is " + MAX_ITEMS_PER_PAGE);
}
try {
append(PARAM_PER_PAGE, String.valueOf(perPage));
} catch (UnsupportedEncodingException ignored) {
}
}
public PaginationQuery withPage(int page) {
setPage(page);
return this;
}
public PaginationQuery withPerPage(int perPage) {
setPerPage(perPage);
return this;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy