Module stac_fastapi.extensions.core¶
stac_api.extensions.core module.
Sub-modules¶
- stac_fastapi.extensions.core.aggregation
- stac_fastapi.extensions.core.collection_search
- stac_fastapi.extensions.core.fields
- stac_fastapi.extensions.core.filter
- stac_fastapi.extensions.core.free_text
- stac_fastapi.extensions.core.pagination
- stac_fastapi.extensions.core.query
- stac_fastapi.extensions.core.sort
- stac_fastapi.extensions.core.transaction
Classes¶
AggregationExtension¶
class AggregationExtension(
schema_href: Optional[str] = None,
client: Union[stac_fastapi.extensions.core.aggregation.client.AsyncBaseAggregationClient, stac_fastapi.extensions.core.aggregation.client.BaseAggregationClient] = NOTHING,
conformance_classes: List[str] = [<AggregationConformanceClasses.AGGREGATION: 'https://api.stacspec.org/v0.3.0/aggregation'>],
router: fastapi.routing.APIRouter = NOTHING
)
Aggregation Extension.
The purpose of the Aggregation Extension is to provide an endpoint similar to the Search endpoint (/search), but which will provide aggregated information on matching Items rather than the Items themselves. This is highly influenced by the Elasticsearch and OpenSearch aggregation endpoint, but with a more regular structure for responses.
The Aggregation extension adds several endpoints which allow the retrieval of available aggregation fields and aggregation buckets based on a seearch query: GET /aggregations POST /aggregations GET /collections/{collection_id}/aggregations POST /collections/{collection_id}/aggregations GET /aggregate POST /aggregate GET /collections/{collection_id}/aggregate POST /collections/{collection_id}/aggregate
github.com/stac-api-extensions/aggregation/blob/main/README.md
Attributes¶
Name | Type | Description | Default |
---|---|---|---|
conformance_classes | None | Conformance classes provided by the extension | None |
Ancestors (in MRO)¶
- stac_fastapi.types.extension.ApiExtension
- abc.ABC
Class variables¶
GET
POST
Methods¶
get_request_model¶
def get_request_model(
self,
verb: Optional[str] = 'GET'
) -> Optional[pydantic.main.BaseModel]
Return the request model for the extension.method.
The model can differ based on HTTP verb
register¶
def register(
self,
app: fastapi.applications.FastAPI
) -> None
Register the extension with a FastAPI application.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
app | None | target FastAPI application. | None |
Returns:
Type | Description |
---|---|
None | None |
CollectionSearchExtension¶
class CollectionSearchExtension(
GET: stac_fastapi.extensions.core.collection_search.request.BaseCollectionSearchGetRequest = <class 'stac_fastapi.extensions.core.collection_search.request.BaseCollectionSearchGetRequest'>,
conformance_classes: List[str] = [<ConformanceClasses.COLLECTIONSEARCH: 'https://api.stacspec.org/v1.0.0-rc.1/collection-search'>, <ConformanceClasses.BASIS: 'http://www.opengis.net/spec/ogcapi-common-2/1.0/conf/simple-query'>],
schema_href: Optional[str] = None
)
Collection-Search Extension.
The Collection-Search extension adds functionality to the GET - /collections
endpoint which allows the caller to include or exclude specific from the API
response.
Registering this extension with the application has the added effect of
removing the ItemCollection
response model from the /search
endpoint, as
the Fields extension allows the API to return potentially invalid responses
by excluding fields which are required by the STAC spec, such as geometry.
stac-api-extensions/collection-search
Attributes¶
Name | Type | Description | Default |
---|---|---|---|
conformance_classes | list | Defines the list of conformance classes for the extension |
None |
Ancestors (in MRO)¶
- stac_fastapi.types.extension.ApiExtension
- abc.ABC
Descendants¶
- stac_fastapi.extensions.core.CollectionSearchPostExtension
Class variables¶
GET
POST
Static methods¶
from_extensions¶
def from_extensions(
extensions: List[stac_fastapi.types.extension.ApiExtension],
schema_href: Optional[str] = None
) -> 'CollectionSearchExtension'
Create CollectionSearchExtension object from extensions.
Methods¶
get_request_model¶
def get_request_model(
self,
verb: Optional[str] = 'GET'
) -> Optional[pydantic.main.BaseModel]
Return the request model for the extension.method.
The model can differ based on HTTP verb
register¶
def register(
self,
app: fastapi.applications.FastAPI
) -> None
Register the extension with a FastAPI application.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
app | fastapi.FastAPI | target FastAPI application. | None |
Returns:
Type | Description |
---|---|
None | None |
CollectionSearchPostExtension¶
class CollectionSearchPostExtension(
client: Union[stac_fastapi.extensions.core.collection_search.client.AsyncBaseCollectionSearchClient, stac_fastapi.extensions.core.collection_search.client.BaseCollectionSearchClient],
settings: stac_fastapi.types.config.ApiSettings,
conformance_classes: List[str] = [<ConformanceClasses.COLLECTIONSEARCH: 'https://api.stacspec.org/v1.0.0-rc.1/collection-search'>, <ConformanceClasses.BASIS: 'http://www.opengis.net/spec/ogcapi-common-2/1.0/conf/simple-query'>],
schema_href: Optional[str] = None,
router: fastapi.routing.APIRouter = NOTHING,
GET: stac_fastapi.extensions.core.collection_search.request.BaseCollectionSearchGetRequest = <class 'stac_fastapi.extensions.core.collection_search.request.BaseCollectionSearchGetRequest'>,
POST: stac_fastapi.extensions.core.collection_search.request.BaseCollectionSearchPostRequest = <class 'stac_fastapi.extensions.core.collection_search.request.BaseCollectionSearchPostRequest'>
)
Collection-Search Extension.
Extents the collection-search extension with an additional POST - /collections endpoint
NOTE: the POST - /collections endpoint can be conflicting with the POST /collections endpoint registered for the Transaction extension.
stac-api-extensions/collection-search
Attributes¶
Name | Type | Description | Default |
---|---|---|---|
conformance_classes | list | Defines the list of conformance classes for the extension |
None |
Ancestors (in MRO)¶
- stac_fastapi.extensions.core.CollectionSearchExtension
- stac_fastapi.types.extension.ApiExtension
- abc.ABC
Class variables¶
GET
POST
Static methods¶
from_extensions¶
def from_extensions(
extensions: List[stac_fastapi.types.extension.ApiExtension],
*,
client: Union[stac_fastapi.extensions.core.collection_search.client.AsyncBaseCollectionSearchClient, stac_fastapi.extensions.core.collection_search.client.BaseCollectionSearchClient],
settings: stac_fastapi.types.config.ApiSettings,
schema_href: Optional[str] = None,
router: Optional[fastapi.routing.APIRouter] = None
) -> 'CollectionSearchPostExtension'
Create CollectionSearchPostExtension object from extensions.
Methods¶
get_request_model¶
def get_request_model(
self,
verb: Optional[str] = 'GET'
) -> Optional[pydantic.main.BaseModel]
Return the request model for the extension.method.
The model can differ based on HTTP verb
register¶
def register(
self,
app: fastapi.applications.FastAPI
) -> None
Register the extension with a FastAPI application.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
app | None | target FastAPI application. | None |
Returns:
Type | Description |
---|---|
None | None |
FieldsExtension¶
class FieldsExtension(
conformance_classes: List[str] = NOTHING,
schema_href: Optional[str] = None
)
Fields Extension.
The Fields extension adds functionality to the /search
endpoint which
allows the caller to include or exclude specific from the API response.
Registering this extension with the application has the added effect of
removing the ItemCollection
response model from the /search
endpoint, as
the Fields extension allows the API to return potentially invalid responses
by excluding fields which are required by the STAC spec, such as geometry.
Attributes¶
Name | Type | Description | Default |
---|---|---|---|
default_includes | set | defines the default set of included fields. | None |
conformance_classes | list | Defines the list of conformance classes for the extension |
None |
Ancestors (in MRO)¶
- stac_fastapi.types.extension.ApiExtension
- abc.ABC
Class variables¶
GET
POST
Methods¶
get_request_model¶
def get_request_model(
self,
verb: Optional[str] = 'GET'
) -> Optional[pydantic.main.BaseModel]
Return the request model for the extension.method.
The model can differ based on HTTP verb
register¶
def register(
self,
app: fastapi.applications.FastAPI
) -> None
Register the extension with a FastAPI application.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
app | fastapi.FastAPI | target FastAPI application. | None |
Returns:
Type | Description |
---|---|
None | None |
FilterExtension¶
class FilterExtension(
schema_href: Optional[str] = None,
client: Union[stac_fastapi.extensions.core.filter.client.AsyncBaseFiltersClient, stac_fastapi.extensions.core.filter.client.BaseFiltersClient] = NOTHING,
conformance_classes: List[str] = [<FilterConformanceClasses.FILTER: 'http://www.opengis.net/spec/ogcapi-features-3/1.0/conf/filter'>, <FilterConformanceClasses.FEATURES_FILTER: 'http://www.opengis.net/spec/ogcapi-features-3/1.0/conf/features-filter'>, <FilterConformanceClasses.ITEM_SEARCH_FILTER: 'https://api.stacspec.org/v1.0.0-rc.2/item-search#filter'>, <FilterConformanceClasses.BASIC_CQL2: 'http://www.opengis.net/spec/cql2/1.0/conf/basic-cql2'>, <FilterConformanceClasses.CQL2_JSON: 'http://www.opengis.net/spec/cql2/1.0/conf/cql2-json'>, <FilterConformanceClasses.CQL2_TEXT: 'http://www.opengis.net/spec/cql2/1.0/conf/cql2-text'>],
router: fastapi.routing.APIRouter = NOTHING,
response_class: Type[starlette.responses.Response] = <class 'stac_fastapi.api.models.JSONSchemaResponse'>
)
Filter Extension.
The filter extension adds several endpoints which allow the retrieval of queryables and provides an expressive mechanism for searching based on Item
Attributes¶
Name | Type | Description | Default |
---|---|---|---|
client | None | Queryables endpoint logic | None |
conformance_classes | None | Conformance classes provided by the extension | None |
Ancestors (in MRO)¶
- stac_fastapi.types.extension.ApiExtension
- abc.ABC
Class variables¶
GET
POST
Methods¶
get_request_model¶
def get_request_model(
self,
verb: Optional[str] = 'GET'
) -> Optional[pydantic.main.BaseModel]
Return the request model for the extension.method.
The model can differ based on HTTP verb
register¶
def register(
self,
app: fastapi.applications.FastAPI
) -> None
Register the extension with a FastAPI application.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
app | None | target FastAPI application. | None |
Returns:
Type | Description |
---|---|
None | None |
FreeTextAdvancedExtension¶
class FreeTextAdvancedExtension(
conformance_classes: List[str] = [<FreeTextConformanceClasses.SEARCH_ADVANCED: 'https://api.stacspec.org/v1.0.0-rc.1/item-search#advanced-free-text'>, <FreeTextConformanceClasses.COLLECTIONS_ADVANCED: 'https://api.stacspec.org/v1.0.0-rc.1/collection-search#advanced-free-text'>, <FreeTextConformanceClasses.ITEMS_ADVANCED: 'https://api.stacspec.org/v1.0.0-rc.1/ogcapi-features#advanced-free-text'>],
schema_href: Optional[str] = None
)
Free-text Extension.
The Free-text extension adds an additional q
parameter to /search
requests which
allows the caller to perform free-text queries against STAC metadata.
stac-api-extensions/freetext-search?tab=readme-ov-file#advanced
Ancestors (in MRO)¶
- stac_fastapi.types.extension.ApiExtension
- abc.ABC
Class variables¶
GET
POST
Methods¶
get_request_model¶
def get_request_model(
self,
verb: Optional[str] = 'GET'
) -> Optional[pydantic.main.BaseModel]
Return the request model for the extension.method.
The model can differ based on HTTP verb
register¶
def register(
self,
app: fastapi.applications.FastAPI
) -> None
Register the extension with a FastAPI application.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
app | None | target FastAPI application. | None |
Returns:
Type | Description |
---|---|
None | None |
FreeTextExtension¶
class FreeTextExtension(
conformance_classes: List[str] = [<FreeTextConformanceClasses.SEARCH: 'https://api.stacspec.org/v1.0.0-rc.1/item-search#free-text'>, <FreeTextConformanceClasses.COLLECTIONS: 'https://api.stacspec.org/v1.0.0-rc.1/collection-search#free-text'>, <FreeTextConformanceClasses.ITEMS: 'https://api.stacspec.org/v1.0.0-rc.1/ogcapi-features#free-text'>],
schema_href: Optional[str] = None
)
Free-text Extension.
The Free-text extension adds an additional q
parameter to /search
requests which
allows the caller to perform free-text queries against STAC metadata.
stac-api-extensions/freetext-search?tab=readme-ov-file#basic
Ancestors (in MRO)¶
- stac_fastapi.types.extension.ApiExtension
- abc.ABC
Class variables¶
GET
POST
Methods¶
get_request_model¶
def get_request_model(
self,
verb: Optional[str] = 'GET'
) -> Optional[pydantic.main.BaseModel]
Return the request model for the extension.method.
The model can differ based on HTTP verb
register¶
def register(
self,
app: fastapi.applications.FastAPI
) -> None
Register the extension with a FastAPI application.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
app | None | target FastAPI application. | None |
Returns:
Type | Description |
---|---|
None | None |
OffsetPaginationExtension¶
class OffsetPaginationExtension(
conformance_classes: List[str] = NOTHING,
schema_href: Optional[str] = None
)
Offset Pagination.
Though not strictly an extension, the chosen pagination will modify the form of the request object. By making pagination an extension class, we can use create_request_model to dynamically add the correct pagination parameter to the request model for OpenAPI generation.
Ancestors (in MRO)¶
- stac_fastapi.types.extension.ApiExtension
- abc.ABC
Class variables¶
GET
POST
Methods¶
get_request_model¶
def get_request_model(
self,
verb: Optional[str] = 'GET'
) -> Optional[pydantic.main.BaseModel]
Return the request model for the extension.method.
The model can differ based on HTTP verb
register¶
def register(
self,
app: fastapi.applications.FastAPI
) -> None
Register the extension with a FastAPI application.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
app | None | target FastAPI application. | None |
Returns:
Type | Description |
---|---|
None | None |
PaginationExtension¶
class PaginationExtension(
conformance_classes: List[str] = NOTHING,
schema_href: Optional[str] = None
)
Token Pagination.
Though not strictly an extension, the chosen pagination will modify the form of the request object. By making pagination an extension class, we can use create_request_model to dynamically add the correct pagination parameter to the request model for OpenAPI generation.
Ancestors (in MRO)¶
- stac_fastapi.types.extension.ApiExtension
- abc.ABC
Class variables¶
GET
POST
Methods¶
get_request_model¶
def get_request_model(
self,
verb: Optional[str] = 'GET'
) -> Optional[pydantic.main.BaseModel]
Return the request model for the extension.method.
The model can differ based on HTTP verb
register¶
def register(
self,
app: fastapi.applications.FastAPI
) -> None
Register the extension with a FastAPI application.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
app | None | target FastAPI application. | None |
Returns:
Type | Description |
---|---|
None | None |
QueryExtension¶
class QueryExtension(
conformance_classes: List[str] = NOTHING,
schema_href: Optional[str] = None
)
Query Extension.
The Query extension adds an additional query
parameter to /search
requests which
allows the caller to perform queries against item metadata (ex. find all images with
cloud cover less than 15%).
stac-api-extensions/query
Ancestors (in MRO)¶
- stac_fastapi.types.extension.ApiExtension
- abc.ABC
Class variables¶
GET
POST
Methods¶
get_request_model¶
def get_request_model(
self,
verb: Optional[str] = 'GET'
) -> Optional[pydantic.main.BaseModel]
Return the request model for the extension.method.
The model can differ based on HTTP verb
register¶
def register(
self,
app: fastapi.applications.FastAPI
) -> None
Register the extension with a FastAPI application.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
app | None | target FastAPI application. | None |
Returns:
Type | Description |
---|---|
None | None |
SortExtension¶
class SortExtension(
conformance_classes: List[str] = NOTHING,
schema_href: Optional[str] = None
)
Sort Extension.
The Sort extension adds the sortby
parameter to the /search
endpoint, allowing the
caller to specify the sort order of the returned items.
stac-api-extensions/sort
Ancestors (in MRO)¶
- stac_fastapi.types.extension.ApiExtension
- abc.ABC
Class variables¶
GET
POST
Methods¶
get_request_model¶
def get_request_model(
self,
verb: Optional[str] = 'GET'
) -> Optional[pydantic.main.BaseModel]
Return the request model for the extension.method.
The model can differ based on HTTP verb
register¶
def register(
self,
app: fastapi.applications.FastAPI
) -> None
Register the extension with a FastAPI application.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
app | None | target FastAPI application. | None |
Returns:
Type | Description |
---|---|
None | None |
TokenPaginationExtension¶
class TokenPaginationExtension(
conformance_classes: List[str] = NOTHING,
schema_href: Optional[str] = None
)
Token Pagination.
Though not strictly an extension, the chosen pagination will modify the form of the request object. By making pagination an extension class, we can use create_request_model to dynamically add the correct pagination parameter to the request model for OpenAPI generation.
Ancestors (in MRO)¶
- stac_fastapi.types.extension.ApiExtension
- abc.ABC
Class variables¶
GET
POST
Methods¶
get_request_model¶
def get_request_model(
self,
verb: Optional[str] = 'GET'
) -> Optional[pydantic.main.BaseModel]
Return the request model for the extension.method.
The model can differ based on HTTP verb
register¶
def register(
self,
app: fastapi.applications.FastAPI
) -> None
Register the extension with a FastAPI application.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
app | None | target FastAPI application. | None |
Returns:
Type | Description |
---|---|
None | None |
TransactionExtension¶
class TransactionExtension(
client: Union[stac_fastapi.types.core.AsyncBaseTransactionsClient, stac_fastapi.types.core.BaseTransactionsClient],
settings: stac_fastapi.types.config.ApiSettings,
conformance_classes: List[str] = NOTHING,
schema_href: Optional[str] = None,
router: fastapi.routing.APIRouter = NOTHING,
response_class: Type[starlette.responses.Response] = <class 'starlette.responses.JSONResponse'>
)
Transaction Extension.
The transaction extension adds several endpoints which allow the creation, deletion, and updating of items and collections: POST /collections PUT /collections/{collection_id} DELETE /collections/{collection_id} POST /collections/{collection_id}/items PUT /collections/{collection_id}/items DELETE /collections/{collection_id}/items
stac-api-extensions/transaction stac-api-extensions/collection-transaction
Attributes¶
Name | Type | Description | Default |
---|---|---|---|
client | None | CRUD application logic | None |
Ancestors (in MRO)¶
- stac_fastapi.types.extension.ApiExtension
- abc.ABC
Class variables¶
GET
POST
Methods¶
get_request_model¶
def get_request_model(
self,
verb: Optional[str] = 'GET'
) -> Optional[pydantic.main.BaseModel]
Return the request model for the extension.method.
The model can differ based on HTTP verb
register¶
def register(
self,
app: fastapi.applications.FastAPI
) -> None
Register the extension with a FastAPI application.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
app | None | target FastAPI application. | None |
Returns:
Type | Description |
---|---|
None | None |
register_create_collection¶
def register_create_collection(
self
)
Register create collection endpoint (POST /collections).
register_create_item¶
def register_create_item(
self
)
Register create item endpoint (POST /collections/{collection_id}/items).
register_delete_collection¶
def register_delete_collection(
self
)
Register delete collection endpoint (DELETE /collections/{collection_id}).
register_delete_item¶
def register_delete_item(
self
)
Register delete item endpoint (DELETE
/collections/{collection_id}/items/{item_id}).
register_patch_collection¶
def register_patch_collection(
self
)
Register patch collection endpoint (PATCH /collections/{collection_id}).
register_patch_item¶
def register_patch_item(
self
)
Register patch item endpoint (PATCH
/collections/{collection_id}/items/{item_id}).
register_update_collection¶
def register_update_collection(
self
)
Register update collection endpoint (PUT /collections/{collection_id}).
register_update_item¶
def register_update_item(
self
)
Register update item endpoint (PUT
/collections/{collection_id}/items/{item_id}).