|
| 1 | +## User / Migrations API |
| 2 | +[Back to the "Users API"](../../users.md) | [Back to the navigation](../../README.md) |
| 3 | + |
| 4 | +# List user migrations |
| 5 | + |
| 6 | +https://docs.github.com/en/rest/migrations/users?apiVersion=2022-11-28#list-user-migrations |
| 7 | + |
| 8 | +```php |
| 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()); |
| 21 | +``` |
| 22 | + |
| 23 | +# Start a User Migration |
| 24 | + |
| 25 | +https://docs.github.com/en/rest/migrations/users?apiVersion=2022-11-28#start-a-user-migration |
| 26 | + |
| 27 | +```php |
| 28 | +$client->users()->migration()->start([ |
| 29 | + 'repositories' => [ |
| 30 | + 'KnpLabs/php-github-api' |
| 31 | + ], |
| 32 | + 'lock_repositories' => true, |
| 33 | + 'exclude_metadata' => false, |
| 34 | + 'exclude_git_data' => false, |
| 35 | + 'exclude_attachments' => true, |
| 36 | + 'exclude_releases' => false, |
| 37 | + 'exclude_owner_projects' => true, |
| 38 | + 'org_metadata_only' => false, |
| 39 | + 'exclude' => [ |
| 40 | + 'Exclude attributes from the API response to improve performance' |
| 41 | + ] |
| 42 | +]); |
| 43 | +``` |
| 44 | + |
| 45 | +# Get a User Migration Status |
| 46 | + |
| 47 | +https://docs.github.com/en/rest/migrations/users?apiVersion=2022-11-28#get-a-user-migration-status |
| 48 | + |
| 49 | +```php |
| 50 | +$status = $client->user()->migration()->status(12, [ |
| 51 | + 'exclude' => [ |
| 52 | + 'exclude attributes' |
| 53 | + ] |
| 54 | +]); |
| 55 | +``` |
| 56 | + |
| 57 | +# Delete a User Migration Archive |
| 58 | + |
| 59 | +https://docs.github.com/en/rest/migrations/users?apiVersion=2022-11-28#delete-a-user-migration-archive |
| 60 | + |
| 61 | +```php |
| 62 | +$client->user()->migration()->deleteArchive(12); |
| 63 | +``` |
| 64 | + |
| 65 | +# Unlock a User Repository |
| 66 | + |
| 67 | +https://docs.github.com/en/rest/migrations/users?apiVersion=2022-11-28#unlock-a-user-repository |
| 68 | + |
| 69 | +```php |
| 70 | +$client->user()->migration()->unlockRepo(12, 'php-github-api'); |
| 71 | +``` |
| 72 | + |
| 73 | +# List repositories for a User Migration |
| 74 | + |
| 75 | +https://docs.github.com/en/rest/migrations/users?apiVersion=2022-11-28#list-repositories-for-a-user-migration |
| 76 | + |
| 77 | +```php |
| 78 | +$repos = $client->user()->migration()->repos(2); |
| 79 | +``` |
0 commit comments