Skip to content

Commit

Permalink
extend jira meta functions (#1308)
Browse files Browse the repository at this point in the history
  • Loading branch information
gonchik authored Jan 21, 2024
1 parent 3a97c6d commit f5a857d
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 7 deletions.
2 changes: 1 addition & 1 deletion atlassian/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.41.8
3.41.9
4 changes: 2 additions & 2 deletions atlassian/bitbucket/server/projects/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ def create(self, name, key, description, avatar=None):
Note that the avatar has to be embedded as either a data-url or a URL to an external image as shown in
the examples below:
w.projects.create( "Mars Project", "MARS", "Software for colonizing mars.",
w.projects.create( "Mars Project", "MARS", "Software for colonizing Mars.",
avatar="data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/..."
)
w.projects.create( "Mars Project", "MARS", "Software for colonizing mars.",
w.projects.create( "Mars Project", "MARS", "Software for colonizing Mars.",
avatar="http://i.imgur.com/72tRx4w.gif"
)
Expand Down
38 changes: 34 additions & 4 deletions atlassian/jira.py
Original file line number Diff line number Diff line change
Expand Up @@ -1064,13 +1064,43 @@ def issue_createmeta(self, project, expand="projects.issuetypes.fields"):
url = self.resource_url("issue/createmeta?projectKeys={}".format(project))
return self.get(url, params=params)

def issue_createmeta_issuetypes(self, project):
def issue_createmeta_issuetypes(self, project, start=None, limit=None):
"""
Get create metadata issue types for a project
Returns a page of issue type metadata for a specified project.
Use the information to populate the requests in Create issue and Create issues.
:param project:
:param start: default: 0
:param limit: default: 50
:return:
"""
url = self.resource_url("issue/createmeta/{}/issuetypes".format(project))
return self.get(url)
params = {}
if start:
params["startAt"] = start
if limit:
params["maxResults"] = limit
return self.get(url, params=params)

def issue_createmeta_fieldtypes(self, project, issue_type_id):
def issue_createmeta_fieldtypes(self, project, issue_type_id, start=None, limit=None):
"""
Get create field metadata for a project and issue type id
Returns a page of field metadata for a specified project and issuetype id.
Use the information to populate the requests in Create issue and Create issues.
This operation can be accessed anonymously.
:param project:
:param issue_type_id:
:param start: default: 0
:param limit: default: 50
:return:
"""
url = self.resource_url("issue/createmeta/{}/issuetypes/{}".format(project, issue_type_id))
return self.get(url)
params = {}
if start:
params["startAt"] = start
if limit:
params["maxResults"] = limit
return self.get(url, params=params)

def issue_editmeta(self, key):
base_url = self.resource_url("issue")
Expand Down
9 changes: 9 additions & 0 deletions docs/jira.rst
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,15 @@ Manage issues
# Get Issue Edit Meta
jira.issue_editmeta(issue_key)
# Get issue create meta, deprecated on Cloud and from Jira 9.0
jira.issue_createmeta(project, expand="projects.issuetypes.fields")
# Get create metadata issue types for a project
jira.issue_createmeta_issuetypes(project, start=None, limit=None)
# Get create field metadata for a project and issue type id
jira.issue_createmeta_fieldtypes(self, project, issue_type_id, start=None, limit=None)
# Create Issue Link
data = {
"type": {"name": "Duplicate" },
Expand Down

0 comments on commit f5a857d

Please sign in to comment.