-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move filter client from types to extensions (#704)
* move filter client from types to extensions * update changelog
- Loading branch information
1 parent
fc41f8f
commit 07c890e
Showing
4 changed files
with
87 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
stac_fastapi/extensions/stac_fastapi/extensions/core/filter/client.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
"""Filter extensions clients.""" | ||
|
||
import abc | ||
from typing import Any, Dict, Optional | ||
|
||
import attr | ||
|
||
|
||
@attr.s | ||
class AsyncBaseFiltersClient(abc.ABC): | ||
"""Defines a pattern for implementing the STAC filter extension.""" | ||
|
||
async def get_queryables( | ||
self, collection_id: Optional[str] = None, **kwargs | ||
) -> Dict[str, Any]: | ||
"""Get the queryables available for the given collection_id. | ||
If collection_id is None, returns the intersection of all queryables over all | ||
collections. | ||
This base implementation returns a blank queryable schema. This is not allowed | ||
under OGC CQL but it is allowed by the STAC API Filter Extension | ||
https://github.com/radiantearth/stac-api-spec/tree/master/fragments/filter#queryables | ||
""" | ||
return { | ||
"$schema": "https://json-schema.org/draft/2019-09/schema", | ||
"$id": "https://example.org/queryables", | ||
"type": "object", | ||
"title": "Queryables for Example STAC API", | ||
"description": "Queryable names for the example STAC API Item Search filter.", | ||
"properties": {}, | ||
} | ||
|
||
|
||
@attr.s | ||
class BaseFiltersClient(abc.ABC): | ||
"""Defines a pattern for implementing the STAC filter extension.""" | ||
|
||
def get_queryables( | ||
self, collection_id: Optional[str] = None, **kwargs | ||
) -> Dict[str, Any]: | ||
"""Get the queryables available for the given collection_id. | ||
If collection_id is None, returns the intersection of all queryables over all | ||
collections. | ||
This base implementation returns a blank queryable schema. This is not allowed | ||
under OGC CQL but it is allowed by the STAC API Filter Extension | ||
https://github.com/stac-api-extensions/filter#queryables | ||
""" | ||
return { | ||
"$schema": "https://json-schema.org/draft/2019-09/schema", | ||
"$id": "https://example.org/queryables", | ||
"type": "object", | ||
"title": "Queryables for Example STAC API", | ||
"description": "Queryable names for the example STAC API Item Search filter.", | ||
"properties": {}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters