forked from KnpLabs/php-github-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOrganization.php
More file actions
116 lines (103 loc) · 2.92 KB
/
Copy pathOrganization.php
File metadata and controls
116 lines (103 loc) · 2.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<?php
namespace Github\Api;
use Github\Api\Organization\Hooks;
use Github\Api\Organization\Members;
use Github\Api\Organization\Teams;
/**
* Getting organization information and managing authenticated organization account information.
*
* @link http://developer.github.com/v3/orgs/
*
* @author Antoine Berranger <antoine at ihqs dot net>
* @author Joseph Bielawski <stloyd@gmail.com>
*/
class Organization extends AbstractApi
{
/**
* @link https://developer.github.com/v3/orgs/#list-all-organizations
*
* @return array the organizations
*/
public function all($since = '')
{
return $this->get('/organizations?since='.rawurlencode($since));
}
/**
* Get extended information about an organization by its name.
*
* @link http://developer.github.com/v3/orgs/#get
*
* @param string $organization the organization to show
*
* @return array information about the organization
*/
public function show($organization)
{
return $this->get('/orgs/'.rawurlencode($organization));
}
public function update($organization, array $params)
{
return $this->patch('/orgs/'.rawurlencode($organization), $params);
}
/**
* List all repositories across all the organizations that you can access.
*
* @link http://developer.github.com/v3/repos/#list-organization-repositories
*
* @param string $organization the user name
* @param string $type the type of repositories
* @param int $page the page
* @param string $sort sort by
* @param string $direction direction of sort, asc or desc
*
* @return array the repositories
*/
public function repositories($organization, $type = 'all', $page = 1, $sort = null, $direction = null)
{
$parameters = [
'type' => $type,
'page' => $page,
];
if ($sort !== null) {
$parameters['sort'] = $sort;
}
if ($direction !== null) {
$parameters['direction'] = $direction;
}
return $this->get('/orgs/'.rawurlencode($organization).'/repos', $parameters);
}
/**
* @return Members
*/
public function members()
{
return new Members($this->client);
}
/**
* @return Hooks
*/
public function hooks()
{
return new Hooks($this->client);
}
/**
* @return Teams
*/
public function teams()
{
return new Teams($this->client);
}
/**
* @link http://developer.github.com/v3/issues/#list-issues
*
* @param string $organization
* @param array $params
* @param int $page
*
* @return array
*/
public function issues($organization, array $params = [], $page = 1)
{
return $this->get('/orgs/'.rawurlencode($organization).'/issues', array_merge(['page' => $page], $params));
}
}