Add API version endpoint

This commit is contained in:
Inex Code 2021-11-18 09:25:33 +02:00
parent dc56b6f4ad
commit ec76484857
2 changed files with 26 additions and 1 deletions

View file

@ -48,7 +48,7 @@ def create_app():
def spec(): def spec():
if app.config["ENABLE_SWAGGER"] == "1": if app.config["ENABLE_SWAGGER"] == "1":
swag = swagger(app) swag = swagger(app)
swag["info"]["version"] = "1.0" swag["info"]["version"] = "1.0.0"
swag["info"]["title"] = "SelfPrivacy API" swag["info"]["title"] = "SelfPrivacy API"
swag["info"]["description"] = "SelfPrivacy API" swag["info"]["description"] = "SelfPrivacy API"
swag["securityDefinitions"] = { swag["securityDefinitions"] = {

View file

@ -4,6 +4,31 @@ import subprocess
from flask_restful import Resource, reqparse from flask_restful import Resource, reqparse
class ApiVersion(Resource):
"""SelfPrivacy API version"""
def get(self):
"""Get API version
---
tags:
- System
security:
- bearerAuth: []
responses:
200:
description: API version
schema:
type: object
properties:
version:
type: string
description: API version
401:
description: Unauthorized
"""
return {"version": "1.0.0"}
class DecryptDisk(Resource): class DecryptDisk(Resource):
"""Decrypt disk""" """Decrypt disk"""