Class ChatEmbedDeserializer
Maps values present in 'type' property of chat embeds and provides means to deserialize them into a ChatMessage.
Inheritance
System.Object
ChatEmbedDeserializer
Implements
Namespace: TehGM.Wolfringo.Messages.Serialization
Assembly: Wolfringo.Core.dll
Syntax
public class ChatEmbedDeserializer : IChatEmbedDeserializer
Methods
| Improve this Doc View SourceDeserializeEmbeds(JObject)
deserializes all embeds from message body.
Declaration
public IEnumerable<IChatEmbed> DeserializeEmbeds(JObject messageBody)
Parameters
Type | Name | Description |
---|---|---|
Newtonsoft.Json.Linq.JObject | messageBody | Body of the message. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IChatEmbed> | Enumerable of chat embeds. |
Remarks
Embeds are deserialized if body has 'embeds' array. Otherwise an empty enumerable is returned.
MapChatEmbedType<T>(String)
Maps chat embed type to an implementation type.
Declaration
public void MapChatEmbedType<T>(string type)
where T : IChatEmbed
Parameters
Type | Name | Description |
---|---|---|
System.String | type | Type of the chat embed. |
Type Parameters
Name | Description |
---|---|
T | Implementation type of the chat embed. |
PopulateMessageEmbeds(ref ChatMessage, IEnumerable<IChatEmbed>)
Populates chat message's embeds.
Declaration
public void PopulateMessageEmbeds(ref ChatMessage message, IEnumerable<IChatEmbed> embeds)
Parameters
Type | Name | Description |
---|---|---|
ChatMessage | message | Chat message. |
System.Collections.Generic.IEnumerable<IChatEmbed> | embeds | Deserialized embeds. |
TryGetChatEmbedType(String, out Type)
Attempts to retrieve the embed type.
Declaration
public bool TryGetChatEmbedType(string type, out Type result)
Parameters
Type | Name | Description |
---|---|---|
System.String | type | Value of 'type' property. |
System.Type | result | Resulting type if mapped. |
Returns
Type | Description |
---|---|
System.Boolean | Whether a type for given embed type was found. |