Skip to content

Commit f5a857d

Browse files
authored
extend jira meta functions (#1308)
1 parent 3a97c6d commit f5a857d

File tree

4 files changed

+46
-7
lines changed

4 files changed

+46
-7
lines changed

atlassian/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.41.8
1+
3.41.9

atlassian/bitbucket/server/projects/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ def create(self, name, key, description, avatar=None):
2020
Note that the avatar has to be embedded as either a data-url or a URL to an external image as shown in
2121
the examples below:
2222
23-
w.projects.create( "Mars Project", "MARS", "Software for colonizing mars.",
23+
w.projects.create( "Mars Project", "MARS", "Software for colonizing Mars.",
2424
avatar="data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/..."
2525
)
2626
27-
w.projects.create( "Mars Project", "MARS", "Software for colonizing mars.",
27+
w.projects.create( "Mars Project", "MARS", "Software for colonizing Mars.",
2828
avatar="http://i.imgur.com/72tRx4w.gif"
2929
)
3030

atlassian/jira.py

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,13 +1064,43 @@ def issue_createmeta(self, project, expand="projects.issuetypes.fields"):
10641064
url = self.resource_url("issue/createmeta?projectKeys={}".format(project))
10651065
return self.get(url, params=params)
10661066

1067-
def issue_createmeta_issuetypes(self, project):
1067+
def issue_createmeta_issuetypes(self, project, start=None, limit=None):
1068+
"""
1069+
Get create metadata issue types for a project
1070+
Returns a page of issue type metadata for a specified project.
1071+
Use the information to populate the requests in Create issue and Create issues.
1072+
:param project:
1073+
:param start: default: 0
1074+
:param limit: default: 50
1075+
:return:
1076+
"""
10681077
url = self.resource_url("issue/createmeta/{}/issuetypes".format(project))
1069-
return self.get(url)
1078+
params = {}
1079+
if start:
1080+
params["startAt"] = start
1081+
if limit:
1082+
params["maxResults"] = limit
1083+
return self.get(url, params=params)
10701084

1071-
def issue_createmeta_fieldtypes(self, project, issue_type_id):
1085+
def issue_createmeta_fieldtypes(self, project, issue_type_id, start=None, limit=None):
1086+
"""
1087+
Get create field metadata for a project and issue type id
1088+
Returns a page of field metadata for a specified project and issuetype id.
1089+
Use the information to populate the requests in Create issue and Create issues.
1090+
This operation can be accessed anonymously.
1091+
:param project:
1092+
:param issue_type_id:
1093+
:param start: default: 0
1094+
:param limit: default: 50
1095+
:return:
1096+
"""
10721097
url = self.resource_url("issue/createmeta/{}/issuetypes/{}".format(project, issue_type_id))
1073-
return self.get(url)
1098+
params = {}
1099+
if start:
1100+
params["startAt"] = start
1101+
if limit:
1102+
params["maxResults"] = limit
1103+
return self.get(url, params=params)
10741104

10751105
def issue_editmeta(self, key):
10761106
base_url = self.resource_url("issue")

docs/jira.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,15 @@ Manage issues
272272
# Get Issue Edit Meta
273273
jira.issue_editmeta(issue_key)
274274
275+
# Get issue create meta, deprecated on Cloud and from Jira 9.0
276+
jira.issue_createmeta(project, expand="projects.issuetypes.fields")
277+
278+
# Get create metadata issue types for a project
279+
jira.issue_createmeta_issuetypes(project, start=None, limit=None)
280+
281+
# Get create field metadata for a project and issue type id
282+
jira.issue_createmeta_fieldtypes(self, project, issue_type_id, start=None, limit=None)
283+
275284
# Create Issue Link
276285
data = {
277286
"type": {"name": "Duplicate" },

0 commit comments

Comments
 (0)