Skip to content

Commit 56e37bd

Browse files
committed
DOC: docstrings for 'tags' API
1 parent 3b7c95c commit 56e37bd

File tree

1 file changed

+39
-3
lines changed

1 file changed

+39
-3
lines changed

src/save_and_restore_api/_api_threads.py

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -514,9 +514,16 @@ def config_update(self, *, configurationNode, configurationData, auth=None):
514514

515515
def tags_get(self):
516516
"""
517-
Returns all existing tags.
517+
Returns the list of all existing tags.
518518
519519
API: GET /tags
520+
521+
Returns
522+
-------
523+
list[dict]
524+
List of all tags in the database. Each tag is dictionary with the following keys: ``name``
525+
- tag name, ``comment`` - tag comment (may be empty). The list may contain repeated elements.
526+
Tags do not contain pointers to tagged nodes.
520527
"""
521528
method, url = self._prepare_tags_get()
522529
return self.send_request(method, url)
@@ -527,16 +534,45 @@ def tags_add(self, *, uniqueNodeIds, tag, auth=None):
527534
dictionary must contain the ``name`` key and optionally ``comment`` key.
528535
529536
API: POST /tags
537+
538+
Parameters
539+
----------
540+
uniqueNodeIds : list of str
541+
List of node unique IDs to which the tag should be added.
542+
tag : dict
543+
Tag to be added. The dictionary must contain the ``name`` key and optionally ``comment`` key.
544+
auth : httpx.BasicAuth, optional
545+
Object with authentication data (generated using ``auth_gen`` method). If not specified or None,
546+
then the authentication set using ``auth_set`` method is used.
547+
548+
Returns
549+
-------
550+
list[dict]
551+
List of node metadata for the nodes to which the tag was added.
530552
"""
531553
method, url, body_json = self._prepare_tags_add(uniqueNodeIds=uniqueNodeIds, tag=tag)
532554
return self.send_request(method, url, body_json=body_json, auth=auth)
533555

534556
def tags_delete(self, *, uniqueNodeIds, tag, auth=None):
535557
"""
536-
Deletes ``tag`` to nodes specified by a list of UIDs ``uniqueNodeIds``. The ``tag``
537-
dictionary must contain the ``name`` key and optionally ``comment`` key.
558+
Deletes ``tag`` from the nodes specified by a list of UIDs ``uniqueNodeIds``. The deleted
559+
tag is identified by the ``"name"`` in the ``tag`` dictionary. The ``tag``
560+
dictionary may optionally ``comment`` key, but it is ignored by the API.
538561
539562
API: DELETE /tags
563+
564+
Parameters
565+
----------
566+
uniqueNodeIds : list[str]
567+
List of node unique IDs from which the tag should be deleted.
568+
tag : dict
569+
Tag to be deleted. The dictionary must contain the ``name`` key. The ``comment`` key
570+
is optional and ignored by the API.
571+
572+
Returns
573+
-------
574+
list[dict]
575+
List of node metadata for the nodes from ``uniqueNodeIds`` list.
540576
"""
541577
method, url, body_json = self._prepare_tags_delete(uniqueNodeIds=uniqueNodeIds, tag=tag)
542578
return self.send_request(method, url, body_json=body_json, auth=auth)

0 commit comments

Comments
 (0)