Repository.get_issues_comments and Repository.get_pulls_comments (issue #126)

This commit is contained in:
Vincent Jacques
2012-12-25 13:02:15 +01:00
parent b8a3a12991
commit 5edf5a120e
6 changed files with 111 additions and 1 deletions
+39
View File
@@ -778,6 +778,24 @@ class Repository(github.GithubObject.GithubObject):
url_parameters
)
def get_issues_comments(self, sort=github.GithubObject.NotSet, direction=github.GithubObject.NotSet, since=github.GithubObject.NotSet):
assert sort is github.GithubObject.NotSet or isinstance(sort, (str, unicode)), sort
assert direction is github.GithubObject.NotSet or isinstance(direction, (str, unicode)), direction
assert since is github.GithubObject.NotSet or isinstance(since, datetime.datetime), since
url_parameters = dict()
if sort is not github.GithubObject.NotSet:
url_parameters["sort"] = sort
if direction is not github.GithubObject.NotSet:
url_parameters["direction"] = direction
if since is not github.GithubObject.NotSet:
url_parameters["since"] = since.strftime("%Y-%m-%dT%H:%M:%SZ")
return github.PaginatedList.PaginatedList(
github.IssueComment.IssueComment,
self._requester,
self.url + "/issues/comments",
url_parameters
)
def get_issues_event(self, id):
assert isinstance(id, (int, long)), id
headers, data = self._requester.requestAndCheck(
@@ -899,6 +917,27 @@ class Repository(github.GithubObject.GithubObject):
url_parameters
)
def get_pulls_comments(self, sort=github.GithubObject.NotSet, direction=github.GithubObject.NotSet, since=github.GithubObject.NotSet):
return self.get_pulls_review_comments(sort, direction, since)
def get_pulls_review_comments(self, sort=github.GithubObject.NotSet, direction=github.GithubObject.NotSet, since=github.GithubObject.NotSet):
assert sort is github.GithubObject.NotSet or isinstance(sort, (str, unicode)), sort
assert direction is github.GithubObject.NotSet or isinstance(direction, (str, unicode)), direction
assert since is github.GithubObject.NotSet or isinstance(since, datetime.datetime), since
url_parameters = dict()
if sort is not github.GithubObject.NotSet:
url_parameters["sort"] = sort
if direction is not github.GithubObject.NotSet:
url_parameters["direction"] = direction
if since is not github.GithubObject.NotSet:
url_parameters["since"] = since.strftime("%Y-%m-%dT%H:%M:%SZ")
return github.PaginatedList.PaginatedList(
github.IssueComment.IssueComment,
self._requester,
self.url + "/pulls/comments",
url_parameters
)
def get_readme(self, ref=github.GithubObject.NotSet):
assert ref is github.GithubObject.NotSet or isinstance(ref, (str, unicode)), ref
url_parameters = dict()