Struct EnvelopeContent
What an envelope carries: exactly one of a DataMessage, an EditMessage, a SentTranscript, a StoryMessage, a CallMessage, a ReceiptMessage or a TypingMessage. Signal envelopes never combine them, and the union makes that impossible to violate.
public struct EnvelopeContent : IUnion
- Implements
- Inherited Members
Remarks
Switch over the content to handle every kind; the compiler warns when a case is missing (for example when a later version adds one):
var summary = envelope.Content switch
{
DataMessage data => data.Text,
EditMessage edit => $"edited: {edit.Message.Text}",
SentTranscript sent => $"sent from another device: {sent.Message.Text}",
StoryMessage story => $"story: {story.Text}",
CallMessage call => $"call {call.Kind}",
ReceiptMessage receipt => $"{receipt.Type} receipt",
TypingMessage typing => $"typing {typing.Action}",
};