Skip to content

Module stac_fastapi.extensions.core.transaction

Transaction extension.

Classes

PostItem

class PostItem(
    collection_id: typing.Annotated[str, Path(PydanticUndefined)],
    item: Annotated[Union[stac_pydantic.item.Item, stac_pydantic.item_collection.ItemCollection], Body(PydanticUndefined)] = None
)

Create Item.

Ancestors (in MRO)

  • stac_fastapi.api.models.CollectionUri
  • stac_fastapi.types.search.APIRequest

Methods

kwargs

def kwargs(
    self
) -> Dict

Transform api request params into format which matches the signature of the

endpoint.

PutCollection

class PutCollection(
    collection_id: typing.Annotated[str, Path(PydanticUndefined)],
    collection: typing.Annotated[stac_pydantic.collection.Collection, Body(PydanticUndefined)] = None
)

Update Collection.

Ancestors (in MRO)

  • stac_fastapi.api.models.CollectionUri
  • stac_fastapi.types.search.APIRequest

Methods

kwargs

def kwargs(
    self
) -> Dict

Transform api request params into format which matches the signature of the

endpoint.

PutItem

class PutItem(
    collection_id: typing.Annotated[str, Path(PydanticUndefined)],
    item_id: typing.Annotated[str, Path(PydanticUndefined)],
    item: typing.Annotated[stac_pydantic.item.Item, Body(PydanticUndefined)] = None
)

Update Item.

Ancestors (in MRO)

  • stac_fastapi.api.models.ItemUri
  • stac_fastapi.types.search.APIRequest

Methods

kwargs

def kwargs(
    self
) -> Dict

Transform api request params into format which matches the signature of the

endpoint.

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}).