execute<TResponse> method

  1. @override
Future<TResponse> execute<TResponse>(
  1. FunctionsAction<TResponse> action
)
override

Executes a Function with action.

A FunctionsAction and FunctionsActionResponse must be prepared for each mode.

actionを持つFunctionを実行します。

各モードに応じたFunctionsActionFunctionsActionResponseを用意する必要があります。

Implementation

@override
Future<TResponse> execute<TResponse>(FunctionsAction<TResponse> action) {
  final stub = functions.firstWhereOrNull(
    (stub) => stub.functionName == action.action,
  );
  if (stub == null) {
    return action.execute((input) async => {});
  }
  return action.execute((input) async => stub.process(input ?? {}));
}