{ "openapi": "3.1.0", "info": { "title": "API CRUD", "version": "0.1.0" }, "paths": { "/health": { "get": { "summary": "Health", "description": "Verifica o banco: um health check que so retorna 200 engana orquestrador.", "operationId": "health_health_get", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } } } } }, "/games": { "get": { "tags": [ "games" ], "summary": "List Games", "operationId": "list_games_games_get", "parameters": [ { "name": "status", "in": "query", "required": false, "schema": { "anyOf": [ { "$ref": "#/components/schemas/GameStatus" }, { "type": "null" } ], "title": "Status" } }, { "name": "platform", "in": "query", "required": false, "schema": { "anyOf": [ { "$ref": "#/components/schemas/Platform" }, { "type": "null" } ], "title": "Platform" } }, { "name": "search", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "maxLength": 120 }, { "type": "null" } ], "title": "Search" } }, { "name": "sort", "in": "query", "required": false, "schema": { "$ref": "#/components/schemas/SortField", "default": "created_at" } }, { "name": "order", "in": "query", "required": false, "schema": { "$ref": "#/components/schemas/SortOrder", "default": "desc" } }, { "name": "skip", "in": "query", "required": false, "schema": { "type": "integer", "minimum": 0, "default": 0, "title": "Skip" } }, { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "maximum": 100, "minimum": 1, "default": 20, "title": "Limit" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GamePage" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } }, "post": { "tags": [ "games" ], "summary": "Create Game", "operationId": "create_game_games_post", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GameCreate" } } } }, "responses": { "201": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GameRead" } } } }, "409": { "description": "Jogo já cadastrado nessa plataforma" }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/games/external-search": { "get": { "tags": [ "games" ], "summary": "Search External Games", "operationId": "search_external_games_games_external_search_get", "parameters": [ { "name": "q", "in": "query", "required": true, "schema": { "type": "string", "minLength": 1, "maxLength": 120, "title": "Q" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/ExternalGameResult" }, "title": "Response Search External Games Games External Search Get" } } } }, "503": { "description": "Busca externa indisponivel" }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/games/{game_id}": { "get": { "tags": [ "games" ], "summary": "Get Game", "operationId": "get_game_games__game_id__get", "parameters": [ { "name": "game_id", "in": "path", "required": true, "schema": { "type": "integer", "title": "Game Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GameRead" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } }, "patch": { "tags": [ "games" ], "summary": "Update Game", "operationId": "update_game_games__game_id__patch", "parameters": [ { "name": "game_id", "in": "path", "required": true, "schema": { "type": "integer", "title": "Game Id" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GameUpdate" } } } }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GameRead" } } } }, "409": { "description": "Jogo já cadastrado nessa plataforma" }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } }, "delete": { "tags": [ "games" ], "summary": "Delete Game", "operationId": "delete_game_games__game_id__delete", "parameters": [ { "name": "game_id", "in": "path", "required": true, "schema": { "type": "integer", "title": "Game Id" } } ], "responses": { "204": { "description": "Successful Response" }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } } }, "components": { "schemas": { "ExternalGameResult": { "properties": { "external_id": { "type": "integer", "title": "External Id" }, "name": { "type": "string", "title": "Name" }, "released": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Released" }, "cover_image_url": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Cover Image Url" } }, "type": "object", "required": [ "external_id", "name" ], "title": "ExternalGameResult", "description": "Um resultado da busca de capas no catalogo externo (RAWG)." }, "GameCreate": { "properties": { "title": { "type": "string", "maxLength": 120, "minLength": 1, "title": "Title" }, "platform": { "$ref": "#/components/schemas/Platform" }, "status": { "$ref": "#/components/schemas/GameStatus", "default": "backlog" }, "rating": { "anyOf": [ { "type": "integer", "maximum": 10.0, "minimum": 0.0 }, { "type": "null" } ], "title": "Rating" }, "hours_played": { "type": "number", "minimum": 0.0, "title": "Hours Played", "default": 0 }, "cover_image_url": { "anyOf": [ { "type": "string", "maxLength": 500 }, { "type": "null" } ], "title": "Cover Image Url" } }, "type": "object", "required": [ "title", "platform" ], "title": "GameCreate" }, "GamePage": { "properties": { "items": { "items": { "$ref": "#/components/schemas/GameRead" }, "type": "array", "title": "Items" }, "total": { "type": "integer", "title": "Total" }, "skip": { "type": "integer", "title": "Skip" }, "limit": { "type": "integer", "title": "Limit" } }, "type": "object", "required": [ "items", "total", "skip", "limit" ], "title": "GamePage", "description": "Envelope de listagem: sem `total` o frontend nao consegue paginar." }, "GameRead": { "properties": { "id": { "type": "integer", "title": "Id" }, "title": { "type": "string", "title": "Title" }, "platform": { "$ref": "#/components/schemas/Platform" }, "status": { "$ref": "#/components/schemas/GameStatus" }, "rating": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Rating" }, "hours_played": { "type": "number", "title": "Hours Played" }, "cover_image_url": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Cover Image Url" }, "created_at": { "type": "string", "format": "date-time", "title": "Created At" }, "updated_at": { "type": "string", "format": "date-time", "title": "Updated At" } }, "type": "object", "required": [ "id", "title", "platform", "status", "rating", "hours_played", "cover_image_url", "created_at", "updated_at" ], "title": "GameRead" }, "GameStatus": { "type": "string", "enum": [ "backlog", "playing", "finished", "abandoned" ], "title": "GameStatus" }, "GameUpdate": { "properties": { "title": { "anyOf": [ { "type": "string", "maxLength": 120, "minLength": 1 }, { "type": "null" } ], "title": "Title" }, "platform": { "anyOf": [ { "$ref": "#/components/schemas/Platform" }, { "type": "null" } ] }, "status": { "anyOf": [ { "$ref": "#/components/schemas/GameStatus" }, { "type": "null" } ] }, "rating": { "anyOf": [ { "type": "integer", "maximum": 10.0, "minimum": 0.0 }, { "type": "null" } ], "title": "Rating" }, "hours_played": { "anyOf": [ { "type": "number", "minimum": 0.0 }, { "type": "null" } ], "title": "Hours Played" }, "cover_image_url": { "anyOf": [ { "type": "string", "maxLength": 500 }, { "type": "null" } ], "title": "Cover Image Url" } }, "type": "object", "title": "GameUpdate" }, "HTTPValidationError": { "properties": { "detail": { "items": { "$ref": "#/components/schemas/ValidationError" }, "type": "array", "title": "Detail" } }, "type": "object", "title": "HTTPValidationError" }, "Platform": { "type": "string", "enum": [ "pc", "playstation", "xbox", "nintendo", "mobile" ], "title": "Platform" }, "SortField": { "type": "string", "enum": [ "created_at", "updated_at", "title", "rating", "hours_played" ], "title": "SortField" }, "SortOrder": { "type": "string", "enum": [ "asc", "desc" ], "title": "SortOrder" }, "ValidationError": { "properties": { "loc": { "items": { "anyOf": [ { "type": "string" }, { "type": "integer" } ] }, "type": "array", "title": "Location" }, "msg": { "type": "string", "title": "Message" }, "type": { "type": "string", "title": "Error Type" }, "input": { "title": "Input" }, "ctx": { "type": "object", "title": "Context" } }, "type": "object", "required": [ "loc", "msg", "type" ], "title": "ValidationError" } } } }