Spaces:
Runtime error
Runtime error
Download src/SCM.Shared/Pagination/PageRequest.cs from rafaeldavila/scm-api: direct link, hf CLI and curl.
- Browser
- Download file 559 Bytes
-
https://huggingface.co/spaces/rafaeldavila/scm-api/resolve/main/src/SCM.Shared/Pagination/PageRequest.cs
- Command line
-
hf download hf://spaces/rafaeldavila/scm-api/src/SCM.Shared/Pagination/PageRequest.cs
-
curl -L -o PageRequest.cs https://huggingface.co/spaces/rafaeldavila/scm-api/resolve/main/src/SCM.Shared/Pagination/PageRequest.cs
559 Bytes
| namespace SCM.Shared.Pagination; | |
| /// <summary>Parâmetros de paginação normalizados (limites defensivos).</summary> | |
| public readonly record struct PageRequest | |
| { | |
| public const int MaxPageSize = 200; | |
| public PageRequest(int page, int pageSize) | |
| { | |
| Page = page < 1 ? 1 : page; | |
| PageSize = pageSize switch | |
| { | |
| < 1 => 20, | |
| > MaxPageSize => MaxPageSize, | |
| _ => pageSize | |
| }; | |
| } | |
| public int Page { get; } | |
| public int PageSize { get; } | |
| public int Offset => (Page - 1) * PageSize; | |
| } | |