{
  "components": {
    "schemas": {
      "AdminData": {
        "properties": {
          "admin": {
            "type": "boolean"
          },
          "email": {
            "format": "email",
            "type": "string"
          }
        },
        "type": "object"
      },
      "CronData": {
        "properties": {
          "cron": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "DeleteSuccessful": {
        "properties": {},
        "type": "object"
      },
      "DeleteUser": {
        "properties": {
          "email": {
            "format": "email",
            "type": "string"
          }
        },
        "type": "object"
      },
      "HTTPError": {
        "properties": {
          "detail": {
            "type": "object"
          },
          "message": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "Keyword": {
        "properties": {
          "keyword": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "KeywordResponse": {
        "properties": {
          "email": {
            "format": "email",
            "type": "string"
          },
          "keyword": {
            "type": "string"
          },
          "s_id": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "LoginData": {
        "properties": {
          "email": {
            "format": "email",
            "type": "string"
          },
          "password": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "PortfolioResponse": {
        "properties": {
          "comment": {
            "type": "string"
          },
          "count": {
            "type": "integer"
          },
          "isin": {
            "type": "string"
          },
          "last_transaction": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "RegisterData": {
        "properties": {
          "email": {
            "format": "email",
            "type": "string"
          },
          "password": {
            "type": "string"
          },
          "username": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "Symbol": {
        "properties": {
          "comment": {
            "type": "string"
          },
          "isin": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "SymbolPrice": {
        "properties": {
          "isin": {
            "type": "string"
          },
          "price": {
            "type": "number"
          },
          "time": {
            "pattern": "\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z",
            "type": "string"
          }
        },
        "type": "object"
      },
      "SymbolRemove": {
        "properties": {
          "isin": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "SymbolResponse": {
        "properties": {
          "comment": {
            "type": "string"
          },
          "email": {
            "format": "email",
            "type": "string"
          },
          "isin": {
            "type": "string"
          },
          "s_id": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "TelegramId": {
        "properties": {
          "telegram_user_id": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "Token": {
        "properties": {
          "token": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "Transaction": {
        "properties": {
          "comment": {
            "type": "string"
          },
          "count": {
            "type": "integer"
          },
          "isin": {
            "type": "string"
          },
          "price": {
            "type": "number"
          },
          "time": {
            "pattern": "\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z",
            "type": "string"
          }
        },
        "type": "object"
      },
      "TransactionResponse": {
        "properties": {
          "comment": {
            "type": "string"
          },
          "count": {
            "type": "integer"
          },
          "email": {
            "format": "email",
            "type": "string"
          },
          "isin": {
            "type": "string"
          },
          "price": {
            "type": "number"
          },
          "time": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "UpdateUserData": {
        "properties": {
          "password": {
            "type": "string"
          },
          "username": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "Users": {
        "properties": {
          "admin": {
            "type": "boolean"
          },
          "cron": {
            "type": "string"
          },
          "email": {
            "format": "email",
            "type": "string"
          },
          "password": {
            "type": "string"
          },
          "telegram_user_id": {
            "type": "string"
          },
          "username": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "ValidationError": {
        "properties": {
          "detail": {
            "properties": {
              "<location>": {
                "properties": {
                  "<field_name>": {
                    "items": {
                      "type": "string"
                    },
                    "type": "array"
                  }
                },
                "type": "object"
              }
            },
            "type": "object"
          },
          "message": {
            "type": "string"
          }
        },
        "type": "object"
      }
    },
    "securitySchemes": {
      "BearerAuth": {
        "scheme": "Bearer",
        "type": "http"
      }
    }
  },
  "info": {
    "title": "APIFlask",
    "version": "0.1.0"
  },
  "openapi": "3.0.3",
  "paths": {
    "/api/keyword": {
      "delete": {
        "description": "Removes existing keyword for current user",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Keyword"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/DeleteSuccessful"
                    },
                    "status": {
                      "type": "integer"
                    },
                    "text": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Successful response"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationError"
                }
              }
            },
            "description": "Validation error"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPError"
                }
              }
            },
            "description": "Authentication error"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Removes existing keyword",
        "tags": [
          "Keyword"
        ]
      },
      "post": {
        "description": "Adds new keyword for current user",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Keyword"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "items": {
                        "$ref": "#/components/schemas/KeywordResponse"
                      },
                      "type": "array"
                    },
                    "status": {
                      "type": "integer"
                    },
                    "text": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Successful response"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationError"
                }
              }
            },
            "description": "Validation error"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPError"
                }
              }
            },
            "description": "Authentication error"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Add new keyword",
        "tags": [
          "Keyword"
        ]
      }
    },
    "/api/keywords": {
      "get": {
        "description": "Returns all keywords for current user",
        "parameters": [],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "items": {
                        "$ref": "#/components/schemas/KeywordResponse"
                      },
                      "type": "array"
                    },
                    "status": {
                      "type": "integer"
                    },
                    "text": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Successful response"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPError"
                }
              }
            },
            "description": "Authentication error"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Returns all keywords",
        "tags": [
          "Keyword"
        ]
      }
    },
    "/api/portfolio": {
      "get": {
        "description": "Returns all shares of current user",
        "parameters": [],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "items": {
                        "$ref": "#/components/schemas/PortfolioResponse"
                      },
                      "type": "array"
                    },
                    "status": {
                      "type": "integer"
                    },
                    "text": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Successful response"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPError"
                }
              }
            },
            "description": "Authentication error"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Returns portfolio",
        "tags": [
          "Portfolio"
        ]
      }
    },
    "/api/share": {
      "delete": {
        "description": "Removes existing symbol for current user",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SymbolRemove"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/DeleteSuccessful"
                    },
                    "status": {
                      "type": "integer"
                    },
                    "text": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Successful response"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationError"
                }
              }
            },
            "description": "Validation error"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPError"
                }
              }
            },
            "description": "Authentication error"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Removes existing symbol",
        "tags": [
          "Share"
        ]
      },
      "post": {
        "description": "Adds new symbol for current user",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Symbol"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "items": {
                        "$ref": "#/components/schemas/SymbolResponse"
                      },
                      "type": "array"
                    },
                    "status": {
                      "type": "integer"
                    },
                    "text": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Successful response"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationError"
                }
              }
            },
            "description": "Validation error"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPError"
                }
              }
            },
            "description": "Authentication error"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Add new symbol",
        "tags": [
          "Share"
        ]
      }
    },
    "/api/shares": {
      "get": {
        "description": "Returns all symbols for current user",
        "parameters": [],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "items": {
                        "$ref": "#/components/schemas/SymbolResponse"
                      },
                      "type": "array"
                    },
                    "status": {
                      "type": "integer"
                    },
                    "text": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Successful response"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPError"
                }
              }
            },
            "description": "Authentication error"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Returns all symbols",
        "tags": [
          "Share"
        ]
      }
    },
    "/api/symbol": {
      "post": {
        "description": "Adds new price to database",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SymbolPrice"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "Successful response"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationError"
                }
              }
            },
            "description": "Validation error"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPError"
                }
              }
            },
            "description": "Authentication error"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Adds new price for isin",
        "tags": [
          "Share_Price"
        ]
      }
    },
    "/api/symbols": {
      "get": {
        "description": "Returns all transaction symbols for all users",
        "parameters": [],
        "responses": {
          "204": {
            "description": "Successful response"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPError"
                }
              }
            },
            "description": "Authentication error"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Returns all transaction symbols",
        "tags": [
          "Share_Price"
        ]
      }
    },
    "/api/telegram": {
      "post": {
        "description": "Connects telegram user id to user account",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TelegramId"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Users"
                    },
                    "status": {
                      "type": "integer"
                    },
                    "text": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Successful response"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationError"
                }
              }
            },
            "description": "Validation error"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPError"
                }
              }
            },
            "description": "Authentication error"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Connects telegram user id",
        "tags": [
          "Telegram"
        ]
      }
    },
    "/api/transaction": {
      "post": {
        "description": "Adds new transaction for current user",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Transaction"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/TransactionResponse"
                    },
                    "status": {
                      "type": "integer"
                    },
                    "text": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Successful response"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationError"
                }
              }
            },
            "description": "Validation error"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPError"
                }
              }
            },
            "description": "Authentication error"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Adds new transaction",
        "tags": [
          "Transaction"
        ]
      }
    },
    "/api/transactions": {
      "get": {
        "description": "Returns all transactions for current user",
        "parameters": [],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Transaction"
                    },
                    "status": {
                      "type": "integer"
                    },
                    "text": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Successful response"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPError"
                }
              }
            },
            "description": "Authentication error"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Returns all transactions",
        "tags": [
          "Transaction"
        ]
      }
    },
    "/api/user": {
      "delete": {
        "description": "Deletes user by username",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeleteUser"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "Successful response"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationError"
                }
              }
            },
            "description": "Validation error"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPError"
                }
              }
            },
            "description": "Authentication error"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Delete user",
        "tags": [
          "Users"
        ]
      },
      "get": {
        "description": "Returns current user",
        "parameters": [],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Users"
                    },
                    "status": {
                      "type": "integer"
                    },
                    "text": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Successful response"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPError"
                }
              }
            },
            "description": "Authentication error"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Get current user",
        "tags": [
          "Users"
        ]
      },
      "put": {
        "description": "Changes password and/or username of current user",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateUserData"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "Successful response"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationError"
                }
              }
            },
            "description": "Validation error"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPError"
                }
              }
            },
            "description": "Authentication error"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Update user",
        "tags": [
          "Users"
        ]
      }
    },
    "/api/user/login": {
      "post": {
        "description": "Returns jwt token if username and password match, otherwise returns error",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LoginData"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Token"
                    },
                    "status": {
                      "type": "integer"
                    },
                    "text": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Successful response"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationError"
                }
              }
            },
            "description": "Validation error"
          }
        },
        "summary": "Login",
        "tags": [
          "Users"
        ]
      }
    },
    "/api/user/register": {
      "post": {
        "description": "Registers user",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RegisterData"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Users"
                    },
                    "status": {
                      "type": "integer"
                    },
                    "text": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Successful response"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationError"
                }
              }
            },
            "description": "Validation error"
          }
        },
        "summary": "Register",
        "tags": [
          "Users"
        ]
      }
    },
    "/api/user/setAdmin": {
      "put": {
        "description": "Set admin state of specified user",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AdminData"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "Successful response"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationError"
                }
              }
            },
            "description": "Validation error"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPError"
                }
              }
            },
            "description": "Authentication error"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Set user admin state",
        "tags": [
          "Users"
        ]
      }
    },
    "/api/user/setCron": {
      "put": {
        "description": "Set update cron of specified user",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CronData"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "Successful response"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationError"
                }
              }
            },
            "description": "Validation error"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPError"
                }
              }
            },
            "description": "Authentication error"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Set update cron",
        "tags": [
          "Users"
        ]
      }
    },
    "/api/users": {
      "get": {
        "description": "Returns all existing users as array",
        "parameters": [],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "items": {
                        "$ref": "#/components/schemas/Users"
                      },
                      "type": "array"
                    },
                    "status": {
                      "type": "integer"
                    },
                    "text": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Successful response"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPError"
                }
              }
            },
            "description": "Authentication error"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Get all users",
        "tags": [
          "Users"
        ]
      }
    }
  },
  "tags": [
    {
      "name": "Keyword"
    },
    {
      "name": "Share"
    },
    {
      "name": "Share_Price"
    },
    {
      "name": "Transaction"
    },
    {
      "name": "Portfolio"
    },
    {
      "name": "Users"
    },
    {
      "name": "Telegram"
    }
  ]
}
