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
AssignRoleAsync(string, ServerRole)
public Task AssignRoleAsync(string username, ServerRole role)
Parameters
usernamestringroleServerRole
Returns
- Task
BanUserAsync(string, string?)
public Task BanUserAsync(string username, string? reason = null)
Parameters
Returns
- Task
CreateChannelAsync(string, string?, bool, string?, string?, string?)
public Task<ChannelDto?> CreateChannelAsync(string name, string? topic = null, bool isPublic = true, string? password = null, string? encryptionSalt = null, string? wrappedRoomKey = null)
Parameters
Returns
- Task<ChannelDto>
DeleteChannelAsync(string)
public Task DeleteChannelAsync(string channelName)
Parameters
channelNamestring
Returns
- Task
DeleteMessageAsync(Guid)
public Task DeleteMessageAsync(Guid messageId)
Parameters
messageIdGuid
Returns
- Task
Dispose()
public void Dispose()
DownloadFileToTempAsync(string, string)
public Task<string> DownloadFileToTempAsync(string relativeUrl, string fileName)
Parameters
Returns
- Task<string>
GetChannelCryptoAsync(string)
Fetches a channel's public crypto metadata (whether it's E2E-encrypted and its key-derivation salt). Returns null when the channel doesn't exist.
public Task<ChannelCryptoDto?> GetChannelCryptoAsync(string channelName)
Parameters
channelNamestring
Returns
- Task<ChannelCryptoDto>
GetChannelsAsync()
public Task<List<ChannelDto>> GetChannelsAsync()
Returns
- Task<List<ChannelDto>>
GetEncryptionKeyAsync()
public Task<string> GetEncryptionKeyAsync()
Returns
- Task<string>
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>
KickUserAsync(string, string?)
public Task KickUserAsync(string username, string? reason = null)
Parameters
Returns
- Task
LoginAsync(string, string)
public Task<LoginResponse> LoginAsync(string username, string password)
Parameters
Returns
- Task<LoginResponse>
LoginWithRefreshTokenAsync(string)
public Task<LoginResponse> LoginWithRefreshTokenAsync(string refreshToken)
Parameters
refreshTokenstring
Returns
- Task<LoginResponse>
LogoutAsync()
public Task LogoutAsync()
Returns
- Task
MuteUserAsync(string, int?, string?)
public Task MuteUserAsync(string username, int? durationMinutes = null, string? reason = null)
Parameters
Returns
- Task
NukeChannelAsync(string)
public Task NukeChannelAsync(string channelName)
Parameters
channelNamestring
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>
RekeyChannelAsync(string, RekeyChannelRequest)
public Task<ChannelDto?> RekeyChannelAsync(string channelName, RekeyChannelRequest request)
Parameters
channelNamestringrequestRekeyChannelRequest
Returns
- Task<ChannelDto>
SendMessageWithAttachmentsAsync(string, string, IReadOnlyList<OutgoingAttachment>, string?)
Sends one message with optional text and one or more file attachments. For end-to-end encrypted channels each attachment carries a declared kind and a room-encrypted preview (empty when none); the caption is likewise room-encrypted.
public Task<MessageDto?> SendMessageWithAttachmentsAsync(string channelName, string content, IReadOnlyList<OutgoingAttachment> attachments, string? size = null)
Parameters
channelNamestringcontentstringattachmentsIReadOnlyList<OutgoingAttachment>sizestring
Returns
- Task<MessageDto>
SendUrlAsync(string, string, string?)
public Task<MessageDto?> SendUrlAsync(string channelName, string url, string? size = null)
Parameters
Returns
- Task<MessageDto>
UnbanUserAsync(string)
public Task UnbanUserAsync(string username)
Parameters
usernamestring
Returns
- Task
UnmuteUserAsync(string)
public Task UnmuteUserAsync(string username)
Parameters
usernamestring
Returns
- Task
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>
Events
OnTokensRefreshed
public event Action? OnTokensRefreshed