mirror of
https://github.com/status-im/PyGithub.git
synced 2026-09-02 03:41:08 +00:00
Merge branch 'topic/AddAuthorizationsAndKeys' into develop
This commit is contained in:
+15
-15
@@ -1,13 +1,13 @@
|
||||
API `/authorizations`
|
||||
=====================
|
||||
* GET: (TODO)
|
||||
* POST: (TODO)
|
||||
* GET: `AuthenticatedUser.get_authorizations`
|
||||
* POST: `AuthenticatedUser.create_authorization`
|
||||
|
||||
API `/authorizations/:id`
|
||||
=========================
|
||||
* GET: (TODO)
|
||||
* PATCH: (TODO)
|
||||
* DELETE: (TODO)
|
||||
* GET: `AuthenticatedUser.get_authorization`
|
||||
* PATCH: `Authorization.edit`
|
||||
* DELETE: `Authorization.delete`
|
||||
|
||||
API `/events`
|
||||
=============
|
||||
@@ -279,14 +279,14 @@ API `/repos/:user/:repo/issues/events/:id`
|
||||
|
||||
API `/repos/:user/:repo/keys`
|
||||
=============================
|
||||
* GET: (TODO)
|
||||
* POST: (TODO)
|
||||
* GET: `Repository.get_keys`
|
||||
* POST: `Repository.create_key`
|
||||
|
||||
API `/repos/:user/:repo/keys/:id`
|
||||
=================================
|
||||
* GET: (TODO)
|
||||
* PATCH: (TODO)
|
||||
* DELETE: (TODO)
|
||||
* GET: `Repository.get_key`
|
||||
* PATCH: `RepositoryKey.edit`
|
||||
* DELETE: `RepositoryKey.delete`
|
||||
|
||||
API `/repos/:user/:repo/labels`
|
||||
===============================
|
||||
@@ -417,14 +417,14 @@ API `/user/following/:user`
|
||||
|
||||
API `/user/keys`
|
||||
================
|
||||
* GET: (TODO)
|
||||
* POST: (TODO)
|
||||
* GET: `AuthenticatedUser.get_keys`
|
||||
* POST: `AuthenticatedUser.create_key`
|
||||
|
||||
API `/user/keys/:id`
|
||||
====================
|
||||
* GET: (TODO)
|
||||
* PATCH: (TODO)
|
||||
* DELETE: (TODO)
|
||||
* GET: `AuthenticatedUser.get_key`
|
||||
* PATCH: `UserKey.edit`
|
||||
* DELETE: `UserKey.delete`
|
||||
|
||||
API `/user/orgs`
|
||||
================
|
||||
|
||||
@@ -58,6 +58,18 @@ Emails
|
||||
* `remove_from_emails( email, ... )`
|
||||
* `email`: string
|
||||
|
||||
Authorizations
|
||||
--------------
|
||||
* `get_authorizations()`: list of `Authorization`
|
||||
* `get_authorization( id )`: `Authorization`
|
||||
* `create_authorization( [scopes, note, note_url] )`: `Authorization`
|
||||
|
||||
Keys
|
||||
----
|
||||
* `get_keys()`: list of `UserKey`
|
||||
* `get_key( id )`: `UserKey`
|
||||
* `create_key( title, key )`: `UserKey`
|
||||
|
||||
Followers
|
||||
---------
|
||||
* `get_followers()`: list of `NamedUser`
|
||||
@@ -102,6 +114,29 @@ Gists
|
||||
* `create_gist( public, files, [description] )`: `Gist`
|
||||
* `get_starred_gists()`: list of `Gist`
|
||||
|
||||
Class `Authorization`
|
||||
=====================
|
||||
|
||||
Attributes
|
||||
----------
|
||||
* `id`
|
||||
* `url`
|
||||
* `scopes`
|
||||
* `token`
|
||||
* `app`
|
||||
* `note`
|
||||
* `note_url`
|
||||
* `updated_at`
|
||||
* `created_at`
|
||||
|
||||
Modification
|
||||
------------
|
||||
* `edit( [scopes, add_scopes, remove_scopes, note, note_url] )`
|
||||
|
||||
Deletion
|
||||
--------
|
||||
* `delete()`
|
||||
|
||||
Class `Branch`
|
||||
==============
|
||||
|
||||
@@ -675,6 +710,12 @@ Languages
|
||||
---------
|
||||
* `get_languages()`: dictionary of strings to integers
|
||||
|
||||
Keys
|
||||
----
|
||||
* `get_keys()`: list of `RepositoryKey`
|
||||
* `get_key( id )`: `RepositoryKey`
|
||||
* `create_key( title, key )`: `RepositoryKey`
|
||||
|
||||
Collaborators
|
||||
-------------
|
||||
* `get_collaborators()`: list of `NamedUser`
|
||||
@@ -771,6 +812,24 @@ Teams
|
||||
-----
|
||||
* `get_teams()`: list of `Team`
|
||||
|
||||
Class `RepositoryKey`
|
||||
=====================
|
||||
|
||||
Attributes
|
||||
----------
|
||||
* `url`
|
||||
* `id`
|
||||
* `title`
|
||||
* `key`
|
||||
|
||||
Modification
|
||||
------------
|
||||
* `edit( title, key )`
|
||||
|
||||
Deletion
|
||||
--------
|
||||
* `delete()`
|
||||
|
||||
Class `Tag`
|
||||
===========
|
||||
|
||||
@@ -821,4 +880,22 @@ Repos
|
||||
* `has_in_repos( repo )`: `bool`
|
||||
* `repo`: `Repository`
|
||||
|
||||
Class `UserKey`
|
||||
===============
|
||||
|
||||
Attributes
|
||||
----------
|
||||
* `url`
|
||||
* `id`
|
||||
* `title`
|
||||
* `key`
|
||||
|
||||
Modification
|
||||
------------
|
||||
* `edit( title, key )`
|
||||
|
||||
Deletion
|
||||
--------
|
||||
* `delete()`
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,27 @@ import urllib
|
||||
|
||||
from GithubObject import *
|
||||
|
||||
Authorization = GithubObject(
|
||||
"Authorization",
|
||||
BaseUrl( lambda obj: "/authorizations/" + str( obj.id ) ), ### @todo make the lambda return a tuple, and BaseUrl convert elements to strings and join them with "/"
|
||||
InternalSimpleAttributes(
|
||||
"id", "url", "scopes", "token", "app", "note", "note_url", "updated_at",
|
||||
"created_at",
|
||||
),
|
||||
Editable( [], [ "scopes", "add_scopes", "remove_scopes", "note", "note_url" ] ),
|
||||
Deletable(),
|
||||
)
|
||||
|
||||
UserKey = GithubObject(
|
||||
"UserKey",
|
||||
BaseUrl( lambda obj: "/user/keys/" + str( obj.id ) ),
|
||||
InternalSimpleAttributes(
|
||||
"url", "id", "title", "key",
|
||||
),
|
||||
Editable( [ "title", "key" ], [] ),
|
||||
Deletable(),
|
||||
)
|
||||
|
||||
AuthenticatedUser = GithubObject(
|
||||
"AuthenticatedUser",
|
||||
BaseUrl( lambda obj: "/user" ),
|
||||
@@ -20,6 +41,17 @@ AuthenticatedUser = GithubObject(
|
||||
SeveralElementsAddable(),
|
||||
SeveralElementsRemovable()
|
||||
),
|
||||
ExternalListOfObjects( "authorizations", "authorization", Authorization,
|
||||
ListGetable( [], [] ),
|
||||
ElementGetable( [ "id" ], [] ),
|
||||
ElementCreatable( [], [ "scopes", "note", "note_url" ] ),
|
||||
url = "/authorizations",
|
||||
),
|
||||
ExternalListOfObjects( "keys", "key", UserKey,
|
||||
ListGetable( [], [] ),
|
||||
ElementGetable( [ "id" ], [] ),
|
||||
ElementCreatable( [ "title", "key" ], [] ),
|
||||
),
|
||||
)
|
||||
|
||||
NamedUser = GithubObject(
|
||||
@@ -337,6 +369,17 @@ PullRequest = GithubObject(
|
||||
),
|
||||
)
|
||||
|
||||
RepositoryKey = GithubObject(
|
||||
"RepositoryKey",
|
||||
BaseUrl( lambda obj: obj._repo._baseUrl + "/keys/" + str( obj.id ) ),
|
||||
InternalSimpleAttributes(
|
||||
"url", "id", "title", "key",
|
||||
"_repo", ### Ugly hack
|
||||
),
|
||||
Editable( [ "title", "key" ], [] ),
|
||||
Deletable()
|
||||
)
|
||||
|
||||
Repository = GithubObject(
|
||||
"Repository",
|
||||
BaseUrl( lambda obj: "/repos/" + obj.owner.login + "/" + obj.name ),
|
||||
@@ -366,6 +409,11 @@ Repository._addAttributePolicy(
|
||||
SeveralAttributePolicies( [ ExternalSimpleAttribute( "languages", "dictionary of strings to integers" ) ], "Languages" )
|
||||
)
|
||||
Repository._addAttributePolicy( SeveralAttributePolicies( [
|
||||
ExternalListOfObjects( "keys", "key", RepositoryKey,
|
||||
ListGetable( [], [] ),
|
||||
ElementGetable( [ "id" ], [], __modifyAttributesForObjectsReferingRepo ),
|
||||
ElementCreatable( [ "title", "key" ], [] ),
|
||||
),
|
||||
ExternalListOfObjects( "collaborators", "collaborator", NamedUser,
|
||||
ListGetable( [], [] ),
|
||||
ElementAddable(),
|
||||
|
||||
Reference in New Issue
Block a user