This is the baseline class for all Jira issue events such as Post functions and Listeners
This Issue
class encapsulates functionality for interacting with one Jira issue.
It includes properties and methods for various actions such as checking if an issue is a subtask, if it has a parent, attachments, comments, links, subtasks, etc.
It also provides methods for editing issues, deleting them, linking them to other issues, transitioning their status, and fetching comments. Additionally, it allows adding comments, setting properties, and provides a string representation of the issue. The class utilizes threading for certain operations to run asynchronously.
Usage
Below you can check examples of usage for this class.
Expression | Type | Parameters | Example Output |
---|---|---|---|
issue.is_subtask | PROPERTY | NONE | True or False BOOL |
issue.has_parent | PROPERTY | NONE | True or False BOOL |
issue.has_attachments | PROPERTY | NONE | True or False BOOL |
issue.has_comments | PROPERTY | NONE | True or False BOOL |
issue.has_links | PROPERTY | NONE | True or False BOOL |
issue.last_comment | PROPERTY | NONE | True or False BOOL |
issue.has_subtasks | PROPERTY | NONE | True or False BOOL |
issue.is_resolved | PROPERTY | NONE | True or False BOOL |
issue.is_overdue | PROPERTY | NONE | True or False BOOL |
issue.linked_issues | PROPERTY | NONE | [<Issue Object>, <Issue Object> … N] (list[Issue]) |
issue.parent_summary | PROPERTY | NONE | "Find Replicants” STR |
# Get the parent from any level in the hierarchy if available issue.parent issue.parent.parent issue.parent.parent.parent .... issue.parent.parent.parent.parent.parent.parent (lol) | PROPERTY | NONE | <Issue Object> OBJECT |
# Get the child issues if any issue.child | PROPERTY | NONE | [<Issue Object>, <Issue Object> … N] (list[Issue]) |
# Get the siblings (same parent issue) issue.siblings | PROPERTY | NONE | [<Issue Object>, <Issue Object> … N] (list[Issue]) |
# Get the parent status issue.parent_status | PROPERTY | NONE | "Done", "In Progress”, “To Do" STR |
# Get common data issue.summary issue.description issue.status issue.reporter issue.assignee issue.resolution issue.priority | PROPERTIES | NONE | ANY |
# Get the issue changelog issue.changelog | PROPERTY | NONE | [<Dict of changelog items>, … ] |
# Get the issue comments issue.comments | PROPERTY | NONE | [<Dict of comment items>, … ] Example of one comment object |
# Copies information from another issue issue.copy_field_from(source_issue_key: str, fieldKey: str) | FUNCTION |
| NONE |
# Copies data from one field to another (same issue) issue.copy_field_value(source_field: str, target_field: str) | FUNCTION |
| NONE |
# Assign an issue issue.assign_to(issue.fields.reporter) # OR issue.assign_to(issue.fields.reporter.accountId) # Accepts both | FUNCTION |
| NONE |
# Set the value of a field (performance approach) issue.set('field', 'value') issue.set('labels', ['label1', 'label2']) issue.set('summary', 'new summary') issue.set('customfield_10000', 'my info') Information on the “Value" should match expected data by the field type. | FUNCTION |
| NONE |
issue.set_due_date(due_date) # Expects YYYY-MM-DD eg.: 2021-04-21 | FUNCTION | ||
# Links an Issue to another issue.link_to("ISSUE-456", "Relates to") | FUNCTION |
| RESPONSE |
# Transition one issue AND (optionally) update fields issue.transition("in progress", customfield_10000="ABC") | FUNCTION |
| NONE |
# Add a comment (internal or external) issue.add_comment(message, internal=False) | FUNCTION |
| NONE |
# Set a custom property for the issue issue.set_property(key="custom_key", value="custom_value") | FUNCTION |
| NONE |
# Get a custom property for the issue issue.get_property(key="custom_key") | FUNCTION |
| ANY |
# Calculate the time the issue spent in each status issue.time_in_status() | FUNCTION | NONE | DICT |
# Handle Labels issue.add_label("your-label") issue.remove_label("your-label") | FUNCTION |
| NONE |
# Issue Notification issue.notify( subject, html, text, users=[], assignee=True, reporter=False, voters=False, watchers=False ) Users must be a list of accountIds ["accountId1", "accountId2"... etc] | FUNCTION |
| NONE |
Examples
issue = Issue("TEST-123") issue.transition("In Progress") issue.assign(issue.fields.reporter) if issue.has_parent: if issue.parent_status == "To Do": issue.parent.transition("In Progress") if issue.is_subtask: issue.add_comment("Started working on Issue", internal=True)