Skip to content

Commit

Permalink
Added expand option to api
Browse files Browse the repository at this point in the history
  • Loading branch information
DEADSEC-SECURITY committed Jul 11, 2023
1 parent 787fde4 commit 75312cf
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions jira/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4286,18 +4286,34 @@ def permissionschemes(self):
return data["permissionSchemes"]

@lru_cache(maxsize=None)
def issue_type_schemes(self) -> list[IssueTypeScheme]:
"""Get all issue type schemes defined.
@warning: Admin is required to perform this action
def issue_type_schemes(
self,
expand_projects: bool = False,
expand_issue_types: bool = False
) -> list[IssueTypeScheme]:
"""
Get all issue type schemes defined (Admin required).
@return: List[IssueTypeScheme]: All the Issue Type Schemes available to the currently logged in user
@param expand_projects: For each issue type schemes, returns information about the projects the issue type scheme is assigned to
@param expand_issue_types: For each issue type schemes, returns information about the issueTypes the issue type scheme have.
@return: List[IssueTypeScheme]: All the Issue Type Schemes available to the currently logged in user.
"""
expand = []
if expand_projects:
expand.append("projects")
if expand_issue_types:
expand.append("issueTypes")

params = {}
if expand:
params["expand"] = ",".join(expand)

url = self._get_url("issuetypescheme")
print(url)

r = self._session.get(url)
data: dict[str, Any] = json_loads(r)
data = data.get("values", [])
response = self._session.get(url, params=params)
data: dict[str, Any] = json_loads(response)
data = data.get("values")

issue_type_schemes = [
IssueTypeScheme(self._options, self._session, raw_type_json)
Expand Down

0 comments on commit 75312cf

Please sign in to comment.