Class ApiClient
public sealed class ApiClient : IDisposable
- Inheritance
-
ApiClient
- Implements
- Inherited Members
Constructors
ApiClient(string)
public ApiClient(string baseUrl)
Parameters
baseUrlstring
Properties
BaseUrl
public string BaseUrl { get; }
Property Value
RefreshToken
public string? RefreshToken { get; }
Property Value
Token
public string? Token { get; }
Property Value
Methods
CreateChannelAsync(string, string?)
public Task<ChannelDto?> CreateChannelAsync(string name, string? topic = null)
Parameters
Returns
- Task<ChannelDto>
DeleteChannelAsync(string)
public Task DeleteChannelAsync(string channelName)
Parameters
channelNamestring
Returns
- Task
Dispose()
public void Dispose()
GetChannelsAsync()
public Task<List<ChannelDto>> GetChannelsAsync()
Returns
- Task<List<ChannelDto>>
GetServerInfoAsync()
public Task<ServerStatusDto?> GetServerInfoAsync()
Returns
- Task<ServerStatusDto>
GetUserProfileAsync(string)
public Task<UserProfileDto?> GetUserProfileAsync(string username)
Parameters
usernamestring
Returns
- Task<UserProfileDto>
GetValidTokenAsync()
Returns a valid access token, refreshing if expired. Used by EchoHubConnection for SignalR token provider.
public Task<string?> GetValidTokenAsync()
Returns
- Task<string>
LoginAsync(string, string)
public Task<LoginResponse> LoginAsync(string username, string password)
Parameters
Returns
- Task<LoginResponse>
LogoutAsync()
public Task LogoutAsync()
Returns
- Task
RefreshTokenAsync()
public Task RefreshTokenAsync()
Returns
- Task
RegisterAsync(string, string, string?)
public Task<LoginResponse> RegisterAsync(string username, string password, string? displayName = null)
Parameters
Returns
- Task<LoginResponse>
SendUrlAsync(string, string)
public Task<MessageDto?> SendUrlAsync(string channelName, string url)
Parameters
Returns
- Task<MessageDto>
UpdateChannelTopicAsync(string, string?)
public Task<ChannelDto?> UpdateChannelTopicAsync(string channelName, string? topic)
Parameters
Returns
- Task<ChannelDto>
UpdateProfileAsync(UpdateProfileRequest)
public Task<UserProfileDto?> UpdateProfileAsync(UpdateProfileRequest request)
Parameters
requestUpdateProfileRequest
Returns
- Task<UserProfileDto>
UploadAvatarAsync(Stream, string)
public Task<string?> UploadAvatarAsync(Stream imageStream, string fileName)
Parameters
imageStreamStreamfileNamestring
Returns
- Task<string>
UploadFileAsync(string, Stream, string)
public Task<MessageDto?> UploadFileAsync(string channelName, Stream fileStream, string fileName)
Parameters
Returns
- Task<MessageDto>