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:
@@ -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