Skip to content

Commit 35c695c

Browse files
committed
Merge remote-tracking branch 'origin/feature/catalog-tcgdex-series'
2 parents 1a9bb02 + a5284d7 commit 35c695c

18 files changed

Lines changed: 1868 additions & 59 deletions

api/app_types/tcgdex.py

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
"""TCGdex REST API v2 response shapes (https://tcgdex.dev/)."""
2+
3+
from typing import Any, NotRequired, TypedDict
4+
5+
6+
class TcgdexCardCount(TypedDict, total=False):
7+
"""Card counts inside a set or nested ``set`` on a card."""
8+
9+
total: int
10+
official: int
11+
firstEd: int
12+
holo: int
13+
normal: int
14+
reverse: int
15+
16+
17+
class TcgdexSetBrief(TypedDict, total=False):
18+
"""Row from ``GET /v2/{locale}/sets`` (may omit optional fields)."""
19+
20+
id: str
21+
name: str
22+
logo: str
23+
symbol: str
24+
cardCount: TcgdexCardCount
25+
26+
27+
class TcgdexAbbreviation(TypedDict, total=False):
28+
"""Official / internal product codes when present."""
29+
30+
official: str
31+
32+
33+
class TcgdexSerieRef(TypedDict, total=False):
34+
"""Parent series reference on a set."""
35+
36+
id: str
37+
name: str
38+
39+
40+
class TcgdexSeriesBrief(TypedDict, total=False):
41+
"""Row from ``GET /v2/{locale}/series``."""
42+
43+
id: str
44+
name: str
45+
logo: str
46+
47+
48+
class TcgdexSeriesDetail(TypedDict, total=False):
49+
"""Full series from ``GET /v2/{locale}/series/{seriesId}`` (includes nested sets)."""
50+
51+
id: str
52+
name: str
53+
logo: str
54+
releaseDate: str
55+
firstSet: TcgdexSetBrief
56+
lastSet: TcgdexSetBrief
57+
sets: list[TcgdexSetBrief]
58+
59+
60+
class TcgdexSetLegal(TypedDict, total=False):
61+
"""Play format flags."""
62+
63+
standard: bool
64+
expanded: bool
65+
66+
67+
class TcgdexCardInSetBrief(TypedDict, total=False):
68+
"""Card stub embedded in a full set payload."""
69+
70+
id: str
71+
localId: str
72+
name: str
73+
image: str
74+
75+
76+
class TcgdexSetDetail(TypedDict, total=False):
77+
"""Full set from ``GET /v2/{locale}/sets/{setId}`` (superset of TcgdexSetBrief)."""
78+
79+
id: str
80+
name: str
81+
logo: str
82+
symbol: str
83+
cardCount: TcgdexCardCount
84+
cards: list[TcgdexCardInSetBrief]
85+
releaseDate: str
86+
serie: TcgdexSerieRef
87+
tcgOnline: str
88+
abbreviation: TcgdexAbbreviation
89+
legal: TcgdexSetLegal
90+
91+
92+
class TcgdexSetNestedOnCard(TypedDict, total=False):
93+
"""``set`` object on a single-card response (subset of set fields)."""
94+
95+
id: str
96+
name: str
97+
logo: str
98+
symbol: str
99+
cardCount: TcgdexCardCount
100+
101+
102+
class TcgdexCardDetail(TypedDict, total=False):
103+
"""Single card from ``GET /v2/{locale}/cards/{cardId}``."""
104+
105+
id: str
106+
localId: str
107+
name: str
108+
image: str
109+
rarity: str
110+
category: str
111+
set: TcgdexSetNestedOnCard
112+
pricing: dict[str, Any]

api/main.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from routes import articles as articles_routes
2222
from routes import auth as auth_routes
2323
from routes import cardmarket_searches as cardmarket_searches_routes
24+
from routes import catalog_route
2425
from routes import ebay_market_route
2526
from routes import ebay_route
2627
from routes import pricing_route
@@ -108,6 +109,7 @@ def health() -> dict[str, str]:
108109
app.include_router(ebay_route.router)
109110
app.include_router(ebay_market_route.router)
110111
app.include_router(pricing_route.router)
112+
app.include_router(catalog_route.router)
111113
app.include_router(stats_route.router)
112114
app.include_router(scan_routes.router)
113115
app.include_router(shipping_route.router)

0 commit comments

Comments
 (0)