mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2025-03-29 04:38:59 +03:00
OAS: example payload
This commit is contained in:
parent
8aeab69303
commit
55dd3fffe5
4 changed files with 20 additions and 6 deletions
File diff suppressed because one or more lines are too long
21
openapi.yaml
21
openapi.yaml
|
@ -17,6 +17,10 @@ paths:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/RegisterUser'
|
$ref: '#/components/schemas/RegisterUser'
|
||||||
|
example:
|
||||||
|
username: "testuser"
|
||||||
|
password: "mysuperlongandsecurepassword"
|
||||||
|
email: "testuser@example.com"
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
description: Successful registration
|
description: Successful registration
|
||||||
|
@ -48,6 +52,9 @@ paths:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/LoginUser'
|
$ref: '#/components/schemas/LoginUser'
|
||||||
|
example:
|
||||||
|
username: "testuser"
|
||||||
|
password: "mysuperlongandsecurepassword"
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
description: Successful authentication
|
description: Successful authentication
|
||||||
|
@ -95,6 +102,8 @@ paths:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/DeleteUser'
|
$ref: '#/components/schemas/DeleteUser'
|
||||||
|
example:
|
||||||
|
password: "mysuperlongandsecurepassword"
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
description: OK
|
description: OK
|
||||||
|
@ -128,6 +137,8 @@ paths:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/UserDetailCheck'
|
$ref: '#/components/schemas/UserDetailCheck'
|
||||||
|
example:
|
||||||
|
val: "testuser"
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
description: OK
|
description: OK
|
||||||
|
@ -153,6 +164,8 @@ paths:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/UserDetailCheck'
|
$ref: '#/components/schemas/UserDetailCheck'
|
||||||
|
example:
|
||||||
|
val: "testuser@example.com"
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
description: OK
|
description: OK
|
||||||
|
@ -208,7 +221,7 @@ paths:
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/addDomain'
|
$ref: '#/components/schemas/AddDomain'
|
||||||
|
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
|
@ -246,7 +259,7 @@ paths:
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/addDomain'
|
$ref: '#/components/schemas/AddDomain'
|
||||||
|
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
|
@ -288,7 +301,7 @@ paths:
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/addDomain'
|
$ref: '#/components/schemas/AddDomain'
|
||||||
|
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
|
@ -332,7 +345,7 @@ paths:
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/addDomain'
|
$ref: '#/components/schemas/AddDomain'
|
||||||
|
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
|
|
|
@ -31,6 +31,8 @@ pub struct AddLevels {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO try for non-existent token names
|
||||||
|
|
||||||
#[post("/api/v1/mcaptcha/domain/token/levels/add")]
|
#[post("/api/v1/mcaptcha/domain/token/levels/add")]
|
||||||
pub async fn add_levels(
|
pub async fn add_levels(
|
||||||
payload: web::Json<AddLevels>,
|
payload: web::Json<AddLevels>,
|
||||||
|
|
|
@ -138,7 +138,6 @@ impl ResponseError for ServiceError {
|
||||||
ServiceError::ChallengeVerificationFailure => StatusCode::UNAUTHORIZED,
|
ServiceError::ChallengeVerificationFailure => StatusCode::UNAUTHORIZED,
|
||||||
ServiceError::CaptchaError(e) => match e {
|
ServiceError::CaptchaError(e) => match e {
|
||||||
CaptchaError::MailboxError => StatusCode::INTERNAL_SERVER_ERROR,
|
CaptchaError::MailboxError => StatusCode::INTERNAL_SERVER_ERROR,
|
||||||
|
|
||||||
_ => StatusCode::BAD_REQUEST,
|
_ => StatusCode::BAD_REQUEST,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue