Module stac_fastapi.types.core¶
Base clients.
Variables¶
NumType
StacType
Classes¶
AsyncBaseCoreClient¶
class AsyncBaseCoreClient(
stac_version: str = '1.0.0',
landing_page_id: str = 'stac-fastapi',
title: str = 'stac-fastapi',
description: str = 'stac-fastapi',
base_conformance_classes: List[str] = NOTHING,
extensions: List[stac_fastapi.types.extension.ApiExtension] = NOTHING
)
Defines a pattern for implementing STAC api core endpoints.
Attributes¶
Name | Type | Description | Default |
---|---|---|---|
extensions | None | list of registered api extensions. | None |
Ancestors (in MRO)¶
- stac_fastapi.types.core.LandingPageMixin
- abc.ABC
Methods¶
all_collections¶
def all_collections(
self,
**kwargs
) -> stac_fastapi.types.stac.Collections
Get all available collections.
Called with GET /collections
.
Returns:
Type | Description |
---|---|
None | A list of collections. |
conformance¶
def conformance(
self,
**kwargs
) -> stac_fastapi.types.stac.Conformance
Conformance classes.
Called with GET /conformance
.
Returns:
Type | Description |
---|---|
None | Conformance classes which the server conforms to. |
conformance_classes¶
def conformance_classes(
self
) -> List[str]
Generate conformance classes by adding extension conformance to base
conformance classes.
extension_is_enabled¶
def extension_is_enabled(
self,
extension: str
) -> bool
Check if an api extension is enabled.
get_collection¶
def get_collection(
self,
collection_id: str,
**kwargs
) -> stac_fastapi.types.stac.Collection
Get collection by id.
Called with GET /collections/{collection_id}
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
collection_id | None | Id of the collection. | None |
Returns:
Type | Description |
---|---|
None | Collection. |
get_item¶
def get_item(
self,
item_id: str,
collection_id: str,
**kwargs
) -> stac_fastapi.types.stac.Item
Get item by id.
Called with GET /collections/{collection_id}/items/{item_id}
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
item_id | None | Id of the item. | None |
collection_id | None | Id of the collection. | None |
Returns:
Type | Description |
---|---|
None | Item. |
get_search¶
def get_search(
self,
collections: Optional[List[str]] = None,
ids: Optional[List[str]] = None,
bbox: Union[Tuple[Union[float, int], Union[float, int], Union[float, int], Union[float, int]], Tuple[Union[float, int], Union[float, int], Union[float, int], Union[float, int], Union[float, int], Union[float, int]], NoneType] = None,
intersects: Optional[Annotated[Union[geojson_pydantic.geometries.Point, geojson_pydantic.geometries.MultiPoint, geojson_pydantic.geometries.LineString, geojson_pydantic.geometries.MultiLineString, geojson_pydantic.geometries.Polygon, geojson_pydantic.geometries.MultiPolygon, geojson_pydantic.geometries.GeometryCollection], FieldInfo(annotation=NoneType, required=True, discriminator='type')]] = None,
datetime: Optional[str] = None,
limit: Optional[int] = 10,
**kwargs
) -> stac_fastapi.types.stac.ItemCollection
Cross catalog search (GET).
Called with GET /search
.
Returns:
Type | Description |
---|---|
None | ItemCollection containing items which match the search criteria. |
item_collection¶
def item_collection(
self,
collection_id: str,
bbox: Union[Tuple[Union[float, int], Union[float, int], Union[float, int], Union[float, int]], Tuple[Union[float, int], Union[float, int], Union[float, int], Union[float, int], Union[float, int], Union[float, int]], NoneType] = None,
datetime: Optional[str] = None,
limit: int = 10,
token: str = None,
**kwargs
) -> stac_fastapi.types.stac.ItemCollection
Get all items from a specific collection.
Called with GET /collections/{collection_id}/items
Parameters:
Name | Type | Description | Default |
---|---|---|---|
collection_id | None | id of the collection. | None |
limit | None | number of items to return. | None |
token | None | pagination token. | None |
Returns:
Type | Description |
---|---|
None | An ItemCollection. |
landing_page¶
def landing_page(
self,
**kwargs
) -> stac_fastapi.types.stac.LandingPage
Landing page.
Called with GET /
.
Returns:
Type | Description |
---|---|
None | API landing page, serving as an entry point to the API. |
post_search¶
def post_search(
self,
search_request: stac_fastapi.types.search.BaseSearchPostRequest,
**kwargs
) -> stac_fastapi.types.stac.ItemCollection
Cross catalog search (POST).
Called with POST /search
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
search_request | None | search request parameters. | None |
Returns:
Type | Description |
---|---|
None | ItemCollection containing items which match the search criteria. |
AsyncBaseTransactionsClient¶
class AsyncBaseTransactionsClient(
)
Defines a pattern for implementing the STAC transaction extension.
Ancestors (in MRO)¶
- abc.ABC
Methods¶
create_collection¶
def create_collection(
self,
collection: stac_pydantic.collection.Collection,
**kwargs
) -> Union[stac_fastapi.types.stac.Collection, starlette.responses.Response, NoneType]
Create a new collection.
Called with POST /collections
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
collection | None | the collection | None |
Returns:
Type | Description |
---|---|
None | The collection that was created. |
create_item¶
def create_item(
self,
collection_id: str,
item: Union[stac_pydantic.item.Item, stac_pydantic.item_collection.ItemCollection],
**kwargs
) -> Union[stac_fastapi.types.stac.Item, starlette.responses.Response, NoneType]
Create a new item.
Called with POST /collections/{collection_id}/items
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
item | None | the item or item collection | None |
collection_id | None | the id of the collection from the resource path | None |
Returns:
Type | Description |
---|---|
None | The item that was created or None if item collection. |
delete_collection¶
def delete_collection(
self,
collection_id: str,
**kwargs
) -> Union[stac_fastapi.types.stac.Collection, starlette.responses.Response, NoneType]
Delete a collection.
Called with DELETE /collections/{collection_id}
Parameters:
Name | Type | Description | Default |
---|---|---|---|
collection_id | None | id of the collection. | None |
Returns:
Type | Description |
---|---|
None | The deleted collection. |
delete_item¶
def delete_item(
self,
item_id: str,
collection_id: str,
**kwargs
) -> Union[stac_fastapi.types.stac.Item, starlette.responses.Response, NoneType]
Delete an item from a collection.
Called with DELETE /collections/{collection_id}/items/{item_id}
Parameters:
Name | Type | Description | Default |
---|---|---|---|
item_id | None | id of the item. | None |
collection_id | None | id of the collection. | None |
Returns:
Type | Description |
---|---|
None | The deleted item. |
update_collection¶
def update_collection(
self,
collection_id: str,
collection: stac_pydantic.collection.Collection,
**kwargs
) -> Union[stac_fastapi.types.stac.Collection, starlette.responses.Response, NoneType]
Perform a complete update on an existing collection.
Called with PUT /collections/{collection_id}
. It is expected that this item
already exists. The update should do a diff against the saved collection and
perform any necessary updates. Partial updates are not supported by the
transactions extension.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
collection_id | None | id of the existing collection to be updated | None |
collection | None | the updated collection (must be complete) | None |
Returns:
Type | Description |
---|---|
None | The updated collection. |
update_item¶
def update_item(
self,
collection_id: str,
item_id: str,
item: stac_pydantic.item.Item,
**kwargs
) -> Union[stac_fastapi.types.stac.Item, starlette.responses.Response, NoneType]
Perform a complete update on an existing item.
Called with PUT /collections/{collection_id}/items
. It is expected
that this item already exists. The update should do a diff against the
saved item and perform any necessary updates. Partial updates are not
supported by the transactions extension.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
item | None | the item (must be complete) | None |
Returns:
Type | Description |
---|---|
None | The updated item. |
BaseCoreClient¶
class BaseCoreClient(
stac_version: str = '1.0.0',
landing_page_id: str = 'stac-fastapi',
title: str = 'stac-fastapi',
description: str = 'stac-fastapi',
base_conformance_classes: List[str] = NOTHING,
extensions: List[stac_fastapi.types.extension.ApiExtension] = NOTHING
)
Defines a pattern for implementing STAC api core endpoints.
Attributes¶
Name | Type | Description | Default |
---|---|---|---|
extensions | None | list of registered api extensions. | None |
Ancestors (in MRO)¶
- stac_fastapi.types.core.LandingPageMixin
- abc.ABC
Methods¶
all_collections¶
def all_collections(
self,
**kwargs
) -> stac_fastapi.types.stac.Collections
Get all available collections.
Called with GET /collections
.
Returns:
Type | Description |
---|---|
None | A list of collections. |
conformance¶
def conformance(
self,
**kwargs
) -> stac_fastapi.types.stac.Conformance
Conformance classes.
Called with GET /conformance
.
Returns:
Type | Description |
---|---|
None | Conformance classes which the server conforms to. |
conformance_classes¶
def conformance_classes(
self
) -> List[str]
Generate conformance classes by adding extension conformance to base
conformance classes.
extension_is_enabled¶
def extension_is_enabled(
self,
extension: str
) -> bool
Check if an api extension is enabled.
get_collection¶
def get_collection(
self,
collection_id: str,
**kwargs
) -> stac_fastapi.types.stac.Collection
Get collection by id.
Called with GET /collections/{collection_id}
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
collection_id | None | Id of the collection. | None |
Returns:
Type | Description |
---|---|
None | Collection. |
get_item¶
def get_item(
self,
item_id: str,
collection_id: str,
**kwargs
) -> stac_fastapi.types.stac.Item
Get item by id.
Called with GET /collections/{collection_id}/items/{item_id}
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
item_id | None | Id of the item. | None |
collection_id | None | Id of the collection. | None |
Returns:
Type | Description |
---|---|
None | Item. |
get_search¶
def get_search(
self,
collections: Optional[List[str]] = None,
ids: Optional[List[str]] = None,
bbox: Union[Tuple[Union[float, int], Union[float, int], Union[float, int], Union[float, int]], Tuple[Union[float, int], Union[float, int], Union[float, int], Union[float, int], Union[float, int], Union[float, int]], NoneType] = None,
intersects: Optional[Annotated[Union[geojson_pydantic.geometries.Point, geojson_pydantic.geometries.MultiPoint, geojson_pydantic.geometries.LineString, geojson_pydantic.geometries.MultiLineString, geojson_pydantic.geometries.Polygon, geojson_pydantic.geometries.MultiPolygon, geojson_pydantic.geometries.GeometryCollection], FieldInfo(annotation=NoneType, required=True, discriminator='type')]] = None,
datetime: Optional[str] = None,
limit: Optional[int] = 10,
**kwargs
) -> stac_fastapi.types.stac.ItemCollection
Cross catalog search (GET).
Called with GET /search
.
Returns:
Type | Description |
---|---|
None | ItemCollection containing items which match the search criteria. |
item_collection¶
def item_collection(
self,
collection_id: str,
bbox: Union[Tuple[Union[float, int], Union[float, int], Union[float, int], Union[float, int]], Tuple[Union[float, int], Union[float, int], Union[float, int], Union[float, int], Union[float, int], Union[float, int]], NoneType] = None,
datetime: Optional[str] = None,
limit: int = 10,
token: str = None,
**kwargs
) -> stac_fastapi.types.stac.ItemCollection
Get all items from a specific collection.
Called with GET /collections/{collection_id}/items
Parameters:
Name | Type | Description | Default |
---|---|---|---|
collection_id | None | id of the collection. | None |
limit | None | number of items to return. | None |
token | None | pagination token. | None |
Returns:
Type | Description |
---|---|
None | An ItemCollection. |
landing_page¶
def landing_page(
self,
**kwargs
) -> stac_fastapi.types.stac.LandingPage
Landing page.
Called with GET /
.
Returns:
Type | Description |
---|---|
None | API landing page, serving as an entry point to the API. |
list_conformance_classes¶
def list_conformance_classes(
self
)
Return a list of conformance classes, including implemented extensions.
post_search¶
def post_search(
self,
search_request: stac_fastapi.types.search.BaseSearchPostRequest,
**kwargs
) -> stac_fastapi.types.stac.ItemCollection
Cross catalog search (POST).
Called with POST /search
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
search_request | None | search request parameters. | None |
Returns:
Type | Description |
---|---|
None | ItemCollection containing items which match the search criteria. |
BaseTransactionsClient¶
class BaseTransactionsClient(
)
Defines a pattern for implementing the STAC API Transaction Extension.
Ancestors (in MRO)¶
- abc.ABC
Methods¶
create_collection¶
def create_collection(
self,
collection: stac_pydantic.collection.Collection,
**kwargs
) -> Union[stac_fastapi.types.stac.Collection, starlette.responses.Response, NoneType]
Create a new collection.
Called with POST /collections
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
collection | None | the collection | None |
Returns:
Type | Description |
---|---|
None | The collection that was created. |
create_item¶
def create_item(
self,
collection_id: str,
item: Union[stac_pydantic.item.Item, stac_pydantic.item_collection.ItemCollection],
**kwargs
) -> Union[stac_fastapi.types.stac.Item, starlette.responses.Response, NoneType]
Create a new item.
Called with POST /collections/{collection_id}/items
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
item | None | the item or item collection | None |
collection_id | None | the id of the collection from the resource path | None |
Returns:
Type | Description |
---|---|
None | The item that was created or None if item collection. |
delete_collection¶
def delete_collection(
self,
collection_id: str,
**kwargs
) -> Union[stac_fastapi.types.stac.Collection, starlette.responses.Response, NoneType]
Delete a collection.
Called with DELETE /collections/{collection_id}
Parameters:
Name | Type | Description | Default |
---|---|---|---|
collection_id | None | id of the collection. | None |
Returns:
Type | Description |
---|---|
None | The deleted collection. |
delete_item¶
def delete_item(
self,
item_id: str,
collection_id: str,
**kwargs
) -> Union[stac_fastapi.types.stac.Item, starlette.responses.Response, NoneType]
Delete an item from a collection.
Called with DELETE /collections/{collection_id}/items/{item_id}
Parameters:
Name | Type | Description | Default |
---|---|---|---|
item_id | None | id of the item. | None |
collection_id | None | id of the collection. | None |
Returns:
Type | Description |
---|---|
None | The deleted item. |
update_collection¶
def update_collection(
self,
collection_id: str,
collection: stac_pydantic.collection.Collection,
**kwargs
) -> Union[stac_fastapi.types.stac.Collection, starlette.responses.Response, NoneType]
Perform a complete update on an existing collection.
Called with PUT /collections/{collection_id}
. It is expected that this
collection already exists. The update should do a diff against the saved
collection and perform any necessary updates. Partial updates are not
supported by the transactions extension.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
collection_id | None | id of the existing collection to be updated | None |
collection | None | the updated collection (must be complete) | None |
Returns:
Type | Description |
---|---|
None | The updated collection. |
update_item¶
def update_item(
self,
collection_id: str,
item_id: str,
item: stac_pydantic.item.Item,
**kwargs
) -> Union[stac_fastapi.types.stac.Item, starlette.responses.Response, NoneType]
Perform a complete update on an existing item.
Called with PUT /collections/{collection_id}/items
. It is expected
that this item already exists. The update should do a diff against the
saved item and perform any necessary updates. Partial updates are not
supported by the transactions extension.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
item | None | the item (must be complete) | None |
collection_id | None | the id of the collection from the resource path | None |
Returns:
Type | Description |
---|---|
None | The updated item. |
LandingPageMixin¶
class LandingPageMixin(
stac_version: str = '1.0.0',
landing_page_id: str = 'stac-fastapi',
title: str = 'stac-fastapi',
description: str = 'stac-fastapi'
)
Create a STAC landing page (GET /).
Ancestors (in MRO)¶
- abc.ABC
Descendants¶
- stac_fastapi.types.core.BaseCoreClient
- stac_fastapi.types.core.AsyncBaseCoreClient