Skip to content

Commit fe50ad1

Browse files
committed
Add matchingBranch() and matchingTags() Methods To References.php
Added two new methods to GitData->References to cover the matching reference endpoints described here: https://developer.github.com/v3/git/refs/#list-matching-references
1 parent f2abf32 commit fe50ad1

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

lib/Github/Api/GitData/References.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,34 @@ public function all($username, $repository)
2525
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs');
2626
}
2727

28+
/**
29+
* Get all matching references for a particular branch of a repository.
30+
*
31+
* @param string $username
32+
* @param string $repository
33+
* @param string $branch
34+
*
35+
* @return array
36+
*/
37+
public function matchingBranch($username, $repository, $branch)
38+
{
39+
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/matching-refs/heads/'.$branch);
40+
}
41+
42+
/**
43+
* Get all matching references for a particular branch of a repository.
44+
*
45+
* @param string $username
46+
* @param string $repository
47+
* @param string $tag
48+
*
49+
* @return array
50+
*/
51+
public function matchingTag($username, $repository, $tag)
52+
{
53+
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/matching-refs/tags/'.$tag);
54+
}
55+
2856
/**
2957
* Get all branches of a repository.
3058
*

0 commit comments

Comments
 (0)