diff options
Diffstat (limited to 'routers/api/v1/repo/issue_comment.go')
-rw-r--r-- | routers/api/v1/repo/issue_comment.go | 135 |
1 files changed, 134 insertions, 1 deletions
diff --git a/routers/api/v1/repo/issue_comment.go b/routers/api/v1/repo/issue_comment.go index b57511a2de..f0b0353d1b 100644 --- a/routers/api/v1/repo/issue_comment.go +++ b/routers/api/v1/repo/issue_comment.go @@ -15,6 +15,34 @@ import ( // ListIssueComments list all the comments of an issue func ListIssueComments(ctx *context.APIContext) { + // swagger:operation GET /repos/{owner}/{repo}/issue/{index}/comments issue issueGetComments + // --- + // summary: List all comments on an issue + // 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: index of the issue + // type: integer + // required: true + // - name: string + // in: query + // description: if provided, only comments updated since the specified time are returned. + // type: string + // responses: + // "200": + // "$ref": "#/responses/CommentList" var since time.Time if len(ctx.Query("since")) > 0 { since, _ = time.Parse(time.RFC3339, ctx.Query("since")) @@ -44,8 +72,31 @@ func ListIssueComments(ctx *context.APIContext) { ctx.JSON(200, &apiComments) } -// ListRepoIssueComments returns all issue-comments for an issue +// ListRepoIssueComments returns all issue-comments for a repo func ListRepoIssueComments(ctx *context.APIContext) { + // swagger:operation GET /repos/{owner}/{repo}/issues/comments issue issueGetRepoComments + // --- + // summary: List all comments in a repository + // 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: string + // in: query + // description: if provided, only comments updated since the provided time are returned. + // type: string + // responses: + // "200": + // "$ref": "#/responses/CommentList" var since time.Time if len(ctx.Query("since")) > 0 { since, _ = time.Parse(time.RFC3339, ctx.Query("since")) @@ -70,6 +121,36 @@ func ListRepoIssueComments(ctx *context.APIContext) { // CreateIssueComment create a comment for an issue func CreateIssueComment(ctx *context.APIContext, form api.CreateIssueCommentOption) { + // swagger:operation POST /repos/{owner}/{repo}/issues/{index}/comments issue issueCreateComment + // --- + // summary: Add a comment to an issue + // consumes: + // - application/json + // 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: index of the issue + // type: integer + // required: true + // - name: body + // in: body + // schema: + // "$ref": "#/definitions/CreateIssueOption" + // responses: + // "201": + // "$ref": "#/responses/Comment" issue, err := models.GetIssueByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index")) if err != nil { ctx.Error(500, "GetIssueByIndex", err) @@ -87,6 +168,36 @@ func CreateIssueComment(ctx *context.APIContext, form api.CreateIssueCommentOpti // EditIssueComment modify a comment of an issue func EditIssueComment(ctx *context.APIContext, form api.EditIssueCommentOption) { + // swagger:operation PATCH /repos/{owner}/{repo}/comments/{id} issue issueEditComment + // --- + // summary: Edit a comment + // consumes: + // - application/json + // 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 comment to edit + // type: integer + // required: true + // - name: body + // in: body + // schema: + // "$ref": "#/definitions/EditIssueCommentOption" + // responses: + // "200": + // "$ref": "#/responses/Comment" comment, err := models.GetCommentByID(ctx.ParamsInt64(":id")) if err != nil { if models.IsErrCommentNotExist(err) { @@ -115,6 +226,28 @@ func EditIssueComment(ctx *context.APIContext, form api.EditIssueCommentOption) // DeleteIssueComment delete a comment from an issue func DeleteIssueComment(ctx *context.APIContext) { + // swagger:operation DELETE /repos/{owner}/{repo}/comments/{id} issue issueDeleteComment + // --- + // summary: Delete a comment + // 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 comment to delete + // type: integer + // required: true + // responses: + // "204": + // "$ref": "#/responses/empty" comment, err := models.GetCommentByID(ctx.ParamsInt64(":id")) if err != nil { if models.IsErrCommentNotExist(err) { |