Class PaginatedCollection<TEntries>
Inheritance
Implements
Inherited Members
Namespace: EasyPost.Models.Shared
Assembly: EasyPost.dll
Syntax
public abstract class PaginatedCollection<TEntries> : EasyPostObject, IEasyPostObject where TEntries : EasyPostObject
Type Parameters
| Name | Description |
|---|---|
| TEntries | The type of EasyPostObject contained in the collection. |
Properties
| Improve this Doc View SourceHasMore
Whether there are more items to retrieve server-side.
Declaration
public bool? HasMore { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Nullable<System.Boolean> |
Methods
| Improve this Doc View SourceBuildNextPageParameters<TParameters>(IEnumerable<TEntries>, Nullable<Int32>)
Build the parameters to retrieve the next page of a paginated collection.
Declaration
public abstract TParameters BuildNextPageParameters<TParameters>(IEnumerable<TEntries> entries, int? pageSize = null)
where TParameters : BaseParameters<TEntries>
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<TEntries> | entries | The entries of the collection. |
| System.Nullable<System.Int32> | pageSize | The size of the next page. |
Returns
| Type | Description |
|---|---|
| TParameters | A TParameters-type set of parameters to use for the subsequent API call. |
Type Parameters
| Name | Description |
|---|---|
| TParameters | The type of BaseParameters<TMatchInputType> to construct for the API call. |
Exceptions
| Type | Condition |
|---|---|
| EndOfPaginationError | Thrown if there are no more items to retrieve for the paginated collection. |
GetNextPage<TCollection, TParameters>(Func<TParameters, Task<TCollection>>, Nullable<List<TEntries>>, Nullable<Int32>)
Get the next page of a paginated collection.
Declaration
public async Task<TCollection> GetNextPage<TCollection, TParameters>(Func<TParameters, Task<TCollection>> apiCallFunction, List<TEntries>? currentEntries, int? pageSize = null)
where TCollection : PaginatedCollection<TEntries> where TParameters : BaseParameters<TEntries>
Parameters
| Type | Name | Description |
|---|---|---|
| Func<TParameters, Task<TCollection>> | apiCallFunction | The function to execute to retrieve a page (most likely an All function). |
| System.Nullable<List<TEntries>> | currentEntries | The results on the current page. Used to determine the API call parameters to retrieve the next page. |
| System.Nullable<System.Int32> | pageSize | The size of the next page. |
Returns
| Type | Description |
|---|---|
| Task<TCollection> | The next page of a paginated collection. |
Type Parameters
| Name | Description |
|---|---|
| TCollection | The type of PaginatedCollection<TEntries> to get the next page of. |
| TParameters | The type of BaseParameters<TMatchInputType> to construct for the API call. |
Exceptions
| Type | Condition |
|---|---|
| EndOfPaginationError | Thrown if there is no next page to retrieve. |