addUserPhone method

Future<MyUserEventsVersionedMixin?> addUserPhone(
  1. UserPhone phone, {
  2. ConfirmationCode? confirmation,
  3. String? locale,
})

Adds a new phone number for the authenticated MyUser.

Sets the given phone number as an unconfirmed sub-field of a MyUser.phones field and sends to this number SMS with a ConfirmationCode.

Once MyUser successfully uses this ConfirmationCode in a Mutation.confirmUserPhone, the phone number becomes a confirmed one and moves to MyUserPhones.confirmed sub-field unlocking the related capabilities.

MyUser can have maximum one MyUserPhones.unconfirmed number at the same time.

Authentication

Mandatory.

Result

Only the following MyUserEvent may be produced on success:

Idempotent

Succeeds as no-op (and returns no MyUserEvent) if the provided phone already is present in a MyUser.phones field (either in confirmed or unconfirmed sub-field).

Implementation

Future<MyUserEventsVersionedMixin?> addUserPhone(
  UserPhone phone, {
  ConfirmationCode? confirmation,
  String? locale,
}) async {
  throw UnimplementedError();

  // Log.debug(
  //   'addUserPhone($phone, confirmation: $confirmation)',
  //   '$runtimeType',
  // );

  // final variables =
  //     AddUserPhoneArguments(phone: phone, confirmation: confirmation);
  // final QueryResult result = await client.mutate(
  //   MutationOptions(
  //     operationName: 'AddUserPhone',
  //     document: AddUserPhoneMutation(variables: variables).document,
  //     variables: variables.toJson(),
  //   ),
  //   onException: (data) => AddUserPhoneException(
  //       (AddUserPhone$Mutation.fromJson(data).addUserPhone
  //               as AddUserPhone$Mutation$AddUserPhone$AddUserPhoneError)
  //           .code),
  // );
  // return AddUserPhone$Mutation.fromJson(result.data!).addUserPhone
  //     as MyUserEventsVersionedMixin?;
}