|
16 | 16 | class FilterExtensionGetRequest(APIRequest): |
17 | 17 | """Filter extension GET request model.""" |
18 | 18 |
|
19 | | - filter: Annotated[Optional[str], Query()] = attr.ib(default=None) |
20 | | - filter_crs: Annotated[Optional[str], Query(alias="filter-crs")] = attr.ib( |
21 | | - default=None |
22 | | - ) |
23 | | - filter_lang: Annotated[Optional[FilterLang], Query(alias="filter-lang")] = attr.ib( |
24 | | - default="cql2-text" |
25 | | - ) |
| 19 | + filter: Annotated[ |
| 20 | + Optional[str], |
| 21 | + Query( |
| 22 | + description="""A CQL filter expression for filtering items.\n |
| 23 | +Supports `CQL-JSON` as defined in https://portal.ogc.org/files/96288\n |
| 24 | +Remember to URL encode the CQL-JSON if using GET""", |
| 25 | + json_schema_extra={ |
| 26 | + "example": "id='LC08_L1TP_060247_20180905_20180912_01_T1_L1TP' AND collection='landsat8_l1tp'", # noqa: E501 |
| 27 | + }, |
| 28 | + ), |
| 29 | + ] = attr.ib(default=None) |
| 30 | + filter_crs: Annotated[ |
| 31 | + Optional[str], |
| 32 | + Query( |
| 33 | + alias="filter-crs", |
| 34 | + description="The coordinate reference system (CRS) used by spatial literals in the 'filter' value. Default is `http://www.opengis.net/def/crs/OGC/1.3/CRS84`", # noqa: E501 |
| 35 | + ), |
| 36 | + ] = attr.ib(default=None) |
| 37 | + filter_lang: Annotated[ |
| 38 | + Optional[FilterLang], |
| 39 | + Query( |
| 40 | + alias="filter-lang", |
| 41 | + description="The CQL filter encoding that the 'filter' value uses.", |
| 42 | + ), |
| 43 | + ] = attr.ib(default="cql2-text") |
26 | 44 |
|
27 | 45 |
|
28 | 46 | class FilterExtensionPostRequest(BaseModel): |
29 | 47 | """Filter extension POST request model.""" |
30 | 48 |
|
31 | | - filter: Optional[Dict[str, Any]] = None |
32 | | - filter_crs: Optional[str] = Field(alias="filter-crs", default=None) |
33 | | - filter_lang: Optional[FilterLang] = Field(alias="filter-lang", default="cql2-json") |
| 49 | + filter: Optional[Dict[str, Any]] = Field( |
| 50 | + default=None, |
| 51 | + description="A CQL filter expression for filtering items.", |
| 52 | + json_schema_extra={ |
| 53 | + "example": { |
| 54 | + "op": "and", |
| 55 | + "args": [ |
| 56 | + { |
| 57 | + "op": "=", |
| 58 | + "args": [ |
| 59 | + {"property": "id"}, |
| 60 | + "LC08_L1TP_060247_20180905_20180912_01_T1_L1TP", |
| 61 | + ], |
| 62 | + }, |
| 63 | + {"op": "=", "args": [{"property": "collection"}, "landsat8_l1tp"]}, |
| 64 | + ], |
| 65 | + }, |
| 66 | + }, |
| 67 | + ) |
| 68 | + filter_crs: Optional[str] = Field( |
| 69 | + alias="filter-crs", |
| 70 | + default=None, |
| 71 | + description="The coordinate reference system (CRS) used by spatial literals in the 'filter' value. Default is `http://www.opengis.net/def/crs/OGC/1.3/CRS84`", # noqa: E501 |
| 72 | + ) |
| 73 | + filter_lang: Optional[FilterLang] = Field( |
| 74 | + alias="filter-lang", |
| 75 | + default="cql2-json", |
| 76 | + description="The CQL filter encoding that the 'filter' value uses.", |
| 77 | + ) |
0 commit comments