Do all paginated calls inside PaginatedList

This was already the case for Legacy.PaginatedList.

Doing it in PaginatedList.PaginatedList reduces the amount of
repeated code and will allow a generic solution for issue #77
This commit is contained in:
Vincent Jacques
2012-09-11 23:47:08 +02:00
parent 25a7696b76
commit ef403a1594
25 changed files with 200 additions and 553 deletions
+8 -32
View File
@@ -224,45 +224,27 @@ class PullRequest( GithubObject.GithubObject ):
return self.get_review_comments()
def get_review_comments( self ):
headers, data = self._requester.requestAndCheck(
"GET",
self.url + "/comments",
None,
None
)
return PaginatedList.PaginatedList(
PullRequestComment.PullRequestComment,
self._requester,
headers,
data
self.url + "/comments",
None
)
def get_commits( self ):
headers, data = self._requester.requestAndCheck(
"GET",
self.url + "/commits",
None,
None
)
return PaginatedList.PaginatedList(
Commit.Commit,
self._requester,
headers,
data
self.url + "/commits",
None
)
def get_files( self ):
headers, data = self._requester.requestAndCheck(
"GET",
self.url + "/files",
None,
None
)
return PaginatedList.PaginatedList(
File.File,
self._requester,
headers,
data
self.url + "/files",
None
)
def get_issue_comment( self, id ):
@@ -276,17 +258,11 @@ class PullRequest( GithubObject.GithubObject ):
return IssueComment.IssueComment( self._requester, data, completed = True )
def get_issue_comments( self ):
headers, data = self._requester.requestAndCheck(
"GET",
self._parentUrl( self._parentUrl( self.url ) ) + "/issues/" + str( self.number ) + "/comments",
None,
None
)
return PaginatedList.PaginatedList(
IssueComment.IssueComment,
self._requester,
headers,
data
self._parentUrl( self._parentUrl( self.url ) ) + "/issues/" + str( self.number ) + "/comments",
None
)
def is_merged( self ):