Skip to content

Commit

Permalink
feat(api): update api
Browse files Browse the repository at this point in the history
  • Loading branch information
DorielRivalet committed Mar 23, 2024
1 parent 2b84547 commit 16526d9
Show file tree
Hide file tree
Showing 101 changed files with 122,980 additions and 70 deletions.
2 changes: 1 addition & 1 deletion api/docs/json/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default (req: VercelRequest, res: VercelResponse) => {
});
}

const dataPath = join(process.cwd(), "api", "docs", "json", "swagger.json");
const dataPath = join(process.cwd(), "api", "docs", "json", "openapi.json");
const data = JSON.parse(readFileSync(dataPath, "utf8"));
return res.status(200).json(data);
} catch {
Expand Down
195 changes: 195 additions & 0 deletions api/docs/json/openapi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
{
"openapi": "3.1.0",
"info": {
"title": "EZlion API Reference",
"version": "0.2.0",
"summary": "Retrieves information about Monster Hunter Frontier Z.",
"description": "This API returns a list of objects or a single object depending on the endpoint. Each list includes metadata information, and in case of an error it returns the default value in the default key. All information comes from the game Monster Hunter Frontier Z.",
"contact": {
"name": "Doriel Rivalet",
"url": "https://github.com/DorielRivalet/ezlion/issues",
"email": "[email protected]"
},
"license": {
"name": "MIT",
"url": "https://github.com/DorielRivalet/ezlion/blob/main/LICENSE"
}
},
"components": {
"examples": {
"application/json": {
"results": [
{
"id": 1,
"name": "Rathian"
},
{
"id": 2,
"name": "Fatalis"
}
],
"metadata": {
"readonly": true
}
}
},
"schemas": {
"GeneralError": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
}
}
},
"Category": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"name": {
"type": "string"
}
}
},
"Tag": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"name": {
"type": "string"
}
}
}
},
"parameters": {
"skipParam": {
"name": "skip",
"in": "query",
"description": "number of items to skip",
"required": true,
"schema": {
"type": "integer",
"format": "int32"
}
},
"limitParam": {
"name": "limit",
"in": "query",
"description": "max records to return",
"required": true,
"schema": {
"type": "integer",
"format": "int32"
}
}
},
"responses": {
"NotFound": {
"description": "Entity not found."
},
"IllegalInput": {
"description": "Illegal input for operation."
},
"GeneralError": {
"description": "General Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/GeneralError"
}
}
}
}
}
},
"paths": {
"/api/v0/monsters": {
"get": {
"summary": "Get all monsters",
"tags": ["monster"],
"responses": {
"200": {
"description": "A list of monsters in the results key. Includes metadata key.",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Tag"
}
}
}
}
},
"400": {
"description": "Bad Request. Return application/problem+json. Returns default value in default key."
},
"500": {
"description": "Internal Server Error. Return application/problem+json. Returns default value in default key."
}
}
},
"parameters": [
{
"name": "page",
"in": "query",
"description": "The page number of the results to return.",
"required": false,
"schema": {
"type": "integer",
"default": 1
}
},
{
"name": "limit",
"in": "query",
"description": "The number of results to return per page.",
"required": false,
"schema": {
"type": "integer",
"default": 10
}
}
]
},
"/api/v0/monsters/{id}": {
"get": {
"summary": "Get a monster by ID",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "integer"
}
}
],
"responses": {
"200": {
"description": "A single monster."
},
"400": {
"description": "Bad Request. Return application/problem+json. Returns default value in default key."
},
"404": {
"description": "Not Found. Return problem+json. Returns default value in default key."
},
"500": {
"description": "Internal Server Error. Return application/problem+json. Returns default value in default key."
}
}
}
}
}
}
60 changes: 0 additions & 60 deletions api/docs/json/swagger.json

This file was deleted.

6 changes: 6 additions & 0 deletions api/v0/armor-arms/[id]/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import type { VercelRequest, VercelResponse } from "@vercel/node";
import { respondWithDefaultValue } from "../../handler";

export default (req: VercelRequest, res: VercelResponse) => {
respondWithDefaultValue(req, res, "armor-arms", false);
};
Loading

0 comments on commit 16526d9

Please sign in to comment.