Added docs for config plugin

This commit is contained in:
Fabio Manganiello 2021-11-17 23:59:17 +01:00
parent 40903393df
commit 518d9f20c6
Signed by: blacklight
GPG key ID: D90FBA7F76362774
2 changed files with 24 additions and 8 deletions

View file

@ -16,14 +16,9 @@ class EventGenerator(object):
self._event_handlers = {} # Event type => callback map self._event_handlers = {} # Event type => callback map
def fire_event(self, event): def fire_event(self, event):
""" # Fires an event (instance of :class:`platypush.message.event.Event` or a
Fires an event (instance of :class:`platypush.message.event.Event` or a # subclass) to the internal bus and triggers any handler callback
subclass) to the internal bus and triggers any handler callback # associated to the event type or any of its super-classes.
associated to the event type or any of its super-classes.
:param event: Event to fire
:type event: :class:`platypush.message.event.Event` or a subclass
"""
def hndl_thread(handler): def hndl_thread(handler):
handler(event) handler(event)

View file

@ -12,30 +12,51 @@ class ConfigPlugin(Plugin):
@action @action
def get(self) -> dict: def get(self) -> dict:
"""
Get the current configuration.
"""
return Config.get() return Config.get()
@action @action
def get_plugins(self) -> dict: def get_plugins(self) -> dict:
"""
Get the configured plugins.
"""
return Config.get_plugins() return Config.get_plugins()
@action @action
def get_backends(self) -> dict: def get_backends(self) -> dict:
"""
Get the configured backends.
"""
return Config.get_backends() return Config.get_backends()
@action @action
def get_procedures(self) -> dict: def get_procedures(self) -> dict:
"""
Get the configured procedures.
"""
return json.loads(json.dumps(Config.get_procedures(), cls=Message.Encoder)) return json.loads(json.dumps(Config.get_procedures(), cls=Message.Encoder))
@action @action
def dashboards(self) -> dict: def dashboards(self) -> dict:
"""
Get the configured dashboards.
"""
return Config.get_dashboards() return Config.get_dashboards()
@action @action
def get_dashboard(self, name: str) -> str: def get_dashboard(self, name: str) -> str:
"""
Get a dashboard configuration by name.
"""
return Config.get_dashboard(name) return Config.get_dashboard(name)
@action @action
def get_device_id(self) -> str: def get_device_id(self) -> str:
"""
Get the configured ``device_id``.
"""
return Config.get('device_id') return Config.get('device_id')