docs: add docstrings and sphinx, readthedocs configuration

This commit is contained in:
lucasheld 2022-12-16 21:39:18 +01:00
parent face6c731d
commit ce5ba2d943
20 changed files with 2578 additions and 110 deletions

1
.gitignore vendored
View file

@ -4,3 +4,4 @@ venv
__pycache__
*.egg-info
dist
docs/_build

6
.readthedocs.yaml Normal file
View file

@ -0,0 +1,6 @@
version: 2
python:
install:
- method: pip
path: .

20
docs/Makefile Normal file
View file

@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

38
docs/api.rst Normal file
View file

@ -0,0 +1,38 @@
.. _api:
Main Interface
--------------
.. module:: uptime_kuma_api
.. autoclass:: UptimeKumaApi
:inherited-members:
Enums
-----
.. autoclass:: AuthMethod
:members:
.. autoclass:: MonitorType
:members:
.. autoclass:: NotificationType
:members:
.. autoclass:: ProxyProtocol
:members:
.. autoclass:: IncidentStyle
:members:
.. autoclass:: DockerType
:members:
Exceptions
----------
.. autoexception:: UptimeKumaException

53
docs/conf.py Normal file
View file

@ -0,0 +1,53 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
import os
import sys
sys.path.insert(0, os.path.abspath(".."))
import uptime_kuma_api
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
project = 'uptime-kuma-api'
copyright = '2022, Lucas Held'
author = 'Lucas Held'
version = uptime_kuma_api.__version__
release = uptime_kuma_api.__version__
# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
extensions = [
"sphinx.ext.autodoc"
]
templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
toc_object_entries_show_parents = "hide"
autodoc_member_order = "bysource"
add_module_names = False
# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
html_theme = 'alabaster'
html_static_path = ['_static']
html_theme_options = {
"show_powered_by": False,
"github_user": "lucasheld",
"github_repo": "uptime-kuma-api",
"github_banner": True,
"show_related": False,
"note_bg": "#FFF59C",
"github_button": True,
"github_type": "star"
}

32
docs/index.rst Normal file
View file

@ -0,0 +1,32 @@
.. uptime-kuma-api documentation master file, created by
sphinx-quickstart on Thu Dec 15 11:58:11 2022.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
uptime-kuma-api
===============
Release v\ |version|. (:ref:`Installation <install>`)
A Python wrapper for the Uptime Kuma Socket.IO API
-------------------
Indices and tables
------------------
* :ref:`genindex`
* :ref:`search`
API Reference
-------------
If you are looking for information on a specific function, class, or method,
this part of the documentation is for you.
.. toctree::
:maxdepth: 3
api

8
docs/install.rst Normal file
View file

@ -0,0 +1,8 @@
.. _install:
Installation
------------
To install uptime-kuma-api, run this command in your terminal::
$ pip install uptime-kuma-api

35
docs/make.bat Normal file
View file

@ -0,0 +1,35 @@
@ECHO OFF
pushd %~dp0
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set BUILDDIR=_build
%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)
if "%1" == "" goto help
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end
:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
:end
popd

1
docs/requirements.txt Normal file
View file

@ -0,0 +1 @@
Sphinx==5.3.0

View file

@ -1,6 +1,6 @@
#!/bin/sh
for version in 1.18.3 1.17.1
for version in 1.18.5 1.17.1
do
echo "Starting uptime kuma $version..."
docker run -d -it --rm -p 3001:3001 --name uptimekuma "louislam/uptime-kuma:$version" > /dev/null

View file

@ -0,0 +1,9 @@
from uptime_kuma_api import notification_provider_options
for provider in notification_provider_options:
provider_options = notification_provider_options[provider]
for option in provider_options:
type_ = provider_options[option]["type"]
print(f":param {option}: (optional) Notification option for type NotificationType.{provider.name}")
print(f":type {option}: {type_}")
print("")

File diff suppressed because one or more lines are too long

