{
  "openapi": "3.1.0",
  "info": {
    "title": "Cow Hunter public API",
    "version": "1.0.0",
    "summary": "The two read-only routes of the Cow Hunter world service.",
    "description": "No key and no account. These are the routes the game client itself reads: the shared table of finished runs, and the modifiers currently live on the field. The routes that create and finish a run are not public - a score is only filed by playing the round.",
    "contact": {
      "name": "Sergei Vorniches",
      "url": "https://cowhunter.lol/"
    },
    "license": {
      "name": "All rights reserved",
      "url": "https://cowhunter.lol/"
    }
  },
  "servers": [
    {
      "url": "https://cowhunter.lol",
      "description": "Production"
    }
  ],
  "paths": {
    "/api/runs": {
      "get": {
        "operationId": "getRuns",
        "summary": "Read the shared table",
        "description": "Finished runs, highest score first.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "How many rows to return, 1 to 100.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 10
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The table.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "runs"
                  ],
                  "properties": {
                    "runs": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "id",
                          "name",
                          "score",
                          "kills",
                          "combo",
                          "explosions",
                          "car",
                          "seconds",
                          "world",
                          "at"
                        ],
                        "properties": {
                          "id": {
                            "type": "integer",
                            "description": "Row identifier in the shared table."
                          },
                          "name": {
                            "type": "string",
                            "description": "The name the run was filed under."
                          },
                          "score": {
                            "type": "integer",
                            "description": "Dollars scored in the round."
                          },
                          "kills": {
                            "type": "integer",
                            "description": "Cows hit."
                          },
                          "combo": {
                            "type": "integer",
                            "description": "Longest combo in the round."
                          },
                          "explosions": {
                            "type": "integer",
                            "description": "Dynamite cows set off."
                          },
                          "car": {
                            "type": "string",
                            "enum": [
                              "bizon",
                              "viper",
                              "cricket"
                            ],
                            "description": "Vehicle driven."
                          },
                          "seconds": {
                            "type": "integer",
                            "description": "How long the round lasted, clock pickups included."
                          },
                          "world": {
                            "type": "string",
                            "description": "Modifiers live during the run, as key=value pairs."
                          },
                          "at": {
                            "type": "integer",
                            "description": "When the run was filed, epoch milliseconds."
                          },
                          "country": {
                            "type": "string",
                            "description": "Two-letter country the run was filed from, when known."
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/world": {
      "get": {
        "operationId": "getWorld",
        "summary": "Read the live field modifiers",
        "description": "Modifiers that have not lapsed. An empty list means an unmodified field.",
        "responses": {
          "200": {
            "description": "The live modifiers.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "mods"
                  ],
                  "properties": {
                    "mods": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "key",
                          "value",
                          "name",
                          "until"
                        ],
                        "properties": {
                          "key": {
                            "type": "string",
                            "description": "Which world rule is modified, such as round.seconds."
                          },
                          "value": {
                            "type": "number",
                            "description": "The value in force, already inside the rule’s bounds."
                          },
                          "name": {
                            "type": "string",
                            "description": "Who set it."
                          },
                          "until": {
                            "type": "integer",
                            "description": "When it lapses, epoch milliseconds."
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
