Skip to content

Commit ad78480

Browse files
committed
add swagger information
1 parent 5623f8b commit ad78480

File tree

2 files changed

+255
-2
lines changed

2 files changed

+255
-2
lines changed

routers/api/v1/repo/issue_comment.go

Lines changed: 80 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,12 +457,90 @@ func GetCommentReactions(ctx *context.APIContext, form api.CommentReactionList)
457457
}
458458

459459
func AddCommentReaction(ctx *context.APIContext, form api.CommentReaction) {
460-
460+
// swagger:operation PUT /repos/{owner}/{repo}/issues/{index}/comments/{id}/reactions issue issueAddCommentReaction
461+
// ---
462+
// summary: Create reaction to a comment
463+
// consumes:
464+
// - application/json
465+
// produces:
466+
// - application/json
467+
// parameters:
468+
// - name: owner
469+
// in: path
470+
// description: owner of the repo
471+
// type: string
472+
// required: true
473+
// - name: repo
474+
// in: path
475+
// description: name of the repo
476+
// type: string
477+
// required: true
478+
// - name: index
479+
// in: path
480+
// description: index of the issue
481+
// type: integer
482+
// required: true
483+
// - name: id
484+
// in: path
485+
// description: id of the comment
486+
// type: integer
487+
// format: int64
488+
// required: true
489+
// - name: body
490+
// in: body
491+
// schema:
492+
// "$ref": "#/definitions/CommentReaction"
493+
// responses:
494+
// "201":
495+
// "$ref": "#/responses/empty"
496+
// "304":
497+
// description: User can only create reactions for itself if he is no admin
498+
// "404":
499+
// description: Comment not found
461500
setCommentReaction(ctx, form, true)
462501
}
463502

464503
func DelCommentReaction(ctx *context.APIContext, form api.CommentReaction) {
465-
504+
// swagger:operation DELETE /repos/{owner}/{repo}/issues/{index}/comments/{id}/reactions issue issueDelCommentReaction
505+
// ---
506+
// summary: Delete reaction to a comment
507+
// consumes:
508+
// - application/json
509+
// produces:
510+
// - application/json
511+
// parameters:
512+
// - name: owner
513+
// in: path
514+
// description: owner of the repo
515+
// type: string
516+
// required: true
517+
// - name: repo
518+
// in: path
519+
// description: name of the repo
520+
// type: string
521+
// required: true
522+
// - name: index
523+
// in: path
524+
// description: index of the issue
525+
// type: integer
526+
// required: true
527+
// - name: id
528+
// in: path
529+
// description: id of the comment
530+
// type: integer
531+
// format: int64
532+
// required: true
533+
// - name: body
534+
// in: body
535+
// schema:
536+
// "$ref": "#/definitions/CommentReaction"
537+
// responses:
538+
// "201":
539+
// "$ref": "#/responses/empty"
540+
// "304":
541+
// description: User can only delete reactions for itself if he is no admin
542+
// "404":
543+
// description: Comment not found
466544
setCommentReaction(ctx, form, false)
467545
}
468546

templates/swagger/v1_json.tmpl

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3388,6 +3388,181 @@
33883388
}
33893389
}
33903390
},
3391+
"/repos/{owner}/{repo}/issues/{index}/comments/{id}/reactions": {
3392+
"get": {
3393+
"consumes": [
3394+
"application/json"
3395+
],
3396+
"produces": [
3397+
"application/json"
3398+
],
3399+
"tags": [
3400+
"issue"
3401+
],
3402+
"summary": "Return all reactions of a specific comment",
3403+
"operationId": "issueGetCommentReactions",
3404+
"parameters": [
3405+
{
3406+
"type": "string",
3407+
"description": "owner of the repo",
3408+
"name": "owner",
3409+
"in": "path",
3410+
"required": true
3411+
},
3412+
{
3413+
"type": "string",
3414+
"description": "name of the repo",
3415+
"name": "repo",
3416+
"in": "path",
3417+
"required": true
3418+
},
3419+
{
3420+
"type": "integer",
3421+
"description": "index of the issue",
3422+
"name": "index",
3423+
"in": "path",
3424+
"required": true
3425+
},
3426+
{
3427+
"type": "integer",
3428+
"format": "int64",
3429+
"description": "id of the comment",
3430+
"name": "id",
3431+
"in": "path",
3432+
"required": true
3433+
}
3434+
],
3435+
"responses": {
3436+
"200": {
3437+
"$ref": "#/responses/CommentReactions"
3438+
}
3439+
}
3440+
},
3441+
"put": {
3442+
"consumes": [
3443+
"application/json"
3444+
],
3445+
"produces": [
3446+
"application/json"
3447+
],
3448+
"tags": [
3449+
"issue"
3450+
],
3451+
"summary": "Create reaction to a comment",
3452+
"operationId": "issueAddCommentReaction",
3453+
"parameters": [
3454+
{
3455+
"type": "string",
3456+
"description": "owner of the repo",
3457+
"name": "owner",
3458+
"in": "path",
3459+
"required": true
3460+
},
3461+
{
3462+
"type": "string",
3463+
"description": "name of the repo",
3464+
"name": "repo",
3465+
"in": "path",
3466+
"required": true
3467+
},
3468+
{
3469+
"type": "integer",
3470+
"description": "index of the issue",
3471+
"name": "index",
3472+
"in": "path",
3473+
"required": true
3474+
},
3475+
{
3476+
"type": "integer",
3477+
"format": "int64",
3478+
"description": "id of the comment",
3479+
"name": "id",
3480+
"in": "path",
3481+
"required": true
3482+
},
3483+
{
3484+
"name": "body",
3485+
"in": "body",
3486+
"schema": {
3487+
"$ref": "#/definitions/CommentReaction"
3488+
}
3489+
}
3490+
],
3491+
"responses": {
3492+
"201": {
3493+
"$ref": "#/responses/empty"
3494+
},
3495+
"304": {
3496+
"description": "User can only create reactions for itself if he is no admin"
3497+
},
3498+
"404": {
3499+
"description": "Comment not found"
3500+
}
3501+
}
3502+
},
3503+
"delete": {
3504+
"consumes": [
3505+
"application/json"
3506+
],
3507+
"produces": [
3508+
"application/json"
3509+
],
3510+
"tags": [
3511+
"issue"
3512+
],
3513+
"summary": "Delete reaction to a comment",
3514+
"operationId": "issueDelCommentReaction",
3515+
"parameters": [
3516+
{
3517+
"type": "string",
3518+
"description": "owner of the repo",
3519+
"name": "owner",
3520+
"in": "path",
3521+
"required": true
3522+
},
3523+
{
3524+
"type": "string",
3525+
"description": "name of the repo",
3526+
"name": "repo",
3527+
"in": "path",
3528+
"required": true
3529+
},
3530+
{
3531+
"type": "integer",
3532+
"description": "index of the issue",
3533+
"name": "index",
3534+
"in": "path",
3535+
"required": true
3536+
},
3537+
{
3538+
"type": "integer",
3539+
"format": "int64",
3540+
"description": "id of the comment",
3541+
"name": "id",
3542+
"in": "path",
3543+
"required": true
3544+
},
3545+
{
3546+
"name": "body",
3547+
"in": "body",
3548+
"schema": {
3549+
"$ref": "#/definitions/CommentReaction"
3550+
}
3551+
}
3552+
],
3553+
"responses": {
3554+
"201": {
3555+
"$ref": "#/responses/empty"
3556+
},
3557+
"304": {
3558+
"description": "User can only delete reactions for itself if he is no admin"
3559+
},
3560+
"404": {
3561+
"description": "Comment not found"
3562+
}
3563+
}
3564+
}
3565+
},
33913566
"/repos/{owner}/{repo}/issues/{index}/deadline": {
33923567
"post": {
33933568
"consumes": [

0 commit comments

Comments
 (0)