Skip to content

Commit 993ed2f

Browse files
author
Matt Humphrey
committed
Added missing group methods and added description field to endpoint and Group model. Fixes #70 #67.
1 parent 296d7f9 commit 993ed2f

File tree

2 files changed

+43
-5
lines changed

2 files changed

+43
-5
lines changed

lib/Gitlab/Api/Groups.php

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,20 @@ public function all($page = 1, $per_page = self::PER_PAGE)
1515
));
1616
}
1717

18+
/**
19+
* @param string $query
20+
* @param int $page
21+
* @param int $per_page
22+
* @return mixed
23+
*/
24+
public function search($query, $page = 1, $per_page = self::PER_PAGE)
25+
{
26+
return $this->get('groups?search='.urlencode($query), array(
27+
'page' => $page,
28+
'per_page' => $per_page
29+
));
30+
}
31+
1832
/**
1933
* @param int $id
2034
* @return mixed
@@ -27,16 +41,27 @@ public function show($id)
2741
/**
2842
* @param string $name
2943
* @param string $path
44+
* @param string $description
3045
* @return mixed
3146
*/
32-
public function create($name, $path)
47+
public function create($name, $path, $description = null)
3348
{
3449
return $this->post('groups', array(
3550
'name' => $name,
36-
'path' => $path
51+
'path' => $path,
52+
'description' => $description
3753
));
3854
}
3955

56+
/**
57+
* @param int $group_id
58+
* @return mixed
59+
*/
60+
public function remove($group_id)
61+
{
62+
return $this->delete('groups/'.urlencode($group_id));
63+
}
64+
4065
/**
4166
* @param int $group_id
4267
* @param int $project_id
@@ -75,6 +100,19 @@ public function addMember($group_id, $user_id, $access_level)
75100
));
76101
}
77102

103+
/**
104+
* @param int $group_id
105+
* @param int $user_id
106+
* @param int $access_level
107+
* @return mixed
108+
*/
109+
public function saveMember($group_id, $user_id, $access_level)
110+
{
111+
return $this->put('groups/'.urlencode($group_id).'/members/'.urlencode($user_id), array(
112+
'access_level' => $access_level
113+
));
114+
}
115+
78116
/**
79117
* @param int $group_id
80118
* @param int $user_id

lib/Gitlab/Model/Group.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
* @property-read int $id
99
* @property-read string $name
1010
* @property-read string $path
11-
* @property-read int $owner_id
12-
* @property-read Project[]
11+
* @property-read string $description
12+
* @property-read Project[] $projects
1313
*/
1414
class Group extends AbstractModel
1515
{
@@ -20,7 +20,7 @@ class Group extends AbstractModel
2020
'id',
2121
'name',
2222
'path',
23-
'owner_id',
23+
'description',
2424
'projects'
2525
);
2626

0 commit comments

Comments
 (0)