Replies: 8 comments 6 replies
-
I'd quite like to move away from passing strings into arguments when an object could be passed instead. e.g. @translate_resource_args
def add_watcher(self, issue: str, watcher: str) -> Response:
"""Add a user to an issue's watchers list.
Args:
issue (str): ID or key of the issue affected
watcher (str): name of the user to add to the watchers list
"""
url = self._get_url("issue/" + str(issue) + "/watchers")
return self._session.post(url, data=json.dumps(watcher)) Would become @translate_resource_args
def add_watcher(self, issue: Issue, watcher: User) -> Response:
"""Add a user to an issue's watchers list.
Args:
issue (Issue): Issue affected
watcher (User): user to add to the watchers list
"""
url = self._get_url(f"issue/{issue.key}/watchers")
return self._session.post(url, data=json.dumps(watcher.accountId if self.deploymentType == "Cloud" else watcher.name)) Would be a pretty big change from a user perspective, but I feel like this will make things more robust long term for both sides. The user workflow may change from: We could provide some helper methods that may make this less painful: jira_client : JIRA
jira_client.add_watcher(issue=get_issue(key="PRJ-123"), watcher=get_user(email="user@example.com")) |
Beta Was this translation helpful? Give feedback.
-
making a better segregation between jira server and jira cloud |
Beta Was this translation helpful? Give feedback.
-
Not something that is functionally relevant but while looking through the package it would help if things like the comments were in a consistant manner, In client.py for example the 3 following styles are used (as well as some functions not commented at all) """Get a list of comment Resources.
:param issue: the issue to get comments from
:type issue: str
:param expand: extra information to fetch for each comment
such as renderedBody and properties.
:type expand: str
:rtype: List[Comment]
""" """Internal method for translating an user search (str) to an id.
Return None and -1 unchanged.
This function uses :py:meth:`JIRA.search_users` to find the user
and then using :py:meth:`JIRA._get_user_identifier` extracts
the relevant identifier property depending on whether
the instance is a Cloud or self-hosted Instance.
Args:
user (Optional[str]): The search term used for finding a user.
None, '-1' and -1 are equivalent to 'Unassigned'.
Raises:
JIRAError: If any error occurs.
Returns:
Optional[str]: The Jira user's identifier. Or "-1" and None unchanged.
""" """Decorator that converts Issue and Project resources to their keys when used as arguments.""" Each of the above are for functions/generators that take arguments and have a return value. Typing seems to be missing in places (or at least is not obvious). Improving typing may help. Guessing this would come down to a general code clean up in general. |
Beta Was this translation helpful? Give feedback.
-
I think it would be great for Insight access, this is something that I am looking at implementing if it is a possibility (discussion in a currently open issue I created) |
Beta Was this translation helpful? Give feedback.
-
Some general file structure would be great the main file client.py is enormous |
Beta Was this translation helpful? Give feedback.
-
I think we should also rethink the way we are testing things. It's hard for people to add tests, its hard to run them. |
Beta Was this translation helpful? Give feedback.
-
another feature proposal => historical issues |
Beta Was this translation helpful? Give feedback.
-
It would be nice to have some helper function to get custom field names and their possible values. I can get custom fields printed and it prints something like this: But I have no way to get ids of all possible values that can be assigned to this custom field 'customfield_16271' (i.e. options in the select box) programmatically. |
Beta Was this translation helpful? Give feedback.
-
drop those things in here.
bumping a major version means changes which might break the API
I'll start with it
Beta Was this translation helpful? Give feedback.
All reactions