Skip to content

Jira: Add ability to add icons to issue remote links #1040

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion atlassian/jira.py
Original file line number Diff line number Diff line change
Expand Up @@ -1321,14 +1321,18 @@ def get_issue_remote_links(self, issue_key, global_id=None, internal_id=None):
url += "/" + internal_id
return self.get(url, params=params)

def create_or_update_issue_remote_links(self, issue_key, link_url, title, global_id=None, relationship=None):
def create_or_update_issue_remote_links(
self, issue_key, link_url, title, global_id=None, relationship=None, icon_url=None, icon_title=None
):
"""
Add Remote Link to Issue, update url if global_id is passed
:param issue_key: str
:param link_url: str
:param title: str
:param global_id: str, OPTIONAL:
:param relationship: str, OPTIONAL: Default by built-in method: 'Web Link'
:param icon_url: str, OPTIONAL: Link to a 16x16 icon representing the type of the object in the remote system
:param icon_title: str, OPTIONAL: Text for the tooltip of the main icon describing the type of the object in the remote system
"""
base_url = self.resource_url("issue")
url = "{base_url}/{issue_key}/remotelink".format(base_url=base_url, issue_key=issue_key)
Expand All @@ -1337,6 +1341,13 @@ def create_or_update_issue_remote_links(self, issue_key, link_url, title, global
data["globalId"] = global_id
if relationship:
data["relationship"] = relationship
if icon_url or icon_title:
icon_data = {}
if icon_url:
icon_data["url16x16"] = icon_url
if icon_title:
icon_data["title"] = icon_title
data["icon"] = icon_data
return self.post(url, data=data)

def get_issue_remote_link_by_id(self, issue_key, link_id):
Expand Down
2 changes: 1 addition & 1 deletion docs/jira.rst
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ Manage issues
jira.remove_issue_link(link_id)

# Create or Update Issue Remote Links
jira.create_or_update_issue_remote_links(issue_key, link_url, title, global_id=None, relationship=None)
jira.create_or_update_issue_remote_links(issue_key, link_url, title, global_id=None, relationship=None, icon_url=None, icon_title=None)

# Get Issue Remote Link by link ID
jira.get_issue_remote_link_by_id(issue_key, link_id)
Expand Down