From 4ee37d5a1b66b34fc9f68e7961ed5082bfa8997d Mon Sep 17 00:00:00 2001 From: Dan Snider Date: Thu, 25 Feb 2021 13:04:20 +0800 Subject: [PATCH 1/2] Jira: Support creating project from shared template private endpoint. --- atlassian/jira.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/atlassian/jira.py b/atlassian/jira.py index a1d5e69ef..336d4d4be 100644 --- a/atlassian/jira.py +++ b/atlassian/jira.py @@ -1525,6 +1525,23 @@ def create_project_from_raw_json(self, json): """ return self.post("rest/api/2/project", json=json) + def create_project_from_shared_template(self, project_id, key, name, lead): + """ + Creates a new project based on an existing project. + :param str project_id: The numeric ID of the project to clone + :param str key: The KEY to use for the new project, e.g. KEY-10000 + :param str name: The name of the new project + :param str lead: The username of the project lead + :return: + """ + json = { + "key": key, + "name": name, + "lead": lead + } + + return self.post("rest/project-templates/1.0/createshared/{}".format(project_id), json=json) + def delete_project(self, key): """ DELETE /rest/api/2/project/ From 0067b4086c8f0a65568fe30c927ee2fb605e8a3a Mon Sep 17 00:00:00 2001 From: Dan Snider Date: Thu, 25 Feb 2021 13:19:49 +0800 Subject: [PATCH 2/2] Address Black formatting issue. --- atlassian/jira.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/atlassian/jira.py b/atlassian/jira.py index 336d4d4be..9e7eced79 100644 --- a/atlassian/jira.py +++ b/atlassian/jira.py @@ -1534,11 +1534,7 @@ def create_project_from_shared_template(self, project_id, key, name, lead): :param str lead: The username of the project lead :return: """ - json = { - "key": key, - "name": name, - "lead": lead - } + json = {"key": key, "name": name, "lead": lead} return self.post("rest/project-templates/1.0/createshared/{}".format(project_id), json=json)