{
  "openapi": "3.0.4",
  "info": {
    "title": "Peazyrsa generator",
    "description": "service to generate ovpn configs",
    "contact": {
      "email": "mail@b4tman.ru"
    },
    "license": {
      "name": "MIT"
    },
    "version": "0.0.1"
  },
  "tags": [
    {
      "name": "OpenVPN",
      "description": "OpenVPN related"
    }
  ],
  "paths": {
    "/get": {
      "get": {
        "summary": "get directories",
        "description": "",
        "operationId": "",
        "responses": {
          "500": {
            "description": "Internal Server Error",
            "content": {
              "text/plain; charset=utf-8": {
                "examples": {
                  "error": {
                    "value": "Failed to read directory"
                  }
                }
              }
            }
          },
          "default": {
            "description": "Default sample response",
            "content": {
              "application/json": {
                "examples": {
                  "example": {
                    "value": [
                      "dir1",
                      "dir2"
                    ]
                  }
                }
              }
            }
          }
        },
        "tags": [
          "OpenVPN"
        ]
      }
    },
    "/get/<directory>": {
      "get": {
        "summary": "get directory file",
        "description": "",
        "operationId": "",
        "responses": {
          "default": {
            "description": "Default sample response",
            "content": {
              "application/json": {
                "examples": {
                  "example": {
                    "value": [
                      "file1",
                      "file2"
                    ]
                  }
                }
              }
            }
          }
        },
        "tags": [
          "OpenVPN"
        ]
      }
    },
    "/generate": {
      "summary": "generate config",
      "post": {
        "summary": "generate config",
        "description": "",
        "operationId": "",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "directory": {
                    "type": "string",
                    "example": "dir1"
                  },
                  "common_name": {
                    "type": "string",
                    "example": "computer2"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "404": {
            "description": "dir not found",
            "content": {
              "text/plain; charset=utf-8": {
                "examples": {
                  "error": {
                    "value": "Directory not found"
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "text/plain; charset=utf-8": {
                "examples": {
                  "error": {
                    "value": "Failed create config"
                  }
                }
              }
            }
          },
          "default": {
            "description": "Default sample response",
            "content": {
              "text/plain; charset=utf-8": {
                "example": "client\nproto udp\ndev tun\n...\n"
              }
            }
          }
        },
        "tags": [
          "OpenVPN"
        ]
      }
    }
  }
}