1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-03-20 06:50:23 +03:00

Refactor API documentation and improve help method descriptions for clarity

This commit is contained in:
Adolfo Gómez García 2025-02-04 03:40:57 +01:00
parent 4c6a9237e8
commit 458b4d3412
No known key found for this signature in database
GPG Key ID: DD1ABF20724CDA23
5 changed files with 36 additions and 8 deletions

View File

@ -125,7 +125,8 @@ class Documentation(View):
else:
methods = []
help_data.append(HelpInfo(level, path, node.help.text, methods))
if node.kind != types.rest.HelpNode.HelpNodeType.PATH:
help_data.append(HelpInfo(level, path, node.help.text, methods))
for child in node.children:
_process_node(

View File

@ -42,6 +42,11 @@ logger = logging.getLogger(__name__)
class Callback(Handler):
"""
API:
Description:
Executes a callback from the GUI. Internal use, not intended to be called from outside.
"""
path = 'gui'
min_access_role = consts.UserRole.STAFF

View File

@ -290,6 +290,14 @@ class MetaPools(ModelHandler):
# Set fallback status
def set_fallback_access(self, item: MetaPool) -> typing.Any:
"""
API:
Description:
Sets the fallback access for a metapool
Response:
200: All fine, no data returned
"""
self.ensure_has_access(item, types.permissions.PermissionType.MANAGEMENT)
fallback = self._params.get('fallbackAccess', 'ALLOW')

View File

@ -151,10 +151,10 @@ class System(Handler):
types.rest.HelpPath('stats/inuse', ''),
types.rest.HelpPath('stats/cached', ''),
types.rest.HelpPath('stats/complete', ''),
types.rest.HelpPath('stats/assigned/<servicePoolId>', ''),
types.rest.HelpPath('stats/inuse/<servicePoolId>', ''),
types.rest.HelpPath('stats/cached/<servicePoolId>', ''),
types.rest.HelpPath('stats/complete/<servicePoolId>', ''),
types.rest.HelpPath('stats/assigned/<uuuid>', 'Get service pool assigned stats'),
types.rest.HelpPath('stats/inuse/<uuid>', 'Get service pool in use stats'),
types.rest.HelpPath('stats/cached/<uuid>', 'Get service pool cached stats'),
types.rest.HelpPath('stats/complete/<uuid>', 'Get service pool complete stats'),
]
help_text = 'Provides system information. Must be admin to access this'

View File

@ -273,14 +273,28 @@ class HandlerNode:
doc = getattr(method_class, detail_method).__doc__ or ''
custom_help.add(
HelpNode(
HelpPath(path=self.full_path() + '/<uuid>/' + method_name + '/<uuid>/' + detail_method, help=doc),
HelpPath(
path=self.full_path()
+ '/<uuid>/'
+ method_name
+ '/<uuid>/'
+ detail_method,
help=doc,
),
[],
HelpNode.HelpNodeType.CUSTOM,
)
)
custom_help |= {
HelpNode(HelpPath(path=help_info.path, help=help_info.text), [], help_node_type)
HelpNode(
HelpPath(
path=self.full_path() + '/' + help_info.path,
help=help_info.text,
),
[],
help_node_type,
)
for help_info in self.handler.help_paths
}
@ -298,7 +312,7 @@ class HandlerNode:
"""
if not path or not self.children:
return self
# Remove any trailing '/' to allow some "bogus" paths with trailing slashes
path = path.lstrip('/').split('/') if isinstance(path, str) else path