From 73c0648d866d35b7ce75a5aa32efcd7110a68d4a Mon Sep 17 00:00:00 2001 From: bandophahita Date: Mon, 28 Oct 2024 15:22:03 -0500 Subject: [PATCH 1/3] Adding support for expand parameter to worklog fetches --- jira/client.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/jira/client.py b/jira/client.py index 36dc2fea9..05ad71124 100644 --- a/jira/client.py +++ b/jira/client.py @@ -2770,17 +2770,18 @@ def worklogs(self, issue: str | int) -> list[Worklog]: return worklogs @translate_resource_args - def worklog(self, issue: str | int, id: str) -> Worklog: + def worklog(self, issue: str | int, id: str, expand: str | None=None) -> Worklog: """Get a specific worklog Resource from the server. Args: issue (Union[str, int]): ID or key of the issue to get the worklog from id (str): ID of the worklog to get + expand (Optional[str]): extra information to fetch inside each resource Returns: Worklog """ - return self._find_for_resource(Worklog, (issue, id)) + return self._find_for_resource(Worklog, (issue, id), expand=expand) @translate_resource_args def add_worklog( From 2acb8afc11a028a8373b35f16fbe0eab8da76413 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 28 Oct 2024 20:23:21 +0000 Subject: [PATCH 2/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- jira/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jira/client.py b/jira/client.py index 05ad71124..6bf2c6534 100644 --- a/jira/client.py +++ b/jira/client.py @@ -2770,7 +2770,7 @@ def worklogs(self, issue: str | int) -> list[Worklog]: return worklogs @translate_resource_args - def worklog(self, issue: str | int, id: str, expand: str | None=None) -> Worklog: + def worklog(self, issue: str | int, id: str, expand: str | None = None) -> Worklog: """Get a specific worklog Resource from the server. Args: From fcb122b1ae2211217a22cf9a442cf72544f1e42f Mon Sep 17 00:00:00 2001 From: bandophahita Date: Mon, 28 Oct 2024 15:43:36 -0500 Subject: [PATCH 3/3] Adding support for expand parameter to worklogs fetches --- jira/client.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/jira/client.py b/jira/client.py index 6bf2c6534..9c9195e62 100644 --- a/jira/client.py +++ b/jira/client.py @@ -2754,15 +2754,19 @@ def remove_watcher(self, issue: str | int, watcher: str) -> Response: return result @translate_resource_args - def worklogs(self, issue: str | int) -> list[Worklog]: + def worklogs(self, issue: str | int, expand: str | None = None) -> list[Worklog]: """Get a list of worklog Resources from the server for an issue. Args: issue (Union[str, int]): ID or key of the issue to get worklogs from + expand (Optional[str]): extra information to fetch inside each resource Returns: List[Worklog] """ - r_json = self._get_json("issue/" + str(issue) + "/worklog") + params = {} + if expand: + params["expand"] = expand + r_json = self._get_json("issue/" + str(issue) + "/worklog", params=params) worklogs = [ Worklog(self._options, self._session, raw_worklog_json) for raw_worklog_json in r_json["worklogs"]