Skip to content

Commit

Permalink
Add documentation of ResponsePage class
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinTTY committed Aug 6, 2024
1 parent 39d315b commit 4b61b3e
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 1 deletion.
97 changes: 97 additions & 0 deletions docs/docs/api-reference/responses/response-page.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
---
title: ResponsePage<T>
---

The `ResponsePage<T>` class represents a paged response from the GoCardless API.

## Properties

### `Count` - [uint](https://learn.microsoft.com/en-us/dotnet/api/system.uint32)

The total number of items that can be accessed via the paged responses (not necessarily through the current page).

### `Next` - [Uri](https://learn.microsoft.com/en-us/dotnet/api/system.uri)?

The URI of the next response page.

### `Previous` - [Uri](https://learn.microsoft.com/en-us/dotnet/api/system.uri)?

The URI of the last response page.

### `Results` - [List\<T\>](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.list-1)

The results that were fetched with this page.

## Constructor

```csharp
public ResponsePage(uint count, Uri? next, Uri? previous, List<T> results)
```

### Parameters

#### `count` - [uint](https://learn.microsoft.com/en-us/dotnet/api/system.uint32)

The total number of items that can be accessed via the paged responses (not necessarily through the current page).

#### `next` - [Uri](https://learn.microsoft.com/en-us/dotnet/api/system.uri)?

The URI of the next response page.

#### `previous` - [Uri](https://learn.microsoft.com/en-us/dotnet/api/system.uri)?

The URI of the last response page.

#### `results` - [List\<T\>](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.list-1)

## Methods

### `GetNextPage`

Gets the next `ResponsePage<T>`, linked to the current one.

```csharp
public async Task<NordigenApiResponse<ResponsePage<T>, BasicResponse>?>
GetNextPage(NordigenClient nordigenClient, CancellationToken cancellationToken = default)
```

#### Parameters

##### `nordigenClient` - [NordigenClient](/docs/api-reference/nordigen-client)

The client to use to retrieve the page.

##### `cancellationToken` - [CancellationToken](https://learn.microsoft.com/en-us/dotnet/api/system.threading.cancellationtoken)

A token to signal cancellation of the operation.

#### Returns

`Task<NordigenApiResponse<ResponsePage<T>, BasicResponse>?>`

A `NordigenApiResponse` containing either the next `ResponsePage<T>` or null if there is no next page to retrieve (if the request is successful).

### `GetPreviousPage`

Gets the previous `ResponsePage<T>`, linked to the current one.

```csharp
public async Task<NordigenApiResponse<ResponsePage<T>, BasicResponse>?>
GetPreviousPage(NordigenClient nordigenClient, CancellationToken cancellationToken = default)
```

#### Parameters

##### `nordigenClient` - [NordigenClient](/docs/api-reference/nordigen-client)

The client to use to retrieve the page.

##### `cancellationToken` - [CancellationToken](https://learn.microsoft.com/en-us/dotnet/api/system.threading.cancellationtoken)

A token to signal cancellation of the operation.

#### Returns

`Task<NordigenApiResponse<ResponsePage<T>, BasicResponse>?>`

A `NordigenApiResponse` containing either the previous `ResponsePage<T>` or null if there is no previous page to retrieve (if the request is successful).
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace RobinTTY.NordigenApiClient.Models.Responses;

/// <summary>
/// A paged response from the Nordigen API.
/// A paged response from the GoCardless API.
/// </summary>
/// <typeparam name="T">The contained response type.</typeparam>
public class ResponsePage<T>
Expand Down

0 comments on commit 4b61b3e

Please sign in to comment.