Add support for editing project cards (#1418)

* Add edit() to ProjectCard

* Add unit tests of ProjectCard.edit
This commit is contained in:
Jody McIntyre
2020-03-08 14:24:35 +11:00
committed by GitHub
parent 96494965ee
commit 425280cee7
5 changed files with 178 additions and 0 deletions
+26
View File
@@ -172,6 +172,32 @@ class ProjectCard(github.GithubObject.CompletableGithubObject):
)
return status == 204
def edit(
self, note=github.GithubObject.NotSet, archived=github.GithubObject.NotSet
):
"""
:calls: `PATCH /projects/columns/cards/:card_id <http://developer.github.com/v3/projects/cards>`_
:param note: string
:param archived: bool
:rtype: None
"""
assert note is github.GithubObject.NotSet or isinstance(note, str), note
assert archived is github.GithubObject.NotSet or isinstance(
archived, bool
), archived
patch_parameters = dict()
if note is not github.GithubObject.NotSet:
patch_parameters["note"] = note
if archived is not github.GithubObject.NotSet:
patch_parameters["archived"] = archived
headers, data = self._requester.requestJsonAndCheck(
"PATCH",
self.url,
input=patch_parameters,
headers={"Accept": Consts.mediaTypeProjectsPreview},
)
self._useAttributes(data)
def _initAttributes(self):
self._archived = github.GithubObject.NotSet
self._column_url = github.GithubObject.NotSet