{
  "openapi": "3.1.1",
  "info": {
    "title": "MonTools | v1",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://mon-tools.cincura.net/"
    }
  ],
  "paths": {
    "/last-modified": {
      "get": {
        "tags": [
          "MonTools"
        ],
        "summary": "Endpoint to check whether the given `url` was modified in last `seconds` using If-Modified-Since HTTP header.",
        "parameters": [
          {
            "name": "url",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "seconds",
            "in": "query",
            "required": true,
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The `url` was modified in last `seconds`."
          },
          "412": {
            "description": "The `url` was not modified in last `seconds`."
          },
          "400": {
            "description": "Invalid input provided."
          },
          "500": {
            "description": "Cannot check `url`."
          }
        }
      }
    },
    "/nts-cert": {
      "get": {
        "tags": [
          "MonTools"
        ],
        "summary": "Endpoint to check whether certificate provided by `host` NTS server is valid within `days`.",
        "parameters": [
          {
            "name": "host",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "days",
            "in": "query",
            "required": true,
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32"
            }
          },
          {
            "name": "port",
            "in": "query",
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Certificate is valid within `days`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NtsCertResponse"
                }
              }
            }
          },
          "412": {
            "description": "Certificate is not valid within `days`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NtsCertResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input provided."
          },
          "404": {
            "description": "Cannot get certificate from `host`."
          }
        }
      }
    },
    "/ntp-info": {
      "get": {
        "tags": [
          "MonTools"
        ],
        "summary": "Endpoint to get NTP server information from `host`.",
        "parameters": [
          {
            "name": "host",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "port",
            "in": "query",
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NtpInfoResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input provided."
          },
          "500": {
            "description": "Cannot connect to `host`."
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "NtpInfoResponse": {
        "required": [
          "version",
          "stratum",
          "poll",
          "precision",
          "rootDelay",
          "rootDispersion",
          "referenceTimestamp",
          "originTimestamp",
          "receiveTimestamp",
          "transmitTimestamp"
        ],
        "type": "object",
        "properties": {
          "version": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "uint8"
          },
          "stratum": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "uint8"
          },
          "poll": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ]
          },
          "precision": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ]
          },
          "rootDelay": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "uint32"
          },
          "rootDispersion": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "uint32"
          },
          "referenceId": {
            "type": [
              "null",
              "string"
            ]
          },
          "referenceTimestamp": {
            "type": "string",
            "format": "date-time"
          },
          "originTimestamp": {
            "type": "string",
            "format": "date-time"
          },
          "receiveTimestamp": {
            "type": "string",
            "format": "date-time"
          },
          "transmitTimestamp": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "NtsCertResponse": {
        "type": "object",
        "properties": {
          "subject": {
            "type": "string"
          },
          "issuer": {
            "type": "string"
          },
          "notBefore": {
            "type": "string",
            "format": "date-time"
          },
          "notAfter": {
            "type": "string",
            "format": "date-time"
          },
          "thumbprint": {
            "type": "string"
          },
          "expiresInDays": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          }
        }
      }
    }
  },
  "tags": [
    {
      "name": "MonTools"
    }
  ]
}