Skip to content

Commit df94484

Browse files
committed
Add Projects to Group Model and added to API so projects can be obtained from API\Groups from within Model similar to how Members can be selected from with the Group model.
1 parent 93bc1c3 commit df94484

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-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
}

0 commit comments

Comments
 (0)