Table of Contents

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

id Guid

The message id.

cancellationToken CancellationToken

Cancels the operation.

Returns

Task<bool>

true if it was still scheduled.

ListAsync(PhoneNumber, CancellationToken)

Lists the messages scheduled for an account, ordered by due time.

Task<IReadOnlyList<ScheduledMessage>> ListAsync(PhoneNumber account, CancellationToken cancellationToken = default)

Parameters

account PhoneNumber

The sending account.

cancellationToken CancellationToken

Cancels 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

account PhoneNumber

The sending account.

recipient Recipient

Who receives it.

text string

The text.

dueAt DateTimeOffset

When to send it; a time in the past sends it on the next check.

repeatEvery TimeSpan?

Repeat interval (at least one minute), or null to send once.

cancellationToken CancellationToken

Cancels the operation.

Returns

Task<ScheduledMessage>

The scheduled message, with its Id.

Exceptions

ArgumentException

text is empty.

ArgumentOutOfRangeException

repeatEvery is shorter than one minute.