Skip to content

Commit

Permalink
Rewrite according to feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Martijn Vos committed Dec 24, 2024
1 parent 5d5bcfa commit e968d9d
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 3 deletions.
5 changes: 2 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [3.0.0] - TBD
## [2.10.0] - TBD
### Changed
- Add Context.MessageId support for RichMessages
- RichMessage model is now an abstract class instead of an interface for Context.MessageId (breaking)
- Add Context.MessageId on RichMessages supporting WhatsApp for referencing a previous message
- Updated `System.Text.Json` to 8.0.5 fixing a [high impact security vulnerability](https://github.com/advisories/GHSA-hh2w-p6rv-4g7w)

## [2.9.0] - 2024-06-20
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ public class ContactMessage : IRichMessage
/// </summary>
[JsonPropertyName("contacts")]
public Contact[] Contacts { get; set; }

/// <summary>
/// Contextual properties of the message
/// </summary>
[JsonPropertyName("context")]
[CanBeNull]
public MessageContext MessageContext { get; set; }
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,12 @@ public class LocationPushMessage : IRichMessage
/// </summary>
[JsonPropertyName("location")]
public ViewLocationOptions Location { get; set; }

/// <summary>
/// Contextual properties of the message. Only applicable to <see cref="Channel.WhatsApp"/>
/// </summary>
[JsonPropertyName("context")]
[CanBeNull]
public MessageContext MessageContext { get; set; }
}
}
7 changes: 7 additions & 0 deletions CM.Text/BusinessMessaging/Model/MultiChannel/MediaMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,12 @@ public MediaMessage(string mediaName, string mediaUri, string mimeType)
/// </summary>
[JsonPropertyName("media")]
public MediaContent Media { get; set; }

/// <summary>
/// Contextual properties of the message. Only applicable to <see cref="Channel.WhatsApp"/>
/// </summary>
[JsonPropertyName("context")]
[CanBeNull]
public MessageContext MessageContext { get; set; }
}
}
19 changes: 19 additions & 0 deletions CM.Text/BusinessMessaging/Model/MultiChannel/MessageContext.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System.Text.Json.Serialization;
using JetBrains.Annotations;

namespace CM.Text.BusinessMessaging.Model.MultiChannel
{
/// <summary>
/// Contextual properties of the message. Currently only applicable to <see cref="Channel.WhatsApp" />
/// Docs: https://developers.cm.com/messaging/docs/whatsapp-inbound#mt-replies-mo
/// </summary>
public class MessageContext
{
/// <summary>
/// Message ID to which the current message is a reply
/// </summary>
[JsonPropertyName("message_id")]
[CanBeNull]
public string MessageId { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,12 @@ public class TemplateMessage : IRichMessage
/// </remarks>
[JsonPropertyName("template")]
public TemplateMessageContent Content { get; set; }

/// <summary>
/// Contextual properties of the message
/// </summary>
[JsonPropertyName("context")]
[CanBeNull]
public MessageContext MessageContext { get; set; }
}
}
7 changes: 7 additions & 0 deletions CM.Text/BusinessMessaging/Model/MultiChannel/TextMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,12 @@ public TextMessage(string text)
/// </summary>
[JsonPropertyName("suggestions")]
public SuggestionBase[] Suggestions { get; set; }

/// <summary>
/// Contextual properties of the message. Currently only applicable to <see cref="Channel.WhatsApp" />
/// </summary>
[JsonPropertyName("context")]
[CanBeNull]
public MessageContext MessageContext { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ public class WhatsAppInteractiveMessage : IRichMessage
/// </summary>
[JsonPropertyName("interactive")]
public WhatsAppInteractiveContent whatsAppInteractiveContent { get; set; }

/// <summary>
/// Contextual properties of the message
/// </summary>
[JsonPropertyName("context")]
[CanBeNull]
public MessageContext MessageContext { get; set; }
}

/// <summary>
Expand Down

0 comments on commit e968d9d

Please sign in to comment.