SuspendingAppFunction
@ExperimentalAppFunctionsApi
fun interface SuspendingAppFunction
An implementation of an app function that supports suspend execution.
This interface is expected as part of HandleAppFunctionRequest.
Summary
Public functions |
|
|---|---|
suspend ExecuteAppFunctionResponse |
executeAppFunction(request: ExecuteAppFunctionRequest)Called when the app function is invoked using |
Public functions
executeAppFunction
suspend fun executeAppFunction(request: ExecuteAppFunctionRequest): ExecuteAppFunctionResponse
Called when the app function is invoked using AppFunctionManager.executeAppFunction.
-
If this method completes successfully, the returned
ExecuteAppFunctionResponseis delivered to the caller. -
If this method throws an
AppFunctionException, it is caught and returned to the caller as anExecuteAppFunctionResponse.Errorwrapping the exception. -
If execution is cancelled via a platform cancellation signal, an
AppFunctionCancelledExceptionerror response is delivered to the caller. -
If this method throws any other uncaught exception (such as
RuntimeException), anAppFunctionAppUnknownExceptionerror response is reported to the caller, and the exception is rethrown to unregister the app function and terminate its handling coroutine scope.
| Parameters | |
|---|---|
request: ExecuteAppFunctionRequest |
The request details. |
| Returns | |
|---|---|
ExecuteAppFunctionResponse |
The execution response result. |