All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sourcelab.github.client.response.PageableResponse Maven / Gradle / Ivy

The newest version!
package org.sourcelab.github.client.response;

import org.sourcelab.github.client.request.PageableRequest;

/**
 * Interface indicates that a Response from the Buildkite REST Api is Pageable, and can be passed into
 * the following methods to retrieve various pages.
 *
 * @param  The parsed Response object type.
 */
public interface PageableResponse {
    /**
     * Contains references to First, Next, Previous, and Last pages of a Response.
     * @return Contains references to First, Next, Previous, and Last pages of a Response.
     */
    PagingLinks getPagingLinks();

    /**
     * Utility method to determine if there are additional pages available.
     * @return true if there is a next page that can be retrieved, false if not.
     */
    default boolean hasNextPage() {
        return getPagingLinks().hasNextUrl();
    }

    /**
     * Utility method to determine if there are previous pages available.
     * @return true if there is a previous page that can be retrieved, false if not.
     */
    default boolean hasPreviousPage() {
        return getPagingLinks().hasPrevUrl();
    }

    /**
     * Utility method to determine if there is a first page available.
     * @return true if there is a first page that can be retrieved, false if not.
     */
    default boolean hasFirstPage() {
        return getPagingLinks().hasFirstUrl();
    }

    /**
     * Utility method to determine if there is a last page available.
     * @return true if there is a last page that can be retrieved, false if not.
     */
    default boolean hasLastPage() {
        return getPagingLinks().hasLastUrl();
    }

    /**
     * Get the original underlying Request used
     * to generate this response.
     *
     * @return Original underlying Request.
     */
    PageableRequest getOriginalRequest();
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy