Skip to content

Plugin API Reference

This page shows the available public API available for plugins to access.

You can access them by importing them like this:

from web_portal.plugin_api import login_admin_required

# Or

from web_portal import plugin_api

Variables

Route Decorators

used to ensure the app has not gone through setup wizard, aborting to 404 if it has.

used the same as login_required but checks whether user is admin

login is required if public access is disabled, otherwise skip

Used to decorate a Quart response, allowing redirects to a provided back_to request arg

Settings Access

Gets a plugin's system setting stored in db or from cache

:param plugin_name: The plugin's internal name
:param key: The setting's key
:param default: The default value to use if no setting was found, defaults to None
:param skip_cache: Whether the skip cache and load from db directly, defaults to False
:return: The loaded value or None

Set a plugin's system setting stored in db and updates cache

:param plugin_name: The plugin's internal name
:param key: The setting's key
:param value: Value to update setting to

Removes a set plugin's system setting stored in db and cache

:param plugin_name: The plugin's internal name
:param key: The setting's key

Widget Access

Used for storing information about a widget, returned by get_widget_details()

Get a widget's owner id

:param widget_id: The widgets id
:return: The owner id

Get a widgets details

:param widget_id: The widgets id
:return: The details

Set a widgets config

:param widget_id: The widgets id
:param config: The config to update to

Plugin

Class used when creating a plugin, stores all information about a plugin and what it supports.

is_supported_version(app_version)

Check whether the version requirement matches the given app version

:param app_version: The app version, given as a semantic version number
:return: Whether it is supported

Get a plugins's data path for storing persistant data outside of the database, path will be created if not exists when this function is run

:param plugin_name: The plugin's internal name
:return: The data path

Endpoints