Class IncomingEnvelope
Aggregate root for everything received from Signal. Knows which conversation it belongs to and which domain event it represents.
public sealed record IncomingEnvelope : IEquatable<IncomingEnvelope>
- Inheritance
-
IncomingEnvelope
- Implements
- Inherited Members
Constructors
IncomingEnvelope(PhoneNumber, Sender, long, EnvelopeContent)
Aggregate root for everything received from Signal. Knows which conversation it belongs to and which domain event it represents.
public IncomingEnvelope(PhoneNumber Account, Sender Source, long Timestamp, EnvelopeContent Content)
Parameters
AccountPhoneNumberThe receiving account.
SourceSenderWho sent the envelope.
TimestamplongServer timestamp of the envelope (Unix milliseconds).
ContentEnvelopeContentWhat the envelope carries.
Properties
Account
The receiving account.
public PhoneNumber Account { get; init; }
Property Value
Call
The content if it is a call event; otherwise null.
public CallMessage? Call { get; }
Property Value
Content
What the envelope carries.
public EnvelopeContent Content { get; init; }
Property Value
Conversation
Where a reply should go: the group, or the sender for direct messages. For a SentTranscript it is the transcript's destination, because the sender is the account itself.
public Recipient Conversation { get; }
Property Value
Data
The content if it is a data message; otherwise null.
public DataMessage? Data { get; }
Property Value
Edit
The content if it is an edit; otherwise null.
public EditMessage? Edit { get; }
Property Value
Group
The group context of a data message, edit, transcript, group story or typing indicator; null for direct conversations, calls and receipts.
public GroupId? Group { get; }
Property Value
IsGroup
Whether the envelope belongs to a group conversation.
public bool IsGroup { get; }
Property Value
Receipt
The content if it is a receipt; otherwise null.
public ReceiptMessage? Receipt { get; }
Property Value
ReceivedAt
Timestamp as a DateTimeOffset.
public DateTimeOffset ReceivedAt { get; }
Property Value
Source
Who sent the envelope.
public Sender Source { get; init; }
Property Value
Story
The content if it is a story; otherwise null.
public StoryMessage? Story { get; }
Property Value
Timestamp
Server timestamp of the envelope (Unix milliseconds).
public long Timestamp { get; init; }
Property Value
Transcript
The content if it is a transcript of a message sent from another device; otherwise null.
public SentTranscript? Transcript { get; }
Property Value
Typing
The content if it is a typing indicator; otherwise null.
public TypingMessage? Typing { get; }
Property Value
Methods
ToDomainEvent()
The domain event represented by this envelope:
- for data messages, in this order of precedence: MessageDeleted, ReactionReceived, GroupUpdated, MessageReceived;
- MessageEdited for edits and MessageSent for transcripts;
- StoryReceived for stories and CallReceived for call events;
- ReceiptReceived for receipts and TypingIndicatorChanged for typing indicators.
public IDomainEvent? ToDomainEvent()
Returns
- IDomainEvent
The event, or null for data messages without content (e.g. an empty sync).