pendingMessages

suspend fun pendingMessages(afterSequence: Long? = null, limit: Int, recipient: DeviceAddress? = null): PendingMessagePage

One page of the sent messages not acknowledged yet, with their plaintext (docs/outbound-message-lifecycle.md): at most limit (1..PendingMessagePage.MAX_SIZE) messages with a PendingMessage.sequence greater than afterSequence (from the start if null), to recipient only if given, in ascending sequence order.

The cursor is the sequence number, never an offset: messages acknowledged or abandoned between pages do not shift later pages, and no message is returned twice by one enumeration. Each page is read in its own transaction; an enumeration is not a snapshot, so messages sent meanwhile (higher sequence numbers) can appear on later pages. A recipient filter uses the same global sequence as cursor.

Throws IllegalArgumentException for a limit outside 1..PendingMessagePage.MAX_SIZE or a negative afterSequence.