> Documentation index: https://www.gooddata.ai/docs/gooddata-ui/llms.txt lists every page of these docs as Markdown.

# IPagedResource

- Package: [@gooddata/sdk-backend-spi](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/index.md)
- Kind: interface
- Source: https://github.com/gooddata/gooddata-ui-sdk/blob/rel/11.64/libs/sdk-backend-spi/src/common/paging.ts

Interface to interact with paged asynchronous resources

**Signature:**

```typescript
export interface IPagedResource<TItem> 
```

## Properties

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [cacheId?](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ipagedresource/index.md#ipagedresourcecacheid) | `readonly` | string | _(Optional)_ |
| [items](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ipagedresource/index.md#ipagedresourceitems) | `readonly` | TItem[] |  |
| [limit](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ipagedresource/index.md#ipagedresourcelimit) | `readonly` | number |  |
| [offset](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ipagedresource/index.md#ipagedresourceoffset) | `readonly` | number |  |
| [totalCount](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ipagedresource/index.md#ipagedresourcetotalcount) | `readonly` | number |  |

## Methods

| Method | Description |
| --- | --- |
| [all()](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ipagedresource/index.md#ipagedresourceall) | Request all the pages merged in a single array. |
| [allSorted(compareFn)](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ipagedresource/index.md#ipagedresourceallsorted) | Request all the pages merged in a single array and sort them using the given comparator. |
| [goTo(pageIndex)](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ipagedresource/index.md#ipagedresourcegoto) | Request a specific page of the resource |
| [next()](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ipagedresource/index.md#ipagedresourcenext) | Request next page of the resource |

## Property details

### IPagedResource.cacheId

**Signature:**

```typescript
readonly cacheId?: string;
```

### IPagedResource.items

**Signature:**

```typescript
readonly items: TItem[];
```

### IPagedResource.limit

**Signature:**

```typescript
readonly limit: number;
```

### IPagedResource.offset

**Signature:**

```typescript
readonly offset: number;
```

### IPagedResource.totalCount

**Signature:**

```typescript
readonly totalCount: number;
```

## Method details

### IPagedResource.all()

Request all the pages merged in a single array.

**Signature:**

```typescript
all(): Promise<TItem[]>;
```
**Returns:**

Promise&lt;TItem[]&gt;

promise of an array for all the pages' contents in one array

#### Remarks

This MUST respect all the original query settings except for the paging settings (e.g. offset, limit).

### IPagedResource.allSorted()

Request all the pages merged in a single array and sort them using the given comparator.

**Signature:**

```typescript
allSorted(compareFn: (a: TItem, b: TItem) => number): Promise<TItem[]>;
```

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| compareFn | (a: TItem, b: TItem) =&gt; number | the compare function to use - the semantics are the same os for the Array.sort parameter |

**Returns:**

Promise&lt;TItem[]&gt;

promise of an array for all the pages' contents in one array

#### Remarks

This MUST respect all the original query settings except for the paging settings (e.g. offset, limit).

### IPagedResource.goTo()

Request a specific page of the resource

**Signature:**

```typescript
goTo(pageIndex: number): Promise<IPagedResource<TItem>>;
```

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| pageIndex | number | index of requested page: positive, zero-based |

**Returns:**

Promise&lt;[IPagedResource](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ipagedresource/index.md)&lt;TItem&gt;&gt;

promise of a paged resource with the results of selected page

### IPagedResource.next()

Request next page of the resource

**Signature:**

```typescript
next(): Promise<IPagedResource<TItem>>;
```
**Returns:**

Promise&lt;[IPagedResource](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ipagedresource/index.md)&lt;TItem&gt;&gt;

promise of a paged resource with the results of next page
