add function to get pull requests (Repo::getPulls)
This commit is contained in:
parent
ba51d4ad7d
commit
42952f6d74
20
src/Repo.php
20
src/Repo.php
@ -51,6 +51,26 @@ class Repo{
|
||||
return $all_issues;
|
||||
}
|
||||
|
||||
public function getPulls($args=null){
|
||||
$page=1;
|
||||
$all_pulls=[];
|
||||
while(1){
|
||||
$url="repos/{$this->user}/{$this->repo}/pulls?page=$page";
|
||||
if($args){
|
||||
$url.='&'.http_build_query($args);
|
||||
}
|
||||
$pulls=$this->client->request($url);
|
||||
foreach($pulls as $data){
|
||||
$pull=$data;//new Issue($this,$data);
|
||||
$all_pulls[]=$pull;
|
||||
}
|
||||
if(!$pulls) break;
|
||||
$page++;
|
||||
}
|
||||
return $all_pulls;
|
||||
}
|
||||
|
||||
|
||||
public function getIssue($id){
|
||||
$url="repos/{$this->user}/{$this->repo}/issues/{$id}";
|
||||
$data=$this->client->request($url);
|
||||
|
Loading…
Reference in New Issue
Block a user