feat: tests for new flags API

added missing files for schema update
This commit is contained in:
Julian Lam
2021-07-09 15:57:46 -04:00
parent 66946be9f0
commit 8a02c66ed5
7 changed files with 295 additions and 173 deletions

View File

@@ -0,0 +1,38 @@
post:
tags:
- flags
summary: create a flag
description: This operation creates a new flag (with a report). If a flag already exists for a given user or post, a report will be appended to the existing flag. The response will change depending on the privilege level of the calling uid. Privileged users (moderators and up) will see the full flag details, whereas regular users will see an empty (but successful) response.
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
type:
type: string
enum: ['post', 'user']
example: 'post'
id:
type: number
example: 2
reason:
type: string
example: 'Spam'
required:
- type
- id
- reason
responses:
'200':
description: flag successfully created
content:
application/json:
schema:
type: object
properties:
status:
$ref: ../components/schemas/Status.yaml#/Status
response:
$ref: ../components/schemas/FlagObject.yaml#/FlagObject

View File

@@ -0,0 +1,67 @@
get:
tags:
- flags
summary: get a flag
description: This operation retrieve a flag's details. It is only available to privileged users (that is, moderators, global moderators, and administrators).
parameters:
- in: path
name: flagId
schema:
type: number
required: true
description: a valid flag id
example: 1
responses:
'200':
description: flag successfully retrieved
content:
application/json:
schema:
type: object
properties:
status:
$ref: ../../components/schemas/Status.yaml#/Status
response:
$ref: ../../components/schemas/FlagObject.yaml#/FlagObject
put:
tags:
- flags
summary: update a flag
description: This operation updates a flag's details. It is only available to privileged users (that is, moderators, global moderators, and administrators).
parameters:
- in: path
name: flagId
schema:
type: number
required: true
description: a valid flag id
example: 1
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
datetime:
type: number
example: 1625859990035
state:
type: string
enum: ['open', 'wip', 'resolved', 'rejected']
example: 'wip'
assignee:
type: number
example: 1
responses:
'200':
description: flag successfully updated
content:
application/json:
schema:
type: object
properties:
status:
$ref: ../../components/schemas/Status.yaml#/Status
response:
$ref: ../../components/schemas/FlagObject.yaml#/FlagHistoryObject