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

feat: add sprint agile apis #471

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

limseong
Copy link

Description

(1) What

  • Jira's Agile REST APIs provides CRUD for agile-related resources
  • Board is fully implemented in go-jira for now, but Sprint is partially implemented
  • This PR is to add more features for Sprint

(2) Why

  • To extend the list of Jira APIs that go-jira supports
  • Real world use case
    • examples/sprint/main.go
    • I wanted to have my sprint completed and a new sprint started automatically every week
    • To achieve this, new API supports are required
      • create sprint
      • update sprint (to finish or start a sprint)
      • retrieve issues of a sprint
    • With those new features,
      • create a new sprint
      • get the sprint currently active
      • finish the sprint
      • transfer the issues of the completed sprint to the sprint newly created
      • start the newly created sprint

(3) Type of change

  • New feature

(4) Breaking change

  • No
  • It's just adding new things, so it doesn't affect any of old features

(5) Related issue

  • None
  • I didn't create an issue


Example

  • I have added an example code using the new features
  • examples/sprint/main.go
  • (the real-world use case I described above)


Checklist

  • Unit or Integration tests added

    • Good Path
    • Error Path
    • NOTE: I have followed the same format of the other test files
  • Commits follow conventions described here:

  • Commits are squashed such that

    • There is 1 commit per isolated change
  • I've not made extraneous commits/changes that are unrelated to my change.

Comment on lines 67 to 76
type Sprint struct {
ID int `json:"id" structs:"id"`
Name string `json:"name" structs:"name"`
CompleteDate *time.Time `json:"completeDate" structs:"completeDate"`
EndDate *time.Time `json:"endDate" structs:"endDate"`
StartDate *time.Time `json:"startDate" structs:"startDate"`
OriginBoardID int `json:"originBoardId" structs:"originBoardId"`
Self string `json:"self" structs:"self"`
State string `json:"state" structs:"state"`
ID int `json:"id,omitempty" structs:"id,omitempty"`
Name string `json:"name,omitempty" structs:"name,omitempty"`
CompleteDate *time.Time `json:"completeDate,omitempty" structs:"completeDate,omitempty"`
EndDate *time.Time `json:"endDate,omitempty" structs:"endDate,omitempty"`
StartDate *time.Time `json:"startDate,omitempty" structs:"startDate,omitempty"`
OriginBoardID int `json:"originBoardId,omitempty" structs:"originBoardId,omitempty"`
Self string `json:"self,omitempty" structs:"self,omitempty"`
State string `json:"state,omitempty" structs:"state,omitempty"`
}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sprint struct has been used only in unmarshaling JSON responses from /boards API call.
So adding omitempty will not break any of current behaviours.

Comment on lines +192 to +216
// UpdateSprintWithContext partially updates a sprint from a JSON representation. The sprint is found by ID.
//
// Jira API docs: https://docs.atlassian.com/jira-software/REST/7.3.1/#agile/1.0/sprint-partiallyUpdateSprint
// Caller must close resp.Body
func (s *SprintService) UpdateSprintWithContext(ctx context.Context, sprintID int, data map[string]interface{}) (*Response, error) {
apiEndpoint := fmt.Sprintf("rest/agile/1.0/sprint/%v", sprintID)

req, err := s.client.NewRequestWithContext(ctx, "POST", apiEndpoint, data)
if err != nil {
return nil, err
}
resp, err := s.client.Do(req, nil)
if err != nil {
jerr := NewJiraError(resp, err)
return resp, jerr
}

return resp, nil
}

// UpdateSprint wraps UpdateSprintWithContext using the background context.
// Caller must close resp.Body
func (s *SprintService) UpdateSprint(sprintID int, data map[string]interface{}) (*Response, error) {
return s.UpdateSprintWithContext(context.Background(), sprintID, data)
}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've followed the format that caller must close response body

@andygrunwald
Copy link
Owner

Hey,

I am very sorry that this pull request has been open for a long time with no final feedback or merge/decline. We work on this project in our spare time, and sometimes, other priorities take over. This is the typical open source dilemma.

However, there is news: We are kicking off v2 of this library 🚀

To provide visibility, we created the Road to v2 Milestone and calling for your feedback in #489

The development will take some time; however, I hope you can benefit from the changes.
If you seek priority development for your pull request + you like to sponsor it, please contact me.

What does this mean for my pull request?

We will work on this pull request indirectly.
We might merge it during the development or pull parts of it into the new version.
This means that during the development phase, we aim to tackle it.
Maybe in a different way like it is currently handled.
Please understand that this will take a while because we are running this in our spare time.

Final words

Thanks for using and contributing to this library.
If there is anything else you would like to tell us, let us know!

@github-actions github-actions bot added the conflicts Indicates merge conflicts label Sep 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conflicts Indicates merge conflicts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants