Skip to content
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

Adding support for expand parameter to worklog fetches #1912

Open
wants to merge 3 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
13 changes: 9 additions & 4 deletions jira/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2754,33 +2754,38 @@ 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"]
]
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(
Expand Down
Loading