Skip to content

Commit a572f6b

Browse files
authored
Merge pull request #185 from donkidd/add_projects_to_groups
Addition of Projects API calls in Group Model
2 parents 9244192 + df94484 commit a572f6b

File tree

4 files changed

+28
-0
lines changed

4 files changed

+28
-0
lines changed

lib/Gitlab/Api/Groups.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,4 +133,18 @@ public function removeMember($group_id, $user_id)
133133
{
134134
return $this->delete('groups/'.$this->encodePath($group_id).'/members/'.$this->encodePath($user_id));
135135
}
136+
137+
/**
138+
* @param $id
139+
* @param int $page
140+
* @param int $per_page
141+
* @return mixed
142+
*/
143+
public function projects($id, $page = 1, $per_page = self::PER_PAGE)
144+
{
145+
return $this->get('groups/'.$this->encodePath($id).'/projects', array(
146+
'page' => $page,
147+
'per_page' => $per_page
148+
));
149+
}
136150
}

lib/Gitlab/Model/Group.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,4 +125,15 @@ public function removeMember($user_id)
125125

126126
return true;
127127
}
128+
129+
/**
130+
* @return Group
131+
*/
132+
public function projects()
133+
{
134+
135+
$data = $this->api('groups')->projects($this->id);
136+
137+
return Group::fromArray($this->getClient(),$data);
138+
}
128139
}

lib/Gitlab/Model/Node.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@ class Node extends AbstractModel
2121
'type',
2222
'mode',
2323
'id',
24+
'path',
2425
'project'
2526
);
2627

28+
2729
/**
2830
* @param Client $client
2931
* @param Project $project

test/Gitlab/Tests/Api/ProjectsTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ public function shouldGetOwnedProjects()
7070
$this->assertEquals($expectedArray, $api->owned(3, 50));
7171
}
7272

73+
7374
/**
7475
* @test
7576
*/

0 commit comments

Comments
 (0)