Heimdall/vendor/knplabs/github-api/lib/Github/ResultPagerInterface.php

105 lines
2.7 KiB
PHP
Raw Normal View History

2018-10-18 14:59:38 +00:00
<?php
namespace Github;
2022-03-10 11:54:29 +00:00
use Generator;
use Github\Api\AbstractApi;
2018-10-18 14:59:38 +00:00
/**
* Pager interface.
*
* @author Ramon de la Fuente <ramon@future500.nl>
* @author Mitchel Verschoof <mitchel@future500.nl>
2022-03-10 11:54:29 +00:00
* @author Graham Campbell <graham@alt-three.com>
2018-10-18 14:59:38 +00:00
*/
interface ResultPagerInterface
{
/**
* Fetch a single result (page) from an api call.
*
2022-03-10 11:54:29 +00:00
* @param AbstractApi $api the Api instance
* @param string $method the method name to call on the Api instance
* @param array $parameters the method parameters in an array
2018-10-18 14:59:38 +00:00
*
* @return array returns the result of the Api::$method() call
*/
2022-03-10 11:54:29 +00:00
public function fetch(AbstractApi $api, string $method, array $parameters = []): array;
2018-10-18 14:59:38 +00:00
/**
* Fetch all results (pages) from an api call.
*
* Use with care - there is no maximum.
*
2022-03-10 11:54:29 +00:00
* @param AbstractApi $api the Api instance
* @param string $method the method name to call on the Api instance
* @param array $parameters the method parameters in an array
2018-10-18 14:59:38 +00:00
*
* @return array returns a merge of the results of the Api::$method() call
*/
2022-03-10 11:54:29 +00:00
public function fetchAll(AbstractApi $api, string $method, array $parameters = []): array;
/**
* Lazily fetch all results (pages) from an api call.
*
* Use with care - there is no maximum.
*
* @param AbstractApi $api the Api instance
* @param string $method the method name to call on the Api instance
* @param array $parameters the method parameters in an array
*
* @return \Generator returns a merge of the results of the Api::$method() call
*/
public function fetchAllLazy(AbstractApi $api, string $method, array $parameters = []): Generator;
2018-10-18 14:59:38 +00:00
/**
* Method that performs the actual work to refresh the pagination property.
2022-03-10 11:54:29 +00:00
*
* @deprecated since 3.2 and will be removed in 4.0.
*
* @return void
2018-10-18 14:59:38 +00:00
*/
2022-03-10 11:54:29 +00:00
public function postFetch(): void;
2018-10-18 14:59:38 +00:00
/**
* Check to determine the availability of a next page.
*
* @return bool
*/
2022-03-10 11:54:29 +00:00
public function hasNext(): bool;
2018-10-18 14:59:38 +00:00
/**
* Check to determine the availability of a previous page.
*
* @return bool
*/
2022-03-10 11:54:29 +00:00
public function hasPrevious(): bool;
2018-10-18 14:59:38 +00:00
/**
* Fetch the next page.
*
* @return array
*/
2022-03-10 11:54:29 +00:00
public function fetchNext(): array;
2018-10-18 14:59:38 +00:00
/**
* Fetch the previous page.
*
* @return array
*/
2022-03-10 11:54:29 +00:00
public function fetchPrevious(): array;
2018-10-18 14:59:38 +00:00
/**
* Fetch the first page.
*
* @return array
*/
2022-03-10 11:54:29 +00:00
public function fetchFirst(): array;
2018-10-18 14:59:38 +00:00
/**
* Fetch the last page.
*
* @return array
*/
2022-03-10 11:54:29 +00:00
public function fetchLast(): array;
2018-10-18 14:59:38 +00:00
}