mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 10:51:14 +00:00
Repository.xxx_download
This commit is contained in:
@@ -175,6 +175,9 @@ class IntegrationTest:
|
||||
|
||||
i.create_comment( "Commented from PyGithub" )
|
||||
|
||||
# Downloads
|
||||
r.create_download( "MyDownloadCreatedByPyGithub", 1000 )
|
||||
|
||||
self.dumpRepository( r )
|
||||
|
||||
def dumpUser( self, u, doPrivateThings ):
|
||||
@@ -215,6 +218,7 @@ class IntegrationTest:
|
||||
print " Watchers:", ", ".join( u.login for u in r.get_watchers() )
|
||||
print " Forks:", ", ".join( f.owner.login + "/" + f.name for f in r.get_forks() )
|
||||
print " Languages:", r.get_languages()
|
||||
print " Downloads:", ", ".join( d.name for d in r.get_downloads() )
|
||||
print " References:", ", ".join( ref.ref + " (" + ref.object[ "sha" ][ :7 ] + ")" for ref in r.get_git_refs() )
|
||||
masterCommitSha = r.get_git_ref( "refs/heads/master" ).object[ "sha" ]
|
||||
masterCommit = r.get_git_commit( masterCommitSha )
|
||||
|
||||
+4
-4
@@ -151,13 +151,13 @@ API `/repos/:user/:repo/contributors`
|
||||
|
||||
API `/repos/:user/:repo/downloads`
|
||||
==================================
|
||||
* GET: (TODO SOON)
|
||||
* POST: (TODO SOON)
|
||||
* GET: `Repository.get_downloads()` list of `Download`
|
||||
* POST: `Repository.create_download( ... )`: `Download`
|
||||
|
||||
API `/repos/:user/:repo/downloads/:id`
|
||||
======================================
|
||||
* GET: (TODO SOON)
|
||||
* DELETE: (TODO SOON)
|
||||
* GET: `Repository.get_download( id )`: `Download`
|
||||
* DELETE: `Download.delete()`
|
||||
|
||||
API `/repos/:user/:repo/events`
|
||||
===============================
|
||||
|
||||
@@ -156,6 +156,17 @@ Issues and milestones
|
||||
* `create_milestone( ... )`: `Milestone`: see [API](http://developer.github.com/v3/issues/milestones/#create-a-milestone) for parameters
|
||||
* `get_milestone( number )`: `Milestone`
|
||||
|
||||
Downloads
|
||||
---------
|
||||
`Repository.get_downloads()` list of `Download`
|
||||
`Repository.create_download( ... )`: `Download`: see [API](http://developer.github.com/v3/repos/downloads/#create-a-new-download-part-1-create-the-resource)
|
||||
`Repository.get_download( id )`: `Download`
|
||||
|
||||
Class `Download`
|
||||
================
|
||||
* Attributes: see [API](http://developer.github.com/v3/repos/downloads/#get-a-single-download)
|
||||
* `delete()`
|
||||
|
||||
Class `Label`
|
||||
=============
|
||||
* Attributes: see [API](http://developer.github.com/v3/issues/labels/#get-a-single-label)
|
||||
|
||||
@@ -186,6 +186,19 @@ Issue = GithubObject(
|
||||
),
|
||||
)
|
||||
|
||||
Download = GithubObject(
|
||||
"Download",
|
||||
BaseUrl( lambda obj: obj._repo._baseUrl + "/downloads/" + str( obj.id ) ),
|
||||
InternalSimpleAttributes(
|
||||
"url", "html_url", "id", "name", "description", "size",
|
||||
"download_count", "content_type", "policy", "signature", "bucket",
|
||||
"accesskeyid", "path", "acl", "expirationdate", "prefix", "mime_type",
|
||||
"redirect", "s3_url", "created_at",
|
||||
"_repo", ### Ugly hack
|
||||
),
|
||||
Deletable(),
|
||||
)
|
||||
|
||||
__modifyAttributesForObjectsReferingRepo = lambda obj, attributes: dict( itertools.chain( attributes.iteritems(), { "_repo": obj }.iteritems() ) )
|
||||
Repository = GithubObject(
|
||||
"Repository",
|
||||
@@ -242,6 +255,11 @@ Repository = GithubObject(
|
||||
ElementCreatable( "issue", [ "title" ], [ "body", "assignee", "milestone", "labels", ], __modifyAttributesForObjectsReferingRepo )
|
||||
),
|
||||
ExternalSimpleAttribute( "languages" ),
|
||||
ExternalListOfObjects( "downloads", Download,
|
||||
ListGetable( [], [], __modifyAttributesForObjectsReferingRepo ),
|
||||
ElementGetable( "download", lambda repo, id : { "_repo": repo, "number": number } ),
|
||||
ElementCreatable( "download", [ "name", "size" ], [ "description", "content_type" ], __modifyAttributesForObjectsReferingRepo ),
|
||||
)
|
||||
)
|
||||
Repository._addAttributePolicy( InternalObjectAttribute( "parent", Repository ) )
|
||||
Repository._addAttributePolicy( InternalObjectAttribute( "source", Repository ) )
|
||||
|
||||
Reference in New Issue
Block a user