Skip to content

Module stac_fastapi.extensions.core.transaction

Transaction extension.

Classes

PostItem

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

Create Item.

Ancestors (in MRO)

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

Methods

kwargs

def kwargs(
    self
) -> Dict

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

endpoint.

PutCollection

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

Update Collection.

Ancestors (in MRO)

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

Methods

kwargs

def kwargs(
    self
) -> Dict

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

endpoint.

PutItem

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

Update Item.

Ancestors (in MRO)

  • stac_fastapi.api.models.ItemUri
  • stac_fastapi.api.models.CollectionUri
  • stac_fastapi.types.search.APIRequest
  • abc.ABC

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