Skip to content

Commit fc5a76c

Browse files
committed
docs: Add migration list example with ResultPager and remove per_page
Signed-off-by: Hari Darshan Gorana <er.haridarshan@gmail.com>
1 parent 3948174 commit fc5a76c

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

doc/user/migration.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,18 @@
66
https://docs.github.com/en/rest/migrations/users?apiVersion=2022-11-28#list-user-migrations
77

88
```php
9-
$migrations = $client->api('user')->migration()->list([
10-
'per_page' => 10
11-
]);
9+
$api = $github->api('user')->migration();
10+
$paginator = new Github\ResultPager($github);
11+
$parameters = [];
12+
$migrations = $paginator->fetchAll($api, 'list', $parameters);
13+
14+
do {
15+
foreach ($migrations as $migration) {
16+
// do something
17+
}
18+
$migrations = $paginator->fetchNext();
19+
}
20+
while($paginator->hasNext());
1221
```
1322

1423
# Start a User Migration

0 commit comments

Comments
 (0)