Compare commits
3 commits
creating_b
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
30ea0d8fec | ||
|
|
7279d9f93c | ||
|
|
7d1b3458e7 |
3 changed files with 2 additions and 39 deletions
|
|
@ -1,2 +1,4 @@
|
||||||
# bgg_api
|
# bgg_api
|
||||||
|
|
||||||
|
An API implementation that will be used by my own board game website.
|
||||||
|
The plan is for this API to be used by a single person who wants their board game collection to be cached so that retrieval is much faster.
|
||||||
|
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
from pydantic import BaseModel, HttpUrl
|
|
||||||
|
|
||||||
class BoardGame(BaseModel):
|
|
||||||
id: int
|
|
||||||
name: str
|
|
||||||
description: str
|
|
||||||
image_url = HttpUrl
|
|
||||||
thumbnail_url = HttpUrl
|
|
||||||
year_published: int
|
|
||||||
min_players: int
|
|
||||||
max_players: int
|
|
||||||
min_playing_time: int
|
|
||||||
max_playing_time: int
|
|
||||||
min_age: int
|
|
||||||
all_expansion_ids: list[int]
|
|
||||||
|
|
||||||
|
|
||||||
class BoardGameExpansion(BoardGame):
|
|
||||||
pass
|
|
||||||
20
main.py
20
main.py
|
|
@ -1,20 +0,0 @@
|
||||||
from typing import Union
|
|
||||||
from fastapi import FastAPI
|
|
||||||
|
|
||||||
from classes.boardgame import BoardGame, BoardGameExpansion
|
|
||||||
|
|
||||||
app = FastAPI()
|
|
||||||
|
|
||||||
|
|
||||||
@app.get("/")
|
|
||||||
def read_root():
|
|
||||||
return {"Hello": "World"}
|
|
||||||
|
|
||||||
|
|
||||||
@app.get("/items/{item_id}")
|
|
||||||
def read_item(item_id: int, q: Union[str, None] = None):
|
|
||||||
return {"item_id": item_id, "q": q}
|
|
||||||
|
|
||||||
@app.get("/boardgame/{boardgame_id}", response_model=BoardGame)
|
|
||||||
def get_boardgame_by_id(boardgame_id: int):
|
|
||||||
pass
|
|
||||||
Loading…
Reference in a new issue