-
-
Notifications
You must be signed in to change notification settings - Fork 471
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 Sprint column for issue. Fix get group member function to return all members. #119
Conversation
It seems accessing https://issues.apache.org/jira/rest/agile/1.0/issue/MESOS-3325 needs to be authenticated... |
This change will affect everyone else using the library. You're changing the version of the API that we use for pulling issues. It also uses the |
I looked at this again and you're switching to the agile endpoint. This means everyone will have to switch to the agile endpoint. I don't think we should force everyone to a non-standard endpoint just to include agile feature like boards and sprints. Please move the agile endpoint into a separate entity instead of taking over the Also, I like the idea of pagination support but for everything, not just a one-off for groups. Github handles pagination nicely (https://github.com/google/go-github/blob/2f5b584d4694ff036b98283940be4d23d113e2d4/github/github.go#L352). This doesn't translate exactly to how JIRA handles it but I think it's a good start for a nicer solution that covers all cases. |
@rbriski Do you mean like the implementation for Sprint and Board APIs? I'm not sure what entity name it should be if I create a separate service for agile endpoints. Also, I'm not sure if creating a new service would be a right way for implementing the agile endpoints. BTW, is agile endpoint not stable or not ready for production use, as you have mentioned that it is non-standard? And yes, I agree that pagination support is quite important for many cases in go-jira. However, only getting the first page of something doesn't make sense for any use case. For the request for pagination, actually sb. has already reported in issues (just listed here for reference): |
Adding By "non-standard" I just mean that it may not be available to everyone. Is the agile endpoint available for projects that aren't agile? What about service desk projects? It seems like a lot of unknowns to just be dropping a new endpoint in. You could do something like Regarding pagination, yes, it should be there but I don't think this is the best way. I haven't looked closely enough to figure out a backward compatible way. I'll have more time this weekend. If you figure out a good way to add the agile "GET", just strip out the pagination stuff for now and I can merge this. Even if you do have a good idea of pagination, it would be best to have it in a separate PR. |
Looking at this more, the Agile add-on encompasses a lot more calls: You could add Sprint to the struct but I think I'd create an entirely new service just to handle agile stuff. |
The modification I applied:
|
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've been thinking about this a lot for the past few days and I have some ideas that I've laid out below. Tell me if you want me to elaborate more. I know it's been a little scattered but I think I've landed on the best solution right now.
group.go
Outdated
// User of this resource is required to have sysadmin or admin permissions. | ||
// | ||
// JIRA API docs: https://docs.atlassian.com/jira/REST/server/#api/2/group-getUsersFromGroup | ||
func (s *GroupService) GetByPage(name string, startAt int, maxResults int, includeInactiveUsers bool) (*groupMembersResult, *Response, error) { |
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.
Can you rename this to GetWithOptions
and have the method signature match this:
https://github.com/andygrunwald/go-jira/blob/master/issue.go#L783
That's a good example of how pagination is set up in this library. I'm not sure why it wasn't included in the GroupService
but ... here we are. If there's a major version change in the future, I would expect options to be included in the Get
function.
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.
Sure, this make sense. Would better to wrap these in options.
issue.go
Outdated
// | ||
// JIRA API docs: https://docs.atlassian.com/jira-software/REST/7.3.1/#agile/1.0/issue-getIssue | ||
// TODO: create agile service for holding all agile apis' implementation | ||
func (s *IssueService) GetWithAgile(issueID string, options *GetQueryOptions) (*Issue, *Response, error) { |
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.
Can you put this in the SprintService
? I'd like to keep all of the agile-specific stuff together. I think naming it GetIssue
will make sense in that service. You can also get rid of the if/else
stuff for the endpoint because they'll know exactly what they're calling if they use SprintService
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.
actually board also uses agile api. are we going to merge board to somewhere else?
Moreover, the agile api doesn't actually only add sprint information. It also comes out with the epic infor. I think it might not be proper to put in SprintService.
group.go
Outdated
@@ -18,6 +18,30 @@ type groupMembersResult struct { | |||
MaxResults int `json:"maxResults"` | |||
Total int `json:"total"` | |||
Members []GroupMember `json:"values"` | |||
IsLast bool `json:"isLast"` |
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.
Please remove these. They're not needed in this results struct.
group.go
Outdated
Client *Client `json:"-"` | ||
} | ||
|
||
func (g *groupMembersResult) GetNextPage() (*groupMembersResult, *Response, error) { |
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.
Can you remove this function? I don't think we need to copy the GetByPage
function. The code to set up the next page can be in the calling code's loop like this:
https://github.com/google/go-github#pagination
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.
The pagination stuff looks good. Just a request to use GetWithOptions
since GetByOption
doesn't make sense.
Regarding the SprintService, I agree that it's not ideal, but it's better than mixing the agile stuff in with the main API. There aren't any other functions named "Agile" and SprintService.GetIssue
keeps the agile stuff together. I know there's a BoardService
but that seems more for kanban (maybe?). JIRA certainly makes it confusing.
group.go
Outdated
// User of this resource is required to have sysadmin or admin permissions. | ||
// | ||
// JIRA API docs: https://docs.atlassian.com/jira/REST/server/#api/2/group-getUsersFromGroup | ||
func (s *GroupService) GetByOption(name string, options *GroupSearchOptions) ([]GroupMember, *Response, error) { |
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.
GetWithOptions
@zenixls2 are you still working on this? |
sorry, i was quite busy during these days, and maybe until next week. I'll fix this when i have time. |
hi, I've changed the code according to your comments |
https://developer.atlassian.com/cloud/jira/platform/rest/#api-api-2-issue-issueIdOrKey-get
to
https://docs.atlassian.com/jira-software/REST/7.3.1/#agile/1.0/issue-getIssue
in order to export Sprint column
Call Group.Get to iterate through all members instead of returning only the first page
(we have no way to exam if there's other pages of members from this api design, so return all by default)