aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api/v1/repo/milestone.go
diff options
context:
space:
mode:
authorLanre Adelowo <adelowomailbox@gmail.com>2019-06-06 01:37:45 +0100
committerLunny Xiao <xiaolunwen@gmail.com>2019-06-06 08:37:45 +0800
commitde6539fc8c37485afcd6f30092a9ccbc3cae7de5 (patch)
tree02aec172ffe99ac123b56b301c70774f1f3f1292 /routers/api/v1/repo/milestone.go
parent59e6a7b97f503c12ef2a6096ca7f127f81521b7a (diff)
downloadgitea-de6539fc8c37485afcd6f30092a9ccbc3cae7de5.tar.gz
gitea-de6539fc8c37485afcd6f30092a9ccbc3cae7de5.zip
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
Diffstat (limited to 'routers/api/v1/repo/milestone.go')
-rw-r--r--routers/api/v1/repo/milestone.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/routers/api/v1/repo/milestone.go b/routers/api/v1/repo/milestone.go
index 1d01093306..14030a2186 100644
--- a/routers/api/v1/repo/milestone.go
+++ b/routers/api/v1/repo/milestone.go
@@ -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