Pagination
PaginatedQueryParams
Section titled “PaginatedQueryParams”Query parameters for paginated routes. These parameters should be used on GET routes that support pagination.
Parameter | Type | Default | Description |
---|---|---|---|
page | integer | 1 | The page to return |
pageSize | integer | 100 | The number of items to return per page |
Formats
Section titled “Formats”A JSON example of this model.
/common-grants/opportunities?page=1&pageSize=100
The JSON Schema for this model.
$schema: https://json-schema.org/draft/2020-12/schema$id: PaginatedQueryParams.yamltype: objectproperties: page: type: integer minimum: 1 maximum: 2147483647 default: 1 description: The page to return pageSize: type: integer minimum: 1 maximum: 2147483647 default: 100 description: The number of items to return per pagedescription: Query parameters for paginated routes
The TypeSpec code for this model.
/** Query parameters for paginated routes */model PaginatedQueryParams { /** The page to return */ @query @pageIndex @minValue(1) page?: int32 = 1;
/** The number of items to return per page */ @query @pageSize @minValue(1) pageSize?: int32 = 100;
The Python code for this model.
class PaginationBase(BaseModel): """Parameters for pagination."""
page: int = Field( default=1, description="The page number to retrieve", ge=1, ) page_size: int = Field( default=10, alias="pageSize", description="The number of items per page", ge=1, )
PaginatedBodyParams
Section titled “PaginatedBodyParams”Body parameters for paginated routes. These parameters should be used on POST and PUT routes that support pagination.
Parameter | Type | Default | Description |
---|---|---|---|
page | integer | 1 | The page to return |
pageSize | integer | 100 | The number of items to return per page |
Formats
Section titled “Formats”A JSON example of this model.
{ "page": 1, "pageSize": 100}
The JSON Schema for this model.
$schema: https://json-schema.org/draft/2020-12/schema$id: PaginatedBodyParams.yamltype: objectproperties: page: type: integer minimum: 1 maximum: 2147483647 default: 1 description: The page to return pageSize: type: integer minimum: 1 maximum: 2147483647 default: 100 description: The number of items to return per pagedescription: Body parameters for paginated routes
The TypeSpec code for this model.
/** Body parameters for paginated routes */model PaginatedBodyParams { /** The page to return */ @pageIndex @minValue(1) page?: int32 = 1;
/** The number of items to return per page */ @pageSize @minValue(1) pageSize?: int32 = 100;
The Python code for this model.
class PaginationBase(BaseModel): """Parameters for pagination."""
page: int = Field( default=1, description="The page number to retrieve", ge=1, ) page_size: int = Field( default=10, alias="pageSize", description="The number of items per page", ge=1, )
PaginatedResultsInfo
Section titled “PaginatedResultsInfo”Details about the paginated results. This model should included in the response from a paginated route.
Parameter | Type | Description |
---|---|---|
page | integer | The page to return |
pageSize | integer | The number of items to return per page |
totalItems | integer | The total number of items across all pages |
totalPages | integer | The total number of pages |
Formats
Section titled “Formats”A JSON example of this model.
{ "page": 1, "pageSize": 10, "totalItems": 100, "totalPages": 10}
The JSON Schema for this model.
$schema: https://json-schema.org/draft/2020-12/schema$id: PaginatedResultsInfo.yamltype: objectproperties: page: type: integer minimum: 1 maximum: 2147483647 examples: - 1 description: Current page number (indexing starts at 1) pageSize: type: integer examples: - 20 minimum: 1 description: Number of items per page totalItems: type: integer examples: - 100 description: Total number of items across all pages totalPages: type: integer examples: - 5 description: Total number of pagesrequired: - page - pageSizedescription: Details about the paginated results
The TypeSpec code for this model.
/** Details about the paginated results */model PaginatedResultsInfo { /** Current page number (indexing starts at 1) */ @example(1) @minValue(1) page: int32;
/** Number of items per page */ @example(20) @minValue(1) pageSize: integer;
/** Total number of items across all pages */ @example(100) totalItems?: integer;
/** Total number of pages */ @example(5) totalPages?: integer;
The Python code for this model.
class PaginationBase(BaseModel): """Parameters for pagination."""
page: int = Field( default=1, description="The page number to retrieve", ge=1, ) page_size: int = Field( default=10, alias="pageSize", description="The number of items per page", ge=1, )
class PaginationInfo(PaginationBase): """Information about the pagination of a list."""
total_items: int = Field( ..., alias="totalItems", description="The total number of items", ) total_pages: int = Field( ..., alias="totalPages", description="The total number of pages", )