Skip to content

Commit f37f16a

Browse files
authored
The Prio scheme methods (#426)
* A new Tempo method
1 parent 93c91a9 commit f37f16a

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

atlassian/jira.py

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1628,6 +1628,72 @@ def get_project_issue_security_scheme(self, project_id_or_key, only_levels=False
16281628
else:
16291629
return self.get(url)
16301630

1631+
# Priority Schemes
1632+
def get_all_priority_schemes(self, start=0, limit=100, expand=None):
1633+
"""
1634+
Returns all priority schemes.
1635+
All project keys associated with the priority scheme will only be returned
1636+
if additional query parameter is provided expand=schemes.projectKeys.
1637+
:param start: the page offset, if not specified then defaults to 0
1638+
:param limit: how many results on the page should be included. Defaults to 100, maximum is 1000.
1639+
:param expand: can be 'schemes.projectKeys'
1640+
:return:
1641+
"""
1642+
url = 'rest/api/2/priorityschemes'
1643+
params = {}
1644+
if start:
1645+
params['startAt'] = int(start)
1646+
if limit:
1647+
params['maxResults'] = int(limit)
1648+
if expand:
1649+
params['expand'] = expand
1650+
return self.get(url, params=params)
1651+
1652+
def create_priority_scheme(self, data):
1653+
"""
1654+
Creates new priority scheme.
1655+
:param data:
1656+
{"name": "New priority scheme",
1657+
"description": "Priority scheme for very important projects",
1658+
"defaultOptionId": "3",
1659+
"optionIds": [
1660+
"1",
1661+
"2",
1662+
"3",
1663+
"4",
1664+
"5"
1665+
]}
1666+
:return: Returned if the priority scheme was created.
1667+
"""
1668+
return self.post(path="rest/api/2/priorityschemes", data=data)
1669+
1670+
# api/2/project/{projectKeyOrId}/priorityscheme
1671+
# Resource for associating priority schemes and projects.
1672+
def get_priority_scheme_of_project(self, project_key_or_id):
1673+
"""
1674+
Gets a full representation of a priority scheme in JSON format used by specified project.
1675+
User must be global administrator or project administrator.
1676+
:param project_key_or_id:
1677+
:return:
1678+
"""
1679+
url = 'rest/api/2/project/{}/priorityscheme'.format(project_key_or_id)
1680+
return self.get(url)
1681+
1682+
def assign_priority_scheme_for_project(self, project_key_or_id, priority_scheme_id):
1683+
"""
1684+
Assigns project with priority scheme. Priority scheme assign with migration is possible from the UI.
1685+
Operation will fail if migration is needed as a result of operation
1686+
eg. there are issues with priorities invalid in the destination scheme.
1687+
All project keys associated with the priority scheme will only be returned
1688+
if additional query parameter is provided expand=projectKeys.
1689+
:param project_key_or_id:
1690+
:param priority_scheme_id:
1691+
:return:
1692+
"""
1693+
url = "rest/api/2/project/{projectKeyOrId}/priorityscheme".format(projectKeyOrId=project_key_or_id)
1694+
data = {"id": priority_scheme_id}
1695+
return self.put(url, data=data)
1696+
16311697
# Application properties
16321698
def get_property(self, key=None, permission_level=None, key_filter=None):
16331699
"""

0 commit comments

Comments
 (0)