-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement UpdateMessage in Messages
- Loading branch information
Showing
10 changed files
with
131 additions
and
2 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
Vonage.Test/Messages/Rcs/Data/UpdateAsyncReturnsOk-request.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"status": "revoked" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
Vonage.Test/Messages/WhatsApp/Data/UpdateAsyncReturnsOk-request.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"status": "read" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,17 @@ | ||
using System.Threading.Tasks; | ||
#region | ||
using System.Threading.Tasks; | ||
#endregion | ||
|
||
namespace Vonage.Messages; | ||
|
||
public interface IMessagesClient | ||
{ | ||
Task<MessagesResponse> SendAsync(IMessage message); | ||
|
||
/// <summary> | ||
/// This endpoint lets you update the status of outbound and/or inbound messages for certain channels. For example, you | ||
/// can revoke outbound messages or mark inbound messages as read. | ||
/// </summary> | ||
/// <param name="request">The request.</param> | ||
Task UpdateAsync(IUpdateMessageRequest request); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
namespace Vonage.Messages; | ||
|
||
/// <summary> | ||
/// Represents a request to update a message. | ||
/// </summary> | ||
public interface IUpdateMessageRequest | ||
{ | ||
/// <summary> | ||
/// UUID of the message to be updated | ||
/// </summary> | ||
string MessageUuid { get; } | ||
|
||
/// <summary> | ||
/// The status to set for the message. | ||
/// </summary> | ||
string Status { get; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#region | ||
using System.Text.Json.Serialization; | ||
#endregion | ||
|
||
namespace Vonage.Messages.Rcs; | ||
|
||
/// <summary> | ||
/// Update message request for RCS. | ||
/// </summary> | ||
public struct RcsUpdateMessageRequest : IUpdateMessageRequest | ||
{ | ||
/// <inheritdoc /> | ||
[JsonIgnore] | ||
public string MessageUuid { get; private init; } | ||
|
||
/// <inheritdoc /> | ||
public string Status { get; private init; } | ||
|
||
/// <summary> | ||
/// Build an update message request for RCS. | ||
/// </summary> | ||
/// <param name="messageUuid">UUID of the message to be updated</param> | ||
/// <returns>The request.</returns> | ||
public static RcsUpdateMessageRequest Build(string messageUuid) => new RcsUpdateMessageRequest | ||
{ | ||
MessageUuid = messageUuid, | ||
Status = "revoked", | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#region | ||
using System.Text.Json.Serialization; | ||
#endregion | ||
|
||
namespace Vonage.Messages.WhatsApp; | ||
|
||
/// <summary> | ||
/// Update message request for WhatsApp. | ||
/// </summary> | ||
public readonly struct WhatsAppUpdateMessageRequest : IUpdateMessageRequest | ||
{ | ||
/// <inheritdoc /> | ||
[JsonIgnore] | ||
public string MessageUuid { get; private init; } | ||
|
||
/// <inheritdoc /> | ||
public string Status { get; private init; } | ||
|
||
/// <summary> | ||
/// Build an update message request for WhatsApp. | ||
/// </summary> | ||
/// <param name="messageUuid">UUID of the message to be updated</param> | ||
/// <returns>The request.</returns> | ||
public static WhatsAppUpdateMessageRequest Build(string messageUuid) => new WhatsAppUpdateMessageRequest | ||
{ | ||
MessageUuid = messageUuid, | ||
Status = "read", | ||
}; | ||
} |