View file

@ -2,6 +2,13 @@ from enum import Enum
class AuthMethod(str, Enum):
"""Enumerate authentication methods for monitors."""
NONE = ""
"""Authentication is disabled."""
HTTP_BASIC = "basic"
"""HTTP Basic Authentication."""
NTLM = "ntlm"
"""NTLM Authentication."""

View file

@ -2,5 +2,10 @@ from enum import Enum
class DockerType(str, Enum):
"""Enumerate docker connection types."""
SOCKET = "socket"
"""Socket"""
TCP = "tcp"
"""TCP"""

View file

@ -0,0 +1,619 @@
def append_docstring(value):
def _doc(func):
# inserts the value into the existing docstring before the :return: line
split_value = ":return:"
splitted = func.__doc__.split(split_value)
part1 = splitted[0]
line = [i for i in part1.split("\n") if i][0]
indent = len(line) - len(line.lstrip())
line_start = " " * indent
part2 = split_value + line_start.join(splitted[1:])
func.__doc__ = part1 + "\n" + line_start + value + "\n" + line_start + part2
return func
return _doc
def monitor_docstring(mode) -> str:
return f"""
:param type: {"(optional) " if mode == "edit" else ""} Monitor Type
:type type: MonitorType
:param name: {"(optional) " if mode == "edit" else ""} Friendly Name
:type name: str
:param interval: (optional) Heartbeat Interval
:type interval: int
:param retryInterval: (optional) Retry every X seconds
:type retryInterval: int
:param resendInterval: (optional) Resend every X times
:type resendInterval: int
:param maxretries: (optional) Retries. Maximum retries before the service is marked as down and a notification is sent.
:type maxretries: int
:param upsideDown: (optional) Upside Down Mode. Flip the status upside down. If the service is reachable, it is DOWN.
:type upsideDown: bool
:param notificationIDList: (optional) Notifications
:type notificationIDList: list
:param url: (optional) URL
:type url: str
:param expiryNotification: (optional) Certificate Expiry Notification
:type expiryNotification: bool
:param ignoreTls: (optional) Ignore TLS/SSL error for HTTPS websites
:type ignoreTls: bool
:param maxredirects: (optional) Max. Redirects. Maximum number of redirects to follow. Set to 0 to disable redirects.
:type maxredirects: int
:param accepted_statuscodes: (optional) Accepted Status Codes. Select status codes which are considered as a successful response.
:type accepted_statuscodes: list
:param proxyId: (optional) Proxy
:type proxyId: int
:param method: (optional) Method
:type method: str
:param body: (optional) Body
:type body: str
:param headers: (optional) Headers
:type headers: str
:param authMethod: (optional) Method
:type authMethod: AuthMethod
:param basic_auth_user: (optional) Username
:type basic_auth_user: str
:param basic_auth_pass: (optional) Password
:type basic_auth_pass: str
:param authDomain: (optional) Domain
:type authDomain: str
:param authWorkstation: (optional) Workstation
:type authWorkstation: str
:param keyword: (optional) Keyword. Search keyword in plain HTML or JSON response. The search is case-sensitive.
:type keyword: str
:param hostname: (optional) Hostname
:type hostname: str
:param port: (optional) Port
:type port: int
:param dns_resolve_server: (optional) Resolver Server
:type dns_resolve_server: str
:param dns_resolve_type: (optional) Resource Record Type
:type dns_resolve_type: str
:param mqttUsername: (optional) MQTT Username
:type mqttUsername: str
:param mqttPassword: (optional) MQTT Password
:type mqttPassword: str
:param mqttTopic: (optional) MQTT Topic
:type mqttTopic: str
:param mqttSuccessMessage: (optional) MQTT Success Message
:type mqttSuccessMessage: str
:param databaseConnectionString: (optional) Connection String
:type databaseConnectionString: str
:param databaseQuery: (optional) Query
:type databaseQuery: str
:param docker_container: (optional) Container Name / ID
:type docker_container: str
:param docker_host: (optional) Docker Host
:type docker_host: int
:param radiusUsername: (optional) Radius Username
:type radiusUsername: str
:param radiusPassword: (optional) Radius Password
:type radiusPassword: str
:param radiusSecret: (optional) Radius Secret. Shared Secret between client and server.
:type radiusSecret: str
:param radiusCalledStationId: (optional) Called Station Id. Identifier of the called device.
:type radiusCalledStationId: str
:param radiusCallingStationId: (optional) Calling Station Id. Identifier of the calling device.
:type radiusCallingStationId: str
"""
def notification_docstring(mode) -> str:
return f"""
:param name: {"(optional) " if mode == "edit" else ""} Friendly Name
:type name: str
:param type: {"(optional) " if mode == "edit" else ""} Notification Type
:type type: NotificationType
:param isDefault: (optional) Default enabled. This notification will be enabled by default for new monitors. You can still disable the notification separately for each monitor.
:type isDefault: bool
:param applyExisting: (optional) Apply on all existing monitors
:type applyExisting: bool
:param alertaApiEndpoint: (optional) Notification option for type NotificationType.ALERTA
:type alertaApiEndpoint: str
:param alertaApiKey: (optional) Notification option for type NotificationType.ALERTA
:type alertaApiKey: str
:param alertaEnvironment: (optional) Notification option for type NotificationType.ALERTA
:type alertaEnvironment: str
:param alertaAlertState: (optional) Notification option for type NotificationType.ALERTA
:type alertaAlertState: str
:param alertaRecoverState: (optional) Notification option for type NotificationType.ALERTA
:type alertaRecoverState: str
:param phonenumber: (optional) Notification option for type NotificationType.ALIYUNSMS
:type phonenumber: str
:param templateCode: (optional) Notification option for type NotificationType.ALIYUNSMS
:type templateCode: str
:param signName: (optional) Notification option for type NotificationType.ALIYUNSMS
:type signName: str
:param accessKeyId: (optional) Notification option for type NotificationType.ALIYUNSMS
:type accessKeyId: str
:param secretAccessKey: (optional) Notification option for type NotificationType.ALIYUNSMS
:type secretAccessKey: str
:param appriseURL: (optional) Notification option for type NotificationType.APPRISE
:type appriseURL: str
:param title: (optional) Notification option for type NotificationType.APPRISE
:type title: str
:param clicksendsmsLogin: (optional) Notification option for type NotificationType.CLICKSENDSMS
:type clicksendsmsLogin: str
:param clicksendsmsPassword: (optional) Notification option for type NotificationType.CLICKSENDSMS
:type clicksendsmsPassword: str
:param clicksendsmsToNumber: (optional) Notification option for type NotificationType.CLICKSENDSMS
:type clicksendsmsToNumber: str
:param clicksendsmsSenderName: (optional) Notification option for type NotificationType.CLICKSENDSMS
:type clicksendsmsSenderName: str
:param webHookUrl: (optional) Notification option for type NotificationType.DINGDING
:type webHookUrl: str
:param secretKey: (optional) Notification option for type NotificationType.DINGDING
:type secretKey: str
:param discordUsername: (optional) Notification option for type NotificationType.DISCORD
:type discordUsername: str
:param discordWebhookUrl: (optional) Notification option for type NotificationType.DISCORD
:type discordWebhookUrl: str
:param discordPrefixMessage: (optional) Notification option for type NotificationType.DISCORD
:type discordPrefixMessage: str
:param feishuWebHookUrl: (optional) Notification option for type NotificationType.FEISHU
:type feishuWebHookUrl: str
:param googleChatWebhookURL: (optional) Notification option for type NotificationType.GOOGLECHAT
:type googleChatWebhookURL: str
:param gorushDeviceToken: (optional) Notification option for type NotificationType.GORUSH
:type gorushDeviceToken: str
:param gorushPlatform: (optional) Notification option for type NotificationType.GORUSH
:type gorushPlatform: str
:param gorushTitle: (optional) Notification option for type NotificationType.GORUSH
:type gorushTitle: str
:param gorushPriority: (optional) Notification option for type NotificationType.GORUSH
:type gorushPriority: str
:param gorushRetry: (optional) Notification option for type NotificationType.GORUSH
:type gorushRetry: str
:param gorushTopic: (optional) Notification option for type NotificationType.GORUSH
:type gorushTopic: str
:param gorushServerURL: (optional) Notification option for type NotificationType.GORUSH
:type gorushServerURL: str
:param gotifyserverurl: (optional) Notification option for type NotificationType.GOTIFY
:type gotifyserverurl: str
:param gotifyapplicationToken: (optional) Notification option for type NotificationType.GOTIFY
:type gotifyapplicationToken: str
:param gotifyPriority: (optional) Notification option for type NotificationType.GOTIFY
:type gotifyPriority: int
:param lineChannelAccessToken: (optional) Notification option for type NotificationType.LINE
:type lineChannelAccessToken: str
:param lineUserID: (optional) Notification option for type NotificationType.LINE
:type lineUserID: str
:param lunaseaDevice: (optional) Notification option for type NotificationType.LUNASEA
:type lunaseaDevice: str
:param internalRoomId: (optional) Notification option for type NotificationType.MATRIX
:type internalRoomId: str
:param accessToken: (optional) Notification option for type NotificationType.MATRIX
:type accessToken: str
:param homeserverUrl: (optional) Notification option for type NotificationType.MATRIX
:type homeserverUrl: str
:param mattermostusername: (optional) Notification option for type NotificationType.MATTERMOST
:type mattermostusername: str
:param mattermostWebhookUrl: (optional) Notification option for type NotificationType.MATTERMOST
:type mattermostWebhookUrl: str
:param mattermostchannel: (optional) Notification option for type NotificationType.MATTERMOST
:type mattermostchannel: str
:param mattermosticonemo: (optional) Notification option for type NotificationType.MATTERMOST
:type mattermosticonemo: str
:param mattermosticonurl: (optional) Notification option for type NotificationType.MATTERMOST
:type mattermosticonurl: str
:param httpAddr: (optional) Notification option for type NotificationType.ONEBOT
:type httpAddr: str
:param accessToken: (optional) Notification option for type NotificationType.ONEBOT
:type accessToken: str
:param msgType: (optional) Notification option for type NotificationType.ONEBOT
:type msgType: str
:param recieverId: (optional) Notification option for type NotificationType.ONEBOT
:type recieverId: str
:param pagerdutyAutoResolve: (optional) Notification option for type NotificationType.PAGERDUTY
:type pagerdutyAutoResolve: str
:param pagerdutyIntegrationUrl: (optional) Notification option for type NotificationType.PAGERDUTY
:type pagerdutyIntegrationUrl: str
:param pagerdutyPriority: (optional) Notification option for type NotificationType.PAGERDUTY
:type pagerdutyPriority: str
:param pagerdutyIntegrationKey: (optional) Notification option for type NotificationType.PAGERDUTY
:type pagerdutyIntegrationKey: str
:param promosmsLogin: (optional) Notification option for type NotificationType.PROMOSMS
:type promosmsLogin: str
:param promosmsPassword: (optional) Notification option for type NotificationType.PROMOSMS
:type promosmsPassword: str
:param promosmsPhoneNumber: (optional) Notification option for type NotificationType.PROMOSMS
:type promosmsPhoneNumber: str
:param promosmsSMSType: (optional) Notification option for type NotificationType.PROMOSMS
:type promosmsSMSType: str
:param promosmsSenderName: (optional) Notification option for type NotificationType.PROMOSMS
:type promosmsSenderName: str
:param pushbulletAccessToken: (optional) Notification option for type NotificationType.PUSHBULLET
:type pushbulletAccessToken: str
:param pushdeerKey: (optional) Notification option for type NotificationType.PUSHDEER
:type pushdeerKey: str
:param pushoveruserkey: (optional) Notification option for type NotificationType.PUSHOVER
:type pushoveruserkey: str
:param pushoverapptoken: (optional) Notification option for type NotificationType.PUSHOVER
:type pushoverapptoken: str
:param pushoversounds: (optional) Notification option for type NotificationType.PUSHOVER
:type pushoversounds: str
:param pushoverpriority: (optional) Notification option for type NotificationType.PUSHOVER
:type pushoverpriority: str
:param pushovertitle: (optional) Notification option for type NotificationType.PUSHOVER
:type pushovertitle: str
:param pushoverdevice: (optional) Notification option for type NotificationType.PUSHOVER
:type pushoverdevice: str
:param pushyAPIKey: (optional) Notification option for type NotificationType.PUSHY
:type pushyAPIKey: str
:param pushyToken: (optional) Notification option for type NotificationType.PUSHY
:type pushyToken: str
:param rocketchannel: (optional) Notification option for type NotificationType.ROCKET_CHAT
:type rocketchannel: str
:param rocketusername: (optional) Notification option for type NotificationType.ROCKET_CHAT
:type rocketusername: str
:param rocketiconemo: (optional) Notification option for type NotificationType.ROCKET_CHAT
:type rocketiconemo: str
:param rocketwebhookURL: (optional) Notification option for type NotificationType.ROCKET_CHAT
:type rocketwebhookURL: str
:param rocketbutton: (optional) Notification option for type NotificationType.ROCKET_CHAT
:type rocketbutton: str
:param serwersmsUsername: (optional) Notification option for type NotificationType.SERWERSMS
:type serwersmsUsername: str
:param serwersmsPassword: (optional) Notification option for type NotificationType.SERWERSMS
:type serwersmsPassword: str
:param serwersmsPhoneNumber: (optional) Notification option for type NotificationType.SERWERSMS
:type serwersmsPhoneNumber: str
:param serwersmsSenderName: (optional) Notification option for type NotificationType.SERWERSMS
:type serwersmsSenderName: str
:param signalNumber: (optional) Notification option for type NotificationType.SIGNAL
:type signalNumber: str
:param signalRecipients: (optional) Notification option for type NotificationType.SIGNAL
:type signalRecipients: str
:param signalURL: (optional) Notification option for type NotificationType.SIGNAL
:type signalURL: str
:param slackbutton: (optional) Notification option for type NotificationType.SLACK
:type slackbutton: str
:param slackchannel: (optional) Notification option for type NotificationType.SLACK
:type slackchannel: str
:param slackusername: (optional) Notification option for type NotificationType.SLACK
:type slackusername: str
:param slackiconemo: (optional) Notification option for type NotificationType.SLACK
:type slackiconemo: str
:param slackwebhookURL: (optional) Notification option for type NotificationType.SLACK
:type slackwebhookURL: str
:param smtpHost: (optional) Notification option for type NotificationType.SMTP
:type smtpHost: str
:param smtpPort: (optional) Notification option for type NotificationType.SMTP
:type smtpPort: int
:param smtpSecure: (optional) Notification option for type NotificationType.SMTP
:type smtpSecure: str
:param smtpIgnoreTLSError: (optional) Notification option for type NotificationType.SMTP
:type smtpIgnoreTLSError: str
:param smtpDkimDomain: (optional) Notification option for type NotificationType.SMTP
:type smtpDkimDomain: str
:param smtpDkimKeySelector: (optional) Notification option for type NotificationType.SMTP
:type smtpDkimKeySelector: str
:param smtpDkimPrivateKey: (optional) Notification option for type NotificationType.SMTP
:type smtpDkimPrivateKey: str
:param smtpDkimHashAlgo: (optional) Notification option for type NotificationType.SMTP
:type smtpDkimHashAlgo: str
:param smtpDkimheaderFieldNames: (optional) Notification option for type NotificationType.SMTP
:type smtpDkimheaderFieldNames: str
:param smtpDkimskipFields: (optional) Notification option for type NotificationType.SMTP
:type smtpDkimskipFields: str
:param smtpUsername: (optional) Notification option for type NotificationType.SMTP
:type smtpUsername: str
:param smtpPassword: (optional) Notification option for type NotificationType.SMTP
:type smtpPassword: str
:param customSubject: (optional) Notification option for type NotificationType.SMTP
:type customSubject: str
:param smtpFrom: (optional) Notification option for type NotificationType.SMTP
:type smtpFrom: str
:param smtpCC: (optional) Notification option for type NotificationType.SMTP
:type smtpCC: str
:param smtpBCC: (optional) Notification option for type NotificationType.SMTP
:type smtpBCC: str
:param smtpTo: (optional) Notification option for type NotificationType.SMTP
:type smtpTo: str
:param stackfieldwebhookURL: (optional) Notification option for type NotificationType.STACKFIELD
:type stackfieldwebhookURL: str
:param pushAPIKey: (optional) Notification option for type NotificationType.PUSHBYTECHULUS
:type pushAPIKey: str
:param telegramBotToken: (optional) Notification option for type NotificationType.TELEGRAM
:type telegramBotToken: str
:param telegramChatID: (optional) Notification option for type NotificationType.TELEGRAM
:type telegramChatID: str
:param webhookContentType: (optional) Notification option for type NotificationType.WEBHOOK
:type webhookContentType: str
:param webhookURL: (optional) Notification option for type NotificationType.WEBHOOK
:type webhookURL: str
:param weComBotKey: (optional) Notification option for type NotificationType.WECOM
:type weComBotKey: str
:param alertNowWebhookURL: (optional) Notification option for type NotificationType.ALERTNOW
:type alertNowWebhookURL: str
:param homeAssistantUrl: (optional) Notification option for type NotificationType.HOMEASSISTANT
:type homeAssistantUrl: str
:param longLivedAccessToken: (optional) Notification option for type NotificationType.HOMEASSISTANT
:type longLivedAccessToken: str
:param lineNotifyAccessToken: (optional) Notification option for type NotificationType.LINENOTIFY
:type lineNotifyAccessToken: str
:param barkEndpoint: (optional) Notification option for type NotificationType.BARK
:type barkEndpoint: str
:param barkGroup: (optional) Notification option for type NotificationType.BARK
:type barkGroup: str
:param barkSound: (optional) Notification option for type NotificationType.BARK
:type barkSound: str
:param goAlertBaseURL: (optional) Notification option for type NotificationType.GOALERT
:type goAlertBaseURL: str
:param goAlertToken: (optional) Notification option for type NotificationType.GOALERT
:type goAlertToken: str
:param octopushVersion: (optional) Notification option for type NotificationType.OCTOPUSH
:type octopushVersion: str
:param octopushAPIKey: (optional) Notification option for type NotificationType.OCTOPUSH
:type octopushAPIKey: str
:param octopushLogin: (optional) Notification option for type NotificationType.OCTOPUSH
:type octopushLogin: str
:param octopushPhoneNumber: (optional) Notification option for type NotificationType.OCTOPUSH
:type octopushPhoneNumber: str
:param octopushSMSType: (optional) Notification option for type NotificationType.OCTOPUSH
:type octopushSMSType: str
:param octopushSenderName: (optional) Notification option for type NotificationType.OCTOPUSH
:type octopushSenderName: str
:param octopushDMLogin: (optional) Notification option for type NotificationType.OCTOPUSH
:type octopushDMLogin: str
:param octopushDMAPIKey: (optional) Notification option for type NotificationType.OCTOPUSH
:type octopushDMAPIKey: str
:param octopushDMPhoneNumber: (optional) Notification option for type NotificationType.OCTOPUSH
:type octopushDMPhoneNumber: str
:param octopushDMSenderName: (optional) Notification option for type NotificationType.OCTOPUSH
:type octopushDMSenderName: str
:param octopushDMSMSType: (optional) Notification option for type NotificationType.OCTOPUSH
:type octopushDMSMSType: str
:param serverChanSendKey: (optional) Notification option for type NotificationType.SERVERCHAN
:type serverChanSendKey: str
:param smsmanagerApiKey: (optional) Notification option for type NotificationType.SMSMANAGER
:type smsmanagerApiKey: str
:param numbers: (optional) Notification option for type NotificationType.SMSMANAGER
:type numbers: str
:param messageType: (optional) Notification option for type NotificationType.SMSMANAGER
:type messageType: str
:param squadcastWebhookURL: (optional) Notification option for type NotificationType.SQUADCAST
:type squadcastWebhookURL: str
:param webhookUrl: (optional) Notification option for type NotificationType.TEAMS
:type webhookUrl: str
:param freemobileUser: (optional) Notification option for type NotificationType.FREEMOBILE
:type freemobileUser: str
:param freemobilePass: (optional) Notification option for type NotificationType.FREEMOBILE
:type freemobilePass: str
:param ntfyusername: (optional) Notification option for type NotificationType.NTFY
:type ntfyusername: str
:param ntfypassword: (optional) Notification option for type NotificationType.NTFY
:type ntfypassword: str
:param ntfytopic: (optional) Notification option for type NotificationType.NTFY
:type ntfytopic: str
:param ntfyPriority: (optional) Notification option for type NotificationType.NTFY
:type ntfyPriority: int
:param ntfyserverurl: (optional) Notification option for type NotificationType.NTFY
:type ntfyserverurl: str
"""
def proxy_docstring(mode) -> str:
return f"""
:param protocol: {"(optional) " if mode == "edit" else ""} Proxy Protocol
:type protocol: ProxyProtocol
:param host: {"(optional) " if mode == "edit" else ""} Proxy Server
:type host: str
:param port: {"(optional) " if mode == "edit" else ""} Port
:type port: str
:param auth: (optional) Proxy server has authentication
:type auth: bool
:param username: (optional) User
:type username: str
:param password: (optional) Password
:type password: str
:param active: (optional) Enabled. This proxy will not effect on monitor requests until it is activated. You can control temporarily disable the proxy from all monitors by activation status.
:type active: bool
:param default: (optional) Set As Default. This proxy will be enabled by default for new monitors. You can still disable the proxy separately for each monitor.
:type default: bool
:param applyExisting: (optional) Apply on all existing monitors
:type applyExisting: bool
"""
def docker_host_docstring(mode) -> str:
return f"""
:param name: {"(optional) " if mode == "edit" else ""} Friendly Name
:type name: str
:param dockerType: {"(optional) " if mode == "edit" else ""} Connection Type
:type dockerType: DockerType
:param dockerDaemon: (optional) Docker Daemon
:type dockerDaemon: str
"""

