diff --git a/public/swagger.v1.json b/public/swagger.v1.json index abc4bbb24..d73f64882 100644 --- a/public/swagger.v1.json +++ b/public/swagger.v1.json @@ -1665,6 +1665,13 @@ "in": "path", "required": true }, + { + "type": "integer", + "description": "index of the hook", + "name": "id", + "in": "path", + "required": true + }, { "name": "body", "in": "body", @@ -2892,7 +2899,7 @@ "issue" ], "summary": "Get all of a repository's milestones", - "operationId": "issueGetMilestones", + "operationId": "issueGetMilestonesList", "parameters": [ { "type": "string", @@ -2967,6 +2974,29 @@ ], "summary": "Get a milestone", "operationId": "issueGetMilestone", + "parameters": [ + { + "type": "string", + "description": "owner of the repo", + "name": "owner", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the repo", + "name": "repo", + "in": "path", + "required": true + }, + { + "type": "integer", + "description": "id of the milestone", + "name": "id", + "in": "path", + "required": true + } + ], "responses": { "200": { "$ref": "#/responses/Milestone" @@ -3035,6 +3065,13 @@ "in": "path", "required": true }, + { + "type": "integer", + "description": "id of the milestone", + "name": "id", + "in": "path", + "required": true + }, { "name": "body", "in": "body", diff --git a/routers/api/v1/repo/hook.go b/routers/api/v1/repo/hook.go index cb053d2f6..1f121dfc3 100644 --- a/routers/api/v1/repo/hook.go +++ b/routers/api/v1/repo/hook.go @@ -189,6 +189,11 @@ func EditHook(ctx *context.APIContext, form api.EditHookOption) { // description: name of the repo // type: string // required: true + // - name: id + // in: path + // description: index of the hook + // type: integer + // required: true // - name: body // in: body // schema: diff --git a/routers/api/v1/repo/milestone.go b/routers/api/v1/repo/milestone.go index 42a43a52d..a138cb7a6 100644 --- a/routers/api/v1/repo/milestone.go +++ b/routers/api/v1/repo/milestone.go @@ -16,30 +16,7 @@ import ( // ListMilestones list all the milestones for a repository func ListMilestones(ctx *context.APIContext) { - // swagger:operation GET /repos/{owner}/{repo}/milestones/{id} issue issueGetMilestone - // --- - // summary: Get a milestone - // produces: - // - application/json - // responses: - // "200": - // "$ref": "#/responses/Milestone" - milestones, err := models.GetMilestonesByRepoID(ctx.Repo.Repository.ID) - if err != nil { - ctx.Error(500, "GetMilestonesByRepoID", err) - return - } - - apiMilestones := make([]*api.Milestone, len(milestones)) - for i := range milestones { - apiMilestones[i] = milestones[i].APIFormat() - } - ctx.JSON(200, &apiMilestones) -} - -// GetMilestone get a milestone for a repository -func GetMilestone(ctx *context.APIContext) { - // swagger:operation GET /repos/{owner}/{repo}/milestones issue issueGetMilestones + // swagger:operation GET /repos/{owner}/{repo}/milestones issue issueGetMilestonesList // --- // summary: Get all of a repository's milestones // produces: @@ -58,6 +35,45 @@ func GetMilestone(ctx *context.APIContext) { // responses: // "200": // "$ref": "#/responses/MilestoneList" + milestones, err := models.GetMilestonesByRepoID(ctx.Repo.Repository.ID) + if err != nil { + ctx.Error(500, "GetMilestonesByRepoID", err) + return + } + + apiMilestones := make([]*api.Milestone, len(milestones)) + for i := range milestones { + apiMilestones[i] = milestones[i].APIFormat() + } + ctx.JSON(200, &apiMilestones) +} + +// GetMilestone get a milestone for a repository +func GetMilestone(ctx *context.APIContext) { + // swagger:operation GET /repos/{owner}/{repo}/milestones/{id} issue issueGetMilestone + // --- + // summary: Get a milestone + // produces: + // - application/json + // parameters: + // - name: owner + // in: path + // description: owner of the repo + // type: string + // required: true + // - name: repo + // in: path + // description: name of the repo + // type: string + // required: true + // - name: id + // in: path + // description: id of the milestone + // type: integer + // required: true + // responses: + // "200": + // "$ref": "#/responses/Milestone" milestone, err := models.GetMilestoneByRepoID(ctx.Repo.Repository.ID, ctx.ParamsInt64(":id")) if err != nil { if models.IsErrMilestoneNotExist(err) { @@ -136,6 +152,11 @@ func EditMilestone(ctx *context.APIContext, form api.EditMilestoneOption) { // description: name of the repo // type: string // required: true + // - name: id + // in: path + // description: id of the milestone + // type: integer + // required: true // - name: body // in: body // schema: