Skip to content

Commit

Permalink
Add Projects to Group Model and added to API so projects can be obtai…
Browse files Browse the repository at this point in the history
…ned from API\Groups from within Model similar to how Members can be selected from with the Group model.
  • Loading branch information
donkidd committed Apr 28, 2017
1 parent 93bc1c3 commit df94484
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/Gitlab/Api/Groups.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,18 @@ public function removeMember($group_id, $user_id)
{
return $this->delete('groups/'.$this->encodePath($group_id).'/members/'.$this->encodePath($user_id));
}

/**
* @param $id
* @param int $page
* @param int $per_page
* @return mixed
*/
public function projects($id, $page = 1, $per_page = self::PER_PAGE)
{
return $this->get('groups/'.$this->encodePath($id).'/projects', array(
'page' => $page,
'per_page' => $per_page
));
}
}
11 changes: 11 additions & 0 deletions lib/Gitlab/Model/Group.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,15 @@ public function removeMember($user_id)

return true;
}

/**
* @return Group
*/
public function projects()
{

$data = $this->api('groups')->projects($this->id);

return Group::fromArray($this->getClient(),$data);
}
}

0 comments on commit df94484

Please sign in to comment.