diff --git a/api/repositories/statistics.py b/api/repositories/statistics.py new file mode 100644 index 0000000..91d4581 --- /dev/null +++ b/api/repositories/statistics.py @@ -0,0 +1,35 @@ +from core.rest_client import RestClient + +class Statistics(RestClient): + def __init__(self, api_root_url, **kwargs): + super(Statistics, self).__init__(api_root_url, **kwargs) + + def get_contributors_list(self,owner,repo,**kwargs): + """ + https://developer.github.com/v3/repos/statistics/#get-contributors-list-with-additions-deletions-and-commit-counts + """ + return self.get("/repos/{}/{}/stats/contributors".format(owner,repo),**kwargs) + + def get_last_year_commit(self,owner,repo,**kwargs): + """ + https://developer.github.com/v3/repos/statistics/#get-the-last-year-of-commit-activity-data + """ + return self.get("/repos/{}/{}/stats/commit_activity".format(owner,repo),**kwargs) + + def get_number_of_additions_deletions(self,owner,repo,**kwargs): + """ + https://developer.github.com/v3/repos/statistics/#get-the-number-of-additions-and-deletions-per-week + """ + return self.get("/repos/{}/{}/stats/code_frequency".format(owner,repo),**kwargs) + + def get_weekly_commit_count(self,owner,repo,**kwargs): + """ + https://developer.github.com/v3/repos/statistics/#get-the-weekly-commit-count-for-the-repository-owner-and-everyone-else + """ + return self.get("/repos/{}/{}/stats/participation".format(owner,repo),**kwargs) + + def get_numbers_commits_hour(self,owner,repo,**kwargs): + """ + https://developer.github.com/v3/repos/statistics/#get-the-number-of-commits-per-hour-in-each-day + """ + return self.get("/repos/{}/{}/stats/punch_card".format(owner,repo),**kwargs) diff --git a/api/repositories/statuses.py b/api/repositories/statuses.py new file mode 100644 index 0000000..bafc337 --- /dev/null +++ b/api/repositories/statuses.py @@ -0,0 +1,23 @@ +from core.rest_client import RestClient + +class Statuses(RestClient): + def __init__(self, api_root_url, **kwargs): + super(Statuses, self).__init__(api_root_url, **kwargs) + + def create_a_status(self,owner,repo,sha,**kwargs): + """ + https://developer.github.com/v3/repos/statuses/#create-a-status + """ + return self.post("/repos/{}/{}/statuses/{}".format(owner,repo,sha),**kwargs) + + def list_statuses_for_specific_ref(self,owner,repo,ref,**kwargs): + """ + https://developer.github.com/v3/repos/statuses/#list-statuses-for-a-specific-ref + """ + return self.get("/repos/{}/{}/commits/{}/statuses".format(owner,repo,ref),**kwargs) + + def get_combined_status_for_specific_ref(self,owner,repo,ref,**kwargs): + """ + https://developer.github.com/v3/repos/statuses/#get-the-combined-status-for-a-specific-ref + """ + return self.get("/repos/{}/{}/commits/{}/status".format(owner,repo,ref),**kwargs) \ No newline at end of file