Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions runtimes/eoapi/stac/eoapi/stac/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ def register_get_item_collection(self):
"content": {
MimeTypes.geojson.value: {},
MimeTypes.html.value: {},
MimeTypes.csv.value: {},
MimeTypes.geojsonseq.value: {},
},
"model": api.ItemCollection,
},
Expand Down Expand Up @@ -187,6 +189,8 @@ def register_get_search(self):
"content": {
MimeTypes.geojson.value: {},
MimeTypes.html.value: {},
MimeTypes.csv.value: {},
MimeTypes.geojsonseq.value: {},

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL 🙇🏼

},
"model": api.ItemCollection,
},
Expand All @@ -199,3 +203,34 @@ def register_get_search(self):
self.client.get_search, self.search_get_request_model
),
)

def register_post_search(self):
"""Register search endpoint (POST /search).

Returns:
None
"""
self.router.add_api_route(
name="Search",
path="/search",
response_model=api.ItemCollection
if self.settings.enable_response_models
else None,
responses={
200: {
"content": {
MimeTypes.geojson.value: {},
MimeTypes.csv.value: {},
MimeTypes.geojsonseq.value: {},

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Next step, stac-geoparquet!

},
"model": api.ItemCollection,
},
},
response_class=GeoJSONResponse,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this interact with a CSV response?

response_model_exclude_unset=True,
response_model_exclude_none=True,
methods=["POST"],
endpoint=create_async_endpoint(
self.client.post_search, self.search_post_request_model
),
)
5 changes: 3 additions & 2 deletions runtimes/eoapi/stac/eoapi/stac/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
from .client import FiltersClient, PgSTACClient
from .config import Settings
from .extensions import (
HTMLorGeoMultiOutputExtension,
HTMLorGeoOutputExtension,
HTMLorJSONOutputExtension,
ItemCollectionFilterExtension,
Expand Down Expand Up @@ -84,7 +85,7 @@
FieldsExtension(),
SearchFilterExtension(client=FiltersClient()), # type: ignore
TokenPaginationExtension(),
HTMLorGeoOutputExtension(),
HTMLorGeoMultiOutputExtension(),
]

# collection_search extensions
Expand All @@ -111,7 +112,7 @@
FieldsExtension(conformance_classes=[FieldsConformanceClasses.ITEMS]),
ItemCollectionFilterExtension(client=FiltersClient()), # type: ignore
TokenPaginationExtension(),
HTMLorGeoOutputExtension(),
HTMLorGeoMultiOutputExtension(),
]

# Request Models
Expand Down
Loading