Add state param to milestone listing API (#7131)
* Support state params * update tests * fix tests * add state=all support * update tests * update swagger * update swagger
This commit is contained in:
parent
59e6a7b97f
commit
de6539fc8c
8 changed files with 76 additions and 15 deletions
|
@ -14,7 +14,7 @@ import (
|
|||
api "code.gitea.io/gitea/modules/structs"
|
||||
)
|
||||
|
||||
// ListMilestones list all the opened milestones for a repository
|
||||
// ListMilestones list milestones for a repository
|
||||
func ListMilestones(ctx *context.APIContext) {
|
||||
// swagger:operation GET /repos/{owner}/{repo}/milestones issue issueGetMilestonesList
|
||||
// ---
|
||||
|
@ -32,10 +32,14 @@ func ListMilestones(ctx *context.APIContext) {
|
|||
// description: name of the repo
|
||||
// type: string
|
||||
// required: true
|
||||
// - name: state
|
||||
// in: query
|
||||
// description: Milestone state, Recognised values are open, closed and all. Defaults to "open"
|
||||
// type: string
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/MilestoneList"
|
||||
milestones, err := models.GetMilestonesByRepoID(ctx.Repo.Repository.ID)
|
||||
milestones, err := models.GetMilestonesByRepoID(ctx.Repo.Repository.ID, api.StateType(ctx.Query("state")))
|
||||
if err != nil {
|
||||
ctx.Error(500, "GetMilestonesByRepoID", err)
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue