Interface IMessageScheduler
- Namespace
- Signal.Application.Scheduling
- Assembly
- Signal.Application.dll
Schedules, cancels and lists messages sent later by the host.
public interface IMessageScheduler
Methods
CancelAsync(Guid, CancellationToken)
Cancels a scheduled message.
Task<bool> CancelAsync(Guid id, CancellationToken cancellationToken = default)
Parameters
idGuidThe message id.
cancellationTokenCancellationTokenCancels the operation.
Returns
ListAsync(PhoneNumber, CancellationToken)
Lists the messages scheduled for an account, ordered by due time.
Task<IReadOnlyList<ScheduledMessage>> ListAsync(PhoneNumber account, CancellationToken cancellationToken = default)
Parameters
accountPhoneNumberThe sending account.
cancellationTokenCancellationTokenCancels the operation.
Returns
- Task<IReadOnlyList<ScheduledMessage>>
The messages.
ScheduleAsync(PhoneNumber, Recipient, string, DateTimeOffset, TimeSpan?, CancellationToken)
Schedules a text message.
Task<ScheduledMessage> ScheduleAsync(PhoneNumber account, Recipient recipient, string text, DateTimeOffset dueAt, TimeSpan? repeatEvery = null, CancellationToken cancellationToken = default)
Parameters
accountPhoneNumberThe sending account.
recipientRecipientWho receives it.
textstringThe text.
dueAtDateTimeOffsetWhen to send it; a time in the past sends it on the next check.
repeatEveryTimeSpan?Repeat interval (at least one minute), or null to send once.
cancellationTokenCancellationTokenCancels the operation.
Returns
- Task<ScheduledMessage>
The scheduled message, with its Id.
Exceptions
- ArgumentException
textis empty.- ArgumentOutOfRangeException
repeatEveryis shorter than one minute.