Skip to content

Commit 0df9f48

Browse files
committed
Merge pull request KnpLabs#18 from m4tthumphrey/master
No option to create a repository for an organization
2 parents 22c1d08 + ff614c9 commit 0df9f48

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

lib/Github/Api/Repo.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,19 @@ public function show($username, $repository)
5555
* Create repository
5656
* @link http://developer.github.com/v3/repos/
5757
*
58-
* @param string $name name of the repository
59-
* @param string $description repository description
60-
* @param string $homepage homepage url
61-
* @param boolean $public 1 for public, 0 for private
58+
* @param string $name name of the repository
59+
* @param string $description repository description
60+
* @param string $homepage homepage url
61+
* @param boolean $public 1 for public, 0 for private
62+
* @param boolean|string $organization username of organization if applicable
6263
*
6364
* @return array returns repository data
6465
*/
65-
public function create($name, $description = '', $homepage = '', $public = true)
66+
public function create($name, $description = '', $homepage = '', $public = true, $organization = false)
6667
{
67-
return $this->post('user/repos', array(
68+
$path = ($organization) ? 'orgs/'.$organization.'/repos' : 'user/repos';
69+
70+
return $this->post($path, array(
6871
'name' => $name,
6972
'description' => $description,
7073
'homepage' => $homepage,

lib/Github/HttpClient/HttpClient.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,9 @@ public function delete($path, array $parameters = array(), array $headers = arra
131131
/**
132132
* {@inheritDoc}
133133
*/
134-
public function put($path, array $headers = array())
134+
public function put($path, array $paramters = array(), array $headers = array())
135135
{
136-
return $this->request($path, array(), 'PUT', $headers);
136+
return $this->request($path, $paramters, 'PUT', $headers);
137137
}
138138

139139
/**

lib/Github/HttpClient/HttpClientInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function patch($path, array $parameters = array(), array $headers = array
5252
*
5353
* @return array Data
5454
*/
55-
public function put($path, array $headers = array());
55+
public function put($path, array $paramters = array(), array $headers = array());
5656

5757
/**
5858
* Send a DELETE request

0 commit comments

Comments
 (0)