createOtpCaptcha method

Creates an explicit CAPTCHA challenge for an OTP request.

Implementation

@override
Future<InappifySdkResult<InappifyCaptchaChallenge>> createOtpCaptcha(
  InappifyNetworkRequest request,
) async {
  final cancelled = _preCancelled<InappifyCaptchaChallenge>(
    'createOtpCaptcha',
    request.cancellation,
  );
  if (cancelled != null) return cancelled;
  return _run<InappifyCaptchaChallenge>(
    'createOtpCaptcha',
    action: () async {
      final raw = await _bridge.call(
        'createOtpCaptcha',
        positionalArguments: request.cancellation == null
            ? const <Object?>[]
            : const <Object?>[<String, Object?>{}],
        cancellation: request.cancellation,
        injectAbortSignal: request.cancellation != null,
      );
      return InappifyWebPayloadCodec.captchaChallenge(raw);
    },
    cancellation: request.cancellation,
    mutationMayHaveCommitted: true,
  );
}