-
-
Notifications
You must be signed in to change notification settings - Fork 876
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
Add projectstatuses method to get project statuses (missing endpoint) #1267
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me ! Will wait a bit too see if @studioj spots anything I've missed.
Thanks !
jira/client.py
Outdated
@@ -2927,6 +2927,19 @@ def statuses(self) -> List[Status]: | |||
] | |||
return statuses | |||
|
|||
def projectstatuses(self, projectIdOrKey: str) -> List[Status]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(non-blocking)
@studioj what are you thoughts on using the more conventional naming convention here?
e.g.:
def projectstatuses(self, projectIdOrKey: str) -> List[Status]: | |
def project_statuses(self, projectIdOrKey: str) -> List[Status]: |
My only concern is that we don't really conform to this anyway, e.g. statuscategories()
below. So perhaps we want to have a separate merge request where we add a deprecation warning to the current non snake_case methods, and also convert them to a wrapper of the snake case ones. Something like:
def projectstatuses(self, projectIdOrKey: str) -> List[Status]:
warnings.warn("Please use project_statuses()", DeprecationWarning)
return self.project_status(projectIdOrKey)
def project_statuses(self, projectIdOrKey: str) -> List[Status]:
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i would indeed do that in a separate PR, but tbh if we add something new i would suggest making it snake case yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so this method should be snake case
project_statuses
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool thank you for your addition.
We do prefer PR's where there is a test added so the functionality can keep on running properly
jira/client.py
Outdated
@@ -2927,6 +2927,19 @@ def statuses(self) -> List[Status]: | |||
] | |||
return statuses | |||
|
|||
def projectstatuses(self, projectIdOrKey: str) -> List[Status]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i would indeed do that in a separate PR, but tbh if we add something new i would suggest making it snake case yes
jira/client.py
Outdated
@@ -2927,6 +2927,19 @@ def statuses(self) -> List[Status]: | |||
] | |||
return statuses | |||
|
|||
def projectstatuses(self, projectIdOrKey: str) -> List[Status]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so this method should be snake case
project_statuses
Apologize for the back and forth... Please review again. I realized I misunderstood what the endpoint returns when writing the test case. I thought it returns all statuses within a project, but it actually returns issue types with statuses within each issue type. I've made some revisions. CI test for servers passed... cloud failed because |
seems like this is for all PR's i hope @adehad will have the time to check... i'm not that knowledgeable with the cloud CI part. seems like an ENV var isn't set. That part has been added pretty recent so maybe it still contains some edge cases |
Sorry yes regarding the Cloud CI, currently it doesn't play nicely with merge requests from forks (it doesn't pass the credentials properly even though we think we've set all the right settings to allow this!) @studioj from my perspective if the Server tests pass that is good, then on our end we can raise a PR from a branch within this repo and we should be able to activate this test to run on Cloud with the |
It's a start😀 |
jira/client.py
Outdated
def project_statuses_by_issue_type(self, projectIdOrKey: str) -> List[IssueType]: | ||
"""Get a list of issue types available within the project with available statuses within each issue type, as each project has a set of valid issue types and each issue type has a set of valid statuses. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @kayx23 !
Sorry I'm just reviewing this again and think this function name and docstring could be clarified.
Technically this function is returning issue types rather than project statuses.
So perhaps the function name should be issue_types_for_project()
I also think the short summary for the function could be made clearer with an example.
Perhaps we can modify this like so:
def project_statuses_by_issue_type(self, projectIdOrKey: str) -> List[IssueType]: | |
"""Get a list of issue types available within the project with available statuses within each issue type, as each project has a set of valid issue types and each issue type has a set of valid statuses. | |
def issue_types_for_project(self, projectIdOrKey: str) -> List[IssueType]: | |
"""Get a list of issue types available within the project. | |
Each project has a set of valid issue types and each issue type has a set of valid statuses. | |
The valid statuses for a given issue type can be extracted via: `issue_type_x.statuses` |
We can then probably also update the docstring of statuses()
to point to this function to help people find this use case!
"""Get a list of all status Resources from the server.
Refer to :py:meth:`JIRA.issue_types_for_project` for getting statuses
for a specific issue type within a specific project.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good suggestion! This makes a lot of sense. I've added them in.
Added
projectstatuses
method for/project/{projectIdOrKey}/statuses
Relevant issue: #723
Atlassian Doc for this REST endpoint: