sharing/info: expose supported actions
This commit is contained in:
@@ -116,6 +116,7 @@ API_TYPES_V1: dict[str, type] = {
|
|||||||
"SupportedConversions": list,
|
"SupportedConversions": list,
|
||||||
"PermittedPropertiesOverlay": bool,
|
"PermittedPropertiesOverlay": bool,
|
||||||
"SupportedPropertiesOverlay": list,
|
"SupportedPropertiesOverlay": list,
|
||||||
|
"SupportedActions": dict,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -184,6 +185,7 @@ def check_template_alarm_trigger(data: Any) -> str:
|
|||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
|
# dict for validation of API request: create/update
|
||||||
ACTIONS_WHITELIST: dict = {
|
ACTIONS_WHITELIST: dict = {
|
||||||
'config': {
|
'config': {
|
||||||
'conversion_bday_summary_template': check_template_not_empty,
|
'conversion_bday_summary_template': check_template_not_empty,
|
||||||
@@ -194,6 +196,17 @@ ACTIONS_WHITELIST: dict = {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# dict for displaying API request: info
|
||||||
|
ACTIONS_WHITELIST_INFO: dict = {
|
||||||
|
'config': {
|
||||||
|
'conversion_bday_summary_template': "str",
|
||||||
|
'conversion_bday_description_template': "str",
|
||||||
|
'conversion_bday_alarm_trigger_template': "str",
|
||||||
|
'conversion_bday_categories': "str",
|
||||||
|
'conversion_bday_age_max': "int",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
CONVERSIONS_WHITELIST: Sequence[str] = ("bday", "none")
|
CONVERSIONS_WHITELIST: Sequence[str] = ("bday", "none")
|
||||||
|
|
||||||
|
|
||||||
@@ -1405,6 +1418,7 @@ class BaseSharing:
|
|||||||
answer['SupportedConversions'] = CONVERSIONS_WHITELIST
|
answer['SupportedConversions'] = CONVERSIONS_WHITELIST
|
||||||
answer['PermittedPropertiesOverlay'] = self.permit_properties_overlay
|
answer['PermittedPropertiesOverlay'] = self.permit_properties_overlay
|
||||||
answer['SupportedPropertiesOverlay'] = OVERLAY_PROPERTIES_WHITELIST
|
answer['SupportedPropertiesOverlay'] = OVERLAY_PROPERTIES_WHITELIST
|
||||||
|
answer['SupportedActions'] = ACTIONS_WHITELIST_INFO
|
||||||
|
|
||||||
# action: TOGGLE
|
# action: TOGGLE
|
||||||
elif action in API_SHARE_TOGGLES_V1:
|
elif action in API_SHARE_TOGGLES_V1:
|
||||||
|
|||||||
Reference in New Issue
Block a user