Add channel search and subscription

This commit is contained in:
sevenhill
2026-07-07 22:09:18 +03:00
parent b2766ebbe9
commit 0a42e6f860
14 changed files with 421 additions and 4 deletions
@@ -160,6 +160,25 @@ public sealed class WorkerMaxBridgeClient(
}
}
public async Task<IReadOnlyList<MaxChannelSearchResult>> SearchChannelsAsync(string query, CancellationToken cancellationToken)
{
return await SendAsync<IReadOnlyList<MaxChannelSearchResult>>(
HttpMethod.Post,
"/channels/search",
new { query },
cancellationToken)
?? Array.Empty<MaxChannelSearchResult>();
}
public async Task<MaxChatUpdate?> JoinChannelAsync(string link, CancellationToken cancellationToken)
{
return await SendAsync<MaxChatUpdate>(
HttpMethod.Post,
"/channels/join",
new { link },
cancellationToken);
}
private async Task<T?> SendAsync<T>(HttpMethod method, string path, object? body, CancellationToken cancellationToken)
{
try