# Class UserService | EchoHub Documentation

# Class UserService

Namespace
  EchoHub.Server.Services

Assembly
  EchoHub.Server.dll

    public class UserService : IUserService

Inheritance
  object
  UserService

Implements
  IUserService

Inherited Members
  object.GetType()
  object.MemberwiseClone()
  object.ToString()
  object.Equals(object)
  object.Equals(object, object)
  object.ReferenceEquals(object, object)
  object.GetHashCode()

## Constructors

### UserService(IServiceScopeFactory, IConfiguration)

    public UserService(IServiceScopeFactory scopeFactory, IConfiguration configuration)

#### Parameters

`scopeFactory` IServiceScopeFactory
`configuration` IConfiguration

## Properties

### RegistrationMode

Registration mode from config: "open" (default), "invite", or "closed".

    public string RegistrationMode { get; }

#### Property Value

string

## Methods

### AuthenticateUserAsync(string, string)

    public Task<UserOperationResult> AuthenticateUserAsync(string username, string password)

#### Parameters

`username` string
`password` string

#### Returns

Task<UserOperationResult>

### GetUserByIdAsync(Guid)

    public Task<UserProfileDto?> GetUserByIdAsync(Guid userId)

#### Parameters

`userId` Guid

#### Returns

Task<UserProfileDto>

### GetUserProfileAsync(string)

    public Task<UserProfileDto?> GetUserProfileAsync(string username)

#### Parameters

`username` string

#### Returns

Task<UserProfileDto>

### RegisterUserAsync(string, string, string?, string?)

    public Task<UserOperationResult> RegisterUserAsync(string username, string password, string? displayName = null, string? inviteCode = null)

#### Parameters

`username` string
`password` string
`displayName` string
`inviteCode` string

#### Returns

Task<UserOperationResult>

### SetAvatarAsync(Guid, string)

    public Task<UserOperationResult> SetAvatarAsync(Guid userId, string asciiArt)

#### Parameters

`userId` Guid
`asciiArt` string

#### Returns

Task<UserOperationResult>

### UpdateProfileAsync(Guid, string?, string?, string?)

    public Task<UserOperationResult> UpdateProfileAsync(Guid userId, string? displayName, string? bio, string? nicknameColor)

#### Parameters

`userId` Guid
`displayName` string
`bio` string
`nicknameColor` string

#### Returns

Task<UserOperationResult>