mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 10:51:14 +00:00
Milestones
This commit is contained in:
+25
-7
@@ -115,7 +115,20 @@ GitTag = GithubObject(
|
||||
),
|
||||
)
|
||||
|
||||
__modifyAttributesForGitObjects = lambda obj, attributes: dict( itertools.chain( attributes.iteritems(), { "_repo": obj }.iteritems() ) )
|
||||
Milestone = GithubObject(
|
||||
"Milestone",
|
||||
BaseUrl( lambda obj: obj._repo._baseUrl + "/milestones/" + str( obj.number ) ),
|
||||
BasicAttributes(
|
||||
"url", "number", "state", "title", "description", "open_issues",
|
||||
"closed_issues", "created_at", "due_on",
|
||||
"_repo", ### Ugly hack
|
||||
),
|
||||
ComplexAttribute( "creator", NamedUser ),
|
||||
Editable( [ "title" ], [ "state", "description", "due_on" ] ),
|
||||
Deletable(),
|
||||
)
|
||||
|
||||
__modifyAttributesForObjectsReferingRepo = lambda obj, attributes: dict( itertools.chain( attributes.iteritems(), { "_repo": obj }.iteritems() ) )
|
||||
Repository = GithubObject(
|
||||
"Repository",
|
||||
BaseUrl( lambda obj: "/repos/" + obj.owner.login + "/" + obj.name ),
|
||||
@@ -135,26 +148,31 @@ Repository = GithubObject(
|
||||
ListAttribute( "watchers", NamedUser, ListGetable( [], [] ) ),
|
||||
Editable( [ "name" ], [ "description", "homepage", "public", "has_issues", "has_wiki", "has_downloads" ] ),
|
||||
ListAttribute( "git/refs", GitRef,
|
||||
ListGetable( [], [], __modifyAttributesForGitObjects ),
|
||||
ListGetable( [], [], __modifyAttributesForObjectsReferingRepo ),
|
||||
ElementGetable( "git_ref", lambda repo, ref: { "_repo": repo, "ref": ref } ),
|
||||
ElementCreatable( "git_ref", [ "ref", "sha" ], [], __modifyAttributesForGitObjects )
|
||||
ElementCreatable( "git_ref", [ "ref", "sha" ], [], __modifyAttributesForObjectsReferingRepo )
|
||||
),
|
||||
ListAttribute( "git/commits", GitCommit,
|
||||
ElementGetable( "git_commit", lambda repo, sha: { "_repo": repo, "sha": sha } ),
|
||||
ElementCreatable( "git_commit", [ "message", "tree", "parents" ], [ "author", "commiter" ], __modifyAttributesForGitObjects )
|
||||
ElementCreatable( "git_commit", [ "message", "tree", "parents" ], [ "author", "commiter" ], __modifyAttributesForObjectsReferingRepo )
|
||||
),
|
||||
ListAttribute( "git/trees", GitTree,
|
||||
ElementGetable( "git_tree", lambda repo, sha: { "_repo": repo, "sha": sha } ),
|
||||
ElementCreatable( "git_tree", [ "tree" ], [], __modifyAttributesForGitObjects )
|
||||
ElementCreatable( "git_tree", [ "tree" ], [], __modifyAttributesForObjectsReferingRepo )
|
||||
),
|
||||
ListAttribute( "git/blobs", GitBlob,
|
||||
ElementGetable( "git_blob", lambda repo, sha: { "_repo": repo, "sha": sha } ),
|
||||
ElementCreatable( "git_blob", [ "content", "encoding" ], [], __modifyAttributesForGitObjects )
|
||||
ElementCreatable( "git_blob", [ "content", "encoding" ], [], __modifyAttributesForObjectsReferingRepo )
|
||||
),
|
||||
ListAttribute( "git/tags", GitTag,
|
||||
ElementGetable( "git_tag", lambda repo, sha: { "_repo": repo, "sha": sha } ),
|
||||
ElementCreatable( "git_tag", [ "tag", "message", "object", "type" ], [ "tagger" ], __modifyAttributesForGitObjects )
|
||||
ElementCreatable( "git_tag", [ "tag", "message", "object", "type" ], [ "tagger" ], __modifyAttributesForObjectsReferingRepo )
|
||||
),
|
||||
ListAttribute( "milestones", Milestone,
|
||||
ListGetable( [], [ "state", "sort", "direction" ] ),
|
||||
ElementGetable( "milestone", lambda repo, number: { "_repo": repo, "number": number } ),
|
||||
ElementCreatable( "milestone", [ "title" ], [ "state", "description", "due_on" ], __modifyAttributesForObjectsReferingRepo )
|
||||
)
|
||||
)
|
||||
Repository._addAttributePolicy( ComplexAttribute( "parent", Repository ) )
|
||||
Repository._addAttributePolicy( ComplexAttribute( "source", Repository ) )
|
||||
|
||||
Reference in New Issue
Block a user