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

Update the type for issue in add_comment & transition_issue for better type hints #1580

Merged
merged 1 commit into from
May 15, 2023
Merged
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
Update the type for issue in add_comment & transition_issue for bette…
…r type hints
  • Loading branch information
dvaerum committed May 12, 2023
commit 2feaab9bcf7c1485638f5de0f2e73ffac8a5de12
16 changes: 8 additions & 8 deletions jira/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1936,15 +1936,15 @@ def comment(
@translate_resource_args
def add_comment(
self,
issue: str | int,
issue: str | int | Issue,
body: str,
visibility: dict[str, str] | None = None,
is_internal: bool = False,
) -> Comment:
"""Add a comment from the current authenticated user on the specified issue and return a Resource for it.

Args:
issue (Union[str, int]): ID or key of the issue to add the comment to
issue (Union[str, int, jira.resources.Issue]): ID or key of the issue to add the comment to
body (str): Text of the comment to add
visibility (Optional[Dict[str, str]]): a dict containing two entries: "type" and "value".
"type" is 'role' (or 'group' if the Jira server has configured comment visibility for groups)
Expand Down Expand Up @@ -2125,11 +2125,11 @@ def add_simple_link(self, issue: str, object: dict[str, Any]):

# non-resource
@translate_resource_args
def transitions(self, issue: str | int, id: str | None = None, expand=None):
def transitions(self, issue: str | int | Issue, id: str | None = None, expand=None):
"""Get a list of the transitions available on the specified issue to the current user.

Args:
issue (Union[str, int]): ID or key of the issue to get the transitions from
issue (Union[str, int, jira.resources.Issue]): ID or key of the issue to get the transitions from
id (Optional[str]): if present, get only the transition matching this ID
expand (Optional): extra information to fetch inside each transition

Expand All @@ -2146,14 +2146,14 @@ def transitions(self, issue: str | int, id: str | None = None, expand=None):
]

def find_transitionid_by_name(
self, issue: str | int, transition_name: str
self, issue: str | int | Issue, transition_name: str
) -> int | None:
"""Get a transitionid available on the specified issue to the current user.

Look at https://developer.atlassian.com/static/rest/jira/6.1.html#d2e1074 for json reference

Args:
issue (Union[str, int]): ID or key of the issue to get the transitions from
issue (Union[str, int, jira.resources.Issue]): ID or key of the issue to get the transitions from
transition_name (str): name of transition we are looking for

Returns:
Expand All @@ -2171,7 +2171,7 @@ def find_transitionid_by_name(
@translate_resource_args
def transition_issue(
self,
issue: str | int,
issue: str | int | Issue,
transition: str,
fields: dict[str, Any] | None = None,
comment: str | None = None,
Expand All @@ -2184,7 +2184,7 @@ def transition_issue(
all other keyword arguments will be ignored. Field values will be set on the issue as part of the transition process.

Args:
issue (Union[str, int]): ID or key of the issue to perform the transition on
issue (Union[str, int, jira.resources.Issue]): ID or key of the issue to perform the transition on
transition (str): ID or name of the transition to perform
fields (Optional[Dict[str,Any]]): a dict containing field names and the values to use.
comment (Optional[str]): String to add as comment to the issue when performing the transition.
Expand Down