mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 19:01:15 +00:00
IssueComment
This commit is contained in:
+3
-1
@@ -174,6 +174,8 @@ class IntegrationTest:
|
||||
i.delete_labels()
|
||||
i.add_to_labels( lc )
|
||||
|
||||
i.create_comment( "Commented from PyGithub" )
|
||||
|
||||
self.dumpRepository( r )
|
||||
|
||||
def dumpUser( self, u ):
|
||||
@@ -225,7 +227,7 @@ class IntegrationTest:
|
||||
print base64.b64decode( blob.content ),
|
||||
print
|
||||
print " Labels:", ", ".join( l.name + " (" + l.color + ")" for l in r.get_labels() )
|
||||
print " Issues:", ", ".join( i.title + " (" + ", ".join( l.name for l in i.get_labels() ) + ")" for i in r.get_issues() )
|
||||
print " Issues:", ", ".join( i.title + " (" + ", ".join( l.name for l in i.get_labels() ) + ") (" + ", ".join( c.body for c in i.get_comments() ) + ")" for i in r.get_issues() )
|
||||
print " Milestones:", ", ".join( m.title + " (created by " + m.creator.login + ", " + ", ".join( l.name for l in m.get_labels() ) + ")" for m in r.get_milestones() )
|
||||
print " Closed milestones:", ", ".join( m.title for m in r.get_milestones( state = "closed" ) )
|
||||
print
|
||||
|
||||
+5
-5
@@ -245,8 +245,8 @@ API `/repos/:user/:repo/issues/:id`
|
||||
|
||||
API `/repos/:user/:repo/issues/:id/comments`
|
||||
============================================
|
||||
* GET: (TODO SOON)
|
||||
* POST: (TODO SOON)
|
||||
* GET: `Issue.get_comments()`: list of `IssueComment`
|
||||
* POST: `Issue.create_comment( ... )`: `IssueComment`
|
||||
|
||||
API `/repos/:user/:repo/issues/:id/labels`
|
||||
==========================================
|
||||
@@ -265,9 +265,9 @@ API `/repos/:user/:repo/issues/:id/events`
|
||||
|
||||
API `/repos/:user/:repo/issues/comments/:id`
|
||||
============================================
|
||||
* GET: (TODO SOON)
|
||||
* PATCH: (TODO SOON)
|
||||
* DELETE: (TODO SOON)
|
||||
* GET: `Issue.get_comment( id )`: `IssueComment`
|
||||
* PATCH: `IssueComment.edit( ... )`
|
||||
* DELETE: `IssueComment.delete( ... )`
|
||||
|
||||
API `/repos/:user/:repo/issues/events`
|
||||
======================================
|
||||
|
||||
@@ -164,6 +164,15 @@ Class `Issue`
|
||||
* `set_labels( label, ... )`
|
||||
* `delete_labels()`
|
||||
* `remove_from_labels( label )`
|
||||
* `get_comments()`: list of `IssueComment`
|
||||
* `create_comment( ... )`: `IssueComment`: see [API](http://developer.github.com/v3/issues/comments/#create-a-comment) for parameters
|
||||
* `get_comment( id )`: `IssueComment`
|
||||
|
||||
Class `IssueComment`
|
||||
====================
|
||||
* Attributes: see [API](http://developer.github.com/v3/issues/comments/#get-a-single-comment)
|
||||
* `edit( ... )`: see [API](http://developer.github.com/v3/issues/comments/#edit-a-comment) for parameters
|
||||
* `delete()`
|
||||
|
||||
Class `Milestone`
|
||||
================
|
||||
|
||||
@@ -142,6 +142,18 @@ Milestone = GithubObject(
|
||||
ListAttribute( "labels", Label, ListGetable( [], [], lambda obj, attributes: dict( itertools.chain( attributes.iteritems(), { "_repo": obj._repo }.iteritems() ) ) ) ),
|
||||
)
|
||||
|
||||
IssueComment = GithubObject(
|
||||
"IssueComment",
|
||||
BaseUrl( lambda obj: obj._repo._baseUrl + "/issues/comment" + str( obj.id ) ),
|
||||
BasicAttributes(
|
||||
"url", "body", "created_at", "updated_at", "id",
|
||||
"_repo", ### Ugly hack
|
||||
),
|
||||
ComplexAttribute( "user", NamedUser ),
|
||||
Editable( [ "body" ], [] ),
|
||||
Deletable(),
|
||||
)
|
||||
|
||||
Issue = GithubObject(
|
||||
"Issue",
|
||||
BaseUrl( lambda obj: obj._repo._baseUrl + "/issues/" + str( obj.number ) ),
|
||||
@@ -162,6 +174,11 @@ Issue = GithubObject(
|
||||
ListDeletable(),
|
||||
ElementRemovable(),
|
||||
),
|
||||
ListAttribute( "comments", IssueComment,
|
||||
ListGetable( [], [], lambda obj, attributes: dict( itertools.chain( attributes.iteritems(), { "_repo": obj._repo }.iteritems() ) ) ),
|
||||
ElementGetable( "comment", lambda repo, id: { "_repo": repo, "id": id } ),
|
||||
ElementCreatable( "comment", [ "body" ], [], lambda obj, attributes: dict( itertools.chain( attributes.iteritems(), { "_repo": obj._repo }.iteritems() ) ) ),
|
||||
),
|
||||
)
|
||||
|
||||
__modifyAttributesForObjectsReferingRepo = lambda obj, attributes: dict( itertools.chain( attributes.iteritems(), { "_repo": obj }.iteritems() ) )
|
||||
|
||||
Reference in New Issue
Block a user