Skip to content

Commit f1e4fc9

Browse files
authored
Merge pull request KnpLabs#451 from mdkholy/new-endpoints
Added two new statistics endpoints
2 parents 6b2d292 + b571ad2 commit f1e4fc9

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

lib/Github/Api/Repo.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,36 @@ public function statistics($username, $repository)
8989
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/stats/contributors');
9090
}
9191

92+
/**
93+
* Get a weekly aggregate of the number of additions and deletions pushed to a repository.
94+
*
95+
* @link http://developer.github.com/v3/repos/statistics/#code-frequency
96+
*
97+
* @param string $username the user who owns the repository
98+
* @param string $repository the name of the repository
99+
*
100+
* @return array list of weeks and their commit statistics
101+
*/
102+
public function frequency($username, $repository)
103+
{
104+
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/stats/code_frequency');
105+
}
106+
107+
/**
108+
* Get the weekly commit count for the repository owner and everyone else.
109+
*
110+
* @link http://developer.github.com/v3/repos/statistics/#participation
111+
*
112+
* @param string $username the user who owns the repository
113+
* @param string $repository the name of the repository
114+
*
115+
* @return array list of weekly commit count grouped by 'all' and 'owner'
116+
*/
117+
public function participation($username, $repository)
118+
{
119+
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/stats/participation');
120+
}
121+
92122
/**
93123
* List all repositories for an organization.
94124
*

0 commit comments

Comments
 (0)