|
1 | 1 | """Base clients."""
|
2 | 2 |
|
3 |
| - |
4 | 3 | import abc
|
| 4 | +import importlib |
| 5 | +import warnings |
5 | 6 | from typing import Any, Dict, List, Optional, Union
|
6 | 7 | from urllib.parse import urljoin
|
7 | 8 |
|
|
22 | 23 | from stac_fastapi.types.rfc3339 import DateTimeType
|
23 | 24 | from stac_fastapi.types.search import BaseSearchPostRequest
|
24 | 25 |
|
| 26 | +__all__ = [ |
| 27 | + "NumType", |
| 28 | + "StacType", |
| 29 | + "BaseTransactionsClient", |
| 30 | + "AsyncBaseTransactionsClient", |
| 31 | + "LandingPageMixin", |
| 32 | + "BaseCoreClient", |
| 33 | + "AsyncBaseCoreClient", |
| 34 | +] |
| 35 | + |
25 | 36 | NumType = Union[float, int]
|
26 | 37 | StacType = Dict[str, Any]
|
27 | 38 |
|
@@ -737,53 +748,16 @@ async def item_collection(
|
737 | 748 | ...
|
738 | 749 |
|
739 | 750 |
|
740 |
| -@attr.s |
741 |
| -class AsyncBaseFiltersClient(abc.ABC): |
742 |
| - """Defines a pattern for implementing the STAC filter extension.""" |
743 |
| - |
744 |
| - async def get_queryables( |
745 |
| - self, collection_id: Optional[str] = None, **kwargs |
746 |
| - ) -> Dict[str, Any]: |
747 |
| - """Get the queryables available for the given collection_id. |
748 |
| -
|
749 |
| - If collection_id is None, returns the intersection of all queryables over all |
750 |
| - collections. |
751 |
| -
|
752 |
| - This base implementation returns a blank queryable schema. This is not allowed |
753 |
| - under OGC CQL but it is allowed by the STAC API Filter Extension |
754 |
| - https://github.com/radiantearth/stac-api-spec/tree/master/fragments/filter#queryables |
755 |
| - """ |
756 |
| - return { |
757 |
| - "$schema": "https://json-schema.org/draft/2019-09/schema", |
758 |
| - "$id": "https://example.org/queryables", |
759 |
| - "type": "object", |
760 |
| - "title": "Queryables for Example STAC API", |
761 |
| - "description": "Queryable names for the example STAC API Item Search filter.", |
762 |
| - "properties": {}, |
763 |
| - } |
764 |
| - |
765 |
| - |
766 |
| -@attr.s |
767 |
| -class BaseFiltersClient(abc.ABC): |
768 |
| - """Defines a pattern for implementing the STAC filter extension.""" |
769 |
| - |
770 |
| - def get_queryables( |
771 |
| - self, collection_id: Optional[str] = None, **kwargs |
772 |
| - ) -> Dict[str, Any]: |
773 |
| - """Get the queryables available for the given collection_id. |
774 |
| -
|
775 |
| - If collection_id is None, returns the intersection of all queryables over all |
776 |
| - collections. |
| 751 | +# TODO: remove for 3.0.0 final release |
| 752 | +def __getattr__(name: str) -> Any: |
| 753 | + if name in ["AsyncBaseFiltersClient", "BaseFiltersClient"]: |
| 754 | + warnings.warn( |
| 755 | + f"""importing {name} from `stac_fastapi.types.core` is deprecated, |
| 756 | + please import it from `stac_fastapi.extensions.core.filter.client`.""", |
| 757 | + DeprecationWarning, |
| 758 | + stacklevel=2, |
| 759 | + ) |
| 760 | + clients = importlib.import_module("stac_fastapi.extensions.core.filter.client") |
| 761 | + return getattr(clients, name) |
777 | 762 |
|
778 |
| - This base implementation returns a blank queryable schema. This is not allowed |
779 |
| - under OGC CQL but it is allowed by the STAC API Filter Extension |
780 |
| - https://github.com/stac-api-extensions/filter#queryables |
781 |
| - """ |
782 |
| - return { |
783 |
| - "$schema": "https://json-schema.org/draft/2019-09/schema", |
784 |
| - "$id": "https://example.org/queryables", |
785 |
| - "type": "object", |
786 |
| - "title": "Queryables for Example STAC API", |
787 |
| - "description": "Queryable names for the example STAC API Item Search filter.", |
788 |
| - "properties": {}, |
789 |
| - } |
| 763 | + raise AttributeError(f"module {__name__} has no attribute {name}") |
0 commit comments