Filtered
Filtered
Section titled “Filtered”A 200 response with a paginated list of filtered items.
| Parameter | Type | Description |
|---|---|---|
| status | integer | The HTTP status code |
| message | string | The message to return |
| items | Array | Items from the current page |
| paginationInfo | PaginatedResultsInfo | Details about the pagination |
| sortInfo | SortedResultsInfo | The sort order of the items |
| filterInfo | object | The filters applied to the response items |
Formats
Section titled “Formats”A JSON example of this model.
{ "status": 200, "message": "Success", "items": [ { "id": "123", "name": "Test 1" }, { "id": "124", "name": "Test 2" } ], "paginationInfo": { "page": 1, "pageSize": 10, "totalItems": 25, "totalPages": 3 }, "sortInfo": { "field": "name", "direction": "asc" }, "filterInfo": { "lastModifiedAt": { "operator": "gte", "value": "2024-01-01T00:00:00Z" } }}The JSON Schema for this model.
$schema: https://json-schema.org/draft/2020-12/schema$id: Filtered.yamltype: objectproperties: status: type: integer minimum: 200 default: 200 description: The HTTP status code message: type: string default: "Success" description: The message to return items: type: array description: Items from the current page paginationInfo: $ref: PaginatedResultsInfo.yaml sortInfo: $ref: SortedResultsInfo.yaml filterInfo: type: object description: The filters applied to the response itemsrequired: - status - message - items - paginationInfo - sortInfo - filterInfoThe TypeSpec code for this model.
model Filtered<ItemsT, FilterT> extends Success { // Inherit the properties of the Sorted response ...Sorted<ItemsT>;
/** The filters applied to the response items */ filterInfo: { filters: FilterT;
/** Non-fatal errors that occurred during filtering */ errors?: string[]; };}The Python code for this model.
class FilterInfo(CommonGrantsBaseModel, Generic[FilterT]): """Filter information for search results."""
filters: FilterT = Field( ..., description="The filters applied to the response items" ) errors: Optional[list[str]] = Field( default_factory=lambda: [], description="Non-fatal errors that occurred during filtering", )
class Filtered(Sorted[ItemsT], Generic[ItemsT, FilterT]): """A paginated list of items with a filter."""
filter_info: FilterInfo[FilterT] = Field( ..., description="The filters applied to the response items", alias="filterInfo", )
model_config = {"populate_by_name": True}The TypeScript code for this model.
export const FilteredSchema = <ItemsT extends z.ZodTypeAny, FilterT extends z.ZodTypeAny>( itemsSchema: ItemsT, filterSchema: FilterT) => SortedSchema(itemsSchema).extend({ /** The filters applied to the response items */ filterInfo: z .object({ filters: filterSchema,
/** Non-fatal errors that occurred during filtering */ errors: z.array(z.string()).optional(), }) .strict(), });Changelog
Section titled “Changelog”| Version | Changes |
|---|---|
| 0.1.0 |
|