From f31dd78afcb0b6e86040756404d6e3d08e8a0a0d Mon Sep 17 00:00:00 2001 From: Alexander Piskun Date: Wed, 5 Jul 2023 13:23:37 +0300 Subject: [PATCH] v.0.0.22 [publish] Signed-off-by: Alexander Piskun --- CHANGELOG.md | 6 ++++++ nc_py_api/__init__.py | 7 ++++++- nc_py_api/_version.py | 2 +- nc_py_api/integration_fastapi.py | 6 ++++++ 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d11f3fc..c0817ade 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to this project will be documented in this file. +## [0.0.22 - 2023-07-05] + +### Added + +- `heartbeat` endpoint support for AppEcosystemV2. + ## [0.0.21 - 2023-07-04] ### Added diff --git a/nc_py_api/__init__.py b/nc_py_api/__init__.py index cc901b8e..9f5eaa2a 100644 --- a/nc_py_api/__init__.py +++ b/nc_py_api/__init__.py @@ -5,6 +5,11 @@ from .constants import ApiScope, LogLvl from .exceptions import NextcloudException, check_error from .files import FsNodeInfo -from .integration_fastapi import nc_app, set_enabled_handler, set_scopes +from .integration_fastapi import ( + enable_heartbeat, + nc_app, + set_enabled_handler, + set_scopes, +) from .nextcloud import Nextcloud, NextcloudApp from .ui_files_actions_menu import UiActionFileInfo, UiFileActionHandlerInfo diff --git a/nc_py_api/_version.py b/nc_py_api/_version.py index cacb0b9f..e9829693 100644 --- a/nc_py_api/_version.py +++ b/nc_py_api/_version.py @@ -1,3 +1,3 @@ """ Version of nc_py_api""" -__version__ = "0.0.21" +__version__ = "0.0.22" diff --git a/nc_py_api/integration_fastapi.py b/nc_py_api/integration_fastapi.py index d1ae1090..b1383ebd 100644 --- a/nc_py_api/integration_fastapi.py +++ b/nc_py_api/integration_fastapi.py @@ -37,3 +37,9 @@ def enabled_handler( ): r = callback(enabled, nc) return JSONResponse(content={"error": r}, status_code=200) + + +def enable_heartbeat(fast_api_app: FastAPI): + @fast_api_app.get("/heartbeat") + def heartbeat_handler(): + return JSONResponse(content={"status": "ok"}, status_code=200)