Skip to content

ReplPagingContextExtensions

Convenience helpers for creating result-flow pages from IReplPagingContext.

public static class ReplPagingContextExtensions

CreateSource<T>(IReplPagingContext, Func<ReplPageRequest, CancellationToken, ValueTask<ReplPage<T>>>)

Section titled “CreateSource<T>(IReplPagingContext, Func<ReplPageRequest, CancellationToken, ValueTask<ReplPage<T>>>)”

Creates a lazy page source that can fetch additional pages on demand.

public static IReplPageSource<T> CreateSource<T>(this IReplPagingContext context, Func<ReplPageRequest, CancellationToken, ValueTask<ReplPage<T>>> fetch)
  • T: Item type.
  • context (IReplPagingContext): Paging context for the current invocation.
  • fetch (Func<ReplPageRequest, CancellationToken, ValueTask<ReplPage<T>>>): Page fetch delegate.

IReplPageSource<T> - A page source consumable by interactive renderers.

Page<T>(IReplPagingContext, IReadOnlyList<T>, string?, long?)

Section titled “Page<T>(IReplPagingContext, IReadOnlyList<T>, string?, long?)”

Creates a paged result from an already fetched page.

public static ReplPage<T> Page<T>(this IReplPagingContext context, IReadOnlyList<T> items, string? nextCursor = null, long? totalCount = null)
  • T: Item type.
  • context (IReplPagingContext): Paging context for the current invocation.
  • items (IReadOnlyList<T>): Items in the current page.
  • nextCursor (string): Cursor for the next page, when one exists.
  • totalCount (long?): Total item count, when known without expensive enumeration.

ReplPage<T> - A result page consumable by Repl renderers.