mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2025-02-17 08:59:46 +03:00
OAS: duration
This commit is contained in:
parent
b0c9a7b1c5
commit
8aeab69303
3 changed files with 107 additions and 2 deletions
File diff suppressed because one or more lines are too long
105
openapi.yaml
105
openapi.yaml
|
@ -678,6 +678,81 @@ paths:
|
|||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Error'
|
||||
/api/v1/mcaptcha/domain/token/token/get:
|
||||
post:
|
||||
security:
|
||||
- cookieAuth: []
|
||||
tags:
|
||||
- mcaptcha
|
||||
- domain
|
||||
- token
|
||||
- levels
|
||||
- duration
|
||||
summary: Get duration of a token
|
||||
operationId: getTokenDuration
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/GetDuration'
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Duration'
|
||||
'401':
|
||||
description: (cookie)authentication required or wrong password
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Error'
|
||||
'500':
|
||||
description: Internal server error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Error'
|
||||
|
||||
/api/v1/mcaptcha/domain/token/token/update:
|
||||
post:
|
||||
security:
|
||||
- cookieAuth: []
|
||||
tags:
|
||||
- mcaptcha
|
||||
- domain
|
||||
- token
|
||||
- levels
|
||||
- duration
|
||||
summary: update duration of a token
|
||||
operationId: updateTokenDuration
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/UpdateDuration'
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
'400':
|
||||
description: 'Bad request: Duration must be greater than 0'
|
||||
'401':
|
||||
description: (cookie)authentication required or wrong password
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Error'
|
||||
'500':
|
||||
description: Internal server error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Error'
|
||||
|
||||
|
||||
|
||||
components:
|
||||
schemas:
|
||||
|
@ -834,6 +909,36 @@ components:
|
|||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/Level'
|
||||
GetDuration:
|
||||
type: object
|
||||
required:
|
||||
- token
|
||||
properties:
|
||||
token:
|
||||
type: string
|
||||
Duration:
|
||||
type: object
|
||||
required:
|
||||
- duration
|
||||
properties:
|
||||
duration:
|
||||
type: number
|
||||
minimum: 1
|
||||
maximum: 2147483647
|
||||
|
||||
UpdateDuration:
|
||||
type: object
|
||||
required:
|
||||
- duration
|
||||
- token_name
|
||||
properties:
|
||||
token_name:
|
||||
type: string
|
||||
duration:
|
||||
type: number
|
||||
minimum: 1
|
||||
maximum: 2147483647
|
||||
|
||||
|
||||
securitySchemes:
|
||||
cookieAuth:
|
||||
|
|
|
@ -51,7 +51,7 @@ pub async fn update_duration(
|
|||
} else {
|
||||
// when mCaptcha/mCaptcha #2 is fixed, this wont be necessary
|
||||
Err(ServiceError::CaptchaError(
|
||||
m_captcha::errors::CaptchaError::DifficultyFactorZero,
|
||||
m_captcha::errors::CaptchaError::CaptchaDurationZero,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue