forked from kenzuya/unshackle
feat(api): add url field to services endpoint response
This commit is contained in:
@@ -109,9 +109,14 @@ async def services(request: web.Request) -> web.Response:
|
|||||||
title_regex:
|
title_regex:
|
||||||
type: string
|
type: string
|
||||||
nullable: true
|
nullable: true
|
||||||
|
url:
|
||||||
|
type: string
|
||||||
|
nullable: true
|
||||||
|
description: Service URL from short_help
|
||||||
help:
|
help:
|
||||||
type: string
|
type: string
|
||||||
nullable: true
|
nullable: true
|
||||||
|
description: Full service documentation
|
||||||
'500':
|
'500':
|
||||||
description: Server error
|
description: Server error
|
||||||
"""
|
"""
|
||||||
@@ -120,7 +125,7 @@ async def services(request: web.Request) -> web.Response:
|
|||||||
services_info = []
|
services_info = []
|
||||||
|
|
||||||
for tag in service_tags:
|
for tag in service_tags:
|
||||||
service_data = {"tag": tag, "aliases": [], "geofence": [], "title_regex": None, "help": None}
|
service_data = {"tag": tag, "aliases": [], "geofence": [], "title_regex": None, "url": None, "help": None}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
service_module = Services.load(tag)
|
service_module = Services.load(tag)
|
||||||
@@ -134,6 +139,9 @@ async def services(request: web.Request) -> web.Response:
|
|||||||
if hasattr(service_module, "TITLE_RE"):
|
if hasattr(service_module, "TITLE_RE"):
|
||||||
service_data["title_regex"] = service_module.TITLE_RE
|
service_data["title_regex"] = service_module.TITLE_RE
|
||||||
|
|
||||||
|
if hasattr(service_module, "cli") and hasattr(service_module.cli, "short_help"):
|
||||||
|
service_data["url"] = service_module.cli.short_help
|
||||||
|
|
||||||
if service_module.__doc__:
|
if service_module.__doc__:
|
||||||
service_data["help"] = service_module.__doc__.strip()
|
service_data["help"] = service_module.__doc__.strip()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user