Skip to content

Module stac_fastapi.api.models

Api request/response models.

Functions

create_get_request_model

def create_get_request_model(
    extensions: Optional[List[stac_fastapi.types.extension.ApiExtension]],
    base_model: stac_fastapi.types.search.BaseSearchGetRequest = <class 'stac_fastapi.types.search.BaseSearchGetRequest'>
) -> stac_fastapi.types.search.APIRequest

Wrap create_request_model to create the GET request model.

create_post_request_model

def create_post_request_model(
    extensions: Optional[List[stac_fastapi.types.extension.ApiExtension]],
    base_model: stac_fastapi.types.search.BaseSearchPostRequest = <class 'stac_fastapi.types.search.BaseSearchPostRequest'>
) -> Type[pydantic.main.BaseModel]

Wrap create_request_model to create the POST request model.

create_request_model

def create_request_model(
    model_name='SearchGetRequest',
    base_model: Union[Type[pydantic.main.BaseModel], stac_fastapi.types.search.APIRequest] = <class 'stac_fastapi.types.search.BaseSearchGetRequest'>,
    extensions: Optional[List[stac_fastapi.types.extension.ApiExtension]] = None,
    mixins: Union[List[pydantic.main.BaseModel], List[stac_fastapi.types.search.APIRequest], NoneType] = None,
    request_type: Optional[str] = 'GET'
) -> Union[Type[pydantic.main.BaseModel], stac_fastapi.types.search.APIRequest]

Create a pydantic model for validating request bodies.

Classes

CollectionUri

class CollectionUri(
    collection_id: typing.Annotated[str, Path(PydanticUndefined)]
)

Get or delete collection.

Ancestors (in MRO)

  • stac_fastapi.types.search.APIRequest

Descendants

  • stac_fastapi.extensions.core.transaction.PostItem
  • stac_fastapi.extensions.core.transaction.PutCollection

Methods

kwargs

def kwargs(
    self
) -> Dict

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

endpoint.

EmptyRequest

class EmptyRequest(

)

Empty request.

Ancestors (in MRO)

  • stac_fastapi.types.search.APIRequest

Methods

kwargs

def kwargs(
    self
) -> Dict

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

endpoint.

GeoJSONResponse

class GeoJSONResponse(
    content: 'typing.Any',
    status_code: 'int' = 200,
    headers: 'typing.Mapping[str, str] | None' = None,
    media_type: 'str | None' = None,
    background: 'BackgroundTask | None' = None
)

JSON with custom, vendor content-type.

Ancestors (in MRO)

  • starlette.responses.JSONResponse
  • starlette.responses.Response

Class variables

charset
media_type

Instance variables

headers

Methods

def delete_cookie(
    self,
    key: 'str',
    path: 'str' = '/',
    domain: 'str | None' = None,
    secure: 'bool' = False,
    httponly: 'bool' = False,
    samesite: "typing.Literal['lax', 'strict', 'none'] | None" = 'lax'
) -> 'None'

init_headers

def init_headers(
    self,
    headers: 'typing.Mapping[str, str] | None' = None
) -> 'None'

render

def render(
    self,
    content: 'typing.Any'
) -> 'bytes'
def set_cookie(
    self,
    key: 'str',
    value: 'str' = '',
    max_age: 'int | None' = None,
    expires: 'datetime | str | int | None' = None,
    path: 'str' = '/',
    domain: 'str | None' = None,
    secure: 'bool' = False,
    httponly: 'bool' = False,
    samesite: "typing.Literal['lax', 'strict', 'none'] | None" = 'lax'
) -> 'None'

ItemCollectionUri

class ItemCollectionUri(
    collection_id: typing.Annotated[str, Path(PydanticUndefined)],
    limit: typing.Annotated[int, Query(PydanticUndefined)] = 10,
    bbox: Annotated[Optional[str], Query(PydanticUndefined)] = None,
    datetime: Annotated[Optional[str], Query(PydanticUndefined)] = None
)

Get item collection.

Ancestors (in MRO)

  • stac_fastapi.types.search.APIRequest

Methods

kwargs

def kwargs(
    self
) -> Dict

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

endpoint.

ItemUri

class ItemUri(
    collection_id: typing.Annotated[str, Path(PydanticUndefined)],
    item_id: typing.Annotated[str, Path(PydanticUndefined)]
)

Get or delete item.

Ancestors (in MRO)

  • stac_fastapi.types.search.APIRequest

Descendants

  • stac_fastapi.extensions.core.transaction.PutItem

Methods

kwargs

def kwargs(
    self
) -> Dict

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

endpoint.

JSONSchemaResponse

class JSONSchemaResponse(
    content: 'typing.Any',
    status_code: 'int' = 200,
    headers: 'typing.Mapping[str, str] | None' = None,
    media_type: 'str | None' = None,
    background: 'BackgroundTask | None' = None
)

JSON with custom, vendor content-type.

Ancestors (in MRO)

  • starlette.responses.JSONResponse
  • starlette.responses.Response

Class variables

charset
media_type

Instance variables

headers

Methods

def delete_cookie(
    self,
    key: 'str',
    path: 'str' = '/',
    domain: 'str | None' = None,
    secure: 'bool' = False,
    httponly: 'bool' = False,
    samesite: "typing.Literal['lax', 'strict', 'none'] | None" = 'lax'
) -> 'None'

init_headers

def init_headers(
    self,
    headers: 'typing.Mapping[str, str] | None' = None
) -> 'None'

render

def render(
    self,
    content: 'typing.Any'
) -> 'bytes'
def set_cookie(
    self,
    key: 'str',
    value: 'str' = '',
    max_age: 'int | None' = None,
    expires: 'datetime | str | int | None' = None,
    path: 'str' = '/',
    domain: 'str | None' = None,
    secure: 'bool' = False,
    httponly: 'bool' = False,
    samesite: "typing.Literal['lax', 'strict', 'none'] | None" = 'lax'
) -> 'None'