Skip to content

Commit 8ecc822

Browse files
author
Annie Weng
committed
added getIssueByLabel() method to model/Project and api/Issues
1 parent e656e8c commit 8ecc822

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

lib/Gitlab/Api/Issues.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,17 @@ public function update($project_id, $issue_id, array $params)
5353
return $this->put($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_id)), $params);
5454
}
5555

56+
/**
57+
*@param int $project_id
58+
*@param string $issue_label
59+
*@return mixed
60+
*/
61+
public function getIssueByLabel($project_id, $issue_label)
62+
{
63+
64+
return $this->get($this->getProjectPath($project_id, 'issues?labels='.$this->encodePath($issue_label)));
65+
}
66+
5667
/**
5768
* @param int $project_id
5869
* @param int $issue_id

lib/Gitlab/Model/Project.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -756,6 +756,20 @@ public function openIssue($id)
756756
return $issue->open();
757757
}
758758

759+
/**
760+
* @param String $label
761+
* @return array()
762+
*/
763+
public function getIssueByLabel($label)
764+
$data = $this->api('issues')->getIssueByLabel($this->id,$label);
765+
$issues = array();
766+
foreach ($data as $issue){
767+
$issues[] = Issue::fromArray($this->getClient(), $this, $issue);
768+
}
769+
770+
return $issues;
771+
}
772+
759773
/**
760774
* @param int $page
761775
* @param int $per_page

0 commit comments

Comments
 (0)