mirror of
https://github.com/status-im/PyGithub.git
synced 2026-09-02 03:41:08 +00:00
Add create project method and tests
This commit is contained in:
@@ -391,6 +391,26 @@ class Organization(github.GithubObject.CompletableGithubObject):
|
||||
)
|
||||
return github.Hook.Hook(self._requester, headers, data, completed=True)
|
||||
|
||||
def create_project(self, name, body=github.GithubObject.NotSet):
|
||||
"""
|
||||
:calls: `POST /orgs/:org/projects <https://developer.github.com/v3/projects/#create-an-organization-project>`_
|
||||
:param name: string
|
||||
:param body: string
|
||||
:rtype: :class:`github.Project.Project`
|
||||
"""
|
||||
assert isinstance(name, str), name
|
||||
assert body is github.GithubObject.NotSet or isinstance(body, str), body
|
||||
post_parameters = {"name": name}
|
||||
if body is not github.GithubObject.NotSet:
|
||||
post_parameters["body"] = body
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"POST",
|
||||
self.url + "/projects",
|
||||
input=post_parameters,
|
||||
headers={"Accept": Consts.mediaTypeProjectsPreview},
|
||||
)
|
||||
return github.Project.Project(self._requester, headers, data, completed=True)
|
||||
|
||||
def create_repo(
|
||||
self,
|
||||
name,
|
||||
|
||||
Reference in New Issue
Block a user