in libraries/botbuilder-core/botbuilder/core/activity_handler.py [0:0]
def _get_adaptive_card_invoke_value(self, activity: Activity):
if activity.value is None:
response = self._create_adaptive_card_invoke_error_response(
HTTPStatus.BAD_REQUEST, "BadRequest", "Missing value property"
)
raise _InvokeResponseException(HTTPStatus.BAD_REQUEST, response)
invoke_value = None
try:
invoke_value = AdaptiveCardInvokeValue(**activity.value)
except:
response = self._create_adaptive_card_invoke_error_response(
HTTPStatus.BAD_REQUEST,
"BadRequest",
"Value property is not properly formed",
)
raise _InvokeResponseException(HTTPStatus.BAD_REQUEST, response)
if invoke_value.action is None:
response = self._create_adaptive_card_invoke_error_response(
HTTPStatus.BAD_REQUEST, "BadRequest", "Missing action property"
)
raise _InvokeResponseException(HTTPStatus.BAD_REQUEST, response)
if invoke_value.action.get("type") != "Action.Execute":
response = self._create_adaptive_card_invoke_error_response(
HTTPStatus.BAD_REQUEST,
"NotSupported",
f"The action '{invoke_value.action.get('type')}' is not supported.",
)
raise _InvokeResponseException(HTTPStatus.BAD_REQUEST, response)
return invoke_value