Skip to content

enhancement: add archive and unarchive functionality for issues #1943

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
31 changes: 31 additions & 0 deletions jira/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3600,6 +3600,37 @@ def search_issues(

return issues

# Archive Issues
def archive_issues(self, issues: ResultList[Issue]) -> dict[str, Any]:
"""Archive a list of Issues.

Args:
issues (ResultsList[Issue]): List of issues to archive

Returns:
Dict[str, Any]: Response from the server indicating success or failure for each issue in the list
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution.
Could you provide an example to the end user what this returned dict is?

also dont forget to rebase onto latest main to incorporate some recent fixes

"""
url = self._get_url("issue/archive")
issue_keys_to_archive = [issue.key for issue in issues]
payload = {"issueIdsOrKeys": issue_keys_to_archive}
response = self._session.put(url, data=json.dumps(payload))
return response.json()

def unarchive_issues(self, issues: ResultList[Issue]) -> dict[str, Any]:
"""Unarchive a list of Issues.

Args:
issues (ResultsList[Issue]): List of issues to unarchive

Returns:
Dict[str, Any]: Response from the server indicating success or failure for each issue in the list
"""
url = self._get_url("issue/unarchive")
issue_keys_to_archive = [issue.key for issue in issues]
payload = {"issueIdsOrKeys": issue_keys_to_archive}
response = self._session.put(url, data=json.dumps(payload))
return response.json()

# Security levels
def security_level(self, id: str) -> SecurityLevel:
"""Get a security level Resource.
Expand Down
Loading