From f2808cc33331ee40fbb2ca3788a088035d0f55bf Mon Sep 17 00:00:00 2001 From: Costin Bleotu Date: Thu, 30 Mar 2017 23:39:15 +0300 Subject: [PATCH 1/2] Specify organization when creating a repo. --- gogs_client/entities.py | 2 +- gogs_client/interface.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/gogs_client/entities.py b/gogs_client/entities.py index a117a0f..956a799 100644 --- a/gogs_client/entities.py +++ b/gogs_client/entities.py @@ -239,4 +239,4 @@ def pull(self): :rtype: bool """ - return self._pull + return self._pull \ No newline at end of file diff --git a/gogs_client/interface.py b/gogs_client/interface.py index 95ac587..17892d5 100644 --- a/gogs_client/interface.py +++ b/gogs_client/interface.py @@ -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. @@ -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 @@ -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): From 5787c9a4728476ae049b76715e9244adfe7ea12d Mon Sep 17 00:00:00 2001 From: Costin Bleotu Date: Thu, 30 Mar 2017 23:42:59 +0300 Subject: [PATCH 2/2] New line at end of file --- gogs_client/entities.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gogs_client/entities.py b/gogs_client/entities.py index 956a799..a117a0f 100644 --- a/gogs_client/entities.py +++ b/gogs_client/entities.py @@ -239,4 +239,4 @@ def pull(self): :rtype: bool """ - return self._pull \ No newline at end of file + return self._pull