Skip to content

Filtered

A 200 response with a paginated list of filtered items.

ParameterTypeDescription
statusintegerThe HTTP status code
messagestringThe message to return
itemsArrayItems from the current page
paginationInfoPaginationInfoDetails about the pagination
sortInfoSortInfoThe sort order of the items
filterInfoobjectThe filters applied to the response items

An example filtered response:

{
"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"
}
}
}
import "@common-grants/core";
import "@typespec/http";
using TypeSpec.Http;
using CommonGrants.Pagination;
using CommonGrants.Responses;
using CommonGrants.Filters;
model TestModel {
id: string;
name: string;
}
model TestFilter {
title: StringComparisonFilter;
}
@summary("Get test")
@doc("Get a test model")
@get
op getTest(
filters: TestFilter,
pagination: PaginatedBodyParams,
): Filtered<TestModel, TestFilter>;