Open World Craft

Open World Craft · GPT-Aktionen

Character Management API

API for creating and managing characters in a game.

  • POST /api/characters/createCreateCharacter

    Create a new character with 50 copper, 100 hp, 0 xp.

  • GET /api/characters/fetchFetchCharacter

    Fetch a character's information.

  • PUT /api/characters/updateUpdateCharacter

    Update a characters information.

  • POST /api/characters/travelTravelCharacter

    Attampt to travel to a new zone. Returns wether the travel was successful or not.

  • POST /api/zones/createCreateZone

    Create a new Zone.

  • GET /api/zones/fetchFetchZone

    Fetch a zone's information.

  • PUT /api/zones/updateUpdateZone

    Update a zone's description.

  • POST /api/signs/createCreateSign

    Create a new Sign.

  • PUT /api/quests/contributeContrinbuteToQuest

    Contribute to a community quest.

  • POST /api/points-of-interest/createCreatePOI

    Create a new Point of Interest.

  • GET /api/points-of-interest/fetchFetchPOI

    Fetch a single point-of-interest's information.

  • PUT /api/points-of-interest/updateUpdatePOI

    Update a point of interest's description.

Ursprüngliches API-Schema
{
  "openapi": "3.1.0",
  "info": {
    "title": "Character Management API",
    "description": "API for creating and managing characters in a game.",
    "version": "v1.0.0"
  },
  "servers": [
    {
      "url": "https://www.openworldcraft.com"
    }
  ],
  "paths": {
    "/api/characters/create": {
      "post": {
        "description": "Create a new character with 50 copper, 100 hp, 0 xp.",
        "x-openai-isConsequential": false,
        "operationId": "CreateCharacter",
        "requestBody": {
          "description": "Character creation request body with unique identifier.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "format": "text",
                    "description": "The name of the character"
                  },
                  "notes": {
                    "type": "string",
                    "format": "text",
                    "description": "Any notes about the character"
                  },
                  "pack": {
                    "type": "string",
                    "format": "json",
                    "description": "a json string of coins, weapons, and items and their count"
                  }
                },
                "required": [
                  "name",
                  "notes",
                  "pack"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "The uuid of the created character"
                    }
                  }
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/api/characters/fetch": {
      "get": {
        "description": "Fetch a character's information.",
        "operationId": "FetchCharacter",
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "description": "The character id from the open world API.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "deprecated": false,
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "The uuid of the character."
                    },
                    "xp": {
                      "type": "integer",
                      "description": "The total xp for this character."
                    },
                    "name": {
                      "type": "string",
                      "description": "The name of the character."
                    },
                    "pack": {
                      "type": "object",
                      "description": "coins, weapons, and items and their count"
                    },
                    "zone": {
                      "type": "string",
                      "description": "The zone coordinates currently occupied by the character."
                    },
                    "hp": {
                      "type": "integer",
                      "description": "The current hp for this character."
                    },
                    "notes": {
                      "type": "string",
                      "description": "Additional notes for the character."
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/characters/update": {
      "put": {
        "description": "Update a characters information.",
        "x-openai-isConsequential": false,
        "operationId": "UpdateCharacter",
        "requestBody": {
          "description": "Update any of the information for a character.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "The character uuid from the open world API."
                  },
                  "name": {
                    "type": "string",
                    "format": "text",
                    "description": "The name of the character"
                  },
                  "hp": {
                    "type": "integer",
                    "format": "int64",
                    "description": "The total hit points for a character"
                  },
                  "xp": {
                    "type": "integer",
                    "format": "int64",
                    "description": "The total xp for a character"
                  },
                  "pack": {
                    "type": "string",
                    "format": "json",
                    "description": "a json string of coins, weapons, and items and their count"
                  },
                  "notes": {
                    "type": "string",
                    "format": "text",
                    "description": "notes to manage any other additional information about a character"
                  }
                },
                "required": [
                  "id"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "description": "The updated character data"
                    }
                  }
                }
              }
            }
          },
          "237": {
            "description": "Successful. Character has leveled up.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "description": "The updated character data"
                    },
                    "levelUp": {
                      "type": "boolean",
                      "description": "Indicates the character leveled up"
                    }
                  }
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/api/characters/travel": {
      "post": {
        "description": "Attampt to travel to a new zone. Returns wether the travel was successful or not.",
        "x-openai-isConsequential": false,
        "operationId": "TravelCharacter",
        "requestBody": {
          "description": "Attempt to travel to a new zone.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "The character uuid from the open world API."
                  },
                  "direction": {
                    "type": "string",
                    "format": "text",
                    "description": "The attempted travel direction; north, south, east, or west"
                  }
                },
                "required": [
                  "id",
                  "direction"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The character was travelled successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "description": "The updated character data"
                    },
                    "newCoordinates": {
                      "type": "string",
                      "description": "The coordinates of the new zone the character is in"
                    },
                    "zone": {
                      "type": "object",
                      "description": "The zone object where the character is now located",
                      "properties": {
                        "id": {
                          "type": "integer",
                          "description": "The id of the zone."
                        },
                        "name": {
                          "type": "string",
                          "description": "The name of the zone."
                        },
                        "description": {
                          "type": "string",
                          "description": "The description of the zone."
                        },
                        "coordinates": {
                          "type": "string",
                          "description": "The coordinates of the zone."
                        },
                        "imageUrl": {
                          "type": "string",
                          "description": "The URL of the zone's image."
                        },
                        "level": {
                          "type": "integer",
                          "description": "The level of the zone."
                        },
                        "pointsOfInterest": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "description": "The discovered points of interest in this zone.",
                            "properties": {
                              "id": {
                                "type": "integer",
                                "description": "The id of the sign."
                              },
                              "name": {
                                "type": "string",
                                "description": "The name of the point of interest."
                              },
                              "description": {
                                "type": "string",
                                "description": "Text describing the current state of the point of interest."
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "201": {
            "description": "A new zone was discovered.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "description": "The character data."
                    },
                    "newCoordinates": {
                      "type": "string",
                      "description": "The coordinates of the new zone."
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "The Zone is Impassable Terrain."
          },
          "402": {
            "description": "The Zone is blocke due to a quest dependency.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "The error message."
                    },
                    "questDependency": {
                      "type": "object",
                      "description": "The quest that needs to be completed to unblock the zone.",
                      "properties": {
                        "id": {
                          "type": "integer",
                          "description": "The id of the quest."
                        },
                        "title": {
                          "type": "string",
                          "description": "The title of the quest."
                        },
                        "description": {
                          "type": "string",
                          "description": "The description of the quest."
                        },
                        "requirements": {
                          "type": "object",
                          "description": "The requirements of the quest."
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "420": {
            "description": "The Character needs to wait to move again."
          }
        },
        "deprecated": false
      }
    },
    "/api/zones/create": {
      "post": {
        "description": "Create a new Zone.",
        "x-openai-isConsequential": false,
        "operationId": "CreateZone",
        "requestBody": {
          "description": "Attributes of the new zone.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "format": "text",
                    "description": "The name of the zone"
                  },
                  "description": {
                    "type": "string",
                    "format": "text",
                    "description": "Flavor text to describe the zone, and some of its points of interest"
                  },
                  "coordinates": {
                    "type": "string",
                    "format": "text",
                    "description": "A string of coordinates to describe the zone's location. in the format (X,Y)"
                  },
                  "hostility": {
                    "type": "integer",
                    "format": "int64",
                    "description": "A number between 1 to 10 to describe the hostility of the zone. 1 is peaceful, 10 is extremely hostile"
                  },
                  "discovered_by": {
                    "type": "string",
                    "format": "uuid",
                    "description": "The uuid of the character that discovered the zone"
                  }
                },
                "required": [
                  "name",
                  "description",
                  "coordinates",
                  "hostility",
                  "discovered_by"
                ]
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/api/zones/fetch": {
      "get": {
        "description": "Fetch a zone's information.",
        "operationId": "FetchZone",
        "parameters": [
          {
            "name": "coordinates",
            "in": "query",
            "description": "The coordinates of a zone to be fetched. In the format (X,Y).",
            "required": true,
            "schema": {
              "type": "string",
              "format": "text"
            }
          }
        ],
        "deprecated": false,
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "integer",
                      "description": "The id of the zone."
                    },
                    "name": {
                      "type": "string",
                      "description": "The name of the zone."
                    },
                    "description": {
                      "type": "string",
                      "description": "The description of the zone."
                    },
                    "coordinates": {
                      "type": "string",
                      "description": "The coordinates of the zone."
                    },
                    "imageUrl": {
                      "type": "string",
                      "description": "The URL of the zone's image."
                    },
                    "level": {
                      "type": "integer",
                      "description": "The level of the zone."
                    },
                    "pointsOfInterest": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "description": "The discovered points of interest in this zone.",
                        "properties": {
                          "id": {
                            "type": "integer",
                            "description": "The id of the sign."
                          },
                          "name": {
                            "type": "string",
                            "description": "The name of the point of interest."
                          },
                          "description": {
                            "type": "string",
                            "description": "Text describing the current state of the point of interest."
                          }
                        }
                      }
                    },
                    "adjacentZones": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "description": "The adjacent zones to the current zone.",
                        "properties": {
                          "coordinates": {
                            "type": "string",
                            "description": "The coordinates of the adjacent zone."
                          },
                          "discovered": {
                            "type": "boolean",
                            "description": "Whether the zone has been discovered or not."
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/zones/update": {
      "put": {
        "description": "Update a zone's description.",
        "x-openai-isConsequential": false,
        "operationId": "UpdateZone",
        "requestBody": {
          "description": "Attributes of the zone to be updated.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "coordinates": {
                    "type": "string",
                    "format": "text",
                    "description": "The coordinates of the zone to be updated."
                  },
                  "description": {
                    "type": "string",
                    "format": "text",
                    "description": "The new description for the zone."
                  }
                },
                "required": [
                  "coordinates",
                  "description"
                ]
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/api/signs/create": {
      "post": {
        "description": "Create a new Sign.",
        "x-openai-isConsequential": false,
        "operationId": "CreateSign",
        "requestBody": {
          "description": "Attributes of the sign.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "format": "text",
                    "description": "The text for this sign"
                  },
                  "by_character": {
                    "type": "string",
                    "format": "uuid",
                    "description": "The uuid of the character that wrote this sign"
                  },
                  "point_of_interest": {
                    "type": "integer",
                    "format": "int64",
                    "description": "The ID of the point of interest this sign belongs to"
                  }
                },
                "required": [
                  "text",
                  "by_character",
                  "point_of_interest"
                ]
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/api/quests/contribute": {
      "put": {
        "description": "Contribute to a community quest.",
        "operationId": "ContrinbuteToQuest",
        "requestBody": {
          "description": "The character's contributions.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "integer",
                    "format": "int64",
                    "description": "The quest id."
                  },
                  "characterId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "The character id that is contributing."
                  },
                  "contribution": {
                    "type": "string",
                    "format": "json",
                    "description": "a json string of the contribution to the quest. The key is the item and the value is the amount."
                  }
                },
                "required": [
                  "coordinates",
                  "description",
                  "contribution"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful contribution"
          },
          "222": {
            "description": "Quest Completed!"
          },
          "488": {
            "description": "Contribution not accepted, quest already completed."
          }
        },
        "deprecated": false
      }
    },
    "/api/points-of-interest/create": {
      "post": {
        "description": "Create a new Point of Interest.",
        "x-openai-isConsequential": false,
        "operationId": "CreatePOI",
        "requestBody": {
          "description": "Attributes of the new point of interest.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "format": "text",
                    "description": "The name of the zone"
                  },
                  "description": {
                    "type": "string",
                    "format": "text",
                    "description": "Flavor text to describe the zone, and some of its points of interest"
                  },
                  "zone": {
                    "type": "integer",
                    "format": "int64",
                    "description": "The Zone ID of the zone this point of interest belongs to"
                  }
                },
                "required": [
                  "name",
                  "description",
                  "zone"
                ]
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/api/points-of-interest/fetch": {
      "get": {
        "description": "Fetch a single point-of-interest's information.",
        "operationId": "FetchPOI",
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "description": "The id of the point of interest to be fetched.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "deprecated": false,
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "integer",
                      "description": "The id of the point of interest."
                    },
                    "name": {
                      "type": "string",
                      "description": "The name of the point of interest."
                    },
                    "description": {
                      "type": "string",
                      "description": "The description of the point of interest and the NPCs within."
                    },
                    "signs": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "description": "The signs at this point of interest.",
                        "properties": {
                          "id": {
                            "type": "integer",
                            "description": "The id of the sign."
                          },
                          "by_character": {
                            "type": "string",
                            "description": "The name of the character that wrote the sign."
                          },
                          "text": {
                            "type": "string",
                            "description": "The text on the sign."
                          }
                        }
                      }
                    },
                    "quests": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "description": "The quests at this point of interest.",
                        "properties": {
                          "id": {
                            "type": "integer",
                            "description": "The id of the quest."
                          },
                          "title": {
                            "type": "string",
                            "description": "The name of the quest."
                          },
                          "description": {
                            "type": "string",
                            "description": "The description of the quest."
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/points-of-interest/update": {
      "put": {
        "description": "Update a point of interest's description.",
        "x-openai-isConsequential": false,
        "operationId": "UpdatePOI",
        "requestBody": {
          "description": "Attributes of the point of interest to be updated.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "integer",
                    "format": "int64",
                    "description": "The id of the point of interest to be updated."
                  },
                  "description": {
                    "type": "string",
                    "format": "text",
                    "description": "The updated state for the point of interest."
                  }
                },
                "required": [
                  "id",
                  "description"
                ]
              }
            }
          }
        },
        "deprecated": false
      }
    }
  },
  "components": {
    "schemas": {}
  }
}