{
    "openapi": "3.0.0",
    "servers": [
      { "url": "https://secret.anexia.com/api" }
    ],
    "info": {
      "description": "",
      "version": "1.0.0",
      "title": "secret.anexia.com API",
      "contact": {
        "email": "marketing@anexia-it.com"
      }
    },
    "tags": [
      {
        "name": "secret",
        "description": "Operations for secret"
      }
    ],
    "paths": {
      "/secret": {
        "post": {
          "tags": [
            "secret"
          ],
          "summary": "Create a new secret",
          "description": "For detailed explanation of the given parameters, see the Secret schema below",
          "operationId": "createSecret",
          "requestBody": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Secret"
                }
              }
            }
          },
          "responses": {
            "400": {
              "description": "Invalid parameters"
            },
            "201": {
              "description": "Successfully created secret",
              "content": {
                "application/json": {
                  "schema": {
                    "type": "object",
                    "properties": {
                      "url": {
                        "description": "URL to secret",
                        "type": "string"
                      },
                      "password": {
                        "description": "",
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "/secret/{url}": {
        "delete": {
          "tags": [
            "secret"
          ],
          "summary": "Delete a secret",
          "operationId": "deleteSecret",
          "parameters": [
            {
              "name": "url",
              "in": "path",
              "description": "URL of secret to delete",
              "required": true,
              "schema": {
                "type": "string"
              }
            }
          ],
          "responses": {
            "200": {
              "description": "Secret deleted successfully",
              "content": {
                "application/json": {
                  "schema": {
                    "type": "object",
                    "properties": {
                      "success": {
                        "type": "boolean"
                      }
                    }
                  }
                }
              }
            },
            "400": {
              "description": "Invalid Parameters",
              "content": {
                "application/json": {
                  "schema": {
                    "type": "object",
                    "properties": {
                      "success": {
                        "type": "boolean"
                      },
                      "error": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            },
            "404": {
              "description": "Request not found or already deleted"
            }
          }
        },
        "get": {
          "tags": [
            "secret"
          ],
          "summary": "Get Secret",
          "operationId": "getSecret",
          "parameters": [
            {
              "name": "url",
              "in": "path",
              "description": "URL of secret to get",
              "required": true,
              "schema": {
                "type": "string"
              }
            },
            {
              "name": "password",
              "in": "query",
              "description": "Password if set to view secret",
              "schema": {
                "type": "string"
              }
            }
          ],
          "responses": {
            "400": {
              "description": "Invalid Parameters",
              "content": {
                "application/json": {
                  "schema": {
                    "type": "object",
                    "properties": {
                      "success": {
                        "type": "boolean"
                      },
                      "error": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            },
            "403": {
              "description": "Wrong password"
            },
            "404": {
              "description": "Request not found or already deleted"
            },
            "200": {
              "description": "Successfully loaded secret",
              "content": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "secret": {
                      "description": "Content of secret"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "components": {
      "schemas": {
        "Secret": {
          "type": "object",
          "properties": {
            "secret": {
              "type": "string",
              "description": "Contains the secret message, if null a random 20 character secret of the charset abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!?#+-.&$ will be created",
              "example": "This is an example secret!"
            },
            "password": {
              "type": "string",
              "description": "Password used for protecting the secret with login and encrypting the secret in the database. If the parameter is empty/not provided a secret without a password will be generated that can be viewed from anyone.",
              "example": "supersecretpassword"
            },
            "expire": {
              "description": "Time when the secret will get deleted. If empty, secret will be deleted automatically after one year and when viewed one time. You can also provide a unix timestamp. Note that a expire date greater than one year will cause an error. Default value is empty",
              "example": "+1 hour",
              "oneOf": [
                {"type": "string", "example": "+1 hour", "description": "Can contain any string matching PHP's strtotime parser can understand. See here for additional documentation: https://www.php.net/manual/en/datetime.formats.relative.php"},
                {"type": "integer","example":1593776002}
              ]
            }
          }
        }
      }
    }
  }