Skip to content
This repository was archived by the owner on Jul 21, 2025. It is now read-only.

Commit f00ad42

Browse files
authored
feat: skeleton searches (#27)
- Closes #22 The searching doesn't do anything yet.
1 parent 77f8c4d commit f00ad42

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

src/tistac/app.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from fastapi import FastAPI
22

3+
from .item_collection import ItemCollection
34
from .root import Root
45

56

@@ -14,4 +15,16 @@ async def root() -> Root:
1415

1516
return Root()
1617

18+
@app.get("/search")
19+
async def get_search() -> ItemCollection:
20+
"""Searches this STAC API via a GET request."""
21+
22+
return ItemCollection()
23+
24+
@app.post("/search")
25+
async def post_search() -> ItemCollection:
26+
"""Searches this STAC API via a POST request."""
27+
28+
return ItemCollection()
29+
1730
return app

src/tistac/item_collection.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from pydantic import BaseModel
2+
3+
4+
class ItemCollection(BaseModel):
5+
"""A STAC API item collection.
6+
7+
The features of this collection may not be valid STAC items, if the `fields`
8+
extension is used.
9+
"""

tests/test_search.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from fastapi.testclient import TestClient
2+
3+
4+
async def test_get_search(client: TestClient) -> None:
5+
response = client.get("/search")
6+
assert response.status_code == 200
7+
8+
9+
async def test_post_search(client: TestClient) -> None:
10+
response = client.post("/search")
11+
assert response.status_code == 200

0 commit comments

Comments
 (0)