> ## Documentation Index
> Fetch the complete documentation index at: https://klef.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Pager

> Walks cursor, offset, and link pagination.

```csharp
public static class Pager
```

## Methods

### CollectAsync()

```csharp
public static Task<IReadOnlyList<TItem>> CollectAsync<TPage, TItem>(Func<string?, Task<TPage>> fetch, Func<TPage, IEnumerable<TItem>> items, Func<TPage, string?> next)
```

Collects every page by cursor.

#### Type Parameters

**TPage** *required*

**TItem** *required*

#### Parameters

**fetch** `Func\<string, Task\<TPage\>\>` *required*

**items** `Func\<TPage, IEnumerable\<TItem\>\>` *required*

**next** `Func\<TPage, string\>` *required*

#### Returns

`Task<IReadOnlyList<TItem>>`

### CollectOffsetAsync()

```csharp
public static Task<IReadOnlyList<TItem>> CollectOffsetAsync<TItem>(Func<int, Task<IReadOnlyList<TItem>>> fetch)
```

Collects every page by offset.

#### Type Parameters

**TItem** *required*

#### Parameters

**fetch** `Func\<int, Task\<IReadOnlyList\<TItem\>\>\>` *required*

#### Returns

`Task<IReadOnlyList<TItem>>`

### NextLink()

```csharp
public static string? NextLink(HttpResponseMessage response)
```

Reads the next page's link header.

#### Parameters

**response** `HttpResponseMessage` *required*

#### Returns

`string`


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.