initOtp method

Future<TInitOtpResponse> initOtp({
  1. required TInitOtpBody input,
})

Initiate a generic OTP activity.

Sign the provided TInitOtpBody with the client's stamp function and submit the request (POST /public/v1/submit/init_otp).

See also: stampInitOtp.

Implementation

Future<TInitOtpResponse> initOtp({
  required TInitOtpBody input,
}) async {
  final body = packActivityBody(
    bodyJson: input.toJson(),
    fallbackOrganizationId: input.organizationId ??
        config.organizationId ??
        (throw Exception(
            "Missing organization ID, please pass in a sub-organizationId or instantiate the client with one.")),
    activityType: 'ACTIVITY_TYPE_INIT_OTP',
  );
  return await request<Map<String, dynamic>, TInitOtpResponse>(
      "/public/v1/submit/init_otp",
      body,
      (json) => TInitOtpResponse.fromJson(
          transformActivityResponse(json, 'InitOtp')));
}