View file

@ -1,2 +1,5 @@
class UptimeKumaException(Exception):
"""
There was an exception that occurred while communicating with Uptime Kuma.
"""
pass

View file

@ -2,9 +2,22 @@ from enum import Enum
class IncidentStyle(str, Enum):
"""Enumerate incident styles."""
INFO = "info"
"""Info"""
WARNING = "warning"
"""Warning"""
DANGER = "danger"
"""Danger"""
PRIMARY = "primary"
"""Primary"""
LIGHT = "light"
"""Light"""
DARK = "dark"
"""Dark"""

View file

@ -2,15 +2,40 @@ from enum import Enum
class MonitorType(str, Enum):
"""Enumerate monitor types."""
HTTP = "http"
"""HTTP(s)"""
PORT = "port"
"""TCP Port"""
PING = "ping"
"""Ping"""
KEYWORD = "keyword"
"""HTTP(s) - Keyword"""
DNS = "dns"
"""DNS"""
DOCKER = "docker"
"""Docker Container"""
PUSH = "push"
"""Push"""
STEAM = "steam"
"""Steam Game Server"""
MQTT = "mqtt"
"""MQTT"""
SQLSERVER = "sqlserver"
"""Microsoft SQL Server"""
POSTGRES = "postgres"
"""PostgreSQL"""
RADIUS = "radius"
"""Radius"""

