Skip to content

Added repository documentation to current user #671

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 8, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions doc/currentuser/repositories.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
## Current user / Repo API
[Back to the navigation](../README.md)

> Requires [authentication](../security.md).

### List repositories that are accessible to the authenticated user.

```php
$repositories = $client->currentUser()->repositories();
```

This includes repositories owned by the authenticated user, repositories where the authenticated user is a collaborator, and repositories that the authenticated user has access to through an organization membership.

There are three values that can be passed into the `repositories` method: `type`, `sort` and `direction`

| Parameters | Default | Possible Values |
| ------------- |-------------| -------------------------------------------- |
| type | `owner` | `all`, `owner`, `public`, `private`, `member`
| sort | `full_name` | `created`, `updated`, `pushed`, `full_name`
| direction | `asc` | `asc`, `desc`

> See https://developer.github.com/v3/repos/#list-your-repositories for possible values and additional information

#### Code Example:

```php
$client = new \Github\Client();
$client->authenticate($github_token, null, \Github\Client::AUTH_HTTP_TOKEN);
$client->currentUser()->repositories();
```