Skip to content

Commit 7fd1cb1

Browse files
committed
Added documentation for the pagination support
1 parent 74210a4 commit 7fd1cb1

File tree

2 files changed

+32
-4
lines changed

2 files changed

+32
-4
lines changed

doc/index.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@ APIs:
1616
* [Repositories](repos.md)
1717
* [Users](users.md)
1818

19-
* [Result Pager](result_pager.md)
20-
2119
Additional features:
2220

21+
* [Pagination support](result_pager.md)
2322
* [Authentication & Security](security.md)
2423
* [Request any Route](request_any_route.md)
2524
* [Customize `php-github-api` and testing](customize.md)

doc/result_pager.md

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,42 @@
33

44
### Usage examples
55

6-
Get all results of a organization
6+
Get all repositories of a organization
77

88
```php
99
$client = new Github\Client();
1010

1111
$organizationApi = $client->api('organization');
1212

1313
$paginator = new Github\ResultPager( $client );
14-
$result = $paginator->fetchAll( $organizationApi, 'repositories', 'future500' );
14+
$result = $paginator->fetchAll( $organizationApi, 'repositories', 'github );
1515
```
16+
17+
Get the first page
18+
```php
19+
$client = new Github\Client();
20+
21+
$organizationApi = $client->api('organization');
22+
23+
$paginator = new Github\ResultPager( $client );
24+
$result = $paginator->fetch( $organizationApi, 'repositories', 'github );
25+
```
26+
Check for a next page:
27+
```php
28+
$paginator->hasNext();
29+
```
30+
31+
Get next page:
32+
```php
33+
$paginator->fetchNext();
34+
```
35+
36+
Check for pervious page:
37+
```php
38+
$paginator->getPrevious();
39+
```
40+
41+
Get prevrious page:
42+
```php
43+
$paginator->fetchPrevious();
44+
```

0 commit comments

Comments
 (0)