mirror of
https://github.com/TheRealOwenRees/chess-scribe-api.git
synced 2026-11-18 01:52:06 +00:00
143 lines
4.2 KiB
JSON
143 lines
4.2 KiB
JSON
{
|
|
"openapi": "3.0.0",
|
|
"info": {
|
|
"title": "Chess PDF API",
|
|
"description": "Chess PDF API",
|
|
"version": "0.0.1"
|
|
},
|
|
"paths": {
|
|
"/health": {
|
|
"get": {
|
|
"summary": "Health Check",
|
|
"description": "Health check. Assume that the API is non-functional if any error code other than 200 is returned.",
|
|
"responses": {
|
|
"200": {
|
|
"description": "API is functional",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"type": {
|
|
"type": "string",
|
|
"example": "success"
|
|
},
|
|
"message": {
|
|
"type": "string",
|
|
"example": "API is functional"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/pdf": {
|
|
"post": {
|
|
"summary": "Create PDF",
|
|
"description": "Convert a PGN game to a PDF. Clock times from [%clk ...] PGN comments are rendered alongside diagrams when diagramClock is true.",
|
|
"requestBody": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"required": ["pgn"],
|
|
"properties": {
|
|
"pgn": {
|
|
"type": "string",
|
|
"description": "PGN game text, optionally containing [%clk ...] clock comments.",
|
|
"example": "1. e4 e5 2. Nf3 Nc6 *"
|
|
},
|
|
"diagramClock": {
|
|
"type": "boolean",
|
|
"description": "Render clock times alongside diagrams.",
|
|
"default": false
|
|
},
|
|
"diagrams": {
|
|
"type": "array",
|
|
"description": "Diagram selections. Each item requires fen and either ply, path, or both.",
|
|
"default": [],
|
|
"items": {
|
|
"type": "object",
|
|
"required": ["fen"],
|
|
"properties": {
|
|
"fen": {
|
|
"type": "string"
|
|
},
|
|
"ply": {
|
|
"type": "integer"
|
|
},
|
|
"path": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"201": {
|
|
"description": "PDF generated",
|
|
"content": {
|
|
"application/pdf": {
|
|
"schema": {
|
|
"type": "string",
|
|
"format": "binary"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Response for bad request",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"type": {
|
|
"type": "string",
|
|
"example": "error"
|
|
},
|
|
"message": {
|
|
"type": "string",
|
|
"example": "bad request message"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Response for internal server error",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"type": {
|
|
"type": "string",
|
|
"example": "error"
|
|
},
|
|
"message": {
|
|
"type": "string",
|
|
"example": "Internal server error"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|