Skip to content

Commit 126e853

Browse files
author
Scott Torborg
committed
Support listing comments on an issue.
1 parent 6f16683 commit 126e853

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

github2/issues.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,17 @@ def __repr__(self):
1717
return "<Issue: %s>" % self.title
1818

1919

20+
class Comment(BaseData):
21+
created_at = DateAttribute("The date this comment was created.")
22+
updated_at = DateAttribute("The date when this comment was last updated.")
23+
body = Attribute("The full text of this comment.")
24+
id = Attribute("The comment id.")
25+
user = Attribute("The username of the user that created this comment.")
26+
27+
def __repr__(self):
28+
return "<Comment: %s>" % self.body
29+
30+
2031
class Issues(GithubCommand):
2132
domain = "issues"
2233

@@ -59,3 +70,8 @@ def comment(self, project, number, comment):
5970
return self.make_request("comment", project, str(number),
6071
post_data=comment_data,
6172
filter='comment')
73+
74+
def comments(self, project, number):
75+
"""View comments on an issue."""
76+
return self.get_values("comments", project, str(number),
77+
filter="comments", datatype=Comment)

0 commit comments

Comments
 (0)