refactor: add platform messenger contracts
PR Checks / test-and-build (pull_request) Successful in 12m35s
PR Checks / test-and-build (pull_request) Successful in 12m35s
Introduce platform-neutral PlatformKind, PlatformUser, PlatformGroup, and IPlatformMessenger contracts in GmRelay.Shared. Route Telegram session schedule updates, direct notifications, interaction replies, and calendar export through TelegramPlatformMessenger while preserving existing Telegram behavior. Bump version -> 2.0.1
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
namespace GmRelay.Shared.Platform;
|
||||
|
||||
public interface IPlatformMessenger
|
||||
{
|
||||
Task<PlatformMessageRef> SendScheduleAsync(PlatformScheduleMessage message, CancellationToken ct);
|
||||
|
||||
Task UpdateScheduleAsync(PlatformScheduleMessage message, CancellationToken ct);
|
||||
|
||||
Task SendGroupMessageAsync(PlatformGroup group, string htmlText, CancellationToken ct);
|
||||
|
||||
Task SendPrivateMessageAsync(PlatformPrivateMessage message, CancellationToken ct);
|
||||
|
||||
Task AnswerInteractionAsync(PlatformInteractionReply reply, CancellationToken ct);
|
||||
|
||||
Task SendCalendarFileAsync(PlatformCalendarFile file, CancellationToken ct);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace GmRelay.Shared.Platform;
|
||||
|
||||
public sealed record PlatformGroup(
|
||||
PlatformKind Platform,
|
||||
string ExternalGroupId,
|
||||
string DisplayName,
|
||||
string? ExternalChannelId = null,
|
||||
string? ExternalThreadId = null);
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace GmRelay.Shared.Platform;
|
||||
|
||||
public enum PlatformKind
|
||||
{
|
||||
Telegram = 0,
|
||||
Discord = 1,
|
||||
Max = 2
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using GmRelay.Shared.Rendering;
|
||||
|
||||
namespace GmRelay.Shared.Platform;
|
||||
|
||||
public sealed record PlatformMessageRef(
|
||||
PlatformKind Platform,
|
||||
string ExternalGroupId,
|
||||
string? ExternalThreadId,
|
||||
string ExternalMessageId);
|
||||
|
||||
public sealed record PlatformMessageAction(
|
||||
string Key,
|
||||
string Label,
|
||||
string Payload);
|
||||
|
||||
public sealed record PlatformScheduleMessage(
|
||||
PlatformGroup Group,
|
||||
SessionBatchViewModel View,
|
||||
PlatformMessageRef? ExistingMessage,
|
||||
string? ImageReference = null);
|
||||
|
||||
public sealed record PlatformPrivateMessage(
|
||||
PlatformUser Recipient,
|
||||
string HtmlText);
|
||||
|
||||
public sealed record PlatformInteractionReply(
|
||||
string InteractionId,
|
||||
string Text,
|
||||
bool ShowAlert = false);
|
||||
|
||||
public sealed record PlatformCalendarFile(
|
||||
PlatformGroup Group,
|
||||
string FileName,
|
||||
byte[] Content,
|
||||
string CaptionHtml,
|
||||
IReadOnlyList<PlatformMessageAction> Actions);
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace GmRelay.Shared.Platform;
|
||||
|
||||
public sealed record PlatformUser(
|
||||
PlatformKind Platform,
|
||||
string ExternalUserId,
|
||||
string DisplayName,
|
||||
string? ExternalUsername);
|
||||
Reference in New Issue
Block a user