diff --git a/CodeGenerator/templates/GithubObject.py b/CodeGenerator/templates/GithubObject.py index b1d82fd4..bb1c98af 100644 --- a/CodeGenerator/templates/GithubObject.py +++ b/CodeGenerator/templates/GithubObject.py @@ -39,13 +39,36 @@ class {{ class.name }}( object ): {% for method in class.methods|dictsort:"name" %} def {{ method.name|join:"_" }}( {% include "GithubObject.Parameters.py" with function=method only %} ): {% if method.request %} + +{% if method.request.post_parameters %} + post_parameters = { +{% for parameter in method.mandatory_parameters %} + "{{ parameter.name }}": {{ parameter.name }}, +{% endfor %} + } + +{% for parameter in method.optional_parameters %} + if {{ parameter.name }} is not None: + post_parameters[ "{{ parameter.name }}" ] = {{ parameter.name }} +{% endfor %} + +{% endif %} + result = self.__github._dataRequest( "{{ method.request.verb }}", {% include "GithubObject.Concatenation.py" with concatenation=method.request.url only %}, None, +{% if method.request.post_parameters %} + post_parameters +{% else %} None +{% endif %} ) +{% if method.type.name == "void" %} + self.__useAttributes( result ) +{% else %} + {% if method.type.cardinality == "scalar" %} return {{ method.type.name }}.{{ method.type.name }}( self.__github, result, lazy = True ) {% endif %} @@ -57,6 +80,8 @@ class {{ class.name }}( object ): ] {% endif %} +{% endif %} + {% else %} pass {% endif %} diff --git a/JsonDescriptionOfGithubApiV3/description.001.normalized.json b/JsonDescriptionOfGithubApiV3/description.001.normalized.json index 83266ce4..68171628 100644 --- a/JsonDescriptionOfGithubApiV3/description.001.normalized.json +++ b/JsonDescriptionOfGithubApiV3/description.001.normalized.json @@ -208,14 +208,19 @@ { "mandatory_parameters": [], "group": "modification", - "type": { - "simple": true, - "cardinality": "scalar", - "name": "void" - }, "name": [ "edit" ], + "request": { + "url": [ + { + "type": "constant", + "value": "https://api.github.com/user" + } + ], + "post_parameters": true, + "verb": "PATCH" + }, "optional_parameters": [ { "type": { @@ -273,7 +278,12 @@ }, "name": "bio" } - ] + ], + "type": { + "simple": true, + "cardinality": "scalar", + "name": "void" + } }, { "mandatory_parameters": [], @@ -1228,14 +1238,19 @@ { "mandatory_parameters": [], "group": "modification", - "type": { - "simple": true, - "cardinality": "scalar", - "name": "void" - }, "name": [ "edit" ], + "request": { + "url": [ + { + "type": "constant", + "value": "https://api.github.com/user" + } + ], + "post_parameters": true, + "verb": "PATCH" + }, "optional_parameters": [ { "type": { @@ -1277,7 +1292,12 @@ }, "name": "note_url" } - ] + ], + "type": { + "simple": true, + "cardinality": "scalar", + "name": "void" + } }, { "mandatory_parameters": [], @@ -1577,15 +1597,25 @@ } ], "group": "modification", + "name": [ + "edit" + ], + "request": { + "url": [ + { + "type": "constant", + "value": "https://api.github.com/user" + } + ], + "post_parameters": true, + "verb": "PATCH" + }, + "optional_parameters": [], "type": { "simple": true, "cardinality": "scalar", "name": "void" - }, - "name": [ - "edit" - ], - "optional_parameters": [] + } }, { "mandatory_parameters": [], @@ -2004,14 +2034,19 @@ { "mandatory_parameters": [], "group": "modification", - "type": { - "simple": true, - "cardinality": "scalar", - "name": "void" - }, "name": [ "edit" ], + "request": { + "url": [ + { + "type": "constant", + "value": "https://api.github.com/user" + } + ], + "post_parameters": true, + "verb": "PATCH" + }, "optional_parameters": [ { "type": { @@ -2029,7 +2064,12 @@ }, "name": "files" } - ] + ], + "type": { + "simple": true, + "cardinality": "scalar", + "name": "void" + } }, { "mandatory_parameters": [], @@ -2242,15 +2282,25 @@ } ], "group": "modification", + "name": [ + "edit" + ], + "request": { + "url": [ + { + "type": "constant", + "value": "https://api.github.com/user" + } + ], + "post_parameters": true, + "verb": "PATCH" + }, + "optional_parameters": [], "type": { "simple": true, "cardinality": "scalar", "name": "void" - }, - "name": [ - "edit" - ], - "optional_parameters": [] + } }, { "mandatory_parameters": [], @@ -2416,14 +2466,19 @@ } ], "group": "modification", - "type": { - "simple": true, - "cardinality": "scalar", - "name": "void" - }, "name": [ "edit" ], + "request": { + "url": [ + { + "type": "constant", + "value": "https://api.github.com/user" + } + ], + "post_parameters": true, + "verb": "PATCH" + }, "optional_parameters": [ { "type": { @@ -2433,7 +2488,12 @@ }, "name": "force" } - ] + ], + "type": { + "simple": true, + "cardinality": "scalar", + "name": "void" + } }, { "mandatory_parameters": [], @@ -2639,14 +2699,19 @@ } ], "group": "modification", - "type": { - "simple": true, - "cardinality": "scalar", - "name": "void" - }, "name": [ "edit" ], + "request": { + "url": [ + { + "type": "constant", + "value": "https://api.github.com/user" + } + ], + "post_parameters": true, + "verb": "PATCH" + }, "optional_parameters": [ { "type": { @@ -2680,7 +2745,12 @@ }, "name": "active" } - ] + ], + "type": { + "simple": true, + "cardinality": "scalar", + "name": "void" + } }, { "mandatory_parameters": [], @@ -2854,14 +2924,19 @@ { "mandatory_parameters": [], "group": "modification", - "type": { - "simple": true, - "cardinality": "scalar", - "name": "void" - }, "name": [ "edit" ], + "request": { + "url": [ + { + "type": "constant", + "value": "https://api.github.com/user" + } + ], + "post_parameters": true, + "verb": "PATCH" + }, "optional_parameters": [ { "type": { @@ -2911,7 +2986,12 @@ }, "name": "labels" } - ] + ], + "type": { + "simple": true, + "cardinality": "scalar", + "name": "void" + } }, { "mandatory_parameters": [ @@ -3196,15 +3276,25 @@ } ], "group": "modification", + "name": [ + "edit" + ], + "request": { + "url": [ + { + "type": "constant", + "value": "https://api.github.com/user" + } + ], + "post_parameters": true, + "verb": "PATCH" + }, + "optional_parameters": [], "type": { "simple": true, "cardinality": "scalar", "name": "void" - }, - "name": [ - "edit" - ], - "optional_parameters": [] + } }, { "mandatory_parameters": [], @@ -3332,15 +3422,25 @@ } ], "group": "modification", + "name": [ + "edit" + ], + "request": { + "url": [ + { + "type": "constant", + "value": "https://api.github.com/user" + } + ], + "post_parameters": true, + "verb": "PATCH" + }, + "optional_parameters": [], "type": { "simple": true, "cardinality": "scalar", "name": "void" - }, - "name": [ - "edit" - ], - "optional_parameters": [] + } }, { "mandatory_parameters": [], @@ -3454,14 +3554,19 @@ } ], "group": "modification", - "type": { - "simple": true, - "cardinality": "scalar", - "name": "void" - }, "name": [ "edit" ], + "request": { + "url": [ + { + "type": "constant", + "value": "https://api.github.com/user" + } + ], + "post_parameters": true, + "verb": "PATCH" + }, "optional_parameters": [ { "type": { @@ -3487,7 +3592,12 @@ }, "name": "due_on" } - ] + ], + "type": { + "simple": true, + "cardinality": "scalar", + "name": "void" + } }, { "mandatory_parameters": [], @@ -4269,14 +4379,19 @@ { "mandatory_parameters": [], "group": "modification", - "type": { - "simple": true, - "cardinality": "scalar", - "name": "void" - }, "name": [ "edit" ], + "request": { + "url": [ + { + "type": "constant", + "value": "https://api.github.com/user" + } + ], + "post_parameters": true, + "verb": "PATCH" + }, "optional_parameters": [ { "type": { @@ -4326,7 +4441,12 @@ }, "name": "name" } - ] + ], + "type": { + "simple": true, + "cardinality": "scalar", + "name": "void" + } }, { "mandatory_parameters": [], @@ -4986,14 +5106,19 @@ { "mandatory_parameters": [], "group": "modification", - "type": { - "simple": true, - "cardinality": "scalar", - "name": "void" - }, "name": [ "edit" ], + "request": { + "url": [ + { + "type": "constant", + "value": "https://api.github.com/user" + } + ], + "post_parameters": true, + "verb": "PATCH" + }, "optional_parameters": [ { "type": { @@ -5019,7 +5144,12 @@ }, "name": "state" } - ] + ], + "type": { + "simple": true, + "cardinality": "scalar", + "name": "void" + } }, { "mandatory_parameters": [ @@ -5274,15 +5404,25 @@ } ], "group": "modification", + "name": [ + "edit" + ], + "request": { + "url": [ + { + "type": "constant", + "value": "https://api.github.com/user" + } + ], + "post_parameters": true, + "verb": "PATCH" + }, + "optional_parameters": [], "type": { "simple": true, "cardinality": "scalar", "name": "void" - }, - "name": [ - "edit" - ], - "optional_parameters": [] + } }, { "mandatory_parameters": [], @@ -5634,14 +5774,19 @@ } ], "group": "modification", - "type": { - "simple": true, - "cardinality": "scalar", - "name": "void" - }, "name": [ "edit" ], + "request": { + "url": [ + { + "type": "constant", + "value": "https://api.github.com/user" + } + ], + "post_parameters": true, + "verb": "PATCH" + }, "optional_parameters": [ { "type": { @@ -5691,7 +5836,12 @@ }, "name": "has_downloads" } - ] + ], + "type": { + "simple": true, + "cardinality": "scalar", + "name": "void" + } }, { "mandatory_parameters": [], @@ -7372,15 +7522,25 @@ } ], "group": "modification", + "name": [ + "edit" + ], + "request": { + "url": [ + { + "type": "constant", + "value": "https://api.github.com/user" + } + ], + "post_parameters": true, + "verb": "PATCH" + }, + "optional_parameters": [], "type": { "simple": true, "cardinality": "scalar", "name": "void" - }, - "name": [ - "edit" - ], - "optional_parameters": [] + } }, { "mandatory_parameters": [], @@ -7500,14 +7660,19 @@ } ], "group": "modification", - "type": { - "simple": true, - "cardinality": "scalar", - "name": "void" - }, "name": [ "edit" ], + "request": { + "url": [ + { + "type": "constant", + "value": "https://api.github.com/user" + } + ], + "post_parameters": true, + "verb": "PATCH" + }, "optional_parameters": [ { "type": { @@ -7517,7 +7682,12 @@ }, "name": "permission" } - ] + ], + "type": { + "simple": true, + "cardinality": "scalar", + "name": "void" + } }, { "mandatory_parameters": [], @@ -7776,14 +7946,19 @@ { "mandatory_parameters": [], "group": "modification", - "type": { - "simple": true, - "cardinality": "scalar", - "name": "void" - }, "name": [ "edit" ], + "request": { + "url": [ + { + "type": "constant", + "value": "https://api.github.com/user" + } + ], + "post_parameters": true, + "verb": "PATCH" + }, "optional_parameters": [ { "type": { @@ -7801,7 +7976,12 @@ }, "name": "key" } - ] + ], + "type": { + "simple": true, + "cardinality": "scalar", + "name": "void" + } }, { "mandatory_parameters": [], diff --git a/JsonDescriptionOfGithubApiV3/normalize.py b/JsonDescriptionOfGithubApiV3/normalize.py index ece3bcd4..288e3ccf 100644 --- a/JsonDescriptionOfGithubApiV3/normalize.py +++ b/JsonDescriptionOfGithubApiV3/normalize.py @@ -114,9 +114,10 @@ class Collection: self.methods.append( Function( desc[ "get_list" ] if desc[ "get_list" ] is not True else dict(), { "name": [ "get" ] + name, "type": { "cardinality": "list", "name": desc[ "type" ] }, "group": desc[ "name" ] }, - { "request": { - "verb": "GET", - "url": [ { "type": "attribute", "value": [ "url" ] }, { "type": "constant", "value": "/" + desc[ "name" ] } ], + { + "request": { + "verb": "GET", + "url": [ { "type": "attribute", "value": [ "url" ] }, { "type": "constant", "value": "/" + desc[ "name" ] } ], } } ) ) @@ -145,7 +146,17 @@ class Class: ) self.methods = [] if "edit" in desc: - self.methods.append( Function( desc[ "edit" ], { "name": [ "edit" ], "type": "void", "group": "modification" } ) ) + self.methods.append( Function( + desc[ "edit" ], + { "name": [ "edit" ], "type": "void", "group": "modification" }, + { + "request": { + "verb": "PATCH", + "url": [ { "type": "constant", "value": "https://api.github.com/user" } ], # @todo + "post_parameters": True, # @todo + }, + } + ) ) if "delete" in desc: self.methods.append( Function( { "name": [ "delete" ], "type": "void", "group": "deletion" } ) ) for collection in [ Collection( collection ) for collection in desc[ "collections" ] ]: diff --git a/github/GithubObjects/AuthenticatedUser.py b/github/GithubObjects/AuthenticatedUser.py index 1c5771d7..9d6d68b8 100644 --- a/github/GithubObjects/AuthenticatedUser.py +++ b/github/GithubObjects/AuthenticatedUser.py @@ -215,7 +215,29 @@ class AuthenticatedUser( object ): pass def edit( self, name = None, email = None, blog = None, company = None, location = None, hireable = None, bio = None ): - pass + post_parameters = { + } + if name is not None: + post_parameters[ "name" ] = name + if email is not None: + post_parameters[ "email" ] = email + if blog is not None: + post_parameters[ "blog" ] = blog + if company is not None: + post_parameters[ "company" ] = company + if location is not None: + post_parameters[ "location" ] = location + if hireable is not None: + post_parameters[ "hireable" ] = hireable + if bio is not None: + post_parameters[ "bio" ] = bio + result = self.__github._dataRequest( + "PATCH", + "https://api.github.com/user", + None, + post_parameters + ) + self.__useAttributes( result ) def get_authorization( self, id ): pass diff --git a/github/GithubObjects/Authorization.py b/github/GithubObjects/Authorization.py index 268244bc..43afa930 100644 --- a/github/GithubObjects/Authorization.py +++ b/github/GithubObjects/Authorization.py @@ -84,7 +84,25 @@ class Authorization( object ): pass def edit( self, scopes = None, add_scopes = None, remove_scopes = None, note = None, note_url = None ): - pass + post_parameters = { + } + if scopes is not None: + post_parameters[ "scopes" ] = scopes + if add_scopes is not None: + post_parameters[ "add_scopes" ] = add_scopes + if remove_scopes is not None: + post_parameters[ "remove_scopes" ] = remove_scopes + if note is not None: + post_parameters[ "note" ] = note + if note_url is not None: + post_parameters[ "note_url" ] = note_url + result = self.__github._dataRequest( + "PATCH", + "https://api.github.com/user", + None, + post_parameters + ) + self.__useAttributes( result ) def __useAttributes( self, attributes ): if "app" in attributes: diff --git a/github/GithubObjects/CommitComment.py b/github/GithubObjects/CommitComment.py index f422fdf5..94e0b4d6 100644 --- a/github/GithubObjects/CommitComment.py +++ b/github/GithubObjects/CommitComment.py @@ -97,7 +97,16 @@ class CommitComment( object ): pass def edit( self, body ): - pass + post_parameters = { + "body": body, + } + result = self.__github._dataRequest( + "PATCH", + "https://api.github.com/user", + None, + post_parameters + ) + self.__useAttributes( result ) def __useAttributes( self, attributes ): if "body" in attributes: diff --git a/github/GithubObjects/Gist.py b/github/GithubObjects/Gist.py index 7a4a07d7..9ce65140 100644 --- a/github/GithubObjects/Gist.py +++ b/github/GithubObjects/Gist.py @@ -123,7 +123,19 @@ class Gist( object ): pass def edit( self, description = None, files = None ): - pass + post_parameters = { + } + if description is not None: + post_parameters[ "description" ] = description + if files is not None: + post_parameters[ "files" ] = files + result = self.__github._dataRequest( + "PATCH", + "https://api.github.com/user", + None, + post_parameters + ) + self.__useAttributes( result ) def get_comment( self, id ): pass diff --git a/github/GithubObjects/GistComment.py b/github/GithubObjects/GistComment.py index ce02d514..9dd6544c 100644 --- a/github/GithubObjects/GistComment.py +++ b/github/GithubObjects/GistComment.py @@ -67,7 +67,16 @@ class GistComment( object ): pass def edit( self, body ): - pass + post_parameters = { + "body": body, + } + result = self.__github._dataRequest( + "PATCH", + "https://api.github.com/user", + None, + post_parameters + ) + self.__useAttributes( result ) def __useAttributes( self, attributes ): if "body" in attributes: diff --git a/github/GithubObjects/GitRef.py b/github/GithubObjects/GitRef.py index 4e54f904..e31380fc 100644 --- a/github/GithubObjects/GitRef.py +++ b/github/GithubObjects/GitRef.py @@ -48,7 +48,18 @@ class GitRef( object ): pass def edit( self, sha, force = None ): - pass + post_parameters = { + "sha": sha, + } + if force is not None: + post_parameters[ "force" ] = force + result = self.__github._dataRequest( + "PATCH", + "https://api.github.com/user", + None, + post_parameters + ) + self.__useAttributes( result ) def __useAttributes( self, attributes ): if "object" in attributes: diff --git a/github/GithubObjects/Hook.py b/github/GithubObjects/Hook.py index a750ae17..3c0f2f73 100644 --- a/github/GithubObjects/Hook.py +++ b/github/GithubObjects/Hook.py @@ -84,7 +84,25 @@ class Hook( object ): pass def edit( self, name, config, events = None, add_events = None, remove_events = None, active = None ): - pass + post_parameters = { + "name": name, + "config": config, + } + if events is not None: + post_parameters[ "events" ] = events + if add_events is not None: + post_parameters[ "add_events" ] = add_events + if remove_events is not None: + post_parameters[ "remove_events" ] = remove_events + if active is not None: + post_parameters[ "active" ] = active + result = self.__github._dataRequest( + "PATCH", + "https://api.github.com/user", + None, + post_parameters + ) + self.__useAttributes( result ) def test( self ): pass diff --git a/github/GithubObjects/Issue.py b/github/GithubObjects/Issue.py index 340bd05d..df214219 100644 --- a/github/GithubObjects/Issue.py +++ b/github/GithubObjects/Issue.py @@ -143,7 +143,27 @@ class Issue( object ): pass def edit( self, title = None, body = None, assignee = None, state = None, milestone = None, labels = None ): - pass + post_parameters = { + } + if title is not None: + post_parameters[ "title" ] = title + if body is not None: + post_parameters[ "body" ] = body + if assignee is not None: + post_parameters[ "assignee" ] = assignee + if state is not None: + post_parameters[ "state" ] = state + if milestone is not None: + post_parameters[ "milestone" ] = milestone + if labels is not None: + post_parameters[ "labels" ] = labels + result = self.__github._dataRequest( + "PATCH", + "https://api.github.com/user", + None, + post_parameters + ) + self.__useAttributes( result ) def get_comment( self, id ): pass diff --git a/github/GithubObjects/IssueComment.py b/github/GithubObjects/IssueComment.py index e5250fd7..2f1ffa12 100644 --- a/github/GithubObjects/IssueComment.py +++ b/github/GithubObjects/IssueComment.py @@ -67,7 +67,16 @@ class IssueComment( object ): pass def edit( self, body ): - pass + post_parameters = { + "body": body, + } + result = self.__github._dataRequest( + "PATCH", + "https://api.github.com/user", + None, + post_parameters + ) + self.__useAttributes( result ) def __useAttributes( self, attributes ): if "body" in attributes: diff --git a/github/GithubObjects/Label.py b/github/GithubObjects/Label.py index a68e3585..e83e83e4 100644 --- a/github/GithubObjects/Label.py +++ b/github/GithubObjects/Label.py @@ -48,7 +48,17 @@ class Label( object ): pass def edit( self, name, color ): - pass + post_parameters = { + "name": name, + "color": color, + } + result = self.__github._dataRequest( + "PATCH", + "https://api.github.com/user", + None, + post_parameters + ) + self.__useAttributes( result ) def __useAttributes( self, attributes ): if "color" in attributes: diff --git a/github/GithubObjects/Milestone.py b/github/GithubObjects/Milestone.py index 06d0a7af..4930b155 100644 --- a/github/GithubObjects/Milestone.py +++ b/github/GithubObjects/Milestone.py @@ -92,7 +92,22 @@ class Milestone( object ): pass def edit( self, title, state = None, description = None, due_on = None ): - pass + post_parameters = { + "title": title, + } + if state is not None: + post_parameters[ "state" ] = state + if description is not None: + post_parameters[ "description" ] = description + if due_on is not None: + post_parameters[ "due_on" ] = due_on + result = self.__github._dataRequest( + "PATCH", + "https://api.github.com/user", + None, + post_parameters + ) + self.__useAttributes( result ) def get_labels( self ): result = self.__github._dataRequest( diff --git a/github/GithubObjects/Organization.py b/github/GithubObjects/Organization.py index dbdd7e73..11a919a5 100644 --- a/github/GithubObjects/Organization.py +++ b/github/GithubObjects/Organization.py @@ -187,7 +187,27 @@ class Organization( object ): pass def edit( self, billing_email = None, blog = None, company = None, email = None, location = None, name = None ): - pass + post_parameters = { + } + if billing_email is not None: + post_parameters[ "billing_email" ] = billing_email + if blog is not None: + post_parameters[ "blog" ] = blog + if company is not None: + post_parameters[ "company" ] = company + if email is not None: + post_parameters[ "email" ] = email + if location is not None: + post_parameters[ "location" ] = location + if name is not None: + post_parameters[ "name" ] = name + result = self.__github._dataRequest( + "PATCH", + "https://api.github.com/user", + None, + post_parameters + ) + self.__useAttributes( result ) def get_events( self ): result = self.__github._dataRequest( diff --git a/github/GithubObjects/PullRequest.py b/github/GithubObjects/PullRequest.py index fc4dde2a..427f8fde 100644 --- a/github/GithubObjects/PullRequest.py +++ b/github/GithubObjects/PullRequest.py @@ -187,7 +187,21 @@ class PullRequest( object ): self.__useAttributes( result ) def edit( self, title = None, body = None, state = None ): - pass + post_parameters = { + } + if title is not None: + post_parameters[ "title" ] = title + if body is not None: + post_parameters[ "body" ] = body + if state is not None: + post_parameters[ "state" ] = state + result = self.__github._dataRequest( + "PATCH", + "https://api.github.com/user", + None, + post_parameters + ) + self.__useAttributes( result ) def get_comment( self, id ): pass diff --git a/github/GithubObjects/PullRequestComment.py b/github/GithubObjects/PullRequestComment.py index 30a1cb30..e52a475b 100644 --- a/github/GithubObjects/PullRequestComment.py +++ b/github/GithubObjects/PullRequestComment.py @@ -97,7 +97,16 @@ class PullRequestComment( object ): pass def edit( self, body ): - pass + post_parameters = { + "body": body, + } + result = self.__github._dataRequest( + "PATCH", + "https://api.github.com/user", + None, + post_parameters + ) + self.__useAttributes( result ) def __useAttributes( self, attributes ): if "body" in attributes: diff --git a/github/GithubObjects/Repository.py b/github/GithubObjects/Repository.py index 17afaf09..f8fd4b68 100644 --- a/github/GithubObjects/Repository.py +++ b/github/GithubObjects/Repository.py @@ -267,7 +267,28 @@ class Repository( object ): pass def edit( self, name, description = None, homepage = None, public = None, has_issues = None, has_wiki = None, has_downloads = None ): - pass + post_parameters = { + "name": name, + } + if description is not None: + post_parameters[ "description" ] = description + if homepage is not None: + post_parameters[ "homepage" ] = homepage + if public is not None: + post_parameters[ "public" ] = public + if has_issues is not None: + post_parameters[ "has_issues" ] = has_issues + if has_wiki is not None: + post_parameters[ "has_wiki" ] = has_wiki + if has_downloads is not None: + post_parameters[ "has_downloads" ] = has_downloads + result = self.__github._dataRequest( + "PATCH", + "https://api.github.com/user", + None, + post_parameters + ) + self.__useAttributes( result ) def get_branches( self ): result = self.__github._dataRequest( diff --git a/github/GithubObjects/RepositoryKey.py b/github/GithubObjects/RepositoryKey.py index 5ed9dc35..b1b6a8dc 100644 --- a/github/GithubObjects/RepositoryKey.py +++ b/github/GithubObjects/RepositoryKey.py @@ -54,7 +54,17 @@ class RepositoryKey( object ): pass def edit( self, title, key ): - pass + post_parameters = { + "title": title, + "key": key, + } + result = self.__github._dataRequest( + "PATCH", + "https://api.github.com/user", + None, + post_parameters + ) + self.__useAttributes( result ) def __useAttributes( self, attributes ): if "id" in attributes: diff --git a/github/GithubObjects/Team.py b/github/GithubObjects/Team.py index 703de3a1..be46c48f 100644 --- a/github/GithubObjects/Team.py +++ b/github/GithubObjects/Team.py @@ -74,7 +74,18 @@ class Team( object ): pass def edit( self, name, permission = None ): - pass + post_parameters = { + "name": name, + } + if permission is not None: + post_parameters[ "permission" ] = permission + result = self.__github._dataRequest( + "PATCH", + "https://api.github.com/user", + None, + post_parameters + ) + self.__useAttributes( result ) def get_members( self ): result = self.__github._dataRequest( diff --git a/github/GithubObjects/UserKey.py b/github/GithubObjects/UserKey.py index 07122e33..52b73094 100644 --- a/github/GithubObjects/UserKey.py +++ b/github/GithubObjects/UserKey.py @@ -54,7 +54,19 @@ class UserKey( object ): pass def edit( self, title = None, key = None ): - pass + post_parameters = { + } + if title is not None: + post_parameters[ "title" ] = title + if key is not None: + post_parameters[ "key" ] = key + result = self.__github._dataRequest( + "PATCH", + "https://api.github.com/user", + None, + post_parameters + ) + self.__useAttributes( result ) def __useAttributes( self, attributes ): if "id" in attributes: