contrition/swagger.yaml

176 lines
4.7 KiB
YAML

openapi: 3.0.3
info:
title: Contrition
version: 0.0.1
contact:
name: Project Maintainer
email: 32350@jisedu.or.id
paths:
/oauth:
post:
tags:
- OAuth Endpoints
summary: Create a request to generate an OAuth Token
responses:
200:
description: Successfully retrieve OAuth URL
content:
application/json:
schema:
$ref: '#/components/schemas/OAuth'
/verify:
post:
tags:
- OAuth Endpoints
summary: Callback with discord auth request
responses:
200:
description: Successfully complete OAuth exchange
content:
application/json:
schema:
$ref: '#/components/schemas/OAuth'
400:
$ref: '#/components/responses/MalformedBody'
500:
$ref: '#/components/responses/ServerError'
/submit:
post:
tags:
- Form Endpoints
summary: Post an unban request appeal
requestBody:
description: Form body
required: true
content:
application/json:
schema:
type: object
properties:
token:
type: string
email:
type: string
platform:
type: string
punishment_date:
type: string
ban_reason:
type: string
appeal_reason:
type: string
additional_info:
type: string
responses:
200:
description: Successfully posted appeal request
400:
$ref: '#/components/responses/MalformedBody'
401:
$ref: '#/components/responses/InvalidToken'
422:
$ref: '#/components/responses/Unprocessable'
500:
$ref: '#/components/responses/ServerError'
components:
requestBodies:
AuthCredentials:
description: User credentials.
required: true
content:
application/json:
schema:
required:
- username
- password
type: object
properties:
username:
description: The username of the user.
type: string
password:
description: The password of the user.
type: string
responses:
MalformedBody:
description: The information in your body is incomplete, or your JSON format is invalid.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
reason: Invalid request body provided.
code: 400
InvalidToken:
description: The access token you provided is invalid or missing.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
reason: The token provided is invalid.
code: 401
NotFound:
description: The requested resource was not found.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
reason: The specified resource does not exist.
code: 404
Unprocessable:
description: The request was valid, however some of the parameters have an invalid value.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
reason: Varies
code: 422
ServerError:
description: The server could not complete a request due to an unknown error. More information may be available in the 'reason' parameter.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
reason: The internal server reached an unknown state.
code: 500
schemas:
OAuth:
type: object
properties:
redirectUrl:
type: string
format: url
Verify:
type: object
properties:
token:
type: string
user:
type: object
properties:
username:
type: string
discriminator:
type: string
banned:
type: boolean
Error:
required:
- reason
- code
type: object
properties:
reason:
description: The cause of the error message.
type: string
code:
description: The HTTP error code value accompanying the error.
type: integer