ReplPagingContextExtensions
Convenience helpers for creating result-flow pages from IReplPagingContext.
- Kind:
Class - Namespace: Repl
- Assembly:
Repl.Core - Source: src/Repl.Core/ResultFlow/ReplPagingContextExtensions.cs
Signature
Section titled “Signature”public static class ReplPagingContextExtensionsInheritance
Section titled “Inheritance”Methods
Section titled “Methods”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)Type Parameters
Section titled “Type Parameters”T: Item type.
Parameters
Section titled “Parameters”context(IReplPagingContext): Paging context for the current invocation.fetch(Func<ReplPageRequest, CancellationToken, ValueTask<ReplPage<T>>>): Page fetch delegate.
Returns
Section titled “Returns”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)Type Parameters
Section titled “Type Parameters”T: Item type.
Parameters
Section titled “Parameters”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.
Returns
Section titled “Returns”ReplPage<T> - A result page consumable by Repl renderers.