View file

@ -2,49 +2,136 @@ from enum import Enum
class NotificationType(str, Enum):
"""Enumerate notification types."""
ALERTA = "alerta"
"""Alerta"""
ALIYUNSMS = "AliyunSMS"
"""AliyunSMS"""
APPRISE = "apprise"
"""Apprise (Support 50+ Notification services)"""
CLICKSENDSMS = "clicksendsms"
"""ClickSend SMS"""
DINGDING = "DingDing"
"""DingDing"""
DISCORD = "discord"
"""Discord"""
FEISHU = "Feishu"
"""Feishu"""
GOOGLECHAT = "GoogleChat"
"""Google Chat (Google Workspace only)"""
GORUSH = "gorush"
"""Gorush"""
GOTIFY = "gotify"
"""Gotify"""
LINE = "line"
"""Line Messenger"""
LUNASEA = "lunasea"
"""LunaSea"""
MATRIX = "matrix"
"""Matrix"""
MATTERMOST = "mattermost"
"""Mattermost"""
ONEBOT = "OneBot"
"""OneBot"""
PAGERDUTY = "PagerDuty"
"""PagerDuty"""
PROMOSMS = "promosms"
"""PromoSMS"""
PUSHBULLET = "pushbullet"
"""Pushbullet"""
PUSHDEER = "PushDeer"
"""PushDeer"""
PUSHOVER = "pushover"
"""Pushover"""
PUSHY = "pushy"
"""Pushy"""
ROCKET_CHAT = "rocket.chat"
"""Rocket.Chat"""
SERWERSMS = "serwersms"
"""SerwerSMS.pl"""
SIGNAL = "signal"
"""Signal"""
SLACK = "slack"
"""Slack"""
SMTP = "smtp"
"""Email (SMTP)"""
STACKFIELD = "stackfield"
"""Stackfield"""
PUSHBYTECHULUS = "PushByTechulus"
"""Push by Techulus"""
TELEGRAM = "telegram"
"""Telegram"""
WEBHOOK = "webhook"
"""Webhook"""
WECOM = "WeCom"
"""WeCom"""
ALERTNOW = "AlertNow"
"""AlertNow"""
HOMEASSISTANT = "HomeAssistant"
"""Home Assistant"""
LINENOTIFY = "LineNotify"
"""LineNotify"""
BARK = "Bark"
"""Bark"""
GOALERT = "GoAlert"
"""GoAlert"""
OCTOPUSH = "octopush"
"""Octopush"""
SERVERCHAN = "ServerChan"
"""ServerChan"""
SMSMANAGER = "SMSManager"
"""SMSManager"""
SQUADCAST = "squadcast"
"""Squadcast"""
TEAMS = "teams"
"""Microsoft Teams"""
FREEMOBILE = "FreeMobile"
"""FreeMobile"""
NTFY = "ntfy"
"""ntfy"""
notification_provider_options = {

View file

@ -2,8 +2,19 @@ from enum import Enum
class ProxyProtocol(str, Enum):
"""Enumerate proxy protocols."""
HTTPS = "https"
"""HTTPS"""
HTTP = "http"
"""HTTP"""
SOCKS = "socks"
"""SOCKS"""
SOCKS5 = "socks5"
"""SOCKS5"""
SOCKS4 = "socks4"
"""SOCKS4"""