-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added support for message batches API hence mark `SendBatchAsync(...)` as obsolete in its favour. - Added endpoints/methods for cancel and redact on identity verifications, evaluations and messages. - Added `Batch`, `Segements`, `Sent` properties to `Message`. - Added filters by `sent`, `batch`, and `stream ` when listing messages
- Loading branch information
1 parent
b7115c9
commit 03eb94a
Showing
20 changed files
with
685 additions
and
15 deletions.
There are no files selected for viewing
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,16 @@ | ||
namespace Falu.Core; | ||
|
||
/// | ||
public interface ISupportsCanceling<TResource> where TResource : IHasId, IHasRedaction | ||
{ | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
/// <param name="id">Unique identifier for the object.</param> | ||
/// <param name="options">Options to use for the request.</param> | ||
/// <param name="cancellationToken"></param> | ||
/// <returns></returns> | ||
Task<ResourceResponse<TResource>> CancelAsync(string id, | ||
RequestOptions? options = null, | ||
CancellationToken cancellationToken = default); | ||
} |
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
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,50 @@ | ||
using Falu.Core; | ||
|
||
namespace Falu.MessageBatches; | ||
|
||
/// <summary> | ||
/// Represents a batch of messages | ||
/// </summary> | ||
public class MessageBatch : MessageBatchPatchModel, IHasId, IHasCreated, IHasUpdated, IHasRedaction, IHasWorkspace, IHasLive, IHasEtag | ||
{ | ||
/// <inheritdoc/> | ||
public string? Id { get; set; } | ||
|
||
/// <inheritdoc/> | ||
public DateTimeOffset Created { get; set; } | ||
|
||
/// <inheritdoc/> | ||
public DateTimeOffset Updated { get; set; } | ||
|
||
/// <summary> | ||
/// Stream used for the message. | ||
/// </summary> | ||
public string? Stream { get; set; } | ||
|
||
/// <summary> | ||
/// Schedule information for the message batch. | ||
/// </summary> | ||
public MessageBatchSchedule? Schedule { get; set; } | ||
|
||
/// <summary> | ||
/// Unique identifiers of the messages tracked in this batch. | ||
/// </summary> | ||
public List<string>? Messages { get; set; } | ||
|
||
/// <summary> | ||
/// Total number of segments from each message. | ||
/// </summary> | ||
public int Segements { get; set; } | ||
|
||
/// <inheritdoc/> | ||
public DataRedaction? Redaction { get; set; } | ||
|
||
/// <inheritdoc/> | ||
public string? Workspace { get; set; } | ||
|
||
/// <inheritdoc/> | ||
public bool Live { get; set; } | ||
|
||
/// <inheritdoc/> | ||
public string? Etag { get; set; } | ||
} |
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,28 @@ | ||
using Falu.Messages; | ||
|
||
namespace Falu.MessageBatches; | ||
|
||
/// <summary> | ||
/// Information for creating a message batch. | ||
/// </summary> | ||
public class MessageBatchCreateRequest | ||
{ | ||
/// <summary> | ||
/// The messages. | ||
/// </summary> | ||
public List<MessageBatchCreateRequestMessage>? Messages { get; set; } | ||
|
||
/// <summary> | ||
/// The stream to use. | ||
/// It can either be the name or unique identifier of the stream. | ||
/// If not provided, message will default to the "transactional" stream. | ||
/// </summary> | ||
public string Stream { get; set; } = "transactional"; | ||
|
||
/// <summary> | ||
/// Schedule for sending the message batch. | ||
/// When <see langword="null"/>, the message batch | ||
/// is enqueued for immediate sending. | ||
/// </summary> | ||
public MessageCreateRequestSchedule? Schedule { get; set; } | ||
} |
27 changes: 27 additions & 0 deletions
27
src/FaluSdk/MessageBatches/MessageBatchCreateRequestMessage.cs
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,27 @@ | ||
using Falu.Messages; | ||
|
||
namespace Falu.MessageBatches; | ||
|
||
/// <summary> | ||
/// Information about one or more messages to be created in a batch | ||
/// </summary> | ||
public class MessageBatchCreateRequestMessage | ||
{ | ||
/// <summary> | ||
/// Destination phone numbers in <see href="https://en.wikipedia.org/wiki/E.164">E.164 format</see>. | ||
/// You can provide up to 500 numbers in one request. | ||
/// </summary> | ||
public IList<string>? To { get; set; } | ||
|
||
/// <summary> | ||
/// Actual message content to be sent. | ||
/// Required if <see cref="Template"/> is not specified. | ||
/// </summary> | ||
public string? Body { get; set; } | ||
|
||
/// <summary> | ||
/// The template to use. | ||
/// Required if <see cref="Body"/> is not specified. | ||
/// </summary> | ||
public MessageSourceTemplate? Template { get; set; } | ||
} |
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,12 @@ | ||
using Falu.Core; | ||
|
||
namespace Falu.MessageBatches; | ||
|
||
/// <summary> | ||
/// A model representing details that can be changed about a message batch. | ||
/// </summary> | ||
public class MessageBatchPatchModel : IHasMetadata | ||
{ | ||
/// <inheritdoc/> | ||
public Dictionary<string, string>? Metadata { get; set; } | ||
} |
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 Falu.MessageBatches; | ||
|
||
/// <summary> | ||
/// Information about scheduling for a message batch. | ||
/// </summary> | ||
public class MessageBatchSchedule | ||
{ | ||
/// <summary> | ||
/// Time at which the message batch is/was scheduled scheduled to be sent. | ||
/// </summary> | ||
public DateTimeOffset Time { get; set; } | ||
|
||
/// <summary> | ||
/// Duration for which the message batch is/was to be delayed before sending. | ||
/// </summary> | ||
public TimeSpan? Delay { get; set; } | ||
} |
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,19 @@ | ||
using Falu.Core; | ||
|
||
namespace Falu.MessageBatches; | ||
|
||
/// <summary>Options for filtering and pagination of message batches.</summary> | ||
public record MessageBatchesListOptions : BasicListOptions | ||
{ | ||
/// <summary> | ||
/// Unique identifier of the message stream to filter for. | ||
/// </summary> | ||
public string? Stream { get; set; } | ||
|
||
/// <inheritdoc/> | ||
internal override void Populate(QueryValues values) | ||
{ | ||
base.Populate(values); | ||
values.Add("stream", Stream); | ||
} | ||
} |
Oops, something went wrong.