forked from KnpLabs/php-github-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathResultPagerInterface.php
More file actions
104 lines (92 loc) · 2.71 KB
/
ResultPagerInterface.php
File metadata and controls
104 lines (92 loc) · 2.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?php
namespace Github;
use Generator;
use Github\Api\AbstractApi;
/**
* Pager interface.
*
* @author Ramon de la Fuente <ramon@future500.nl>
* @author Mitchel Verschoof <mitchel@future500.nl>
* @author Graham Campbell <graham@alt-three.com>
*/
interface ResultPagerInterface
{
/**
* Fetch a single result (page) from an api call.
*
* @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 array returns the result of the Api::$method() call
*/
public function fetch(AbstractApi $api, string $method, array $parameters = []): array;
/**
* 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 array returns a merge of the results of the Api::$method() call
*/
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;
/**
* Method that performs the actual work to refresh the pagination property.
*
* @deprecated since 3.2 and will be removed in 4.0.
*
* @return void
*/
public function postFetch(): void;
/**
* Check to determine the availability of a next page.
*
* @return bool
*/
public function hasNext(): bool;
/**
* Check to determine the availability of a previous page.
*
* @return bool
*/
public function hasPrevious(): bool;
/**
* Fetch the next page.
*
* @return array
*/
public function fetchNext(): array;
/**
* Fetch the previous page.
*
* @return array
*/
public function fetchPrevious(): array;
/**
* Fetch the first page.
*
* @return array
*/
public function fetchFirst(): array;
/**
* Fetch the last page.
*
* @return array
*/
public function fetchLast(): array;
}