Multiplayer RPG

Multiplayer RPG · GPT アクション

FastAPI

  • POST /notify/Send a notification to the developer use this to report errors or the like.

    Notifies the developer of any issues with the service

  • POST /game/entities:newPlayerCreate a new player. Will automatically create the player's entity. DO NOT use to create non-player entities.

    Create a new player

  • GET /game/entitiesGet the current game entities

    Get the current game state

  • POST /game/entities:relevantToPlayerActionGet a list of entities most relevant to the current action.

    Get a list of entities most relevant to the current action.

  • PUT /game/entities:bulkUpdateOperate on multiple entities at once. Either updating state and/or creating new entities.

    Update a group of entities together.

  • GET /game/eventsGet the current game events

    Get the current game events

  • GET /log-requestLogs that this endpoint was called

    Logs that this endpoint was called

元の API スキーマ
{
  "openapi": "3.1.0",
  "info": {
    "title": "FastAPI",
    "version": "0.1.0"
  },
  "servers": [
    {
      "url": "https://llm-2.up.railway.app"
    }
  ],
  "paths": {
    "/notify/": {
      "post": {
        "summary": "Send a notification to the developer use this to report errors or the like.",
        "description": "Notifies the developer of any issues with the service",
        "operationId": "send_notification_notify__post",
        "security": [
          {
            "APIKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "message",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Message"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/game/entities:newPlayer": {
      "post": {
        "tags": [
          "game"
        ],
        "summary": "Create a new player. Will automatically create the player's entity. DO NOT use to create non-player entities.",
        "description": "Create a new player",
        "operationId": "new_player_game_entities_newPlayer_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCharacterRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Character"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          }
        ]
      }
    },
    "/game/entities": {
      "get": {
        "tags": [
          "game"
        ],
        "summary": "Get the current game entities",
        "description": "Get the current game state",
        "operationId": "get_entities_game_entities_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/EntityResponse"
                  },
                  "type": "array",
                  "title": "Response Get Entities Game Entities Get"
                }
              }
            }
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          }
        ]
      }
    },
    "/game/entities:relevantToPlayerAction": {
      "post": {
        "tags": [
          "game"
        ],
        "summary": "Get a list of entities most relevant to the current action.",
        "description": "Get a list of entities most relevant to the current action.",
        "operationId": "get_entities_relevant_to_player_action_game_entities_relevantToPlayerAction_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlayerActionRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/EntityResponse"
                  },
                  "type": "array",
                  "title": "Response Get Entities Relevant To Player Action Game Entities Relevanttoplayeraction Post"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          }
        ]
      }
    },
    "/game/entities:bulkUpdate": {
      "put": {
        "tags": [
          "game"
        ],
        "summary": "Operate on multiple entities at once. Either updating state and/or creating new entities.",
        "description": "Update a group of entities together.",
        "operationId": "bulk_update_entities_game_entities_bulkUpdate_put",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BulkEntityAction"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          }
        ]
      }
    },
    "/game/events": {
      "get": {
        "tags": [
          "game"
        ],
        "summary": "Get the current game events",
        "description": "Get the current game events",
        "operationId": "get_events_game_events_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/Event"
                  },
                  "type": "array",
                  "title": "Response Get Events Game Events Get"
                }
              }
            }
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          }
        ]
      }
    },
    "/log-request": {
      "get": {
        "tags": [
          "public"
        ],
        "summary": "Logs that this endpoint was called",
        "description": "Logs that this endpoint was called",
        "operationId": "log_request_log_request_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "BulkEntityAction": {
        "properties": {
          "updated_states": {
            "items": {
              "$ref": "#/components/schemas/EntityStateUpdate"
            },
            "type": "array",
            "title": "Updated States",
            "description": "Optional. Describes a change in state for an entity. From an initial state to an end state"
          },
          "new_entities": {
            "items": {
              "$ref": "#/components/schemas/CreateEntityRequest"
            },
            "type": "array",
            "title": "New Entities",
            "description": "Optional. Describes a new entity to create. This should be the result of player action byproducts, like chopping down a tree."
          },
          "remove_entities": {
            "items": {
              "$ref": "#/components/schemas/IdKnown"
            },
            "type": "array",
            "title": "Remove Entities",
            "description": "Optional. A list of entity IDs to remove/destroy. Used when food is eaten, for example. Maybe when an npc is killed."
          }
        },
        "type": "object",
        "title": "BulkEntityAction"
      },
      "Character": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id",
            "description": "The unique identifier of the entity."
          },
          "name": {
            "type": "string",
            "title": "Name"
          },
          "type": {
            "$ref": "#/components/schemas/EntityType"
          },
          "state": {
            "type": "object",
            "title": "State",
            "description": "The current state of the entity. Stores information on health, inventory, etc. Can even be JSON!"
          },
          "location": {
            "type": "string",
            "title": "Location",
            "description": "The location of the entity in the game world."
          }
        },
        "type": "object",
        "required": [
          "id",
          "name",
          "type",
          "state",
          "location"
        ],
        "title": "Character"
      },
      "CreateCharacterRequest": {
        "properties": {
          "name": {
            "type": "string",
            "title": "Name"
          }
        },
        "type": "object",
        "required": [
          "name"
        ],
        "title": "CreateCharacterRequest"
      },
      "CreateEntityRequest": {
        "properties": {
          "name": {
            "type": "string",
            "title": "Name"
          },
          "type": {
            "$ref": "#/components/schemas/EntityType"
          },
          "state": {
            "type": "object",
            "title": "State",
            "description": "The current state of the entity. Stores information on health, inventory, etc. Can even be JSON!"
          },
          "location": {
            "type": "string",
            "title": "Location",
            "description": "The location of the entity in the game world."
          }
        },
        "type": "object",
        "required": [
          "name",
          "type",
          "state",
          "location"
        ],
        "title": "CreateEntityRequest"
      },
      "EntityResponse": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id",
            "description": "The unique identifier of the entity."
          },
          "name": {
            "type": "string",
            "title": "Name"
          },
          "type": {
            "$ref": "#/components/schemas/EntityType"
          },
          "state": {
            "type": "object",
            "title": "State",
            "description": "The current state of the entity. Stores information on health, inventory, etc. Can even be JSON!"
          },
          "location": {
            "type": "string",
            "title": "Location",
            "description": "The location of the entity in the game world."
          }
        },
        "type": "object",
        "required": [
          "id",
          "name",
          "type",
          "state",
          "location"
        ],
        "title": "EntityResponse"
      },
      "EntityStateUpdate": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id",
            "description": "The unique identifier of the entity."
          },
          "state": {
            "type": "object",
            "title": "State",
            "description": "The current state of the entity. Stores information on health, inventory, etc. Can even be JSON!"
          }
        },
        "type": "object",
        "required": [
          "id",
          "state"
        ],
        "title": "EntityStateUpdate"
      },
      "EntityType": {
        "type": "string",
        "enum": [
          "player",
          "object",
          "npc",
          "structure"
        ],
        "title": "EntityType"
      },
      "Event": {
        "properties": {
          "name": {
            "type": "string",
            "title": "Name"
          },
          "description": {
            "type": "string",
            "title": "Description"
          },
          "time": {
            "type": "string",
            "format": "date-time",
            "title": "Time"
          }
        },
        "type": "object",
        "required": [
          "name",
          "description",
          "time"
        ],
        "title": "Event"
      },
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "IdKnown": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id",
            "description": "The unique identifier of the entity."
          }
        },
        "type": "object",
        "required": [
          "id"
        ],
        "title": "IdKnown"
      },
      "PlayerActionRequest": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id",
            "description": "The unique identifier of the entity."
          },
          "action": {
            "type": "string",
            "title": "Action",
            "description": "The action the player is taking. It should be reasonably combined with the player's and any effected entity states."
          }
        },
        "type": "object",
        "required": [
          "id",
          "action"
        ],
        "title": "PlayerActionRequest"
      },
      "ValidationError": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      }
    },
    "securitySchemes": {
      "APIKeyHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "Authorization"
      }
    }
  }
}