Skip to content

Commit bf8d54b

Browse files
committed
Merge branch '2.x'
* 2.x: Update branch alias Fixed incorrect parameters in apps docs Fix incorrect public key documentation Add missing repo hooks documentation Replace deprecated organization team repository add/remove urls
2 parents 23afc53 + cf962cb commit bf8d54b

File tree

6 files changed

+60
-16
lines changed

6 files changed

+60
-16
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"extra": {
5151
"branch-alias": {
5252
"dev-2.x": "2.19.x-dev",
53-
"dev-master": "3.1.x-dev"
53+
"dev-master": "3.2.x-dev"
5454
}
5555
}
5656
}

doc/apps.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,21 @@ $installations = $client->api('current_user')->installations();
3131

3232
List repositories that are accessible to the authenticated installation.
3333
```php
34-
$repositories = $client->api('apps')->listRepositories(456);
34+
$repositories = $client->api('apps')->listRepositories($userId);
3535
```
3636

3737
### List repositories for a given installation and user
3838

3939
```php
40-
$repositories = $client->api('current_user')->repositoriesByInstallation(456);
40+
$repositories = $client->api('current_user')->repositoriesByInstallation($installationId, $parameters);
4141
```
4242

4343
### Add repository to installation
44-
Add a single repository to an installation.
4544
```php
46-
$client->api('apps')->addRepository(123);
45+
$client->api('apps')->addRepository($installationId, $repositoryId);
4746
```
4847

4948
### Remove repository from installation
50-
Remove a single repository from an installation.
5149
```php
52-
$client->api('apps')->removeRepository(123);
50+
$client->api('apps')->removeRepository($installationId, $repositoryId);
5351
```

doc/currentuser/publickeys.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,23 @@ Wraps [GitHub User Public Keys API](https://developer.github.com/v3/users/keys/#
66
### List your public keys
77

88
```php
9-
$keys = $client->user()->keys()->all();
9+
$keys = $client->me()->keys()->all();
1010
```
1111

1212
Returns a list of public keys for the authenticated user.
1313

1414
### Shows a public key for the authenticated user.
1515

1616
```php
17-
$key = $client->user()->keys()->show(1234);
17+
$key = $client->me()->keys()->show(1234);
1818
```
1919

2020
### Add a public key to the authenticated user.
2121

2222
> Requires [authentication](../security.md).
2323
2424
```php
25-
$key = $client->user()->keys()->create(array('title' => 'key title', 'key' => 12345));
25+
$key = $client->me()->keys()->create(array('title' => 'key title', 'key' => 12345));
2626
```
2727

2828
Adds a key with title 'key title' to the authenticated user and returns a the created key for the user.
@@ -32,5 +32,5 @@ Adds a key with title 'key title' to the authenticated user and returns a the cr
3232
> Requires [authentication](../security.md).
3333
3434
```php
35-
$client->user()->keys()->remove(12345);
35+
$client->me()->keys()->remove(12345);
3636
```

doc/repo/hooks.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
## Repo / Hooks API
2+
[Back to the "Repos API"](../repos.md) | [Back to the navigation](../README.md)
3+
4+
For extended info see the [Github documentation](https://docs.github.com/en/rest/reference/repos#webhooks)
5+
6+
### List repository webhooks
7+
8+
```php
9+
$hooks = $client->api('repo')->hooks()->all('twbs', 'bootstrap');
10+
```
11+
12+
### Get a repository webhook
13+
14+
```php
15+
$hook = $client->api('repo')->hooks()->show('twbs', 'bootstrap', $hookId);
16+
```
17+
18+
### Create a repository webhook
19+
20+
```php
21+
$client->api('repo')->hooks()->create('twbs', 'bootstrap', $parameters);
22+
```
23+
24+
### Update a repository webhook
25+
26+
```php
27+
$client->api('repo')->hooks()->update('twbs', 'bootstrap', $hookId, $parameters);
28+
```
29+
30+
### Delete a repository webhook
31+
32+
```php
33+
$client->api('repo')->hooks()->remove('twbs', 'bootstrap', $hookId);
34+
```
35+
36+
### Ping a repository webhook
37+
38+
```php
39+
$client->api('repo')->hooks()->ping('twbs', 'bootstrap', $hookId);
40+
```
41+
42+
### Test the push repository webhook
43+
44+
```php
45+
$client->api('repo')->hooks()->test('twbs', 'bootstrap', $hookId);
46+
```

lib/Github/Api/Organization/Teams.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,15 @@ public function repository($team, $organization, $repository)
107107

108108
public function addRepository($team, $organization, $repository, $params = [])
109109
{
110-
if (isset($params['permission']) && !in_array($params['permission'], ['pull', 'push', 'admin'])) {
110+
if (isset($params['permission']) && !in_array($params['permission'], ['pull', 'push', 'admin', 'maintain', 'triage'])) {
111111
$params['permission'] = 'pull';
112112
}
113113

114-
return $this->put('/teams/'.rawurlencode($team).'/repos/'.rawurlencode($organization).'/'.rawurlencode($repository), $params);
114+
return $this->put('/orgs/'.rawurlencode($organization).'/teams/'.rawurlencode($team).'/repos/'.rawurlencode($organization).'/'.rawurlencode($repository), $params);
115115
}
116116

117117
public function removeRepository($team, $organization, $repository)
118118
{
119-
return $this->delete('/teams/'.rawurlencode($team).'/repos/'.rawurlencode($organization).'/'.rawurlencode($repository));
119+
return $this->delete('/orgs/'.rawurlencode($organization).'/teams/'.rawurlencode($team).'/repos/'.rawurlencode($organization).'/'.rawurlencode($repository));
120120
}
121121
}

test/Github/Tests/Api/Organization/TeamsTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ public function shouldAddTeamRepository()
161161
$api = $this->getApiMock();
162162
$api->expects($this->once())
163163
->method('put')
164-
->with('/teams/KnpWorld/repos/l3l0/l3l0Repo')
164+
->with('/orgs/l3l0/teams/KnpWorld/repos/l3l0/l3l0Repo')
165165
->will($this->returnValue($expectedValue));
166166

167167
$this->assertEquals($expectedValue, $api->addRepository('KnpWorld', 'l3l0', 'l3l0Repo'));
@@ -177,7 +177,7 @@ public function shouldRemoveTeamRepository()
177177
$api = $this->getApiMock();
178178
$api->expects($this->once())
179179
->method('delete')
180-
->with('/teams/KnpWorld/repos/l3l0/l3l0Repo')
180+
->with('/orgs/l3l0/teams/KnpWorld/repos/l3l0/l3l0Repo')
181181
->will($this->returnValue($expectedValue));
182182

183183
$this->assertEquals($expectedValue, $api->removeRepository('KnpWorld', 'l3l0', 'l3l0Repo'));

0 commit comments

Comments
 (0)