Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions gogs_client/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ def ensure_token(self, auth, name, username=None):
return self.create_token(auth, name, username)

def create_repo(self, auth, name, description=None, private=False, auto_init=False,
gitignore_templates=None, license_template=None, readme_template=None):
gitignore_templates=None, license_template=None, readme_template=None,
organization=None):
"""
Creates a new repository, and returns the created repository.

Expand All @@ -123,6 +124,7 @@ def create_repo(self, auth, name, description=None, private=False, auto_init=Fal
:param list[str] gitignore_templates: collection of ``.gitignore`` templates to apply
:param str license_template: license template to apply
:param str readme_template: README template to apply
:param str organization: organization under which repository is created
:return: a representation of the created repository
:rtype: GogsRepo
:raises NetworkFailure: if there is an error communicating with the server
Expand All @@ -140,7 +142,8 @@ def create_repo(self, auth, name, description=None, private=False, auto_init=Fal
"readme": readme_template
}
data = {k: v for (k, v) in data.items() if v is not None}
response = self._post("/user/repos", auth=auth, data=data)
url = "/org/{0}/repos".format(organization) if organization else "/user/repos"
response = self._post(url, auth=auth, data=data)
return GogsRepo.from_json(self._check_ok(response).json())

def repo_exists(self, auth, username, repo_name):
Expand Down