Repository navigation
Expand file tree
/
Copy pathGroups.php
More file actions
125 lines (115 loc) · 2.99 KB
/
Copy pathGroups.php
File metadata and controls
125 lines (115 loc) · 2.99 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
117
118
119
120
121
122
123
124
125
<?php namespace Gitlab\Api;
class Groups extends AbstractApi
{
/**
* @param int $page
* @param int $per_page
* @return mixed
*/
public function all($page = 1, $per_page = self::PER_PAGE)
{
return $this->get('groups', array(
'page' => $page,
'per_page' => $per_page
));
}
/**
* @param string $query
* @param int $page
* @param int $per_page
* @return mixed
*/
public function search($query, $page = 1, $per_page = self::PER_PAGE)
{
return $this->get('groups?search='.$this->encodePath($query), array(
'page' => $page,
'per_page' => $per_page
));
}
/**
* @param int $id
* @return mixed
*/
public function show($id)
{
return $this->get('groups/'.$this->encodePath($id));
}
/**
* @param string $name
* @param string $path
* @param string $description
* @return mixed
*/
public function create($name, $path, $description = null)
{
return $this->post('groups', array(
'name' => $name,
'path' => $path,
'description' => $description
));
}
/**
* @param int $group_id
* @return mixed
*/
public function remove($group_id)
{
return $this->delete('groups/'.$this->encodePath($group_id));
}
/**
* @param int $group_id
* @param int $project_id
* @return mixed
*/
public function transfer($group_id, $project_id)
{
return $this->post('groups/'.$this->encodePath($group_id).'/projects/'.$this->encodePath($project_id));
}
/**
* @param int $id
* @param int $page
* @param int $per_page
* @return mixed
*/
public function members($id, $page = 1, $per_page = self::PER_PAGE)
{
return $this->get('groups/'.$this->encodePath($id).'/members', array(
'page' => $page,
'per_page' => $per_page
));
}
/**
* @param int $group_id
* @param int $user_id
* @param int $access_level
* @return mixed
*/
public function addMember($group_id, $user_id, $access_level)
{
return $this->post('groups/'.$this->encodePath($group_id).'/members', array(
'user_id' => $user_id,
'access_level' => $access_level
));
}
/**
* @param int $group_id
* @param int $user_id
* @param int $access_level
* @return mixed
*/
public function saveMember($group_id, $user_id, $access_level)
{
return $this->put('groups/'.$this->encodePath($group_id).'/members/'.$this->encodePath($user_id), array(
'access_level' => $access_level
));
}
/**
* @param int $group_id
* @param int $user_id
* @return mixed
*/
public function removeMember($group_id, $user_id)
{
return $this->delete('groups/'.$this->encodePath($group_id).'/members/'.$this->encodePath($user_id));
}
}