getUserByEmail method

Future<MmUser?> getUserByEmail(
  1. String email
)

Get a user by email

Get a user object by providing a user email. Sensitive information will be sanitized out. ##### Permissions Requires an active session and for the current session to be able to view another user's email based on the server's privacy settings.

Parameters:

  • String email (required): User Email

Implementation

Future<MmUser?> getUserByEmail(
  String email,
) async {
  final response = await getUserByEmailWithHttpInfo(
    email,
  );
  if (response.statusCode >= HttpStatus.badRequest) {
    throw MmApiException(response.statusCode, await _decodeBodyBytes(response));
  }
  // When a remote server returns no body with a status of 204, we shall not decode it.
  // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  // FormatException when trying to decode an empty string.
  if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
    return await apiClient.deserializeAsync(
      await _decodeBodyBytes(response),
      'MmUser',
    ) as MmUser;
  }
  return null;
}