execute method

Future<void> execute(
  1. BuildContext context,
  2. APIRequestEntity request,
  3. ExecuteAPIRequestAction action,
  4. int loop,
)

Implementation

Future<void> execute(
  BuildContext context,
  APIRequestEntity request,
  ExecuteAPIRequestAction action,
  int loop,
) async {
  final newRequest = request.copyWith(
    paths: getFields(context, request.paths, action.pathsFields, loop),
    urlParams:
        getFields(context, request.urlParams, action.urlParamsFields, loop),
    headers: getFields(context, request.headers, action.headersField, loop),
    body: getFields(context, request.body, action.bodyFields, loop),
  );

  final repository =
      DesignFlowQueryRepository(newRequest, getIt<APIWorker>());
  final res = await repository.run();
  if (context.mounted) {
    await _fold(
      context: context,
      res: res,
      loop: loop,
      action: action,
      request: request,
    );
  }
}