diff --git a/ReferenceOfApis.md b/ReferenceOfApis.md index cfc219b6..fa94f5e2 100644 --- a/ReferenceOfApis.md +++ b/ReferenceOfApis.md @@ -279,14 +279,14 @@ API `/repos/:user/:repo/issues/events/:id` API `/repos/:user/:repo/keys` ============================= -* GET: (TODO SOON) -* POST: (TODO SOON) +* GET: `Repository.get_keys` +* POST: `Repository.create_key` API `/repos/:user/:repo/keys/:id` ================================= -* GET: (TODO SOON) -* PATCH: (TODO SOON) -* DELETE: (TODO SOON) +* GET: `Repository.get_key` +* PATCH: `RepositoryKey.edit` +* DELETE: `RepositoryKey.delete` API `/repos/:user/:repo/labels` =============================== diff --git a/ReferenceOfClasses.md b/ReferenceOfClasses.md index d86ab9e4..b8a059e8 100644 --- a/ReferenceOfClasses.md +++ b/ReferenceOfClasses.md @@ -701,6 +701,12 @@ Languages --------- * `get_languages()`: dictionary of strings to integers +Keys +---- +* `get_keys()`: list of `RepositoryKey` +* `get_key( id )`: `RepositoryKey` +* `create_key()`: `RepositoryKey` + Collaborators ------------- * `get_collaborators()`: list of `NamedUser` @@ -797,6 +803,20 @@ Teams ----- * `get_teams()`: list of `Team` +Class `RepositoryKey` +===================== + +Attributes +---------- + +Modification +------------ +* `edit()` + +Deletion +-------- +* `delete()` + Class `Tag` =========== diff --git a/github/GithubObjects.py b/github/GithubObjects.py index a412e588..2ae7a165 100644 --- a/github/GithubObjects.py +++ b/github/GithubObjects.py @@ -368,6 +368,17 @@ PullRequest = GithubObject( ), ) +RepositoryKey = GithubObject( + "RepositoryKey", + BaseUrl( lambda obj: obj._repo._baseUrl + "/keys/" + str( obj.id ) ), + InternalSimpleAttributes( + ### @todo + "_repo", ### Ugly hack + ), + Editable( [], [] ), ### @todo + Deletable() +) + Repository = GithubObject( "Repository", BaseUrl( lambda obj: "/repos/" + obj.owner.login + "/" + obj.name ), @@ -397,6 +408,11 @@ Repository._addAttributePolicy( SeveralAttributePolicies( [ ExternalSimpleAttribute( "languages", "dictionary of strings to integers" ) ], "Languages" ) ) Repository._addAttributePolicy( SeveralAttributePolicies( [ + ExternalListOfObjects( "keys", "key", RepositoryKey, + ListGetable( [], [] ), + ElementGetable( [ "id" ], [], __modifyAttributesForObjectsReferingRepo ), + ElementCreatable( [], [] ), ### @todo + ), ExternalListOfObjects( "collaborators", "collaborator", NamedUser, ListGetable( [], [] ), ElementAddable(),