questable-api-docs/docs.yml

403 lines
14 KiB
YAML

openapi: 3.0.0
info:
title: Questable REST API
description: REST API for Questable Bot
version: 1.0.0
servers:
- url: "https://api.questable.webionite.com/"
paths:
/auth:
get:
summary: auth
description: Check whether the token is valid or not
parameters:
- $ref: '#/components/schemas/token'
responses:
200:
content:
application/json:
schema:
$ref: '#/components/schemas/auth'
/player:
get:
summary: player
description: Get info about the user
parameters:
- $ref: '#/components/schemas/token'
responses:
200:
description: Player object
content:
application/json:
schema:
required:
- xp
- quests_completed
- total_quests
- side_quests_completed
- total_side_quests
properties:
xp:
description: Total experience of the player
type: integer
quests_completed:
description: Quests completed
type: integer
total_quests:
description: Total quests
type: integer
side_quests_completed:
description: Side Quests completed
type: integer
total_side_quests:
description: Total side quests
type: integer
401:
$ref: "#/components/responses/bad_auth"
/get_quests:
get:
summary: get_quests
description: Get an array of incomplete quests
parameters:
- $ref: '#/components/schemas/token'
responses:
200:
description: Returns an array of incomplete quests
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/quests'
401:
$ref: "#/components/responses/bad_auth"
/get_side_quests:
get:
summary: get_side_quests
description: Get an array of incomplete side quests
parameters:
- $ref: '#/components/schemas/token'
responses:
200:
description: Returns an array of incomplete side quests
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/quests'
401:
$ref: "#/components/responses/bad_auth"
/get_quest:
get:
summary: get_quest
description: Get a Quest
parameters:
- $ref: '#/components/schemas/token'
- $ref: '#/components/schemas/id'
responses:
200:
description: Returns the quest.
content:
application/json:
schema:
$ref: '#/components/schemas/quests'
400:
$ref: "#/components/responses/bad_request"
401:
$ref: "#/components/responses/bad_auth"
404:
$ref: "#/components/responses/doesnt_exist"
/get_side_quest:
get:
summary: get_side_quest
description: Get a Side Quest
parameters:
- $ref: '#/components/schemas/token'
- $ref: '#/components/schemas/id'
responses:
200:
description: Returns the side quest.
content:
application/json:
schema:
$ref: '#/components/schemas/quests'
400:
$ref: "#/components/responses/bad_request"
401:
$ref: "#/components/responses/bad_auth"
404:
$ref: "#/components/responses/doesnt_exist"
/add_quest:
post:
summary: add_quest
description: Add a quest
parameters:
- $ref: '#/components/schemas/token'
- $ref: '#/components/schemas/name_req'
- $ref: '#/components/schemas/priority_req'
- $ref: '#/components/schemas/difficulty_req'
responses:
200:
description: Returns the added Quest
content:
application/json:
schema:
$ref: '#/components/schemas/quests'
400:
$ref: "#/components/responses/bad_request"
401:
$ref: "#/components/responses/bad_auth"
/add_side_quest:
post:
summary: add_side_quest
description: Add a side quest
parameters:
- $ref: '#/components/schemas/token'
- $ref: '#/components/schemas/name_req'
- $ref: '#/components/schemas/priority_req'
- $ref: '#/components/schemas/difficulty_req'
responses:
200:
description: Returns the added Side Quest
content:
application/json:
schema:
$ref: '#/components/schemas/quests'
400:
$ref: "#/components/responses/bad_request"
401:
$ref: "#/components/responses/bad_auth"
/update_quest:
post:
summary: update_quest
description: To change any of the parameters of a quest. (Pass atleast one of optional parameters)
parameters:
- $ref: '#/components/schemas/token'
- $ref: '#/components/schemas/id'
- $ref: '#/components/schemas/name'
- $ref: '#/components/schemas/difficulty'
- $ref: '#/components/schemas/priority'
- $ref: '#/components/schemas/state'
responses:
200:
description: Returns the updated quest.
content:
application/json:
schema:
$ref: '#/components/schemas/quests'
401:
$ref: "#/components/responses/bad_auth"
400:
$ref: "#/components/responses/bad_request"
404:
$ref: "#/components/responses/doesnt_exist"
/update_side_quest:
post:
summary: update_side_quest
description: To change any of the parameters of a side quest. (Pass atleast one of optional parameters)
parameters:
- $ref: '#/components/schemas/token'
- $ref: '#/components/schemas/id'
- $ref: '#/components/schemas/name'
- $ref: '#/components/schemas/difficulty'
- $ref: '#/components/schemas/priority'
- $ref: '#/components/schemas/state'
responses:
200:
description: Returns the updated side quest.
content:
application/json:
schema:
$ref: '#/components/schemas/quests'
401:
$ref: "#/components/responses/bad_auth"
400:
$ref: "#/components/responses/bad_request"
404:
$ref: "#/components/responses/doesnt_exist"
/delete_quest:
delete:
summary: delete_quest
description: Delete a Quest
parameters:
- $ref: '#/components/schemas/token'
- $ref: '#/components/schemas/id'
responses:
200:
$ref: '#/components/responses/success'
400:
$ref: "#/components/responses/bad_request"
401:
$ref: "#/components/responses/bad_auth"
404:
$ref: "#/components/responses/doesnt_exist"
/delete_side_quest:
delete:
summary: delete_side_quest
description: Delete a Side Quest
parameters:
- $ref: '#/components/schemas/token'
- $ref: '#/components/schemas/id'
responses:
200:
$ref: '#/components/responses/success'
400:
$ref: "#/components/responses/bad_request"
401:
$ref: "#/components/responses/bad_auth"
404:
$ref: "#/components/responses/doesnt_exist"
components:
schemas:
auth:
required:
- success
properties:
success:
type: boolean
token:
name: token
in: query
description: Token recieved from Questable Bot
required: true
schema:
type: String
id:
name: id
in: query
description: ID of the Quest/Side Quest
required: true
schema:
type: integer
quests:
required:
- id
- name
- difficulty
- priority
- state
properties:
id:
type: integer
description: ID of quest/side quest
name:
type: string
description: Name of the quest/side quest
difficulty:
type: integer
description: A value from 1 to 3 representing Low, Medium, High
priority:
type: integer
description: A value from 1 to 3 representing Low, Medium, High
state:
type: boolean
description: True if the quest/side quest has been completed
name:
name: name
in: query
description: Updated Name of the quest/side quest
required: false
schema:
type: string
priority:
name: priority
in: query
description: New Priority to set. (Low = 1, Medium = 2, High = 3)
required: false
schema:
type: integer
difficulty:
name: difficulty
in: query
description: New Difficulty to set. (Low = 1, Medium = 2, High = 3)
required: false
schema:
type: integer
state:
name: state
in: query
description: New state. (can only be true, completed quests can't be un-completed)
required: false
schema:
type: true
name_req:
name: name
in: query
description: Updated Name of the quest/side quest
required: true
schema:
type: string
priority_req:
name: priority
in: query
description: New Priority to set. (Low = 1, Medium = 2, High = 3)
required: true
schema:
type: integer
difficulty_req:
name: difficulty
in: query
description: New Difficulty to set. (Low = 1, Medium = 2, High = 3)
required: true
schema:
type: integer
responses:
bad_request:
description: The request has missing parameters.
content:
application/json:
schema:
required:
- error
properties:
error:
type: string
description: Explains the error. Possible values are "insufficient parameters"
bad_auth:
description: The token is invalid.
content:
application/json:
schema:
required:
- error
properties:
error:
type: string
description: The token is invalid
doesnt_exist:
description: The quest/side quest doesn't exist
content:
application/json:
schema:
required:
- error
properties:
error:
type: string
description: The quest/side quest doesn't exist
success:
description: Returns the success / failure
content:
application/json:
schema:
required:
- success
properties:
success:
type: boolean