deleteUserEmail method

Future<MyUserEventsVersionedMixin?> deleteUserEmail(
  1. UserEmail email, {
  2. MyUserCredentials? confirmation,
})

Deletes the given email from MyUser.emails of the authenticated MyUser.

Authentication

Mandatory.

Result

Only the following MyUserEvent may be produced on success:

Idempotent

Succeeds as no-op (and returns no MyUserEvent) if the authenticated MyUser doesn't have the provided email in his MyUser.emails already.

Implementation

Future<MyUserEventsVersionedMixin?> deleteUserEmail(
  UserEmail email, {
  MyUserCredentials? confirmation,
}) async {
  Log.debug(
    'deleteUserEmail($email, confirmation: $confirmation)',
    '$runtimeType',
  );

  final variables = DeleteUserEmailArguments(
    email: email,
    confirmation: confirmation,
  );
  final QueryResult result = await client.mutate(
    MutationOptions(
      operationName: 'DeleteUserEmail',
      document: DeleteUserEmailMutation(variables: variables).document,
      variables: variables.toJson(),
    ),
    onException:
        (data) => DeleteUserEmailException(
          (DeleteUserEmail$Mutation.fromJson(data).deleteUserEmail
                  as DeleteUserEmail$Mutation$DeleteUserEmail$DeleteUserEmailError)
              .code,
        ),
  );
  return DeleteUserEmail$Mutation.fromJson(result.data!).deleteUserEmail
      as DeleteUserEmail$Mutation$DeleteUserEmail$MyUserEventsVersioned;
}