MrDraw/docs/jsclientlib/settings.rst
Gina Häußge 3e5923b21e Consolidate API Key handling
System wide API key now offers a generate button like the user
API keys. Setting the API key directly to a value via the settings API
endpoint is now no longer possible, which should prevent setting it
accidentally thanks to the browser prefilling things where it shouldn't.

No delete button is offered for the system wide API key since it will
get automatically regenerated on server start if not set, so
regeneration is the only functionality here that makes sense.

If no API key is set in the user settings, the "delete" button is now
disabled. If a key is already set and a new one is to be generated, a
confirmation dialog makes sure this is really what the user wants. Same
for deleting an existing API key.

Both the system wide API key and the user specific API keys will now
only display a QRCode if there's actually a value for the key.
2017-03-13 17:09:56 +01:00

48 lines
1.8 KiB
ReStructuredText

.. _sec-jsclientlib-settings:
:mod:`OctoPrintClient.settings`
-------------------------------
.. js:function:: OctoPrintClient.settings.get(opts)
Retrieves the current settings.
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
.. js:function:: OctoPrintClient.settings.save(settings, opts)
Saves the provided ``settings``.
:param object settings: The settings to save
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
.. js:function:: OctoPrintClient.settings.getPluginSettings(plugin, opts)
Retrieves the settings of the specified ``plugin``.
:param string plugin: The plugin for which to retrieve the settings
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
.. js:function:: OctoPrintClient.settings.savePluginSettings(plugin, settings, opts)
Saves the ``settings`` for the specified ``plugin``.
:param string plugin: The plugin for which to save settings
:param object settings: The settings to save
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
.. js:function:: OctoPrintClient.settings.generateApiKey(opts)
Generate a new system wide API key.
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
.. seealso::
:ref:`Settings API <sec-api-settings>`
The documentation of the underlying settings API.