Fix chat bulk delete URL resolution
This commit is contained in:
@@ -9,6 +9,7 @@ public interface IMaxBridgeClient
|
||||
Task<IReadOnlyList<MaxChatUpdate>> FetchUpdatesAsync(CancellationToken cancellationToken);
|
||||
Task<MaxChatUpdate?> FetchChatHistoryAsync(string externalChatId, string? chatUrl, CancellationToken cancellationToken);
|
||||
Task<MaxChatPresence?> FetchChatPresenceAsync(string externalChatId, string? chatUrl, CancellationToken cancellationToken);
|
||||
Task<MaxChatUrlResult> ResolveChatUrlAsync(string externalChatId, CancellationToken cancellationToken);
|
||||
Task<MaxActionResult> ClearChatHistoryAsync(string externalChatId, string? chatUrl, CancellationToken cancellationToken);
|
||||
Task<MaxActionResult> DeleteChatAsync(string externalChatId, string? chatUrl, CancellationToken cancellationToken);
|
||||
Task<MaxSendResult> SendTextAsync(string externalChatId, string? chatUrl, string text, CancellationToken cancellationToken);
|
||||
|
||||
@@ -53,6 +53,8 @@ public sealed record MaxSendResult(bool Success, string? ExternalMessageId, stri
|
||||
|
||||
public sealed record MaxActionResult(bool Success, string? Error);
|
||||
|
||||
public sealed record MaxChatUrlResult(bool Success, string? ChatUrl, string? Error);
|
||||
|
||||
public sealed record MaxMediaDownload(
|
||||
Stream Stream,
|
||||
string ContentType,
|
||||
|
||||
@@ -56,6 +56,11 @@ public sealed class MockMaxBridgeClient : IMaxBridgeClient
|
||||
return Task.FromResult<MaxChatPresence?>(new MaxChatPresence(false, null, DateTimeOffset.UtcNow));
|
||||
}
|
||||
|
||||
public Task<MaxChatUrlResult> ResolveChatUrlAsync(string externalChatId, CancellationToken cancellationToken)
|
||||
{
|
||||
return Task.FromResult(new MaxChatUrlResult(true, MockChatUrl(externalChatId), null));
|
||||
}
|
||||
|
||||
public Task<MaxActionResult> ClearChatHistoryAsync(string externalChatId, string? chatUrl, CancellationToken cancellationToken)
|
||||
{
|
||||
return Task.FromResult(new MaxActionResult(true, null));
|
||||
|
||||
@@ -53,6 +53,12 @@ public sealed class WorkerMaxBridgeClient(
|
||||
return await SendAsync<MaxChatPresence>(HttpMethod.Post, "/chat/presence", new { externalChatId, chatUrl }, cancellationToken);
|
||||
}
|
||||
|
||||
public async Task<MaxChatUrlResult> ResolveChatUrlAsync(string externalChatId, CancellationToken cancellationToken)
|
||||
{
|
||||
return await SendAsync<MaxChatUrlResult>(HttpMethod.Post, "/chat/resolve-url", new { externalChatId }, cancellationToken)
|
||||
?? new MaxChatUrlResult(false, null, "Worker returned an empty chat URL result.");
|
||||
}
|
||||
|
||||
public async Task<MaxActionResult> ClearChatHistoryAsync(string externalChatId, string? chatUrl, CancellationToken cancellationToken)
|
||||
{
|
||||
return await SendAsync<MaxActionResult>(
|
||||
|
||||
Reference in New Issue
Block a user