mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2025-03-24 02:08:59 +03:00
382 lines
9.6 KiB
JSON
382 lines
9.6 KiB
JSON
{
|
|
"openapi": "3.0.0",
|
|
"info": {
|
|
"version": "0.1.0",
|
|
"title": "mCaptcha/guard"
|
|
},
|
|
"servers": [
|
|
{
|
|
"url": "/"
|
|
}
|
|
],
|
|
"paths": {
|
|
"/api//signup": {
|
|
"post": {
|
|
"summary": "Registration endpoint",
|
|
"operationId": "registerUser",
|
|
"tags": ["user"],
|
|
"requestBody": {
|
|
"required": true,
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/RegisterUser"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful registration"
|
|
},
|
|
"400": {
|
|
"description": "Bad request: username contains profainity/blacklisted words or email not acceptable or password too long/short or duplicate username/password",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Error"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal server error",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Error"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api//signin": {
|
|
"post": {
|
|
"summary": "Login endpoint",
|
|
"operationId": "loginUser",
|
|
"tags": ["user", "authentication"],
|
|
"requestBody": {
|
|
"required": true,
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/LoginUser"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful authentication"
|
|
},
|
|
"401": {
|
|
"description": "authentication failed, wrong password",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Error"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "username not found",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Error"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal server error",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Error"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api//signout": {
|
|
"post": {
|
|
"security": [
|
|
{
|
|
"cookieAuth": []
|
|
}
|
|
],
|
|
"summary": "Signout endpoint",
|
|
"operationId": "signoutUser",
|
|
"tags": ["user", "authentication"],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api//account/delete": {
|
|
"post": {
|
|
"security": [
|
|
{
|
|
"cookieAuth": []
|
|
}
|
|
],
|
|
"summary": "Delete user account",
|
|
"operationId": "deleteUserAccount",
|
|
"tags": ["user"],
|
|
"requestBody": {
|
|
"required": true,
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/DeleteUser"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK"
|
|
},
|
|
"401": {
|
|
"description": "(cookie)authentication required or wrong password",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Error"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "username not found",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Error"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal server error",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Error"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api//account/username/exists": {
|
|
"post": {
|
|
"summary": "Check if username exists",
|
|
"operationId": "usernameExists",
|
|
"tags": ["user"],
|
|
"requestBody": {
|
|
"required": true,
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/UserDetailCheck"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/UserDetailCheckRes"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal server error",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Error"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api//account/email/exists": {
|
|
"post": {
|
|
"summary": "Check if email exists",
|
|
"operationId": "emailExists",
|
|
"tags": ["user"],
|
|
"requestBody": {
|
|
"required": true,
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/UserDetailCheck"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/UserDetailCheckRes"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal server error",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Error"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api//meta/build": {
|
|
"post": {
|
|
"summary": "Check if email exists",
|
|
"operationId": "emailExists",
|
|
"tags": ["user"],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/BuildDetails"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"components": {
|
|
"schemas": {
|
|
"RegisterUser": {
|
|
"type": "object",
|
|
"required": ["username", "password", "email"],
|
|
"properties": {
|
|
"username": {
|
|
"type": "string"
|
|
},
|
|
"email": {
|
|
"type": "string"
|
|
},
|
|
"password": {
|
|
"type": "string",
|
|
"format": "password"
|
|
}
|
|
}
|
|
},
|
|
"LoginUser": {
|
|
"type": "object",
|
|
"required": ["username", "password"],
|
|
"properties": {
|
|
"username": {
|
|
"type": "string"
|
|
},
|
|
"password": {
|
|
"type": "string",
|
|
"format": "password"
|
|
}
|
|
}
|
|
},
|
|
"DeleteUser": {
|
|
"type": "object",
|
|
"required": ["password"],
|
|
"properties": {
|
|
"password": {
|
|
"type": "string",
|
|
"format": "password"
|
|
}
|
|
}
|
|
},
|
|
"Error": {
|
|
"type": "object",
|
|
"required": ["error"],
|
|
"properties": {
|
|
"error": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"User": {
|
|
"type": "object",
|
|
"required": ["id", "name"],
|
|
"properties": {
|
|
"id": {
|
|
"type": "integer",
|
|
"format": "int64"
|
|
},
|
|
"name": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"UserDetailCheck": {
|
|
"type": "object",
|
|
"required": ["val"],
|
|
"properties": {
|
|
"val": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"UserDetailCheckRes": {
|
|
"type": "object",
|
|
"required": ["exists"],
|
|
"properties": {
|
|
"val": {
|
|
"type": "boolean"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"BuildDetails": {
|
|
"type": "object",
|
|
"required": ["version", "git_commit_hash"],
|
|
"properties": {
|
|
"version": {
|
|
"type": "string"
|
|
},
|
|
"git_commit_hash": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
|
|
"securitySchemes": {
|
|
"cookieAuth": {
|
|
"type": "apiKey",
|
|
"in": "cookie",
|
|
"name": "Authorization"
|
|
}
|
|
}
|
|
}
|
|
}
|