-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reporting(swagger) add swagger doc for endpoints
[Finishes #167313418]
- Loading branch information
1 parent
0fcc470
commit d8fdf32
Showing
1 changed file
with
159 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
|
||
/reports/{articleSlug}: | ||
post: | ||
summary: report an article | ||
description: > | ||
report article which is not yours | ||
tags: | ||
- Report | ||
produces: | ||
- application/json | ||
parameters: | ||
- name: x-access-token | ||
in: header | ||
schema: | ||
type: string | ||
required: | ||
- authorization | ||
- name: reason | ||
in: body | ||
description: reason for reporting article | ||
responses: | ||
200: | ||
description: OK | ||
schema: | ||
$ref: '#definitions/Report' | ||
400: | ||
$ref: '#responses/BadRequest' | ||
get: | ||
summary: get reports for a certain article | ||
description: > | ||
admin can get report made for a specific article | ||
tags: | ||
- Report | ||
produces: | ||
- application/json | ||
parameters: | ||
- name: x-access-token | ||
in: header | ||
schema: | ||
type: string | ||
required: | ||
- authorization | ||
responses: | ||
200: | ||
description: Reports for an article retrieved successfully | ||
schema: | ||
$ref: '#definitions/Report' | ||
400: | ||
$ref: '#responses/BadRequest' | ||
/reports/all: | ||
get: | ||
summary: get all reports | ||
description: > | ||
admin can get all reports including pagination for it | ||
tags: | ||
- Report | ||
produces: | ||
- application/json | ||
parameters: | ||
- name: x-access-token | ||
in: header | ||
schema: | ||
type: string | ||
required: | ||
- authorization | ||
responses: | ||
200: | ||
description: Reports retrieved successfully | ||
schema: | ||
$ref: '#definitions/Report' | ||
400: | ||
$ref: '#responses/BadRequest' | ||
/reports: | ||
get: | ||
summary: get your reports | ||
description: > | ||
get all the reports you have made | ||
tags: | ||
- Report | ||
produces: | ||
- application/json | ||
parameters: | ||
- name: x-access-token | ||
in: header | ||
schema: | ||
type: string | ||
required: | ||
- authorization | ||
responses: | ||
200: | ||
description: Your reports retrieved successfully | ||
schema: | ||
$ref: '#definitions/Report' | ||
400: | ||
$ref: '#responses/BadRequest' | ||
/reports/{reportid}: | ||
delete: | ||
summary: delete your report | ||
description: > | ||
user can delete his/her report or admin can | ||
tags: | ||
- Report | ||
produces: | ||
- application/json | ||
parameters: | ||
- name: x-access-token | ||
in: header | ||
schema: | ||
type: string | ||
required: | ||
- authorization | ||
responses: | ||
200: | ||
description: Report successfully deleted | ||
schema: | ||
$ref: '#definitions/Report' | ||
400: | ||
$ref: '#responses/BadRequest' | ||
tags: | ||
- name: Report | ||
description: Operations related to Report | ||
responses: | ||
success: | ||
description: Success | ||
schema: | ||
$ref: '#/definitions/Report' | ||
BadRequest: | ||
description: Bad request | ||
schema: | ||
$ref: '#/definitions/Error' | ||
Notfound: | ||
description: Not found | ||
schema: | ||
$ref: '#/definitions/Error' | ||
definitions: | ||
Report: | ||
type: object | ||
properties: | ||
status: | ||
type: string | ||
description: username | ||
message: | ||
type: string | ||
description: description of data retrieved | ||
data: | ||
type: object | ||
description: data retrieved | ||
required: | ||
- body | ||
- image | ||
Error: | ||
type: object | ||
properties: | ||
status: | ||
type: string | ||
description: status code | ||
message: | ||
type: string | ||
description: description of error |